cypress icon indicating copy to clipboard operation
cypress copied to clipboard

Default blank page, this page was cleared by navigating to about:blank

Open rdwentmp opened this issue 1 year ago • 32 comments

Current behavior

During Cypress run the application page disappear and appear default blank page, after that test scenario fail with visibility of inputs. The issue occur randomly on different test scenarios, possibly some memory leak. The Default blank page errors start to occur after upgrade Cypress version from 11.2.0 to 13.0.0. I already set up migration guide and had to set up testIsolation: false, without that every test occur with default blank page, but still after done everything right the default blank page still occur random. I think it looks like memory leak

image image

Desired behavior

Cypress behave stable without clearing cache with appearing Default blank page

Test code to reproduce

import { defineConfig } from 'cypress'
export default defineConfig({
  retries: {
    runMode: 2,
    openMode: 0,
  },
  video: false,
  numTestsKeptInMemory: 0,
  experimentalMemoryManagement: true,
  chromeWebSecurity: false,
  projectId: '4exo9z',
  defaultCommandTimeout: 20000,
  pageLoadTimeout: 20000,
  responseTimeout: 20000,
  requestTimeout: 20000,
  viewportWidth: 1400,
  viewportHeight: 800,
  screenshotOnRunFailure: true,
  reporter: 'junit',
  reporterOptions: {
    mochaFile: 'results/result.xml',
    toConsole: false,
  },
  env: {
    url: 'http://localhost:5080',
    CHROME_EXTRA_LAUNCH_ARGS: '--disable-gpu',
    codeCoverage: {
      exclude: ['**/tools/**/*.js'],
    },
  },
  e2e: {
    // We've imported your old cypress plugins here.
    // You may want to clean this up later by importing these.
    setupNodeEvents(on, config) {
      return require('./cypress/plugins/index.js')(on, config)
    },
    baseUrl: 'http://localhost:4200/',
    specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
    testIsolation: false,
  },
})

Cypress Version

13.0.0

Node version

v14.21.3

Operating System

linux, macos

Debug Logs

{
  "specName": "cypress%2Fe2e%2Factivities-tab%2Fadd-assumptions-additional-activity.spec.ts",
  "title": "Owner should add assumption for added equipment",
  "suiteName": "Add assumptions for additional activity",
  "testName": "add-assumptions-additional-activity Add assumptions for additional activity Owner should add assumption for added equipment",
  "testError": "Timed out retrying after 20000ms: Expected to find element: `[formcontrolname=assumptions]`, but never found it.",
  "testCommands": [
    "get [formcontrolname=assumptions]",
    "log \n            ⚠️ Could not find any coverage information in your application\n            by looking at the window coverage object.\n            Did you forget to instrument your application?\n            See [code-coverage#instrument-your-application](https://github.com/cypress-io/code-coverage#instrument-your-application)\n           `[@cypress/code-coverage]`"
  ]
}

Other

No response

rdwentmp avatar Dec 14 '23 07:12 rdwentmp

@rdwentmp

According to your issue description, you are using Node.js v14.21.3, which reached end-of-life on Apr 30, 2023 and is no longer supported.

Please check the Changelog for Cypress 13.0.0 and follow the recommendations there:

  • Node 14 support has been removed and Node 16 support has been deprecated. Node 16 may continue to work with Cypress v13, but will not be supported moving forward to closer coincide with Node 16's end-of-life schedule. It is recommended that users update to at least Node 18.

MikeMcC399 avatar Dec 14 '23 08:12 MikeMcC399

Ah that's really sad news, it looks like I missed that, will try to update node then

rdwentmp avatar Dec 14 '23 08:12 rdwentmp

@rdwentmp We'll need some set of tests to run to see the issue and investigate, if the upgrade doesn't help.

jennifer-shehane avatar Dec 14 '23 14:12 jennifer-shehane

change-ctr-owner-not-started -- Change the owner of not started CTR -- Requestor should change CTR owner (failed) (attempt 2)

After update node version to 20.10.0 the error still randomly occurs. In this case I can put some code when the default start to occur from the screenshot:

changeCtrOwner(ctrOwner: string) {
    cy.message(`changeCtrOwner`)
    this.interceptChangeCtrOwner()
    this.interceptDelegateUsers()
    return this.getPxdRigidPipeAndFlowDesignCell()
      .should('contain.text', ctrOwner)
      .trigger('mouseenter')
      .then(() => this.getPxdEditOwnerBtn().should('be.visible').click())
      .then(() => this.waitDelegateUsers())
      .then((engineerNames) => {
        let newOwner = selectRandom(engineerNames)
        let newOwnerFullName: string = newOwner.fullName

        cy.message(`Change CTR owner to ${newOwnerFullName}`)
        this.selectCtrOwner(newOwner.fullName)
          .then(() => this.getDoneBtn().should('be.visible').click())
          .then(() => this.getYesConfirmBtn().should('be.visible').click())
        return this.waitChangeCtrOwner().then(() => {
          return cy.wrap(newOwnerFullName)
        })
      })
  }```



rdwentmp avatar Dec 21 '23 08:12 rdwentmp

This Default blank page error usually occur on second attempt after failed test

image

rdwentmp avatar Dec 21 '23 12:12 rdwentmp

I have same problem , after every test case , the blank page appears

santiespindd avatar Jan 04 '24 12:01 santiespindd

I am also facing same issue 😞

pranaya1997 avatar Jan 04 '24 13:01 pranaya1997

I just added this line in cypress.config.js and it has started to work

image

I am also facing same issue 😞

This Default blank page error usually occur on second attempt after failed test

image

santiespindd avatar Jan 04 '24 17:01 santiespindd

I just added this line in cypress.config.js and it has started to work

image

I am also facing same issue 😞

This Default blank page error usually occur on second attempt after failed test image

I was having this same problem today and your solution helped me solve it, thank you very much! ☺

RMFTI avatar Jan 04 '24 20:01 RMFTI

https://docs.cypress.io/guides/core-concepts/test-isolation#Test-Isolation-Disabled the tradeoffs for this solution ^

kj-fiddler avatar Feb 15 '24 04:02 kj-fiddler

I am facing the same issue, if it can help, I am running tests on Windows. For the other people facing that issue, are you also running tests on windows?

Seb33300 avatar Feb 28 '24 07:02 Seb33300

cypress Versjon 13.7.0 (13.7.0.2514066)

Skjermbilde 2024-03-22 kl  07 27 08

stil having the same issue, on mac OS 14.3.1 even tho i have changed the cypress.config.js to Skjermbilde 2024-03-22 kl  07 29 51

Hakonovrebo avatar Mar 22 '24 06:03 Hakonovrebo

Having same issue when running tests using headless browser only

nomercy360 avatar Apr 10 '24 15:04 nomercy360

I am also facing the same issue with chrome , cypress 13.7.3 and testIsolation: false Randomly occurs

suman8025 avatar Apr 18 '24 03:04 suman8025

The same issue that people above have. All my tests are snapshot verifications and I do up to 4 retries. Occasionally some tests after a second retry drop into a blank page.

This was not the issue in Cypress v13.4.0, but it seems it started happening somewhere around v13.5

I did have testIsolation: false in config already and it does not help at all.

Screenshot 2024-04-25 at 8 06 39 PM

eugenet8k avatar Apr 26 '24 03:04 eugenet8k

I am having the same issue today on v13.8.1. Like someone else here, I see it MOST of the time, but not all the time (like 98% of the time I get the bug. Didn't get it the first time). I also added testIsolation: false to my config, and it didn't help me any.

But I think I've found a workaround! It's a really laaaaame workaround, but in a pinch, maybe it'll help: just tuck everything into just ONE big test body section!

EXAMPLE: This version of my test case with the meat of it looking like THIS failed. Step 1 worked right, to go to my designated URL, but then it went to a blank page right before 'Click on Text Box'

Screenshot 2024-04-26 001524

... but once I changed it to THIS, it succeeded! The only difference is that I moved all the "cy." commands under just one heading:

Screenshot 2024-04-25 235919

Please take all of this with a big pinch of salt... and PLEASE forgive any use on my part of poor terminology! As you can probably guess from the screenshots, it's only my first week learning Cypress.

Daniel-Collins-QA avatar Apr 26 '24 07:04 Daniel-Collins-QA

This helped me solve the issue. With testIsolation enabled I had to do a new cy.visit() within the spect (in a beforeEach in my case)

proko avatar Apr 29 '24 15:04 proko

Do we have any news on that issue ? I got the same issue on my side and 'testIsolation' is not the good solution for it.

naseradd avatar May 30 '24 03:05 naseradd

@proko podrías compartir como lo solucionaste? te lo agradeceria.

jolujs avatar May 30 '24 16:05 jolujs

Do we have any updates on the above issue? I'm also getting the same problem after upgrading the cypress v 13. 'testIsolation' doesn't work for me.

NilminiDharmakeerthi94 avatar Jun 03 '24 07:06 NilminiDharmakeerthi94

I got a temprorary fix for now. I add an additional function in a generic beforeEach() in order to detect if the application is loaded or not and if it's not I am cy.visiting again.

I hope Cypress Team will provide a better solution for this :)

naseradd avatar Jun 04 '24 17:06 naseradd

Any new update on this ?

Chafik-Marouf avatar Jun 26 '24 18:06 Chafik-Marouf

Currently we do not regard this as an issue with Cypress. This change was intended to clear the page between tests.

If someone can provide an example to run where the tests are behaving in a way that is not intended by Cypress, we can investigate.

If you don't want your page to be cleared between tests, pass testIsolation: false to your cypress.config.js file to opt out of this behavior.

jennifer-shehane avatar Jul 01 '24 20:07 jennifer-shehane

I believe there’s a misunderstanding in my original post. The behavior I’m reporting is inconsistent, and it’s not related to the testIsolation configuration.

Consider a Cypress end-to-end testing file with multiple tests within a describe block (e.g., describe(it(...); it(...); it(...); ...)). Additionally, I've configured Cypress with the following settings:

retries: {
      openMode: true,
      runMode: true,
      experimentalStrategy: "detect-flake-and-pass-on-threshold",
      experimentalOptions: {
        maxRetries: 2,
        passesRequired: 1,
      },
    },

Here’s the observed behavior:

When Cypress encounters a failure during the initial test run, it doesn’t clear the page and retries the test according to the specified configuration (in this case, up to 2 retries).

However, if another test within the same run fails and Cypress attempts a retry, it does clear the page. This behavior differs from the initial test runs.

Please let me know if this explanation makes sense, or if you’d like me to provide clear examples.

naseradd avatar Jul 04 '24 17:07 naseradd

@naseradd The original issue didn't mention using experimental retries. Is this issue isolated to experimental retries then?

Or does this behavior happen with just standard 'retries: #' set also.

This makes more sense to possibly have a situation where the state is not correctly reset on some retries but it is reset on others.

jennifer-shehane avatar Jul 09 '24 19:07 jennifer-shehane

Is there any fix to the above issue?

testercs-tst avatar Jul 19 '24 16:07 testercs-tst

Hi team, I was getting this error while runAllSpecs files on start of second file execution : Default blank page This page was cleared by navigating to about:blank. All active session data (cookies, localStorage and sessionStorage) across all domains are cleared.

Adding this line image

testIsolation: false in cypress.config.js worked for me! Thank you so much for this solution!

Prashika avatar Jul 23 '24 10:07 Prashika

I tried to reproduce the defect with a simplier sample but I am not able to reproduce it anymore unfortunately

naseradd avatar Jul 23 '24 17:07 naseradd

  1. Obviously turning testIsolation off is not a long term solution / good practice - please just no.
  2. Is there a session in use? The issue with the page clearing might be due to cy.session reloading the page when switching sessions, causing the test to lose its context, or maybe the old node version is not compatible.

JRRS1982 avatar Jul 25 '24 13:07 JRRS1982