Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cy.session failure that didn't come from my code #29496

Open
crfrolik opened this issue May 9, 2024 · 2 comments
Open

cy.session failure that didn't come from my code #29496

crfrolik opened this issue May 9, 2024 · 2 comments
Labels
pkg/driver This is due to an issue in the packages/driver directory topic: session Issues when using session command type: bug

Comments

@crfrolik
Copy link

crfrolik commented May 9, 2024

Current behavior

I got this failure once. Unfortunately it did not fail the second time, so it is not easily repeatable.

As far as I can tell, the failure came from within cypress, and not from my code.

2024-05-09 12:06:40      1 failing
2024-05-09 12:06:40    
2024-05-09 12:06:40      1) cloud deployment smoke tests
2024-05-09 12:06:40           should successfully log in to the customer portal and select a tenant:
2024-05-09 12:06:40         CypressError: `cy.then()` timed out after waiting `10000ms`.
2024-05-09 12:06:40    
2024-05-09 12:06:40    Your callback function returned a promise that never resolved.
2024-05-09 12:06:40    
2024-05-09 12:06:40    The callback function was:
2024-05-09 12:06:40    
2024-05-09 12:06:40    async () => {
2024-05-09 12:06:40              setSessionLogStatus(_utils__WEBPACK_IMPORTED_MODULE_6__.statusMap.inProgress(_utils__WEBPACK_IMPORTED_MODULE_6__.SESSION_STEPS.restore));
2024-05-09 12:06:40              await (0,_utils__WEBPACK_IMPORTED_MODULE_6__.navigateAboutBlank)();
2024-05-09 12:06:40              await sessions.clearCurrentSessionData();
2024-05-09 12:06:40              return restoreSession(existingSession);
2024-05-09 12:06:40            }
2024-05-09 12:06:40    
2024-05-09 12:06:40    [https://on.cypress.io/then](https://on.cypress.io/then%1B[0m%1B[90m)
2024-05-09 12:06:40          at <unknown> ([...]__cypress/runner/cypress_runner.js:118823:75)
2024-05-09 12:06:40          at tryCatcher ([...]__cypress/runner/cypress_runner.js:1807:23)
2024-05-09 12:06:40          at <unknown> ([...]__cypress/runner/cypress_runner.js:4186:41)
2024-05-09 12:06:40          at tryCatcher ([...]__cypress/runner/cypress_runner.js:1807:23)
2024-05-09 12:06:40          at Promise._settlePromiseFromHandler ([...]__cypress/runner/cypress_runner.js:1519:31)
2024-05-09 12:06:40          at Promise._settlePromise ([...]__cypress/runner/cypress_runner.js:1576:18)
2024-05-09 12:06:40          at Promise._settlePromise0 ([...]__cypress/runner/cypress_runner.js:1621:10)
2024-05-09 12:06:40          at Promise._settlePromises ([...]__cypress/runner/cypress_runner.js:1697:18)
2024-05-09 12:06:40          at _drainQueueStep ([...]__cypress/runner/cypress_runner.js:2407:12)
2024-05-09 12:06:40          at _drainQueue ([...]__cypress/runner/cypress_runner.js:2400:9)
2024-05-09 12:06:40          at Async._drainQueues ([...]__cypress/runner/cypress_runner.js:2416:5)
2024-05-09 12:06:40          at Async.drainQueues ([...]__cypress/runner/cypress_runner.js:2286:14)

Desired behavior

No response

Test code to reproduce

Here is a snippet of my test:

    cy.session([email, sessionCacheId], () => {
      cy.visit(this.url);

      cy.origin(
        this.b2cSigninUrl,
        { args: { email, password }},
        // eslint-disable-next-line @typescript-eslint/no-shadow
        ({ email, password }) => {
          cy.url().should('match', new RegExp(`^${Cypress.env('b2cHostUrl')}`));

          cy.get('[id="signInName"]').clear();
          cy.get('[id="signInName"]').type(email);

          cy.get('[id="password"]').clear();
          cy.get('[id="password"]').type(password);

          cy.get('[id="next"]').click();
        });

      cy.url().should('match', new RegExp(`^${this.url}`));
      cy.url().should('not.contain', '/id/signin');

      cy.window().then((win) => {
        // ensure selected tenant is not cached in session
        win.sessionStorage.removeItem(this.tenantStorageKey);
      });
    }, {
      cacheAcrossSpecs: true
    });

Cypress Version

13.9.0

Node version

20.12.2

Operating System

Ubuntu 22.04

Debug Logs

No response

Other

No response

@jennifer-shehane
Copy link
Member

This is being thrown from this piece of code: https://github.com/cypress-io/cypress/blob/develop/packages/driver/src/cy/commands/sessions/index.ts#L435

I haven't seen this error before, I bet it is a timing thing.

@jennifer-shehane jennifer-shehane added topic: session Issues when using session command type: bug pkg/driver This is due to an issue in the packages/driver directory labels May 9, 2024
@crfrolik
Copy link
Author

crfrolik commented May 9, 2024

This may be similar to #25550.
However, that issue was closed, and I can't tell if there were any changes made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg/driver This is due to an issue in the packages/driver directory topic: session Issues when using session command type: bug
Projects
None yet
Development

No branches or pull requests

2 participants