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

    limited-barista-33480

    10/15/2022, 1:42 AM
    @stale-optician-85950 Hello friend, I have been carrying out many tests and tried all the arguments that I had sent you to check the behavior of the chrome browser when executing the test by cypress and I find that it does not make any changes with respect to what I require, the browser launched by cypress does not change the behavior with all the arguments you send to it. I'll send you a detailed description of what's going on. First of all I share with you an image of what should happen when the test is executed, I did this test manually in the normal browser and as it is visualized in the image it is observed that when clicking the add button some fields are displayed. And the second thing is what happens when that same process is executed but from the test in cypress that, as we can see, does not allow the form to be displayed, it is as if it had a blockage. Then I was checking in code development mode and I see that it is generated as an error that I share here. that popup is shown but it does not disappear and it does not display the form, the strange thing is that if I do it in the normal chrome browser if it executes it well
  • s

    stale-optician-85950

    10/15/2022, 12:52 PM
    Thanks for the images and detailed description of this issue. Lets try a different approach as maybe a request is being blocked! Firstly run test in normal Chrome browser to see what happens with the network requests: * Open your normal Chrome view Dev Tools -> Network * Navigate to the page with that Add button (Do not click it yet) * In Dev Tools -> Network clear the request history * Now click the application Add button * Was there a specific request generated for the pop up form being displayed? (keep a note of this) Now repeat steps with Cypress browser: * Start running your Cypress test with Dev Tools Dev Tools -> Network open * Put
    cy.pause()
    in your code just before your code clicks the Add button * During this pause manually Dev Tools -> Network clear the request history * Allow the Cypress test to continue * Was the same request generated for the pop up form being displayed? Does it have a success status code or error status code?
  • l

    limited-barista-33480

    10/15/2022, 3:06 PM
    @stale-optician-85950 Hi friend, thank you very much for sharing this information to carry out these tests. I am going to follow the step by step of what you tell me and as soon as I have the evidence I will share it with you again to analyze the results. 💪
  • a

    aloof-carpet-54145

    10/16/2022, 10:33 AM
    Hi all, I have a general query, we run a firebase backend from vue(nuxt). While running the tests, we get a huge amount of console logging into the Cypress tool which makes it annoying as hell to debug as you need to scroll loads and loads of entries that have no relevance to the test itself. Is there a way to silence this output? You can see an example in the attached screen
  • m

    mysterious-belgium-25713

    10/16/2022, 10:50 AM
    Yeah you can use this blog to hide the xhr calls https://dev.to/samelawrence/muting-noisy-xhr-logs-in-cypress-4495
  • a

    aloof-carpet-54145

    10/16/2022, 10:59 AM
    Thanks so much @mysterious-belgium-25713 did the job nicely
  • r

    ripe-author-71222

    10/16/2022, 1:25 PM
    I am trying to implement parallel testing in AWS code build. I created a buildspec.yml file like this sample project: https://github.com/cypress-io/cypress-realworld-app/blob/develop/buildspec.yml My problem is the environments that I use during the cypress command are getting as empty.
    Copy code
    - echo $CY_GROUP_SPEC
          - CY_GROUP=$(echo $CY_GROUP_SPEC | cut -d'|' -f1)
          - CY_BROWSER=$(echo $CY_GROUP_SPEC | cut -d'|' -f2)
          - CY_SPEC=$(echo $CY_GROUP_SPEC | cut -d'|' -f3)
          - CY_CONFIG=$(echo $CY_GROUP_SPEC | cut -d'|' -f4)
    And then the cypress code build fails with this error: *Opening Cypress... Cypress encountered an error while parsing the argument: --spec You passed: true The error was: spec must be a string or comma-separated list* I use this command to run cypress:
    Copy code
    - NO_COLOR=1 ./node_modules/.bin/cypress run --browser $CY_BROWSER --spec "$CY_SPEC" --config "$CY_CONFIG" --headless. --record --key $CYPRESS_KEY --parallel --ci-build-id $CODEBUILD_INITIATOR  --group "$CY_GROUP"
    I defined these env variables like this on the top of the file:
    Copy code
    batch:
      build-matrix:
          dynamic:
            env:
              image:
                  - ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/cypress:latest
              variables:
                CY_GROUP_SPEC:
                  - "UI - Chrome|chrome|cypress/e2e/account/*"
                  - "UI - Chrome|chrome|cypress/e2e/auth/*"
                  - "UI - Chrome|chrome|cypress/e2e/mastering/*"
                  - "UI - Chrome|chrome|cypress/e2e/pages/**/*"
                  - "UI - Chrome|chrome|cypress/e2e/user-flows/**/*"
                WORKERS:
                  - 1
                  - 2
                  - 3
                  - 4
                  - 5
    Can anybody help me to fix this problem?
  • l

    little-planet-43809

    10/16/2022, 3:43 PM
    Hello everyone!! Is there a way to upload a folder directly instead of separate file? The app demands an entire folder to be uploaded and not individual files.
  • l

    little-planet-43809

    10/16/2022, 3:44 PM
    I created am trying using fixture folder
  • l

    limited-barista-33480

    10/16/2022, 11:05 PM
    @stale-optician-85950 hello friend I already did some tests both in the normal chrome browser and in the cypress browser, I tried to analyze the results but in the network tools part I don't see anything strange, the requests show a status 200 in both browsers both in normal mode as is cypress. What did seem strange to me was in the security option that for the test with cypress in the browser it generates as a lock. But I really have not found what is the problem that does not allow the form to be displayed. 🤔 normal Chrome browser to see what happens with the network requests
  • l

    limited-barista-33480

    10/16/2022, 11:07 PM
    @stale-optician-85950 Now repeat steps with Cypress browser: * Start running your Cypress test with Dev Tools Dev Tools -> Network
  • h

    happy-megabyte-98400

    10/17/2022, 2:35 AM
    Hello, I have a
    cy.request()
    whose response body is like,
    Copy code
    [
      {
        id: 1234
        name: cypress
        email: cypress@cypress.io
        <other fields>
      },
      {
        id: 1235
        name: cypress
        email: cypress@cypress.io
        <other fields>
      },
    ]
    How can i extract only the id, name and email fields in the
    then()
    block?
  • a

    acceptable-hamburger-48790

    10/17/2022, 7:22 AM
    Give this a read https://medium.com/@gurudatt.sa26/cypress-understanding-basics-of-api-testing-f81e4f70cca9 might help
  • s

    stale-optician-85950

    10/17/2022, 8:54 AM
    Hey @limited-barista-33480 yeah your requests look good. Let's focus on your Add Button HTML next: I can see that your click() button has an invisible element icon shown in the Cypress running (left side) history. So we need to check if the button is in the correct state when you are clicking on it: Steps with Cypress browser: * Start running your Cypress test with Dev Tools -> Elements open * Put cy.pause() in your code just before your code clicks the Add button * then gather this info please: 1 - inspect element of your Add button and share that screenshot here of the html code? 2 - share your test code here too? 3 - manually click on the Add button in the Cypress browser, does the pop-up window display?
  • h

    happy-megabyte-98400

    10/17/2022, 11:20 AM
    Thanks
  • b

    busy-wall-71096

    10/17/2022, 1:06 PM
    Hi. Could someone tell me how to make
    cy.intercept
    work for external calls? It seems to be a very common thing to happen on any web app but yet I failed to find a working example or workaround. Here's a failing snippet I had prepared:
    Copy code
    describe('Intercept external request', () => {
      it('Can intercept external resource request', () => {
        cy.intercept({
          url: 'https://github.githubassets.com/images/modules/site/home/globe/flag.obj',
        }).as('extCall');
        cy.intercept({
          url: 'https://api.funcaptcha.com/*',
        }).as('extCall2');
    
        cy.visit('https://github.com');
        // This works
        cy.wait('@extCall').its('response.statusCode').should('eq', 200);
    
        // eslint-disable-next-line cypress/no-unnecessary-waiting
        cy.wait(5000);
    
        cy.contains('Sign up').click();
        // The following will fail
        cy.wait('@extCall2').its('response.statusCode').should('eq', 200);
    
        // eslint-disable-next-line cypress/no-unnecessary-waiting
        cy.wait(5000);
      });
    });
    Is this me just using it incorrectly or is this a bug? Help will be very appreciated 🙏 PS:
    chromeWebSecurity: false
    didn't help.
  • m

    mysterious-belgium-25713

    10/17/2022, 1:09 PM
    maybe change
    Copy code
    'https://api.funcaptcha.com/*
    
    to 
    'https://api.funcaptcha.com/**
  • b

    busy-wall-71096

    10/17/2022, 1:31 PM
    Okay, that helped in this particular example I did. Thx! But I guess it didn't reproduce my problem enough. Please, have a looks at this instead:
    Copy code
    describe('E2E: Radio stream & Playouts', () => {
      it('Can play radio station from player', () => {
        cy.intercept({
          url: 'https://energyzuerich.mp3.energy.ch/energyzuerich-high.mp3?ua=energy+website+desktop',
        }).as('audioStream');
    
        cy.visit('https://energy.ch');
        // eslint-disable-next-line cypress/no-unnecessary-waiting
        cy.wait(5000);
        cy.visit('https://energy.ch');
        // eslint-disable-next-line cypress/no-unnecessary-waiting
        cy.wait(5000);
    
        cy.get('button.flex-shrink-0.w-12.h-12.p-2.cursor-pointer')
          .filter(':visible')
          .click();
    
        // (fetch) GET 200 https://energyzuerich.mp3.energy.ch/energyzuerich-high.mp3?ua=energy+website+desktop
    
        // This makes request hang and never fulfill. Later time-outs after 30s. Why?
        cy.wait('@audioStream').its('response.statusCode').should('eq', 200);
    
        // eslint-disable-next-line cypress/no-unnecessary-waiting
        cy.wait(3000);
      });
    });
  • b

    busy-wall-71096

    10/17/2022, 1:32 PM
    It is able to recognize a request but it also makes it hanged. If removed that intercept, it would go well and music player would play music as expected.
  • g

    gray-kilobyte-89541

    10/17/2022, 1:46 PM
    I would suggest studying my network course first, it has lots of hands on examples for the cy.intercept command https://cypress.tips/courses/network-testing
  • m

    mysterious-belgium-25713

    10/17/2022, 1:48 PM
    Yeah it could be because you are trying to intercept an audio stream. I'm not sure what the application does and why it is hanging.
  • m

    mysterious-belgium-25713

    10/17/2022, 1:55 PM
    If i look at what happens when you dont do the intercept then after the fetch call 3 other calls to the radio player are being called. When the intercept is set even without a wait then cypress seems to not do anything afterwards. @gray-kilobyte-89541 I dont think he is doing anything wrong. It is more how the application is responding to cypress. If you use this code the radio player starts
    Copy code
    js
    describe('E2E: Radio stream & Playouts', () => {
      it('Can play radio station from player', () => {
        // cy.intercept("GET","https://energyzuerich.mp3.energy.ch/energyzuerich-high.mp3?ua=energy+website+desktop").as("testurl")
    
        cy.visit('https://energy.ch');
    
        cy.get('button.flex-shrink-0.w-12.h-12.p-2.cursor-pointer')
          .filter(':visible')
          .click();
    
        // (fetch) GET 200 https://energyzuerich.mp3.energy.ch/energyzuerich-high.mp3?ua=energy+website+desktop
    
        // This makes request hang and never fulfill. Later time-outs after 30s. Why?
        //cy.wait('@audioStream').its('response.statusCode').should('eq', 200);
      });
    });
    But if you just have the intercept line (not waiting on the intercept) then it does not trigger the radio player
    Copy code
    js
    describe('E2E: Radio stream & Playouts', () => {
      it('Can play radio station from player', () => {
        cy.intercept("GET","https://energyzuerich.mp3.energy.ch/energyzuerich-high.mp3?ua=energy+website+desktop").as("testurl")
    
        cy.visit('https://energy.ch');
    
        cy.get('button.flex-shrink-0.w-12.h-12.p-2.cursor-pointer')
          .filter(':visible')
          .click();
    
        // (fetch) GET 200 https://energyzuerich.mp3.energy.ch/energyzuerich-high.mp3?ua=energy+website+desktop
    
        // This makes request hang and never fulfill. Later time-outs after 30s. Why?
        //cy.wait('@audioStream').its('response.statusCode').should('eq', 200);
      });
    });
  • g

    gray-kilobyte-89541

    10/17/2022, 1:56 PM
    probably binary resource problem
  • m

    mysterious-belgium-25713

    10/17/2022, 1:59 PM
    Are you a tester of this site or are you just using this site to learn cypress?
  • i

    important-fish-21193

    10/17/2022, 2:01 PM
    Hello Guys, another iframe question. any one had this issue where cypress test runner does not render the iframe modal pop up to its actual height ? In my case when I open the modal pop up manually it renders with its actual size which is 850px, but inside cypress test runner, it loads with just 150px, thus my should be visible assertions on elements inside the iframe are failing. 
 I could invoke the css height and set to 850 px, this would solve the issue but is there a better approach to sort this issue incase iframe height changes again in future? Thanks.
  • b

    busy-wall-71096

    10/17/2022, 2:02 PM
    I develop it and I wanted to prepare some e2e tests for it. But apparently hit a wall pretty early with simple attempt to verify if radio is playing music 😐
  • b

    busy-wall-71096

    10/17/2022, 2:06 PM
    Is this a bug then? Or is there any common workaround for this? 🤔
  • g

    gray-kilobyte-89541

    10/17/2022, 2:25 PM
    I don't know. In my course, I did spy / stub PNG images, but in your case the MP3 is probably a streaming resource, which Cypress proxy might not handle correctly
  • b

    busy-wall-71096

    10/17/2022, 2:33 PM
    Ok, I will probably create an issue for this one. Thanks for helping.
  • b

    busy-wall-71096

    10/17/2022, 2:44 PM
    https://github.com/cypress-io/cypress/issues/24278
1...122123124...192Latest