https://cypress.io logo
Join DiscordCommunities
Powered by
# e2e-testing
  • p

    purple-afternoon-2408

    07/15/2021, 3:37 PM
    https://github.com/cypress-io/cypress/issues/17352
  • u

    user

    07/15/2021, 7:40 PM
    Using a cached endpoint (
    Cache-Control
    header with a
    max-age
    and
    must-revalidate
    ), Cypress does not seem to be able to
    cy.wait
    for the alias I setup: * When running with cache disabled in chrome dev tools, my tests run fine * With cache enabled however, the test fails because it does not record any of the calls made to this particular endpoint. What's the correct way to handle this?
  • a

    ancient-wire-34126

    07/15/2021, 8:10 PM
    Hey all, I have a question about fixtures in relation to GraphQL. We're using AWS amplify for our app and fully rely on queries/mutations and subscriptions in our app. We're thinking about using one of the Cypress graph plugins to stub out all graph related calls based on the schema, but we're wondering if anyone has experience with subscriptions at all? We feel stubbing out the whole server is quite a bit of work, but really worth it for development and testing, but we're wondering if this is indeed a good approach and/or if people have experience with Amplify specifically?
  • a

    ancient-wire-34126

    07/16/2021, 7:13 PM
    Whenever I try to intercept a cognito call and return my own stub (with or without use of a fixture) it ends up as a CORS error. Can't seem to find the documentation on this though. What am I doing wrong?
    Copy code
    ts
        cy.intercept('OPTIONS', 'https://cognito-idp.us-east-1.amazonaws.com', { statusCode: 200 })
        cy.intercept('POST', 'https://cognito-idp.us-east-1.amazonaws.com', {
          statusCode: 200,
          headers: {
            'access-control-allow-origin': window.location.origin,
            'Access-Control-Allow-Credentials': 'true',
          }, body: {
            // stuff
          }
        })
      })
  • a

    ancient-wire-34126

    07/16/2021, 7:25 PM
    Oh looks like the preflight needed to return headers
  • a

    ancient-wire-34126

    07/16/2021, 7:45 PM
    Can't you use fixtures for failed requests? Seems like a pain to have to specify
    statusCode
    manually for failed requests and only being able to load fixtures for 200's?
  • a

    ancient-wire-34126

    07/16/2021, 7:47 PM
    Ok you can, but you need to still specify the statusCode :/
  • w

    wonderful-match-15836

    07/16/2021, 7:59 PM
    Wait is it bad to have to specify the status code? When I've been doing stuff with failures I've wanted to specify the status code since that's part of what our app uses to decide what to do. Here's a tiny little helper we use at work:
    Copy code
    Cypress.Commands.add('interceptApi', (endpoint, fixturePath, statusCode = 200) => {
        cy.intercept(INTERCEPT_API_URL + endpoint, {
            statusCode,
            fixture: `/${fixturePath}.json`,
        }).as(fixturePath);
    });
    And we do stuff like
    cy.interceptApi('/yourEndpoint', 'lil-fixture-path/500-error', 500);
    then make our assertions.
  • a

    ancient-wire-34126

    07/16/2021, 8:00 PM
    Well in our case we use AWS cognito and they jumble around 200/400's. Sometimes they even return a 200 on an error
  • a

    ancient-wire-34126

    07/16/2021, 8:00 PM
    so I have to specify a statusCode manually in some cases
  • w

    wonderful-match-15836

    07/16/2021, 8:01 PM
    ooh I've worked a place that had a lot of 200-but-it's-an-error situations, it's a pain
  • a

    ancient-wire-34126

    07/16/2021, 8:01 PM
    Now I run into an issue where there are 3+ calls to the same endpoint and I need to intercept them in sequence
  • a

    ancient-wire-34126

    07/16/2021, 8:11 PM
    aliassing doesn't work... ugh... this has been a pita tbh
  • a

    ancient-wire-34126

    07/16/2021, 8:15 PM
    Copy code
    ts
      it.only('Should login successfully', () => {
        cy.intercept('POST', 'https://cognito-idp.us-east-1.amazonaws.com', { fixture: 'cognito/email-valid.json' }).as('baz')
    
        cy.get('input#email').type(LOGIN_EMAIL_VALID)
        cy.get('[data-login-email-submit]').click()
    
        cy.wait('@baz')
    
        cy.intercept('POST', 'https://cognito-idp.us-east-1.amazonaws.com', { fixture: 'cognito/auth-result.json' }).as('1')
        cy.intercept('POST', 'https://cognito-identity.us-east-1.amazonaws.com', { fixture: 'cognito/id-1.json' }).as('2')
        cy.intercept('POST', 'https://cognito-identity.us-east-1.amazonaws.com', { fixture: 'cognito/id-2.json' }).as('3')
        cy.intercept('POST', 'https://cognito-idp.us-east-1.amazonaws.com', { fixture: 'cognito/auth-2.json' }).as('4')
        
        cy.get('input#verification').type(LOGIN_CHALLENGE_VALID)
        cy.get('[data-login-code-submit]').click()
    
        cy.wait('@1')
        cy.wait('@2')
        cy.wait('@3')
        cy.wait('@4')
    
        cy.location('pathname', { timeout: 10000 }).should('include', 'profile')
      })
    It never waits for
    @1
  • a

    ancient-wire-34126

    07/16/2021, 8:16 PM
    I have a feeling Cypress can't deal with multiple requests to the same endpoint
  • a

    ancient-wire-34126

    07/16/2021, 8:31 PM
    It only ever uses the last one
  • a

    ancient-wire-34126

    07/16/2021, 8:31 PM
    my god this is annoying
  • a

    ancient-wire-34126

    07/16/2021, 8:39 PM
    the
    times
    param also doesn't do anything
  • a

    ancient-wire-34126

    07/16/2021, 8:46 PM
    it's also firing them in the wrong order. This shouldn't be difficult lol
  • a

    ancient-wire-34126

    07/16/2021, 8:47 PM
    Yup, they need to be declared in reverse order. That must be a bug, right?
  • a

    ancient-wire-34126

    07/16/2021, 9:07 PM
    Well, finally got it working, but files a bug report for the intercept issue
  • p

    purple-afternoon-2408

    07/19/2021, 10:43 AM
    Hello everyone, is there anyway for me to wait for page load?
  • p

    purple-afternoon-2408

    07/19/2021, 1:19 PM
    Guys, I am really stuck because of this issue here https://discord.com/channels/755913899261296641/755913900024791046/865250071804379176
  • a

    alert-photographer-39416

    07/19/2021, 7:34 PM
    hey guys im just curious how you guys are able to test a login that is using 2FA
  • h

    hallowed-soccer-80135

    07/20/2021, 6:17 AM
    hello guys, is there any environment variable that stores the cypress dashboard url after the run has been completed in CI? eg. this url: https://dashboard.cypress.io/projects/7s5okt/runs/4730/specs My use case is: I am writing a custom slack bot, that will notify a slack channel after every run. I know there is a slack integration built into the Cy dashboard, but that not my requirement.
  • h

    hallowed-soccer-80135

    07/20/2021, 6:26 AM
    after some mocking around, I found it. Its
    Copy code
    cypress.run(config).then(results => {
        console.log(results.runUrl)
    })
  • f

    fancy-airplane-60156

    07/20/2021, 12:58 PM
    Hello ! I know it's pretty basic. I installed cypress yesterday.I ran few tests. App preview window is not displayed on my runner I was wondering what could be the issue Tests run okay. I see all of them have passed. It's just that i don't get to see the Video of how test progressed as App preview doesn't display 😫
  • h

    hallowed-soccer-80135

    07/21/2021, 12:15 AM
    version?
  • f

    fancy-airplane-60156

    07/21/2021, 3:08 AM
    7.7
  • p

    purple-afternoon-2408

    07/21/2021, 5:09 PM
    Hi @User , are you online?
1...121314...192Latest