https://cypress.io logo
Join Discord
Powered by
# i-need-help
  • Cypress Electron hangs/crashes
    l

    limited-fish-66138

    04/19/2023, 10:49 AM
    Hi I have E2E test which does repeated actions for 4 times Due to company proxy reason I have only electron browser to test. Test runs fine in headless mode , but in headed/open with electron browser , test crashes always. Sometimes it crashes in after hook , sometimes in mid of test. Can’t find any useful logs in DEBUG , if there any specific logs to look for Electron Any suggestions really appreciated Thanks Gayathri
    m
    • 2
    • 7
  • Cypress on Azure Pipelines (False Complete)
    a

    able-twilight-99822

    04/19/2023, 3:04 PM
    Running Cypress on Azure Pipelines, The execution will complete without running any test scenarios. Ive inspected the logs & i am unable to determine where the issues. Any advice is appreciated.

    https://cdn.discordapp.com/attachments/1098262854391562271/1098262855092023406/Screenshot_2023-04-19_at_15.55.13.png▾

    m
    • 2
    • 8
  • Custom query calling an async node function via cy.task()?
    m

    modern-air-62164

    04/19/2023, 3:34 PM
    We have some custom commands that can be flaky thanks to race conditions. The commands are used to retrieve items from a Firebase emulator backend. I'd like to rewrite these commands as custom queries in order to benefit from the native retry-ability of the latter. The commands currently use cy.task() to run custom retrieval tasks in Node. Here's an example a custom command:
    Copy code
    javascript
    Cypress.Commands.add("getFirebaseUserByEmail", (email) => {  
        return cy.task("getFirebaseUserByEmail", { email })
    })
    getFirebaseUserByEmail:
    Copy code
    javascript
    export async function getFirebaseUserByEmail({ email }: { email: string }): Promise<UserRecord | null> {  
      try {    
        const user = await getAuth().getUserByEmail(email.toLocaleLowerCase())    
        return user
      } catch (error) {    
        if (error.code === 'auth/user-not-found') {      
          return null    
      }    
    throw error 
    }}
    That works as a custom command. But, if the user hasn't been created in the backend yet, the command will immediately fail thus failing the e2e test. I'd like to change this to a custom query so that Cypress will retry the user retrieval until the timeout threshold is reached. Here's my attempt at that:
    Copy code
    javascript
    Cypress.Commands.addQuery('getFirebaseUserByEmail', function getFirebaseUserByEmail(email) {
      return () => {      
        cy.task('getFirebaseUserByEmail', { email }).then(user => {
          return user      
        })    
      }  
    })
    That command fails with an error:
    Timed out retrying after 4000ms: Cypress detected that you returned a promise from a command while also invoking one or more cy commands in that promise.
    Is it just not possible to do anything asynchronously within a custom query?
  • `cy.get(…).invoke("attr", "target", "_self")` fails
    h

    hundreds-helicopter-24420

    04/19/2023, 3:54 PM
    I’m trying to follow a link that has
    target="_blank"
    and this is supposed to change the target attribute before visiting it. But the action seems to hang and fail on
    invoke .attr()
    with the following message: > Cannot set property message of [object DOMException] which has only a getter Now the selector in
    cy.get
    is very simple and works on its own, so I don’t get what’s happening. The whole command looks like that:
    Copy code
    cy.get("[data-cy=voir-fiche-spectacle]")
             .invoke("attr", "target", "_self")
             .click()
  • How to use grap on cypress 12.7
    b

    bulky-sundown-7164

    04/19/2023, 4:03 PM
    Hi guys, i'm trying to use grap to execute my test cases using the tag, but when I run the command it runs all my tests. its like the grap function isn't filter anything. I put the configurations commands on the right place like the documentation says. I don't know what i have to do to make it work. had someone worked with grep on cypress 12.7 and can help me on it?
    g
    • 2
    • 2
  • Issues trying to run Cypress in Docker during CICD Stage (Could not find a Cypress config file)
    s

    strong-london-87756

    04/19/2023, 9:55 PM
    Hey All, Not been using Cypress long so any help would be greatly appreciated! So I'm trying to run Cypress tests using a docker image I've built as I want to be able to run multiple cypress jobs using the same gitlab runner (was getting "Cannot establish any listening sockets - Make sure an X server isn't already running" if I tried to run cypress just as a stage without using docker) I seem to be able to get the docker run command working from my host machine, however, as soon as I try this in my Gitlab Pipeline I am getting errors (see screenshot) I've tried to place the file in different directories but this doesn't make a difference. When I do a pwd before I run the docker run command I can clearly see the config.json and test.js files in my gitlab runners build directory. Any ideas? https://github.com/Preddeh/cypress-test/tree/main

    https://cdn.discordapp.com/attachments/1098366339074248754/1098366339208462366/Screenshot_from_2023-04-19_22-48-42.png▾

  • GitHub Actions Failing
    b

    better-carpenter-28878

    04/19/2023, 10:16 PM
    I followed the docs at ( https://docs.cypress.io/guides/continuous-integration/github-actions ) and got this response.
    Copy code
    start server command "npm start"
    current working directory "/home/runner/work/Collaboration/Collaboration"
    /usr/local/bin/npm start
    npm ERR! Missing script: "start"
    This is the repo link that is failing. https://github.com/BOT-TC/Collaboration/actions/runs/4748229651/jobs/8434175506#step:3:61
    m
    • 2
    • 10
  • Cypress doesn't display letters from different countries
    b

    broad-window-45549

    04/20/2023, 7:42 AM
    Hi! Is it possible in Cypress to type and display letters from different countries ? I'm trying to type words inside the input field containing letters as ľ š č ť ž ý á í é ú ä ô ň ŕ ď ó ĺ. After the field is no more focused, those letters are not displayed. NOTE: when typing them manually, the letters are displayed.
    w
    • 2
    • 2
  • Extremely slow with Node 20
    b

    bulky-kilobyte-52158

    04/20/2023, 8:14 AM
    I have no issue with Node v19.9.0 or below, but Cypress becomes extremely slow with Node v20.0.0, either on terminal or visual mode. I had a Github action run for 5 hours yesterday (typical time is less than 2 minutes). Should Node 20 be supported?
    m
    • 2
    • 8
  • Running cypress without electron
    a

    aloof-australia-92236

    04/20/2023, 11:41 AM
    I have a headless machine to which I cannot map or pass through X server socket, which leaves me with very little graphical capabilities. Is it possible to open cypress on an external machine while running the headless counterpart on the headless machine?
    • 1
    • 1
  • I am getting an error when I use cy.visit() as Error: A connection to the upstream proxy could not
    c

    chilly-agent-91912

    04/20/2023, 12:08 PM
    can any one help here?
    b
    n
    • 3
    • 2
  • Why request from previous describe block is canceled by next describe block
    n

    nice-hamburger-65093

    04/20/2023, 1:33 PM
    Request from describe block 1 executes, when second block starts and sends same request, which cancels same request from describe block 1, how I can send multiple requests?
    e
    • 2
    • 25
  • setupNodeEvents won’t update variables nested in config.env
    f

    flat-painter-96557

    04/20/2023, 3:26 PM
    I’m attempting to set a variable in the setupNodeEvents function of my cypress.config.ts. I can successfully modify the config if I set the variables on the parent object, but if I try to update a nested variable (config.env.varname) no change is made. I’m making sure to return the modified config.
    • 1
    • 1
  • My cy.task() command is returning null when it should be returning a string.
    c

    curved-magician-42592

    04/20/2023, 6:59 PM
    Copy code
    cy.task('renameFile', file).then((result) => {
      const renamed_file = result;
    cy.wrap(renamed_file).as('updated_file');
    cy.log('@updated_file');
    cy.log('renamed_file);
    }
    my cy.task() function, renameFile, simply takes a file path and name and renames it for me and then returns me the new file name as a String. In my test, i'm trying to retrieve that renamed file and THEN assign it to a variable I made in the test called 'renamed_file'. I tried to log updated_file and renamed_file to see if either one is going to be the new string but they both return Null! How can I fix my cy.task() to get it to return the text value instead of a null object? I know i'm missing something but I just can't put my finger on it.. Thanks
    e
    c
    • 3
    • 4
  • When intercepting & modifying response, does the backend still receive the request?
    f

    fast-artist-45202

    04/20/2023, 9:38 PM
    If I was to do something along the lines of
    Copy code
    cy.intercept(
              "GET",
              "https://mywebsite.com/api/checkout",
              {
                statusCode: 500,
              }
            ).as("checkout500");
    I was under the impression that we're just intercepting the traffic, modifying it, and sending it on it's way. Is that traffic still hitting the backend, or are we stopping the request entirely and faking the response altogether? Thanks folks! 🙏
    w
    • 2
    • 2
  • Trying to extract cypress video from docker container running in Gitlab Pipeline
    s

    strong-london-87756

    04/20/2023, 9:49 PM
    Hi all! Been hitting a bit of a wall when trying to extract video output from my cypress docker container as a job artifact. I know it can be a bit fiddly running a docker container within a runner job, but I'm left scratching my head. Has anyone got any ideas how I can bypass this error and get the video files from the running container saved as an artifact? Here's a link to the files I'm using: https://github.com/Preddeh/cypress-test/tree/main Thanks!

    https://cdn.discordapp.com/attachments/1098727256832081930/1098727257066975372/Screenshot_from_2023-04-20_22-31-58.png▾

    e
    • 2
    • 2
  • only #electron is working
    r

    red-flag-46123

    04/21/2023, 8:38 AM
    Hello, anyone know why the browsers are not loading up ? #electron

    https://cdn.discordapp.com/attachments/1098890462347153429/1098890462921769000/IMG_3407.jpg▾

    m
    w
    • 3
    • 10
  • Cypress crashing on a POST request
    w

    wide-eye-45012

    04/21/2023, 9:45 AM
    I am running an E2E test, when I submit a form, a POST request is triggered by SUT. This request is taking more than 10 mins and then either crashed the Cypress runner or shows the result. When tested manually, the request returns the response within few seconds. This is the error that I am getting: We detected that the Chromium Renderer process just crashed. This is the equivalent to seeing the 'sad face' when Chrome dies. This can happen for a number of different reasons: - You wrote an endless loop and you must fix your own code - You are running Docker (there is an easy fix for this: see link below) - You are running lots of tests on a memory intense application. - Try enabling experimentalMemoryManagement in your config file. - Try lowering numTestsKeptInMemory in your config file. - You are running in a memory starved VM environment. - Try enabling experimentalMemoryManagement in your config file. - Try lowering numTestsKeptInMemory in your config file. - There are problems with your GPU / GPU drivers - There are browser bugs in Chromium You can learn more including how to fix Docker here: https://on.cypress.io/renderer-process-crashed I am using Cypress 12.10.0 and I have tried clearing the cache. Any help will be greatly appreciated
    w
    f
    • 3
    • 2
  • credit card iframe of different origin than document
    s

    some-zoo-23167

    04/21/2023, 1:40 PM
    Trying to enter CC details under iframe , but the document is not visible. Do you guys have a way to workaround this issue? See attached DOM. and here is the code i'm using to get the cardnumber placeholder. cy.get(‘iframeMonerisCheckout-Frame’) .should("be.visible") .its("0.contentDocument.body") .then(cy.wrap) .find("[name='cardnumber']") .should("be.visible") .type(cardNumber); So 0.contentDocument.body is not available. see attached.

    https://cdn.discordapp.com/attachments/1098966382131040296/1098966383359951019/1AF124C5-3EE1-439F-8D25-615B3EE307C5.jpg▾

    https://cdn.discordapp.com/attachments/1098966382131040296/1098966384484044810/BC6E1D0D-83DB-4C07-9C36-E8BEDB179D85.jpg▾

  • Mocha report with Cypress Parallel running
    l

    limited-fish-66138

    04/21/2023, 4:50 PM
    My repo has 1000 tests , so we use parallization and tagging in Jenkins with 4 tags I use cypress-multi-reporters and cypress-mochawesome-reporter. At the end of Jenkins build, 4 reports are generated ( html and mocha.json ) and saved in nexus. Is it possible to extract stats from mocha.json (from all 4 reports) and send only 1 email . Only stats of each tag is enough in email Thanks Gayathri
    e
    • 2
    • 1
  • How to use Cypress.intercept() for 2 requests to same endpoint
    w

    wide-eye-45012

    04/22/2023, 11:45 AM
    In my project, there are 2 calls made to the same end point on the page load with different data in body. How can I intercept both the calls separately? First call is made to check the 'Draft' status and another is made to check the 'Submitted" status
    g
    c
    f
    • 4
    • 6
  • Element is being covered by another element only when I have the test running minimized
    m

    melodic-quill-67962

    04/22/2023, 3:15 PM
    Hey The element covering is a cookies pop up that disappears when Im not alt tabbed but when im alt tab it doesnt go away and cant really go forward. The problem is that it also happens on cypress cloud Also when I use cy.intercept(x).as(y) and cy.wait(@y) most times only works if im looking at the test not when im minimized.
  • Hi All,
    b

    brainy-translator-85865

    04/23/2023, 5:14 AM
    im new at cypress i colne 'cypress-newworld-app' and try to run it , when i hit 'yarn dev' this error happen 'C:\workspaces\cypress-realworld-app\node_modules\ts-node\src\index.ts:820 [start:api:watch] return new TSError(diagnosticText, diagnosticCodes);' (i attach screen shot). i use nvm version 1.1.11 and node 16.16.0 but i face same error.

    https://cdn.discordapp.com/attachments/1099564026951893113/1099564027195183185/image.png▾

    m
    • 2
    • 12
  • Component testing without any framework
    h

    handsome-wolf-98416

    04/24/2023, 6:30 AM
    Hi everyone. I'm trying to set up some component testing for our website, which does not use any framework. We use a few libraries, such as jQuery and Handlebars, but no frameworks like React or Vue. To do component testing, the Cypress app asks for a framework, however, and I don't see any option to select "none" or to skip this step. How can I proceed? Do I need to select one of the frameworks and then ignore it? Thanks!
    e
    • 2
    • 5
  • Cypress fails to verify that server is running
    v

    victorious-salesclerk-78076

    04/24/2023, 7:12 AM
    Hi everyone! I am trying to setup Cypress in our GitLab CI pipeline. Changes of a merge request should get deployed to a QA server and then Cypress tests should run against it. The
    BASE_URL
    is set correctly to the servers address. For the CI job I am using the
    cypress/included
    (
    cypress/browsers
    also works) image. I install npm dependencies and run cypress with
    cypress run --e2e
    via npm script. However Cypress fails to verify that the server is running. I can confirm that the QA server is running and accessible all the time. I attached a screenshot with the relevant GitLab CI job output (sensitive info blurred). The input also shows that that pinging the server before running Cypress is successful. The QA server is only accessible via VPN. Since the container can also ping the server it also should be able to access it. Running the command locally (with VPN enabled) works like a charm. How can I get Cypress to verify that the server is available?

    https://cdn.discordapp.com/attachments/1099955930977808444/1099955931128791091/CleanShot_2023-04-24_at_08.46.072x.png▾

    m
    • 2
    • 5
  • Login on Auth0
    i

    important-yacht-33847

    04/24/2023, 7:48 AM
    Hi, i try to login to a external website Recruitee, I have look the documentation and i use
    cy.origin
    Copy code
    cy.visit('https://google.com')
        cy.origin(
          'auth.recruitee.com',
          { args: { username, password } },
          ({ username, password }) => {
            cy.visit('/')
            cy.get('input[id="admin_email"]').focus().type(username)
            cy.get('input[id="admin_password"]').focus().type(password, { log: false })
            cy.get('button[type=submit]').focus().click()
          }
        )
        cy.url().should('equal', 'https://app.recruitee.com/')
    But instead to be redirected to
    https://app.recruitee.com/
    , i am on
    https://auth.recruitee.com/sign-in
    . And the url is equal to nothing instead of one of the two above.

    https://cdn.discordapp.com/attachments/1099965142025900154/1099965142755725342/Screenshot_2023-04-24_at_09.45.42.png▾

  • cy.screenshot fails at scrollOverrides (cypress-runner)
    m

    millions-spring-40239

    04/24/2023, 9:44 AM
    Hi 🙂 I'm trying to do a screenshot with vue and cypress. My app runs fine but something breaks cypress tests Vue 2 last cypress version (12.80) vue cli 5.0.8 my test only has cy.visit and a cy.screenshot()
    "test:e2e:ui": "start-server-and-test serve 8080 'cypress open --port 8888 --e2e --browser electron'",
    stack trace in image

    https://cdn.discordapp.com/attachments/1099994163971375124/1099994164181086228/MicrosoftTeams-image_2.png▾

    • 1
    • 1
  • Missing dependency `Xvfb`
    r

    rich-pharmacist-74804

    04/24/2023, 10:02 AM
    I ran my action workflow(Cypress test) on GitHub and used
    self-hosted
    as a runner. While
    npx cypress verify
    I get the error as missing dependency
    xvfb
    . Xvfb is just for display right? As I am running headless mode why should I install this dependency? Your help is highly appreciated.

    https://cdn.discordapp.com/attachments/1099998824249950258/1099998824430313552/Screenshot_from_2023-04-24_15-54-46.png▾

    m
    • 2
    • 7
  • tests coverage calculation
    l

    lively-balloon-98986

    04/24/2023, 11:21 AM
    hi , Does anyone can tell me how to show tests case coverage in cypress?
    e
    • 2
    • 1
  • How can i mail the test report after generating
    b

    bumpy-breakfast-50891

    04/24/2023, 12:38 PM
    I want to share the test report (Mockawesome) with my team members after the report is generated automatically through email. Can someone help me to do this.
1...181920...26Latest