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

    chilly-quill-34099

    09/06/2022, 2:49 PM
    Oh I see. I was nesting the tests inside another
    it()
    . Maybe let me try to describe what I would like to do. The header of my website, which has several tests to be run, needs to be tested with different values for
    visit
    . In context of your image. I would like to run everything what is inside the
    describe('my test scope: dashboard page' ...
    with several different values inside
    visit
    .
  • n

    nutritious-army-46708

    09/06/2022, 2:50 PM
    Does anyone know how to get the verification code in email sent by app?
  • m

    melodic-ocean-83158

    09/06/2022, 2:53 PM
    It's not an easy job..Can you say how much quality/time you want to spend on this test?
  • m

    melodic-ocean-83158

    09/06/2022, 2:56 PM
    If you want a moderately fast but paid path, use mailosaur. Look here: https://mailosaur.com/docs/frameworks-and-tools/cypress/
  • m

    melodic-ocean-83158

    09/06/2022, 2:57 PM
    for free you can use https://ethereal.email/. Just look for how to integrate it with js
  • f

    fierce-engineer-40904

    09/06/2022, 2:57 PM
    Does anyone know how to fix this error?
    Copy code
    fix
    Error: Webpack Compilation Error
    ./cypress/e2e/twilioVoice.cy.ts
    Module not found: Error: Can't resolve '@twilio/voice-sdk' in '/opt/atlassian/pipelines/agent/build/cypress/e2e'
    resolve '@twilio/voice-sdk' in '/opt/atlassian/pipelines/agent/build/cypress/e2e'
  • m

    melodic-ocean-83158

    09/06/2022, 3:00 PM
    But the best way is to use the gmail API integration. Look here: https://github.com/levz0r/gmail-tester
  • m

    melodic-ocean-83158

    09/06/2022, 3:08 PM
    You need to do this as if you were working with multiple environments. You'll need to put changing values ​​into variables, and control what to use from environment variables. So you can say from the terminal "run cypress on x-website" and the variable values ​​will be used as the ones you set for this site.
  • n

    nutritious-army-46708

    09/06/2022, 3:19 PM
    Thank you for your answer! I want a free method. Our app is based on Node.js.
  • n

    nutritious-army-46708

    09/06/2022, 3:21 PM
    Thank you! I will learn it.
  • c

    chilly-quill-34099

    09/06/2022, 3:24 PM
    Reuse test suites
  • s

    sticky-piano-45805

    09/06/2022, 5:10 PM
    Hi Cypress lovers! πŸ‘‹ In last days I'm struggling with login flow for E2E tests. I really wanted to use session and origin functionality, which was introduced in Cypress 9.6.0 for this use case. The problem looks like a standard one - login form is available in another domain and Cypress ofc can't make cross origin requests. I read in documentation (https://docs.cypress.io/api/commands/origin#SSO-login-custom-command) that this can be easily handled by
    cy.origin()
    but I tried to use that scheme and I couldn't managed it to work. 😦 The problem is that firstly I need to visit my application URL (baseURL) to be redirected to another domain. This step is necessary, as if the user has no valid session, it is directly redirected to the login form on another domain with additional information in a link, such as origin application and state for further token challenge (generated before redirecting and saved in session). After user submits the login form it is automatically redirected back to the page. So let's say we have something like this:
    Copy code
    js
    cy.visit('/');
    cy.origin('https://amazinglogin.test', () => {
      // Filling up the form and clicking submit
    })
    This isn't working in that case, as page never return load event (because it is programmatically moved to another domain) and test fails stuck on loaded page with form. In all examples that I saw Cypress always was loading a page, and then clicking a
    magic
    "login" button, which redirected to another domain - this would work fine. Do you know if there is some workaround for that or maybe this is a Cypress limitation for this moment? In worst case I will try to change login flow to using
    cy.request()
    to get token for the tests, but I will really like to avoid that, as this will increase complexity of the whole flow. And if you read this far, I hope you have a great day/evening! 😊
  • n

    nutritious-army-46708

    09/06/2022, 5:24 PM
    if there is no click to redirect, you should write cy.visit("...") in the first line of the origin function.
  • s

    sticky-piano-45805

    09/06/2022, 5:27 PM
    Oh, forgot to mention that! πŸ˜„ Tried that, but the problem is that I cannot visit something from another origin inside that
    cy.origin()
    . So it would look like that:
    Copy code
    js
    cy.origin('https://amazinglogin.test', () => {
      cy.visit('/'); // This visits https://amazinglogin.test, which I don't want
      cy.visit('https://mysuperbapplication.me'); // This fails, as I'm trying to access another domain with visit, even if exactly that was set as baseUrl before
    })
  • n

    nutritious-army-46708

    09/06/2022, 5:30 PM
    There is only one domain we can visit in origin. You have to add another cy.origin() to load the third one.https://mysuperbapplication.me'
  • n

    nutritious-army-46708

    09/06/2022, 5:33 PM
    There is only one domain we can visit in origin. You have to add another cy.origin() to load the third one.https://mysuperbapplication.me/' cy.origin('https://amazinglogin.test/', () => { cy.visit('/'); }); cy.origin('https://mysuperbapplication.me/%27,()=%3E.....
  • s

    sticky-piano-45805

    09/06/2022, 5:39 PM
    I don't think that would work, as it looks like this:
    https://mysuperbapplication.me
    - My main application, which redirects on startup to login page (also said as a baseUrl, which if I understand correctly sets it as origin for every test)
    https://amazinglogin.test
    - Login panel
  • s

    sticky-piano-45805

    09/06/2022, 5:40 PM
    And I cannot visit
    https://amazinglogin.test
    directly, as it will result in error code because of lacking additional arguments in URL
  • n

    nutritious-army-46708

    09/06/2022, 5:46 PM
    Sorry, I do not know your baseurl is 'https://mysuperbapplication.me'. how about cy.origin('https://amazinglogin.test/', () => { cy.visit('/'); });
  • s

    sticky-energy-17458

    09/06/2022, 9:34 PM
    How to itrate the presence of an element in each card of a page of the website, as there are multiple pages, like there are 10 cards in each page as there are total 50 pages and I need verify a text in each card , how to do that please help
  • m

    modern-addition-58981

    09/07/2022, 7:42 AM
    How to send large XML data in post call request body??
  • f

    fierce-engineer-40904

    09/07/2022, 8:12 AM
    Hello, I have a test:
    Copy code
    js
    it('Should open widget with loading state', () => {
        cy.get('[data-cy="twilio-widget"]').click({ force: true })
        cy.get('[data-cy="call-button"]').should('exist')
      })
    I would like to when I press the button, pass in the prop state of Loading to be true, so I can see the loading modal instead of my default one.
    Copy code
    js
      if (isLoading) {
        return (
          <Modal
            isOpen={isOpen}
            onClose={onClose}
            size="xl"
            cy-data="modal-loading"
          >
            <Flex direction="column" m={4}>
              <Skeleton height="30px" />
              <SkeletonText mt={4} />
              <Skeleton height="50px" mt={4} />
              <Flex justify="center" mt={4}>
                <Skeleton height="50px" width="120px" />
              </Flex>
            </Flex>
          </Modal>
        )
      }
    Anyone know how to do that with cypress?
  • m

    modern-addition-58981

    09/07/2022, 9:02 AM
    I want that for API automation not front end
  • a

    acoustic-secretary-90500

    09/07/2022, 9:15 AM
    Hi all, is anyone facing this issue ? "Unable to complete e2e test using paypal payment (on sanbox test website) #23647" See https://github.com/cypress-io/cypress/issues/23647
  • a

    acoustic-secretary-90500

    09/07/2022, 9:15 AM
    I tryed to add the "experimentalModifyObstructiveThirdPartyCode" parameter into the cypress.config.js file: experimentalModifyObstructiveThirdPartyCode: true but with this configuration ALL my test specs fail with the following error: as soos as the cy.visit("...") command is invoked I got an unexpected exception "(uncaught exception)SyntaxError: Invalid left-hand side in assignment", see attached screenshot.
  • a

    acoustic-secretary-90500

    09/07/2022, 9:16 AM
    attached error
  • r

    refined-painter-56677

    09/07/2022, 2:22 PM
    Hi, I am facing a problem when trying to intercept api calls. I have already searched the internet, but I somehow don't understand. I am new to cypress and I am using cypress10 within a react app where a express server runs next to it. The e2e test works locally but on Github Actions CI, I have the following problem: The intercepted request
    /rpc/dags/int
    is not found. Here a log from my server docker container. I noticed that there is no statusCode for the request and in the video, the request never resolves and timeouts as "No request occured". I am not sure if this happens becase the express server has a middleware on this route or not. Other API calls on the server worked, like
    /fire/auth/sign
    Copy code
    (another request before, worked)
     request http: #######  Server API Request #######
     request http: OPTIONS /fire/auth/sign 204
    
     request http: #######  Server API Request #######
     request http: POST /fire/auth/sign 200
    
     (the failing request)
     request http: #######  Server API Request #######
     request http: POST /rpc/dags/int -
    I am doing a: in before:
    Copy code
    cy.intercept({
          method: "POST",
          path: "/rpc/dags/int",
        }).as("trigger")
    in the body:
    Copy code
    cy.wait("@trigger").then(({ response }) => {
            expect(response.statusCode).to.eq(200)
    })
    But somehow the intercepted call is not found. Maybe someone knows the issue. Locally the request resolves:
    Copy code
    request http: ####### Server API Request #######
    request http: POST /rpc/dags/int 200
    I am not sure what's wrong, I have boot up the same environment as in github actions. Best, Minh
  • a

    aloof-student-42798

    09/07/2022, 2:26 PM
    I have a clarification.. I added tags to the test cases and ran using grep command. But all the test cases in the suite were executed instead of only the test cases with tags Can you please let me know what am I missing here.
  • s

    stale-optician-85950

    09/07/2022, 2:30 PM
    The following works for me. e2e.ts:
    Copy code
    import cypressGrep from 'cypress-grep';
    Tagged test:
    Copy code
    it(`Most important test ever`, { tags: ['@smoke'] }, () => {
    CLI command:
    Copy code
    yarn cypress run --browser chrome --env grepTags="@smoke",grepOmitFiltered=true
  • s

    swift-rain-28843

    09/07/2022, 3:40 PM
    Is it possible to use cypress to test a website that is live? Say the website is hosted on netlify and part of the content is dynamic. I would like to run cypress every hour to ensure that certain elements never disappear.
1...969798...192Latest