It would perhaps be better to use cy.location()
as this has an origin
property.
You can of course pass the variable directly into the cy.origin()
command.
clickPaymentTypeRadioButtonAndSubmit(0);
cy.location('origin')
.then(currentOrigin => {
cy.origin(currentOrigin, () => {
...