https://cypress.io logo
Join Discord
Powered by
# i-need-help
  • ESLint 8 support/ plugin?
    e

    elegant-microphone-18288

    03/14/2023, 8:42 PM
    Is there a way to get Cypress playing friendly with my ESLint 8 setup? https://github.com/cypress-io/eslint-plugin-cypress Doesn't seem to work and there is an open issue around ESLint 8
  • HTML Elements appear invisible to Cypress
    s

    square-quill-93570

    03/14/2023, 10:18 PM
    I have a button that is tagged with the correct
    data-cy
    attribute, but when I run a test that clicks on this button, Cypress is unable to find it. Using a normal user action does click on the button and fire its event successfully, but Cypress is unable to. What's more is that using Cypress's element selector also does not reveal any information about the button, simply glossing over it as if it didn't exist. Is there a reason why Cypress is unable to find the button?
    g
    w
    • 3
    • 12
  • How to perform parallel run in multiple nodes/machine in Jenkins
    m

    millions-flower-39293

    03/15/2023, 4:21 AM
    Hi! I hope someone can give an idea how we can perform parallel execution in multiple node/machine in Jenkins pipeline. I followed the instruction here https://github.com/cypress-io/cypress-example-kitchensink/blob/master/Jenkinsfile for setting up Jenkins parallel execution. But it seems that it only execute in one machine. Whenever I check the logs I see that every stages are being run in parallel but only in one machine My JenkinsPipeline is declarative and here is the setup:
    Copy code
    pipeline {
        agent {
            docker {
                label 'default'
                image 'cypress/base:14.16.0'
            
            }
        }
        stages {
            stage('Install Dependencies') { 
                steps {
                    echo "Running build ${env.BUILD_ID} on ${env.JENKINS_URL}"
                    sh 'npm ci'
                    sh 'npm run cy:verify'
                }
              }
            stage('CBS UI Test') { 
                environment {
                    CYPRESS_RECORD_KEY = credentials('cypress-record-key')
                    CYPRESS_trashAssetsBeforeRuns = 'false'
                }
                parallel {
                    stage('Tester A') {
                        steps {
                            echo "Running build ${env.BUILD_ID} on Tester A"
                            sh "NO_COLOR=1 xvfb-run -a npx cypress-cloud run --parallel --record --key ${env.CYPRESS_RECORD_KEY}"
                        }
                    }
                    stage('Tester B') {
                        steps {
                            echo "Running build ${env.BUILD_ID} on Tester B"
                            sh "NO_COLOR=1 xvfb-run -a npx cypress-cloud run --parallel --record --key ${env.CYPRESS_RECORD_KEY}"
                        }
                    }
                    stage('Tester C') {
                        steps {
                            echo "Running build ${env.BUILD_ID} on Tester C"
                            sh "NO_COLOR=1 xvfb-run -a npx cypress-cloud run --parallel --record --key ${env.CYPRESS_RECORD_KEY}"
                        }}}}}}
    m
    • 2
    • 2
  • Test delayed network response
    g

    gray-father-52711

    03/15/2023, 8:10 AM
    Hi. I'm testing a web app. When one specific HTTP call takes longer than 30s to respond (that means
    pending
    status) the app is displaying some network error notification. I want to test that: - before 30s a spinner is visible - after 30s a network error notification is visible I've added an intercept for this call and delayed the response for more than 30s and it works, test is passing, but the test takes too much time. So my question is: can I use
    cy.clock
    and
    cy.tick
    somehow to control the time on the frontend and make the test to run much faster? 🙏
    g
    • 2
    • 1
  • Handling error prevents remainder of test from running
    v

    victorious-traffic-84253

    03/15/2023, 12:36 PM
    I'm implementing a custom command which asserts if an element is actionable or not. It appears to work as expected by suppressing the error but it then leaves the test in a limbo state where anything afterwards doesn't run. There are no errors in the console and I having looked at the Cypress examples (https://github.com/cypress-io/cypress-example-recipes/blob/master/examples/fundamentals__errors/cypress/e2e/app-error.cy.js#L13-L34) I can't find anything that I'm obviously missing. Does anyone have any ideas?
    Copy code
    Cypress.Commands.add(
      "shouldNotBeActionable",
      { prevSubject: "element" },
      (subject) => {
        cy.on("fail", (error) => {
          // We expect the click to fail with one of these messages
          const disabledMessage = "`cy.click()` failed because this element is";
    
          if (error.message.includes(disabledMessage)) {
            expect(error.message).to.include(disabledMessage);
            return false;
          }
    
          // Using Mocha's async done callback to finish this test so we prove that an uncaught exception was thrown
          throw error;
        });
    
        // Assumes this click fails
        cy.wrap(subject)
          .click({ timeout: 100 })
          .then(() => {
            throw new Error(
              "Expected element NOT to be clickable, but click() succeeded"
            );
          });
      }
    );
    This is used in my tests like so
    Copy code
    it.only("opens step settings drawer but doesn't allow changes", () => {
      cy.visit("/myRoute");
    
      Assertions above are all ran…
    
      cy.get("button").shouldNotBeActionable();
    
      …but assertions below aren't being ran
    e
    • 2
    • 2
  • Sorry, we could not load http://localhost:3000/
    f

    flat-night-46072

    03/15/2023, 1:55 PM
    Hello all! Strangely, my web application is available at the address indicated in the title. But when a browser (Firefox, Chrome, etc.) is launched via Cypress, my web application is no longer accessible. Even when opening a new tab, I can go on the internet, but my application at http://localhost:3000/ does not load. Have you ever encountered a similar problem? Thanks! 🌈
    m
    • 2
    • 5
  • No error on file upload but does not attach the file
    c

    curved-mechanic-66366

    03/15/2023, 2:27 PM
    current behavior Hello guys, I am trying to automate a file upload and I got no error on Cypress. It shows that it gets the file passed but doesn't attach into the site. Note: i´m using JS, Cypress Version 10.11.0 Here is my code:
    cy.get('[data-icon="cloud-upload-alt"]').attachFile('images/Group 7 (1).png');
    e
    • 2
    • 1
  • Meaning of colorful XHR dots?
    p

    prehistoric-restaurant-72560

    03/15/2023, 2:51 PM
    I am looking for some description of what specific color of XHR request mean - or why one is empty and other full.
  • API Testing Validations
    m

    millions-megabyte-24728

    03/15/2023, 3:15 PM
    I am trying to figure out what options I have for testing the value types for returned JSON variables that may not be required depending on the input. For instance, I have a returned "description" variable that is not a required field. The value returned can either be a string type or null value. When writing my expect statements, I tried using the .to.be.onOf(['string', null]), but that doesn't work correctly for this use case. Is there something out there that would allow me to check that it is one of those two?
  • How to get image value from list
    c

    cold-bird-96191

    03/15/2023, 8:15 PM
    it is necessary to check the presence of a demo company in the list of all companies. the demo company is marked with a special image and can be at the top of the list or at the bottom. the number of companies in the list may also change. it is necessary to check that the demo company is on the list
    g
    • 2
    • 6
  • Is there any way to verify that the text within a password input is hidden or not hidden?
    n

    nice-terabyte-28126

    03/16/2023, 2:05 AM
    When using
    cy.get('input').should('have.value', '***')
    it still returns the raw string, and as so far I've been unable to find a way to verify if the text in the input field is currently hidden or not
    g
    • 2
    • 3
  • Cypress never ends its last test it block :(
    i

    incalculable-rainbow-43330

    03/16/2023, 5:50 AM
    HI Team iam facing strange behavior. the cypress never ends its last test's it block and keeps on running like the image below, i have used session storage apart from this its normal program. do i need to do anything to stop it as all the specs are passing.
  • Click on link sent by email to sign up into system (MailSlurp)
    m

    magnificent-lamp-44201

    03/16/2023, 6:08 AM
    🧵 I'm registering users that needs to click on a link, sent by email, to access a system I test. I'm using MailSlurp (I'm following this tutorial: https://www.mailslurp.com/examples/cypress-js/) . Doing some modifications to the actual code, I have this:
    example.cy.js
    Copy code
    javascript
    describe('Sign up', () => {
    
      const password = "test-password";
      let inboxId;
      let emailAddress;
      let link;
    
      it('sample', () => {
        cy.visit('http://localhost:3000/');
        
        cy.get('h2').contains('Iniciar');
    
        cy.wait(5000);
    
        cy.get('a').contains('Don\'t').click(); cy.get('label[for="password"]').contains('Create a Password');
    
        cy.createInbox().then(inbox => {
          // verify a new inbox was created
          assert.isDefined(inbox)
    
          // save the inboxId for later checking the emails
          inboxId = inbox.id
          emailAddress = inbox.emailAddress;
    
          // sign up with inbox email address and the password
          cy.get('input[name="email"]').type(emailAddress);
          cy.get('input[name="password"]').type(password);
          cy.get('button[type="submit"]').contains('Sign up').click();
    
          cy.waitForLatestEmail(inboxId).then(email => {
            // verify we received an email
            assert.isDefined(email);
      
            console.log("print the body")
            console.log(email.body)
      
            // extract the link
            link = /<a\s+(?:[^>]*?\s+)?href=(["'])(.*?)\1/.exec(email.body)[2];
            console.log(link)
          });
        });
      });
    
      it('should works', () => {
        console.log('Print the URL: ' + link)
        cy.visit(link);
      });
    
    it('should works', () => {
        // it displays the link sent through email, but when I visit it throws an error
        // see image attached
        console.log('Print the URL: ' + link)
        cy.visit(link);
      });
    • 1
    • 2
  • How to enable intellisense in visual studio when we download cypress not from NPM?
    t

    tall-dress-31592

    03/16/2023, 6:08 AM
    How to enable intellisense in visual studio when we download cypress not from NPM?
  • Timed out retrying after 4000ms: Expected to find element: #contact, but never found it.
    a

    acceptable-angle-31500

    03/16/2023, 12:16 PM
    Hello guys I'm trying to do some code coverage but I don't understand many things : 1- My test e2e won't work anymore I have this error : Timed out retrying after 4000ms: Expected to find element: #contact, but never found it. it's weird because I haven't changed anything ( I have almost the same problem as this guys: https://stackoverflow.com/questions/68776936/cypress-timed-out-retrying-after-4000ms-expected-to-find-element-only-in-je ) 2- my code coverage looks weird I don't understand why the percentage are so low (see image). Here's my config files : (see image)
  • How enable browser cookies for Google sign in - Cypress version 12.5
    p

    plain-candle-1839

    03/16/2023, 12:54 PM
    We are currently using Cypress version 12.5 and now planning to implement some E2E tests for Social sign in flows via Google, there Once entered the email and click the next button, it says your browser was disabled for cookies, even changed the settings to allow cookies but still the issue is there
  • coverageReport fails when performing e2e tests
    n

    numerous-receptionist-75365

    03/16/2023, 2:03 PM
    Hi everyone. I'm developing component and e2e tests for a React application. Component tests run fine and the coverage is generated. When it comes to the e2e part, the tests pass, but
    cy.task('coverageReport')
    fails with the following error:
    The argument 'path' must be a string or Uint8Array without null bytes. Received '/Users/redacted/Documents/projects/redacted/backoffice-fe/cypress-coverage/lcov-report/backoffice-fe/\x00commonjsHelpers.js.html'
    I don't know what that file is and why the name starts with a null byte. This happens both on my machine and in CI. I cannot find anything on Google, I would be very thankful if anyone had a clue. Thanks
    • 1
    • 1
  • Unable to test typing into CKEditor 5 with Cypress 12.5
    w

    witty-wolf-77896

    03/16/2023, 3:22 PM
    Hello all! I've been trying to get cypress to type into a CKEditor v5 instance for a while now, I previously had this working in earlier versions of Cypress (maybe v9) but am unable to get it to work currently. It is able to run keyboard commands like select-all (Ctrl + A) and Delete, but typing text in the same element doesn't seem to do anything. Please see the failing test below.
    Copy code
    describe('CKEditor 5', () => {
        it('types text into a CKEditor 5 editor instance and tests to make sure the text equals whatever is typed in', () => {
          cy.visit('https://ckeditor.com/ckeditor-5/demo/feature-rich/')
          cy.get('div[data-demo-type="feature-rich"] div[contenteditable]').type('{ctrl+a}{del}')
          cy.get('div[data-demo-type="feature-rich"] div[contenteditable]').type('Hello CKEditor')
          cy.get('div[data-demo-type="feature-rich"] div[contenteditable]').invoke('text').should('eq', 'Hello CKEditor')
        })
      })
  • Chrome browser invoked running kitchensink app not working.
    f

    freezing-midnight-9121

    03/16/2023, 4:06 PM
    Went through steps (repo, node install, angular, etc.) and running: ng verision shows: Angular CLI: 15.2.4 Node: 18.15.0 Package Manager: npm 9.5.0 OS: darwin x64 Angular: 15.2.2 ... common, core, platform-browser-dynamic Package Version --------------------------------------------------------- @angular-devkit/architect 0.1502.3 @angular-devkit/build-angular 15.2.3 @angular-devkit/core 15.2.3 @angular-devkit/schematics 15.2.4 @angular/cli 15.2.4 @schematics/angular 15.2.4 1. Open terminal, navigate to project and ran: npm start 2. Open another terminal and ran: npm run cy:open 3. Select E2E testing and select Chrome 4. Click "Start E2E testing in Chrome 5. Browser opens w/About:blank, Chrome is being controlled by automated test 'software' 6. Terminal from step2 shows: "Still waiting to connect to Chrome, retrying in 1 second (attempt 18/62)" nothing is happening in the window invoked 7. Manually Opening a browser window with: http://localhost:8080/ brings up kitchen sink and I can see activity in my window from step 1. Any help would be appreciated....
    m
    • 2
    • 1
  • E2E testing in Chrome stuck
    s

    square-zoo-92250

    03/16/2023, 6:05 PM
    Hi all, I have an issue that on setup of Cypress project from scratch when selecting a browser Cypress gets stuck. On a terminal there aren't any output that might provide any clue what is the issue. NodeJS version is 16.8.1 and Cypress is 12.8.1, Google Chrome on machine is 111, all is running on MacOs with Intel CPU. If Electron selected everything is just fine. Any assistance would be highly appreciated.
    a
    • 2
    • 1
  • Cypress tutorial: "This element is not visible"
    s

    strong-twilight-85943

    03/16/2023, 7:37 PM
    Hello, I cannot view step by step the state of my website. I am following the tutorial, and as you can see on the screenshot there is a slashes eye icon on all of my steps. If I click on them, the canvas will be blank. The test is still finding the elements. It will show correctly only 1 time, when I close and start again the browser for the test. The problem happens with every browser
    m
    g
    r
    • 4
    • 3
  • How can I perform a drawing test in Cypress?
    f

    fresh-van-160

    03/17/2023, 4:32 AM
    My goal is to perform a test on a system where the user can make drawings, and I am using the website https://www.autodraw.com/ for studying purposes. Although Cypress does not detect errors, I am not able to see the drawing on the website. Is it possible to simulate a drawing? Can I simule a click and drag to create a line? describe('Should simulate a drawing', () => { it('Should simulate a drawing', () => { cy.visit('https://www.autodraw.com/') cy.get('.green').click() // press the mouse button cy.get('#main-canvas') .trigger('mousedown', { button: 0, force: true }) // Move the mouse while holding down the left mouse button cy.get('#main-canvas') .trigger('mousemove', { clientX: 100, clientY: 100, force: true }) .trigger('mousemove', { clientX: 200, clientY: 200, force: true }) // Release the left mouse button cy.get('#main-canvas') .trigger('mouseup', { button: 0, force: true }) // Verify if the drawing was made correctly cy.get('#main-canvas') .should('have.css', 'background-color', 'rgba(0, 0, 0, 0)') }) })
    m
    • 2
    • 1
  • Cypress.SelectorPlayground crashes on cy.request()
    c

    clever-night-39043

    03/17/2023, 5:29 AM
    Hi I am sending an API request by
    cy.request()
    with the following syntax:
    Copy code
    cy.request(
        {
          method: method,
          url: format(endpoint, option),
          failOnStatusCode: false,
          headers: headers,
          body: normalisedRequest
        })
    It works when the
    body
    is an object or string, but when the body is a number, the test fails and selector playground crashes. The error is
    Copy code
    The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received type number (1)
    TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received type number (1)
        at new NodeError (node:internal/errors:372:5)
        at write_ (node:_http_outgoing:742:11)
        at ClientRequest.write (node:_http_outgoing:707:15)
        at ee.write (<embedded>:1955:83025)
    Please help. I need to use only a number as request body. Thanks
  • OOM crashes?
    b

    brave-doctor-62978

    03/17/2023, 12:57 PM
    has anyone else been getting a lot of OOM deaths when running it in cypress open?
    Copy code
    <--- JS stacktrace --->
    
    FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
     1: 0x100c5df7c node::Abort() [/opt/homebrew/Cellar/node/19.8.1/bin/node]
     2: 0x100c5f448 node::ModifyCodeGenerationFromStrings(v8::Local<v8::Cont
  • Gitlab cypress/run
    b

    busy-ambulance-42459

    03/17/2023, 2:34 PM
    Does anyone know what this new pipeline is that Cypress has added to Gitlab? It started appearing once I setup the Gitlab integration in Cypress and links out to Cypress Cloud. It seems to be rerunning one of the tests we had in our earlier pipeline, but I'm not exactly sure what it's up to, why it's there, or how to configure it.
    • 1
    • 1
  • How to get all cypress steps to log files with cypress run?
    a

    adamant-toddler-18579

    03/17/2023, 2:54 PM
    I was wondering about how to write all steps (like in cypress app left side) to log file. I'd like to write a separate file for every test file.
    a
    e
    • 3
    • 2
  • Underscore template in <script> tag missing during Cypress test
    r

    ripe-continent-46695

    03/17/2023, 4:01 PM
    Copy code
    it('Missing Script Issue', () => {
      cy.visit('https://www.oldelpaso.com/products/shells-tortillas');
      cy.get('.result-template').should('exist').and('not.be.empty');
    });
    If you inspect the source of this page outside of Cypress, you will see that it always contains this underscore template content within the script tags. https://www.oldelpaso.com/products/shells-tortillas Cypress 12.7.0 (upgraded from Cypress 10.11.0 to try and fix this issue) This happens on all browsers To make things more confusing, this same exact underscore template does exist in the DOM for other pages when run with Cypress: https://www.oldelpaso.com/products/taco-shells-stand-n-stuff-15-count I'm not sure if there is something we can do to fix this issue, or if this is possibly a bug in Cypress. Thanks for any and all help!
    • 1
    • 1
  • Random crashes with cypress:run and not in cypress:open
    b

    blue-belgium-36090

    03/17/2023, 4:54 PM
    Hello everyone ! Here is what we have in the log window, when cypress crash. FIY it's not always failing on the same spec file. We searched for a few days before asking here. If you have any ideas, it would be greatly appreciatted. Cypress version: 12.8.1 Tested in Chrome 111 Node version: 16.19.1 Mac Os 11.4
    a
    b
    • 3
    • 2
  • How to call a const as a response in a cy.intercept?
    b

    busy-agency-3812

    03/18/2023, 12:02 AM
    I have a cy.intercept that was previously calling a static fixture from my fixture files. I now have to make this fixture dynamic so I created a const. To make this simple, say I did something like this;
    Copy code
    const getDivisionBody = () => {
        return {
          data: {
            division: {
              utilitiesConfig: {
                electric: false,
              },
              __typename: 'Division',
            },
          },
        };
      };
    My fixture had electric set to false but I want to be able to create a function which can toggle the value to false or true. First, I wanted to make sure the intercept could take this variable before I modify it. so I did this:
    Copy code
    cy.intercept('POST', '/graphql', (req) => {
        if (req.body.operationName === 'getDivision') {
          req.reply(`${getDivisionBody}`);
        }
      });
    Now my cypress is able to see the variable but it returns this, including the function part
    Copy code
    function () {
            return {
                data: {
                    division: {
                        utilitiesConfig: {
                            electric: false,
                        },
                        __typename: 'Division',
                    },
                },
            };
        }
    And if I do
    Copy code
    cy.intercept('POST', '/graphql', (req) => {
        if (req.body.operationName === 'getDivision') {
          req.reply(getDivisionBody);
        }
      });`
    g
    • 2
    • 1
  • Can not read Json file in github Actions
    g

    gorgeous-forest-77630

    03/18/2023, 10:45 PM
    I'm trying to run the same script from local on the github Actions, however when the job is running it can not find the json file.
    Copy code
    /// <reference types="cypress" />
    import {homePageGeant} from '../../../support/Pages/SuperMarkets'
    const datatest = '../fixtures/datatest.json'
    describe('Get the page information',()=>{
    
        it('Store the page information', ()=>{
            homePageGeant.visitHomepage();
            homePageGeant.typeSearchInput('Cafe');
            homePageGeant.clickSeeAllProducts();
            homePageGeant.storeEachPMarca();
            homePageGeant.storeEachH2();
            homePageGeant.storeEachPPrice();
            homePageGeant.pushIntoCoffeeListArray();
            homePageGeant.writefile();
         })
         it('check json', ()=>{
            cy.readFile(datatest).then((str)=>{
                cy.wrap(str).pause()
                cy.wrap(str[0]).pause()
                cy.wrap(str[0][1]).pause()
                cy.wrap(str[1]).pause()
    
                cy.wrap(str[0].ProductBrand).pause()
            })
         })
    })
    Result from the pipeline:
    Copy code
    1) check json
    
    
      1 passing (31s)
      1 failing
    
      1) Get the page information
           check json:
         AssertionError: Timed out retrying after 4000ms: `cy.readFile("../fixtures/datatest.json")` failed because the file does not exist at the following path:
    
    `/home/runner/work/Scapping/fixtures/datatest.json`
    Any ideas?
    g
    • 2
    • 1
1...151617...26Latest