Addressing the "Your tests are loading..." Problem in Cypress Following Redirect from PayPal Login

I've encountered a challenge with Cypress tests while trying to log into the PayPal sandbox environment using cy.origin(). The issue arises after successful login when the tests get stuck at "Your tests are loading...". This problem occurs after the post-login redirection, and I'm seeking advice or solutions to overcome this hurdle.

Below is the relevant part of my Cypress code:


Cypress.Commands.add('handlePayPalCredential', () => {
  cy.origin('https://www.sandbox.paypal.com', () => {
    cy.fixture('checkout/session').then(({ paypalEmail, paypalPassword }) => {
      cy.get('#email', { timeout: 10000 })
        .should('be.visible')
        .clear()
        .type(paypalEmail as string) // Using paypalEmail directly from the fixture

      cy.get('button[id="btnNext"]', { timeout: 10000 })
        .should('be.visible')
        .click()

      cy.get('#password', { timeout: 10000 })
        .should('be.visible')
        .clear()
        .type(paypalPassword as string) // Using paypalPassword directly from the fixture

      cy.get('button[id="btnLogin"]', { timeout: 10000 })
        .should('be.visible')
        .click()
    })
  })
})

Once I'm redirected after logging in, Cypress seems to get stuck at "Your tests are loading..." without progressing further as expected.

What I've Attempted:

1- Ensuring that Cypress commands are properly chained and handling asynchronous operations correctly.

2- Adding explicit waits and assertions to verify elements on the redirected page.

3- Checking for any console errors or warnings that could explain the post-redirection behavior.

https://i.sstatic.net/dZxgE.png

Queries:

Has anyone faced a similar issue of Cypress tests getting stuck post-login, especially in scenarios involving cross-origin like PayPal?

Are there established workarounds or strategies to ensure Cypress can continue running tests after a login redirection to a different domain?

Any advice or recommendations would be highly appreciated. Thank you for your assistance in advance!

Answer №1

Ensure that you include the following lines in your configuration file: experimentalModifyObstructiveThirdPartyCode: true, experimentalSessionAndOrigin: true,

It is required to have cypress version 10 or above for this feature

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

HTML - Using Tables to Add and Edit Rows

Take a look at this demo on JSFiddle for my project: Demo jsfiddle I'm currently in the process of creating a table with various functionalities. The function "sortTable" is responsible for sorting the table and it's functioning as expected. T ...

Guide to adding a Scrollable Navbar

Is the term "scroll bar" really accurate? I want to create a scrollable feature where users can easily select a city using their mouse wheel (or swipe on a smartphone) and then choose from possible cities within that country in a second window. Something s ...

Does anyone know of a convenient tool that can automatically provide suggested street names for mailing addresses in every country across the globe, for free?

Is there a convenient tool that automatically completes street addresses for various countries worldwide? I'm considering options similar to YQL from Yahoo or Foursquare. I'd like to provide users with suggestions of known street names as they ...

Checking if the group of radio buttons has been selected using JQUERY

Need help with validating a group of radio buttons. If none are checked, display an error message in the span element to prompt users to select an option. The strange issue I am facing is that the validation code works only when placed below the radio butt ...

Using JSON.parse in Node.js to manipulate arrays with Javascript

While taking an online course, I came across a confusing code snippet: notes = JSON.parse(notesString). The confusion arises from the fact that this code is supposed to result in an object, but it's being treated as an array. Isn't JSON.parse sup ...

Setting the selected value of a static select menu in Angular 2 form

I'm having an issue with my Angular 2 form that includes a static select menu. <select formControlName="type" name="type"> <option value="reference">Referentie</option> <option value="name">Aanhef</option> &l ...

Enhancing the performance of your code by optimizing it using jQuery when a checkbox is either checked or

Looking for ways to optimize a jquery function that toggles a URL parameter based on checkbox status. Any suggestions on how to streamline this code? $('#mapControl').live('click', function(){ var thisUrl = $(location).attr(' ...

Transition smoothly with a fade effect when switching between models

I am in the process of creating a basic query system. While I can display questions one at a time, I am looking to incorporate transitions when switching between questions. To further illustrate my issue, I have set up a Plunker demonstration: http://plnk ...

What is the Proper Way to Add Inline Comments in JSX Code?

Currently, I am in the process of learning React and I have been experimenting with adding inline comments within JSX. However, when I try to use the regular JavaScript // comments, it leads to a syntax error. Let me share a snippet of my code below: const ...

React is throwing an error message stating that setCount is not a valid function

Getting an error saying setCount is not a function. I am new to this, please help. import React, { memo, useState } from "react"; export const Container = memo(function Container() { const { count, setCount } = useState(0); return ( ...

Deactivating Cluetip tool tips and adjusting the height limit in JQuery

How can I momentarily turn off the hints? I have seen references to being able to do so on the website and in this forum, but I am having trouble locating the command to disable them. I just need to temporarily deactivate them and then enable them again. ...

Gauging Screen Size: A Comparison between Media Queries and JavaScript for Adjusting Div Position

I am currently facing an issue with the banner on my website. It contains a slider and has a position set to absolute. The problem arises when viewing it on smaller screens, as only the left side of the wide banner is visible. Initially, I tried using med ...

Rotate arrows by 90 degrees instead of 180 degrees in Bootstrap 5 Accordion

I have customized a Bootstrap 5 Accordion according to the guide provided at https://getbootstrap.com/docs/5.0/components/accordion/. The default behavior rotates the arrows 180 degrees when an item is opened, changing from 'v' to '^'. ...

Issue with undefined bindingContext.$data in IE9 on knockout binding handler

I'm attempting to create a unique binding handler that applies role-based access to fields on a page. This custom handler uses the values of other observables from the viewModel to enable or disable input controls based on certain conditions. However ...

Submitting information from a single form to two separate URLs

Is it possible to send a post from one form to two different URLs simultaneously? For example, sending POST name data to both process.php and confirm.php at the same time. $(document).ready(function(){ $("#myform").validate({ debug: false, ...

Efficiently handling multiple responses in Express.js per single request

Currently exploring Node.js and working on a bot utilizing Dialogflow. I am aiming to establish a straightforward process: Step 1: Dialogflow sends a POST request with parameter param1 Step 2: My application replies with a waiting message (e.g., "your re ...

Updating components reactively in Vue.js when a click event occurs

I have a dilemma with my component that allows users to add or remove an item from their favorites. While the functionality works smoothly, there is no visual indication for the user to know whether the item has been added to favorites or not. Currently, I ...

Tips for implementing multiple nested routes using Vue.js?

Can Nested Routes be created with more than 2 levels? I am looking to implement a structure like this: +--------------------+ | User | | +----------------+ | | | Profile | | | | +------------+ | | | | | About | | | | | | +------ ...

Having trouble with the ajax cache not working properly when trying to load an image

I am attempting to dynamically load an image from the server every time a button is clicked using a GET request. However, I am facing an issue where the cached image is being loaded instead of the latest version. Below is the code I am currently using: & ...

Put the browser into offline mode using JavaScript

Currently, I am utilizing selenium for application testing purposes. Although I typically start my browser in the usual manner, there comes a point where I must transition to offline mode. I have come across various sources indicating that switching to off ...