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

Cypress waiting for a new page to load and throwing timed out error #8619

Closed
sudheer-cyp opened this issue Sep 18, 2020 · 3 comments
Closed
Labels
type: duplicate This issue or pull request already exists

Comments

@sudheer-cyp
Copy link

sudheer-cyp commented Sep 18, 2020

Current behavior:

This is my test - Navigate to a page, make some selections on the page and click on a link. So, when i click on a link a file will be downloaded to my local machine. My test should end here. But cypress is waiting for a new page to load for long time and throwing a timed out error. Logging this issue since i could not find a viable solution for this problem in chat or over the web and this is holding my lot of work

Stack Trace:

   at timedOutWaitingForPageLoad (http://ecpphxsit.uscold.com:9083/__cypress/runner/cypress_runner.js:156859:14)
    at <unknown> (http://ecpphxsit.uscold.com:9083/__cypress/runner/cypress_runner.js:157118:15)
From previous event:
    at run (http://ecpphxsit.uscold.com:9083/__cypress/runner/cypress_runner.js:169779:20)
    at $Cy.cy.<computed> [as visit] (http://ecpphxsit.uscold.com:9083/__cypress/runner/cypress_runner.js:170232:12)
From Your Spec Code:
    at eval (webpack:///cypress/integration/smokesuite/xpathdemo.js:41:12)
    at itCallback (webpack:///cypress/support/index.js:65:5)
    at Context.eval (webpack:///cypress/support/index.js:90:34)
From Your Spec Code:
    at eval (webpack:///cypress/integration/smokesuite/xpathdemo.js:41:12)
    at itCallback (webpack:///cypress/support/index.js:65:5)
    at Context.eval (webpack:///cypress/support/index.js:90:34)

Desired behavior:

When the file is downloaded, cypress should pass/fail based on the assertions i put. I don't want it to wait for anything else. Logging
Wait issue
Timedout

### Test code to reproduce

/// <reference types="Cypress" />
describe("Verify Inventory Summary Report with default selections",function() {
    Cypress.on('fail', (error, runnable) => {
    
        throw error 
     
      })

      Cypress.on('uncaught:exception', (err, runnable) => {
                return false
      })
    
      const { softExpect } = chai;

    it('Obtaining inventory summary group by with  in 9083',function(){
        cy.visit('http://ecpphxsit.uscold.com:9083/eUSCOLD/jsp/index.jsp')
        cy.get('input[name="userId"]').type('SMANI')
         cy.get('input[name="password"]').type('Welcome1')
         cy.get('[type="image"]').click()
        cy.contains('Inventory Report').click({force: true})
        cy.get('#inventoryReportSel_customerNames').select('511600000100950')
        cy.get('#productCode').invoke('val',1007)
        cy.xpath("//input[@id='inventoryReportSel_groupByC']").click()
        cy.xpath("//input[@id='inventoryReportSel_htmlFormat']").click()
        cy.xpath("//input[@id='inventoryReportSel_csvFormat']").click()
        cy.wait(10000)
        cy.xpath("//span[contains(text(),'View CSV')]").click()
        cy.wait(5000)
        cy.xpath("//span[contains(text(),'Ok')]")
         
         cy.xpath("//a[contains(text(),'Summary Report - CSV')]").click()
       
        cy.xpath("//span[contains(text(),'Ok')]").click()

            })
})

Versions

5.2.0

Windows 10 64bit,Chrome

@sudheer-cyp
Copy link
Author

@jennifer-shehane Any update

@jennifer-shehane
Copy link
Member

There's currently no way to prevent the page load from happening within Cypress itself once the application under test has initiated a page load - so the tests won't continue until that new page fires its load event.

This thread may be helpful for testing downloading a file - as this is not completely supported in Cypress yet. #949

@jennifer-shehane
Copy link
Member

File download is now supported in Cypress 6.3.0.

You can now test file downloads in Cypress without the download prompt displaying. Any files downloaded while testing file downloads will be stored in the downloadsFolder which is set to cypress/downloads by default. The downloadsFolder will be deleted before each run unless trashAssetsBeforeRuns is set to false.

This means that if you had any code written to prevent the download prompt or to configure the download location (like in a before:browser:launch event handler), you can remove all of these workarounds.

Our file download recipe has been updated, so you can see some ways to test different types of files after they've been downloaded there.

If you're encountering any bugs while testing file downloads, please open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants