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 even if page is loaded and throwing timed out error #18266

Closed
manishGitHub555 opened this issue Sep 28, 2021 · 6 comments
Labels
stale no activity on this issue for a long period

Comments

@manishGitHub555
Copy link

manishGitHub555 commented Sep 28, 2021

Current behavior

While running cypress test case, sometimes cypress waiting for a new page to load even if page is loaded and there is no load event happening and throwing timed out error and issue is happening randomly at any steps[]
(url
Cypress Load error
)

Desired behavior

Cypress should continue running script and not to wait for page load if page is already loaded or there should be a command to disable wait for page load for this exception handling

Test code to reproduce

Test Cases Code

it("To verify PayIn from Vault to Till",function()
 {
  const TillsActions = new Retail_Manage_Tills_Actions()
 
  TillsActions.Retail_manage_tills_event()
  TillsActions.GetVaues_PayInVaultCard_Before()
  TillsActions.VaultPayInLink()
  TillsActions.Vault_FillCashAmount()
  TillsActions.VaultModal_PayIn_ClickDdl_From()
  TillsActions.VaultModal_PayIn_EnterDdl_From()

  TillsActions.VaultModal_PayIn_ClickDdl_To()
  TillsActions.VaultModal_PayIn_EnterDdl_To()

  TillsActions.VaultModal_PayIn_ReasonDdl()
  TillsActions.VaultModal_PayIn_ReasonInput()
  //TillsActions.VaultModal_PayIn_Notes()

  TillsActions.VaultModal_PayIn_AddPayIn()
  TillsActions.VaultModal_Dismiss()
  cy.reload()
  TillsActions.GetVaues_PayInVaultCard_After()
  TillsActions.Validate_Updated_CardandModalValues()
 })

Methods code
Retail_manage_tills_event()

{   
    cy.xpath('//div[@class="k-loading-mask"]').should('not.exist')
    element.Retail().click({force: true})
    cy.xpath('//div[@class="k-loading-mask"]').should('not.exist')
    element.Tillmodule1().trigger('mouseover').click({force: true})
    cy.xpath('//div[@class="k-loading-mask"]').should('not.exist')
    cy.wait(1000)
    element.ManageTills1().trigger('mouseover').click({force: true})
}

Validatecashvault_functionality()
{
    element.Countvalut().click()
    element.Cashbag_Subvault_Count().type('1000')
    element.Coinbag_Subvault_Count().type('1000')
    element.Automation_Deposit_SubVault_Count().type('1000')
    element.Automation_Zero_Amount_Count().type('1000')
    element.Automation_Sub_Tillu_Count().type('1000.50')
    //element.Scriollintoview()
    element.Report_Cash_Button().scrollIntoView().should('be.visible').then(($Element)=>
    {

        $Element.click()


    })
}

VaultPayInLink()
{   
    element.VaultPayInLink().should('be.visible').click({force: true})
}

GetVaues_PayInVaultCard_Before()
{
    cy.wait(2000)     
    element.VaultCard_CashInVault().should('be.visible').then(($el) => 
    {
        const vaultCard_CashInVaultBefore =$el.text().replace('$','').replace(',','');
        cy.wrap(vaultCard_CashInVaultBefore).as('GetVaultCard_CashInVaultBefore')
        cy.log('GetVaultCard_CashInVaultBefore',vaultCard_CashInVaultBefore)         
    })
    element.VaultCard_CashBag().should('be.visible').then(($el) => 
    {
        const vaultCard_CashBagBefore =$el.text().replace('$','').replace(',','');
        cy.wrap(vaultCard_CashBagBefore).as('GetVaultCard_CashBagBefore')
        cy.log('GetVaultCard_CashBagBefore',vaultCard_CashBagBefore) 
    })
    element.VaultCard_CoinBag().should('be.visible').then(($el) => 
    {
        const vaultCard_CoinBagBefore =$el.text().replace('$','').replace(',','');
        cy.wrap(vaultCard_CoinBagBefore).as('GetVaultCard_CoinBagBefore')
        cy.log('GetVaultCard_CoinBagBefore',vaultCard_CoinBagBefore) 
    })
    element.VaultCard_AutomationDepositSubVault().should('be.visible').then(($el) => 
    {
        const vaultCard_AutomationDepositSubVaultBefore =$el.text().replace('$','').replace(',','');
        cy.wrap(vaultCard_AutomationDepositSubVaultBefore).as('GetVaultCard_AutomationDepositSubVaultBefore')
        cy.log('GetVaultCard_AutomationDepositSubVaultBefore',vaultCard_AutomationDepositSubVaultBefore) 
    })
    element.VaultCard_AutomationZeroAmount().should('be.visible').then(($el) => 
    {
        const vaultCard_AutomationZeroAmountBefore =$el.text().replace('$','').replace(',','');
        cy.wrap(vaultCard_AutomationZeroAmountBefore).as('GetVaultCard_AutomationZeroAmountBefore')
        cy.log('GetVaultCard_AutomationZeroAmountBefore',vaultCard_AutomationZeroAmountBefore) 
    })
    element.VaultCard_SubTillu().should('be.visible').then(($el) => 
    {
        const vaultCard_SubTilluBefore =$el.text().replace('$','').replace(',','');
        cy.wrap(vaultCard_SubTilluBefore).as('GetVaultCard_SubTilluBefore')
        cy.log('GetVaultCard_SubTilluBefore',vaultCard_SubTilluBefore) 
    })
}

Cypress Version

8..5.0

Other

Recorded video for reference
https://drive.google.com/file/d/1y65QWWnjOngH4M_cfSwmIiWzGy0riwkB/view?usp=sharing

@jennifer-shehane
Copy link
Member

Cypress is detecting a window onBeforeLoad event, so is then waiting for the following load event to fire. Can you put this in your test code and look at debugger where this event is happening? It will show where this is being fired.

Cypress.on('window:before:load', (err, runnable) => {
  debugger
})

@jennifer-shehane jennifer-shehane added the stage: awaiting response Potential fix was proposed; awaiting response label Sep 28, 2021
@shwarcu
Copy link

shwarcu commented Oct 22, 2021

Hi @jennifer-shehane I have a case when in after hook we log out from the app, and we are redirected to another page (let's say it's identity provider that manages login).
After we log out and redirect to another domain occurs, Cypress is waiting for page to finish loading. Is it possible to disable this behaviour in after hook? In our case there is no need for Cypress to wait for page load in the after hook, especially if the domain is different.
This is causing our tests to fail sometimes
blurScreenshot 2021-10-22 at 13 26 52

@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label May 15, 2023
@cypress-app-bot
Copy link
Collaborator

This issue has been closed due to inactivity.

@cypress-app-bot cypress-app-bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 2, 2023
@nicojones
Copy link

Nice, closed because @cypress didn't respond. Beautiful support

@jennifer-shehane
Copy link
Member

@shwarcu You're asking for this feature: #788

@nicojones The issue here did not provide a reproducible example to work from, not did they respond to our asking for more detail. We close issues in this case when we don't receive responses so that we can focus on issues we can reproduce and fix. If you have a similar issue, please open an issue with a reproducible example so we can investigate.

@jennifer-shehane jennifer-shehane removed the stage: awaiting response Potential fix was proposed; awaiting response label Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale no activity on this issue for a long period
Projects
None yet
Development

No branches or pull requests

5 participants