Code Monkey home page Code Monkey logo

Comments (5)

NoriSte avatar NoriSte commented on July 26, 2024 2

Change you code this way

cy.waitUntil(
-   () => {
+   () =>
        cy.reload().then(
            () => Cypress.$(selector).length,
        );
-   },
    {
        interval: 10000,
        timeout: 120000,
        errorMsg: 'Element not found',
    },
);

The error was that checkFunction, the first parameter of cy.waitUntil, doesn't return a truthy value. The README says

checkFunction: a function that must return a truthy value when the wait is over.

while your function returns undefined 😊

By using the code I shared, it works for me locally, please let me know it it works for you too 😊

from cypress-wait-until.

NoriSte avatar NoriSte commented on July 26, 2024

hi @mturcan
Could you please a minimal repo that reproduces the problem, please? You can also fork this repository, change public/index.html to recreate the same circumstances, and add a test to show the problem if you prefer.

Thanks
Stefano

from cypress-wait-until.

mturcan avatar mturcan commented on July 26, 2024

Hi @NoriSte

I have created the PR with an additional test that searches for an existing element with reload. So element should be found after first reload right? Instead it's reloading the page the whole timeout specified and fails with 'Element not found'.

Thank you,
Maria

from cypress-wait-until.

mturcan avatar mturcan commented on July 26, 2024

@NoriSte it works in the forked repo, however it fails in my original project :(

thank you anyway!

from cypress-wait-until.

NoriSte avatar NoriSte commented on July 26, 2024

@NoriSte it works in the forked repo, however it fails in my original project :(

Ok, at least it's not this plugin's fault 😁 I guess the element appears later compared to the load event Cypress waits before "unlocking" the visit command?

from cypress-wait-until.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.