https://cypress.io logo
Join Discord
Powered by
# e2e-testing
  • g

    gray-kilobyte-89541

    03/23/2022, 4:32 PM
    I think it helps if you post the code that does not work, not an abbreviated version 🙂
  • f

    future-gold-77198

    03/23/2022, 5:22 PM
    Looks like this is the suggested way to accomplish this. https://docs.cypress.io/api/cypress-api/keyboard-api#Examples
  • p

    powerful-orange-86819

    03/24/2022, 7:42 AM
    Using recursion and incrementing time between requests until desired response is returned
    Copy code
    js
        let counter = 1;
        let waitTime = 100;
        const makeRequest= () => {
          cy.request(options).then((response) => {
            if (response.status !== 200 && counter < 10) {
              cy.wait(waitTime);
              makeRequest();
              waitTime = waitTime + 100;
              counter++;
            } else {
              expect(response.status).to.eq(200);
    // some code here e.g. setting env variables
            }
          });
        };
        makeRequest(); //call the function outside
    works really good for me, tested it a lot and with all kinds of query parameters and requests, also important notice is that i use this code in my custom commands, not in the tests
  • w

    wooden-exabyte-51274

    03/24/2022, 10:59 AM
    why am i getting this error in my CI
    Copy code
    AssertionError: Timed out retrying after 4000ms: Expected to find content: 'Log In' but never did
  • p

    powerful-orange-86819

    03/24/2022, 11:48 AM
    could be several reasons - mispelling of "Log In" check it via console inspector - log in button is hidden/ has hidden attribute or is behind an element - retryabilty of getting element is not written correctly, see this article https://docs.cypress.io/guides/core-concepts/retry-ability
  • w

    wooden-exabyte-51274

    03/24/2022, 12:08 PM
    would i need to refer to
    .m-4
    ?
  • w

    wooden-exabyte-51274

    03/24/2022, 12:08 PM
    this is my test now
  • w

    wooden-exabyte-51274

    03/24/2022, 12:09 PM
    locally its fine, its only when it runs within the CI i get that error
  • p

    powerful-orange-86819

    03/24/2022, 12:10 PM
    then its retry-ability problem, read the article also this should work cy.get("h2").should("contain","Log In")
  • w

    wooden-exabyte-51274

    03/24/2022, 12:11 PM
    will read the article, thank you for point me in a direction 🙂
  • p

    powerful-orange-86819

    03/24/2022, 12:12 PM
    I've ran into this problem a lot after running my tests in the CI, the earlier you get it the better
  • w

    wooden-exabyte-51274

    03/24/2022, 12:16 PM
    nice, thanks for the heads, ill keep this in mind for the future
  • b

    billions-architect-48187

    03/24/2022, 2:50 PM
    Hello everyone, i need to mock a server-sent event for one integration test. I’m not sure, if the cy.intercept is a proper way to do so or maybe i need to use an external sse mockserver library. When i go to network in the browser i can see that the intercepted API is called many times instead of one time like in case of a data-stream. I was wondering if it is any way to say cy.intercept() not to “close” the connection and just stay alive all the time. My code is: cy.intercept('**/api/notifications/stream/*', (req) => { const headers = { 'Content-Type': 'text/event-stream', 'Cache-Control': 'no-cache', 'Transfer-Encoding': 'chunked' }; const eventText = `id: 0 data: 'test' `; req.reply(200, eventText, headers); }).as('notifications'); I couldn’t find any other discussion or cypress docs how to mock the SSEs.
  • r

    red-flower-83890

    04/04/2022, 12:43 PM
    Hello, maybe someone can help me with this, about improving mochawesome html report? https://github.com/adamgruber/mochawesome/issues/374
  • a

    acceptable-solstice-90676

    04/04/2022, 10:58 PM
    Have you seen this error?
  • a

    acceptable-solstice-90676

    04/04/2022, 10:58 PM
    I did no changes in the code and now I'm getting this, I saw Cypress release a new version, and I updated but the error keeps happening
  • b

    bitter-fountain-36713

    04/04/2022, 11:07 PM
    The error says its in your app code. You can use
    cy.on()
  • a

    acceptable-solstice-90676

    04/04/2022, 11:16 PM
    yeah, but it is weird because I did not do any changes, and everything was working great 🤯
  • a

    acceptable-solstice-90676

    04/04/2022, 11:16 PM
    but I'll do
    cy.on()
  • t

    tall-animal-48628

    04/06/2022, 12:16 PM
    Hi Everyone. Im just new to cypress and got a test suite working locally without any issues. But when we ran it in pipeline(docker). Im getting aborted instance for XHR request. Currently my test is using web form(user name and password then submit) and as part of this is post request in browser(XHR). I tried to increase the timeout to 12 minutes from the default and no lock. I also try to do cy.request(post method to login to validate the connection in docker and its successful). Just wondering if anyone encountered this scenario.
  • v

    victorious-advantage-96717

    04/06/2022, 5:48 PM
    You probably need to wait till POST is sent successfully. Add assertion where you will wait till status code will be 200/201. Try using cy.intercept() https://docs.cypress.io/api/commands/intercept#Waiting-on-a-request
  • t

    tall-animal-48628

    04/06/2022, 10:23 PM
    HI Yes. Initially i got that cy.intercept and use the alias to wait. then whats happening to actual cy.wait is timing out as it reached the deafult timeout so i increased the timeout to 12 minutes and latest is 30 minutes but since POST request was not successful and getting aborted the cy.wait timed out
  • g

    gifted-kite-7128

    04/07/2022, 2:23 AM
    Would anyone know how to get past an AWS Cognito authentication screen in Cypress? Automating button clicks simply doesn't work.
  • l

    little-byte-59792

    04/07/2022, 11:29 AM
    To stub it is not an option? You can check if the post was sent but stub it.
  • c

    creamy-train-56346

    04/07/2022, 3:12 PM
    Hey fellas. Do know this doesn't really belong on this channel, nonetheless it's the best place for it. I am tasked to test a speedtest app. I did some research and find no way to check whether download/upload values are actually correct. Any suggestions?
  • m

    magnificent-finland-58048

    04/07/2022, 7:44 PM
    when you test it manually, are they even deterministic? For me they have never been; every test there is a variance. Time of day, place, environment like CI will be factor too. How can so much non-determinism work in a test?
  • m

    magnificent-finland-58048

    04/07/2022, 7:46 PM
    https://docs.cypress.io/guides/testing-strategies/amazon-cognito-authentication for our own, we took so many liberties around cognito with development, and had to resort to UI login in the beginning... It does not work on localhost, but deployments are fine
  • a

    acceptable-solstice-90676

    04/08/2022, 4:23 PM
    Hello guys, I am having an issue, I am creating an account through API, and then accessing the UI, but when I do that I am noticing that is using the previous account I created, I need to close the test runner and re-open it, what could it be?
  • m

    magnificent-finland-58048

    04/08/2022, 10:02 PM
    so you hit the db with the API, but the UI does not dynamically update, correct? What happens when you hard wait a bit and
    cy.reload()
    ? maybe you need to cy.request() again and GET, make sure the account you need is there before using the UI it sounds like an eventual consistency challenge, check out https://dev.to/muratkeremozcan/api-testing-event-driven-systems-7fe
  • a

    acceptable-solstice-90676

    04/09/2022, 5:58 PM
    Hmm, I seee... I have not tried the
    cy.reload()
    because I think it will delay the test, and about the
    cy.request()
    I'll give it a try.
1...353637...192Latest