https://cypress.io logo
Join Discord
Powered by
# help
  • s

    straight-chef-47891

    06/02/2022, 2:04 PM
    Hi awesome gurus, i would like to do cy.request with retries until it expects s certain state (e.g. body.data.status = ‘COMPLETE’). I tried something similar to the answer here but it didnt work (error is mixing async and sync code): https://stackoverflow.com/questions/54079106/cypress-request-with-retry … attached is my line of codes. pls help!
    b
    f
    • 3
    • 2
  • r

    ripe-pager-8687

    06/02/2022, 3:03 PM
    Hi guys, sorry for the insistence here, but does anyone have any ideas about this?
  • e

    echoing-painting-40909

    06/02/2022, 3:12 PM
    Hi, take a look at this issue and provided solutions: https://github.com/cypress-io/cypress/issues/448#issuecomment-613236352
  • r

    ripe-pager-8687

    06/02/2022, 3:14 PM
    I would do something like this:
    Copy code
    ts
    const retries = 5;
    let countRetries = 0;
    let fn = async () => {
        try {
            const response = await cy.makeApiRequest(url, options);
            if(response.body.data.status !== 'COMPLETE' && countRetries <= retries){
                countRetries++;
                fn();
                return;
            }
            expect(response.body.data.status).to.eq('COMPLETE')
        } catch (e){
            if(countRetries <= retries) {
                countRetries++;
                fn();
                return;   
            }
        }
    }
  • r

    ripe-pager-8687

    06/02/2022, 3:14 PM
    I will take a look, thanks for the help
  • g

    gray-kilobyte-89541

    06/02/2022, 3:17 PM
    https://github.com/bahmutov/cypress-recurse
  • r

    ripe-pager-8687

    06/02/2022, 3:24 PM
    @straight-chef-47891 check out the bahmutov's library , seems like is that you are looking for with some extra powers
  • f

    fresh-doctor-14925

    06/02/2022, 3:42 PM
    Petition to always refer to @gray-kilobyte-89541 as The Bahmutov
  • m

    mysterious-eve-58444

    06/02/2022, 4:52 PM
    Hello, anyone know how to add path alias to cypress 10? My CRA injects them using Craco and cypress does not seem to pick it up
  • b

    bland-airport-93341

    06/02/2022, 6:06 PM
    Hey Guys, newbie here. Anyone knows how to send an AWS signed request using cy.request()?
  • b

    busy-vegetable-18177

    06/02/2022, 8:16 PM
    I have the following code (with custom commands):
    Copy code
    js
      beforeEach(() => {
        cy.getCookies()
        cy.seedDb()
        cy.login()
        cy.getCookies()
        cy.request("/api/queries")
          .its("body")
          .as("queries")
      })
    
      it("should do the thing 1", function() {
        cy.visit(`/playlist?playlist=${this.queries[0]._id.$oid}`)
      })
      it("should do the thing 2", function() {
        cy.visit(`/playlist?playlist=${this.queries[0]._id.$oid}`)
      })
    And (consistently) I get the following on before each:

    https://owo.whats-th.is/4u7d5V9.png▾

    It seems like it for some reason navigates to the url before doing anything else (like logging in) causing the page to error out... What am I doing wrong?
  • b

    busy-vegetable-18177

    06/02/2022, 8:19 PM
    This might be because I'm navigating to the same url again inside the page... Is there a way to deal with this?
  • c

    chilly-queen-22182

    06/02/2022, 8:56 PM
    Hi guys, I need help for component testing aurelia app, Is there any documentation or sample for Aurelia component testing, please guide me . Thanks
  • c

    cuddly-stone-46263

    06/02/2022, 9:34 PM
    Is anyone familiar with how to set Cypress env config values from the AWS Parameter Store?
  • c

    creamy-translator-27456

    06/02/2022, 10:28 PM
    Getting below error for cypress 10.0.1 install while 'npx cypress verify'
  • c

    creamy-translator-27456

    06/02/2022, 10:28 PM
    Command was killed with SIGILL (Invalid machine instruction): /root/.cache/Cypress/10.0.1/Cypress/Cypress --no-sandbox --smoke-test --ping=320
  • b

    bitter-fountain-36713

    06/03/2022, 12:32 AM
    wait | Cypress Documentation
  • b

    bitter-fountain-36713

    06/03/2022, 12:38 AM
    Hello 👋 I need someone to wrap my head
  • b

    bitter-fountain-36713

    06/03/2022, 12:40 AM
    Cypress request with retry
  • i

    important-fish-21193

    06/03/2022, 10:51 AM
    Hi guys, I have been getting below error after upgrading cypress to v10 and it is preventing me from migration. This used to work absolutely fine in v9.6.0 . any advice would be much appreciated. Thanks.
  • f

    fancy-match-96032

    06/03/2022, 12:33 PM
    in your
    cypress.config.js
    , is the value for
    supportFile
    under
    e2e
    pointing to the correct file (assuming this is for end-to-end and not component testing)? also, can you post the full stack trace?
  • i

    important-fish-21193

    06/03/2022, 12:44 PM
    @fancy-match-96032 its just e2e tests. I get the error even before the migration happens so I do not have cypress.config.js file is created yet. below are the steps i followed in my existing project. 1. install cypress v10 2. open cypress test runner Fails to migrate as i get the above error. please see attached full stack trace.
  • f

    fancy-match-96032

    06/03/2022, 1:22 PM
    can you try this with 10.0.2?
  • i

    important-fish-21193

    06/03/2022, 1:41 PM
    I have tried with 10.0.2 but no luck.
  • w

    wooden-australia-44486

    06/03/2022, 1:43 PM
    migrating to 10.0.2,
    Cypress.Commands.add
    is not working. i must be missing something really simple, right?
  • b

    busy-vegetable-18177

    06/03/2022, 1:45 PM
    this will run, u need to declare that you're extending it if you want typescript to accept it
  • b

    busy-vegetable-18177

    06/03/2022, 1:45 PM
    dont remember the syntax tho
  • w

    wooden-australia-44486

    06/03/2022, 1:45 PM
    that sounds like my problem. let me dig into the docs a little more. thanks
  • w

    wooden-australia-44486

    06/03/2022, 1:50 PM
    got it. needed a definitions file. thanks!
  • n

    nutritious-crayon-33896

    06/03/2022, 1:50 PM
    Hi guys, hoping someone might be able to help me with my cypress issue. Cypress crashed when attempting "Initializing Config" for the first time on any app and i get this error in VS Code:
1...747576...252Latest