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

    handsome-cartoon-58565

    01/08/2022, 2:04 PM
    `viewportWidth`/`viewportHeight` affects just the browser with app, but not the whole test runner window if i understand correctly
  • h

    handsome-cartoon-58565

    01/08/2022, 2:06 PM
    i can manually change the whole window size, but after i run tests again the window is opened on full screen instead of having the size from previous session
  • w

    wonderful-match-15836

    01/10/2022, 5:36 PM
    Hey Chris, I can't tell exactly what you are asking - can you clarify a bit? Is it just not "not remembering" your last window size in Open Mode or are you hoping to influence the window size in Run Mode.
  • m

    magnificent-lamp-25446

    01/10/2022, 5:36 PM
    Does anyone have any tips about how to create and access aliases for the requests that are triggered when the page is loaded? I'm calling cy.intercept(params).as("Request"), then I'm visiting the page, my requests are being intercepted as expected and I can assert the request properties with cy.wait("@Request") in the firest "it" block. But the alias is not accessible between "it" blocks, so I cannot access the aliases for other assertions and I cannot force the request again to create a new alias. How should I address this issue?
    Copy code
    javascript
    describe('TESTS', () => {
      before(() => {
        cy.intercept(
          { method: "GET", url: "URL1" },
          { fixture: "FIXTURE1" }
        ).as("ALIAS1");
    
        cy.intercept(
          { method: "GET", url: "URL2" },
          { fixture: "FIXTURE2" }
        ).as("ALIAS2");
    
        cy.visit("/PAGE");
      });
    
      describe("", () => {
        it("FIRST BLOCK", () => {
          const parametrosEsperados = {
            ...
          };
    
          cy.wait("@ALIAS1").then(({ request }) => {
            cy.decodeQueryParams(request.url).should('deep.equal', parametrosEsperados);
          })
        })
    
        it("ativo mensal terminais deve ser chamado com os parametros corretos", () => {
          const parametrosEsperados = {
            
          };
    
          //This one fails.
          cy.wait("@ALIAS2").then(({ request }) => {
            cy.decodeQueryParams(request.url).should('deep.equal', parametrosEsperados);
          })
        })
      })
    });
  • w

    wonderful-match-15836

    01/10/2022, 6:02 PM
    Hi, aliases are reset between
    it
    blocks, you are running into the issue described here: https://docs.cypress.io/guides/core-concepts/variables-and-aliases#Aliases-are-reset-before-each-test
  • h

    handsome-cartoon-58565

    01/10/2022, 6:04 PM
    Hey, both to be honest. I would like to programatically set the whole Cypress Test Runner app window size. About preserving manually set size - i assume it's about the embedded browser not setting a profile, because i.e. devtools settings are also gone after each browser re-launch. Also, i am using
    cypress run --headed
    , not
    cypress open
    command.
    w
    • 2
    • 2
  • m

    magnificent-lamp-25446

    01/10/2022, 6:06 PM
    Yes, but how should I address this problem? My requests are triggered once the page loads, and I want to check the paremeters it sent to our backend.
    w
    • 2
    • 5
  • w

    wonderful-match-15836

    01/10/2022, 6:47 PM
    window size
  • w

    wide-hospital-71307

    01/10/2022, 9:32 PM
    Have been having an issue where it says caniuse-lite is outdated. This happens both at work but also at home where the whole setup is more barebones. already tried updating, and tried using an environment variable, BROWSERSLIST_IGNORE_OLD_DATA, in the actual test, to try to suppress that issue. This has been happening for a few months now. https://github.com/andrei1015/cypressio-reliability-test/blob/main/reliability-test.sh
  • b

    billowy-spoon-30011

    01/11/2022, 10:06 AM
    Hi all ! New Cypress version, new problems... When I try to launch my test in the window, I got the following error : error:0308010C:digital envelope routines::unsupported Any clue about what it is ?
  • a

    ancient-minister-75558

    01/11/2022, 10:14 AM
    Hello everyone, I am fairly new to Cypress therefore wonder what is the best way or how do you get and store Oauth2 access tokens which are needed for following requests after getting the token? I am aiming to put the tests into CI pipeline as well.
  • g

    gray-flower-69892

    01/11/2022, 2:24 PM
    I am also a noob, so take this with a bucket of salt, but if you have reusable tokens that you don't need to create as part of your testing you might want to consider using a cypress.env.json file that you do not commit to GIT. Set your tokens in there and use them locally and then you should be able to insert tokens using whatever pipeline you use. Cypress has articles on options. https://docs.cypress.io/guides/continuous-integration/introduction#Environment-variables, https://docs.cypress.io/guides/guides/environment-variables#Setting
  • a

    ancient-minister-75558

    01/11/2022, 4:24 PM
    Thanks for the message, I will take a closer look to the links you send. In my case, token expires, therefore needs to be retrieved/refreshed each time before running test. If I could get to update the environmental variable with fresh token this would solve the problem I believe.
  • p

    purple-napkin-62735

    01/11/2022, 4:37 PM
    Hey there people! I wonder is there any chance to run cypress using a really older Chrome version – 45. Did anyone dig into this? Maybe I can run tests on this Chrome version if I use some really old Cypress version too? Any advice will be appreciated, 10x
  • a

    adventurous-dream-20049

    01/11/2022, 8:32 PM
    Which version are using? It looks similar to this issue (https://github.com/webpack/webpack/issues/14532). Is it possible to upgrade to Cypress version 9.2.1, which includes a bug-fix for verifying when the
    --openssl-legacy-provider
    option should be passed to the plugins' child process when the system Node version is v17+.. You can see more in our docs here: https://docs.cypress.io/guides/references/changelog#9-2-1
  • b

    bumpy-yacht-37274

    01/12/2022, 7:10 AM
    Hello, when I'm running
    cy.exec
    I have a strange error
  • h

    handsome-cartoon-58565

    01/12/2022, 6:29 PM
    could you provide a code that produces this error for context?
  • h

    handsome-cartoon-58565

    01/12/2022, 6:44 PM
    [#aliases] I am calling two commands inside
    beforeEach
    hook and i am aliasing them to
    wait
    for them
    Copy code
    js
    // commands.js
      Cypress.Commands.add('deleteEmails', () => {
        return cy.request('DELETE', getEmailAPIURL(1));
      });
    
      Cypress.Commands.add('removeTestUsers', () => {
        return cy.request({
          method: 'DELETE',
          url: '/api/users/delete',
          headers: {
            'Content-Type': 'application/json',
          },
          body: JSON.stringify({
            queryType: 'regex',
            query: 'test user',
          }),
        });
      });
    
    // spec.js
      beforeEach(() => {
        cy.visit(ROUTES.ROOT);
        cy.deleteEmails().as('deleteEmails');
        cy.removeTestUsers().as('removeTestUsers');
        cy.wait(['@deleteEmails', '@removeTestUsers']);
      });
    and i receive error > "before each" hook for "should login to default user account": > CypressError:
    cy.wait()
    only accepts aliases for routes. > The alias:
    deleteEmails
    did not match a route. what "route" it means - the alias name? there is no typo as far as i can see (also, i copy pasted the aliases names) Without
    cy.wait
    i have some race-conditions that i want to prevent. I have been using aliases and
    cy.wait
    already in my code, which makes me more surprised, why it doesn't work here
  • u

    user

    01/12/2022, 8:13 PM
    Hi! How can I solve problem with
    Timed out retrying after 5000ms: cy.wait()
    ?
    Copy code
    ts
    cy.intercept('POST', SIGN_UP).as('signUp')
    cy.get('[data-test="sign-up-form"]').submit() cy.wait('@signUp').its('response.statusCode').should('eq', 200)
    Fetch works correctly
  • h

    handsome-cartoon-58565

    01/12/2022, 8:19 PM
    is
    SIGN_UP
    a correct value (url)?
  • u

    user

    01/12/2022, 8:20 PM
    SIGN_UP is correct url
  • u

    user

    01/12/2022, 8:21 PM
    Oh, sorry
  • u

    user

    01/12/2022, 8:21 PM
    My bad
  • h

    handsome-cartoon-58565

    01/12/2022, 8:22 PM
    what was wrong?
  • u

    user

    01/12/2022, 8:26 PM
    Looks like it was my problem with .env variables
  • h

    handsome-cartoon-58565

    01/12/2022, 8:55 PM
    It seems to work after replacing
    cy.wait
    with
    cy.get
    (although, one
    wait
    against two `get`s) as i found in the issue https://github.com/cypress-io/cypress/issues/3827#issuecomment-502528398 > Using aliases with cy.request() is supported. Although, using cy.wait('@alias') does not work for request - since the cy.request() command itself will not resolve until it has a response. I didn't find this explanation in the docs around the
    cy.request()
    +
    .as()
    +
    cy.get()
    example, which i think would be helpful to not only have a working example with
    cy.request()
    with
    .as()
    , but to know that aliased
    cy.request()
    doesn't work with
    cy.wait()
    . IMO, what's more convenient in
    cy.wait()
    (if it worked with
    cy.request()
    ) is it can be used with multiple aliases, which is not the case for
    cy.get()
    . https://docs.cypress.io/api/commands/request#Alias-the-request-using-as
  • b

    bumpy-yacht-37274

    01/13/2022, 7:40 AM
    You mean the code that is under
    cy.exec
    ? My nodejs script?
  • b

    bumpy-yacht-37274

    01/13/2022, 8:15 AM
    Hey, is it possible to clear console with some command (I couldn't find one)
  • h

    handsome-cartoon-58565

    01/13/2022, 10:28 AM
    yes, your code, which uses the
    cy.exec
    b
    • 2
    • 35
  • h

    handsome-cartoon-58565

    01/13/2022, 10:28 AM
    console.clear()
1...444546...252Latest