Repository: juspay/hyperswitch
File: cypress-tests/cypress/support/redirectionHandler.js (JavaScript)

Code before:
            default:
              throw new Error(
                `Unsupported payment method type: ${paymentMethodType}`
              );
          }
          verifyUrl = true;
          break;
        case "paypal":
          if (["eps", "ideal", "giropay"].includes(paymentMethodType)) {
            cy.get('button[name="Successful"][value="SUCCEEDED"]').click();
            verifyUrl = true;
          } else {
            throw new Error(
              `Unsupported payment method type: ${paymentMethodType}`
            );
          }
          verifyUrl = true;
          break;
        case "stripe":
          if (
            ["eps", "ideal", "giropay", "sofort", "przelewy24"].includes(
              paymentMethodType
            )
          ) {
            cy.get('a[name="success"]').click();
            verifyUrl = true;
          } else {
            throw new Error(
              `Unsupported payment method type: ${paymentMethodType}`
            );
          }
          verifyUrl = true;
          break;
        case "trustpay":
          switch (paymentMethodType) {
            case "eps":
              cy.get("#bankname").type(
                "Allgemeine Sparkasse Oberösterreich Bank AG (ASPKAT2LXXX / 20320)"
              );
              cy.get("#selectionSubmit").click();
              break;
            case "ideal":
              cy.contains("button", "Select your bank").click();
              cy.get(
                'button[data-testid="bank-item"][id="bank-item-INGBNL2A"]'
              ).click();
              break;
            case "giropay":
              cy.get("._transactionId__header__iXVd_").should(
                "contain.text",
                "Bank suchen ‑ mit giropay zahlen."

Review comment (suggestion):
```suggestion
            cy.get("body").then((_) => {
```

Code after:
            default:
              throw new Error(
                `Unsupported payment method type: ${paymentMethodType}`
              );
          }
          verifyUrl = true;
          break;
        case "paypal":
          if (["eps", "ideal", "giropay"].includes(paymentMethodType)) {
            cy.get('button[name="Successful"][value="SUCCEEDED"]').click();
            verifyUrl = true;
          } else {
            throw new Error(
              `Unsupported payment method type: ${paymentMethodType}`
            );
          }
          verifyUrl = true;
          break;
        case "stripe":
          if (
            ["eps", "ideal", "giropay", "sofort", "przelewy24"].includes(
              paymentMethodType
            )
          ) {
            // scroll down and click on the authorize test payment button
            cy.get("body").then(($body) => {
              cy.get("#frame-warning-container").then(($el) => {
                if ($el.is(":visible")) {
                  // Frame warning is visible — use test payment button
                  cy.get("#authorize-test-payment")
                    .scrollIntoView()
                    .should("be.visible")
                    .click();
                } else {
                  // Frame warning is hidden — use the success link
                  cy.contains(
                    'a.common-Button[name="success"]',
                    "Authorize Test Payment"
                  )
                    .scrollIntoView()
                    .should("be.visible")
                    .click();
                }
              });
            });
            verifyUrl = true;
          } else {
            throw new Error(
              `Unsupported payment method type: ${paymentMethodType}`
            );
          }