https://cypress.io logo
Join Discord
Powered by
# i-need-help
  • Running automation tests in qa instance
    b

    blue-noon-19179

    03/19/2023, 2:19 PM
    We are planning to run all the automation tests in qa instance and the db which will be used by the instance will keep all the data after completion of the tests also . We are planning not to tear down the db after each test run . Once on a month, we will restore the original db and all the data created by the test scripts so far will be deleted that time (i.e once in a month). Till that time all the data created by the tests will remain in the db . For this reason we are planning to create test data dynamically (may be adding a standard string with time stamp). Please advise , is this a standard approach OR do you foresee any issue in this approach ?
    g
    • 2
    • 1
  • Cypress 12.8.1 lodash bundle typescript error
    c

    clever-night-39043

    03/20/2023, 3:17 AM
    Hi this is an issue similar to the issue I raised before for Cypress 12.5.0. Typescript is complaining about Cypress._. Also there seems to be error on tsconfig.json. Please have a look. Thanks
  • Cannot click an element to see a suggested selector
    f

    fresh-shampoo-23978

    03/20/2023, 7:04 AM
    Hi, My website use is built by Rails, only use html with slim format, doesn't have any web framework When I click an element to see a suggested selector by Cypress' tool, its border will be having wrong place (check image below) so I cannot click it to get suggested selector How can I fix it? Thank you
    g
    • 2
    • 6
  • Cypress can't open Chromium79 browser
    w

    white-waitress-37720

    03/20/2023, 7:53 AM
    I downloaded Chromium 79 browser and trying to run it through cypress. Cypress just opening a blank page, without cypress automation tooling above it. Looks like cypress can't inject itself to this browser. I have like the same issue as here https://github.com/cypress-io/cypress/issues/24422 - but it closed without answer
    w
    • 2
    • 6
  • Cypress - Webpack - Cucumber preprocessor
    b

    blue-battery-71202

    03/20/2023, 11:43 AM
    Hello, I'm trying to setup webpack for a potential workaround for resolving
    import { fromNodeProviderChain } from '@aws-sdk/credential-providers';
    error which was the following:
    Copy code
    ts
    'import' and 'export' may appear only with 'sourceType: module'
    I've tried turning
    esModuleInterop: false
    however, that would conclude in some of our dependencies can not resolve like this:
    Copy code
    ts
    import aws from 'aws-sdk'
    
    aws.config.update({'us-east-1'})
    When opening cypress it throws "aws can be undefined" Our setup consist of both cucumber test cases, and simple
    it(...)
    test cases as well. Anyone has any idea where could I start investigating potential fixes?
  • AWS Cognito login problem
    a

    aloof-minister-26761

    03/20/2023, 12:41 PM
    Hi community, I have a problem: When I'm trying to automate a test for login, the dashboard is not loading, and the test fails. When I do manually the same thing, everything works correctly. I noticed that the POST request gets canceled, and I think here is the problem, but I don't know why is this happening. Is anyone that can help on this issue?
  • Use setupNodeEvents: require('dd-trace/ci/cypress/plugin') instead of setupNodeEvents(on, config)
    s

    straight-chef-47891

    03/20/2023, 10:26 PM
    Hi gurus, So I am trying to embed Cypress tests into our Datadog instance using [this](https://www.datadoghq.com/blog/datadog-ci-visibility/). Currently, in my
    cypress.config.ts
    I have this code snippet:
    Copy code
    typescript
    const legacyConfig = require('./cypress/plugins/index');
    e2e: {
           setupNodeEvents(on, config) {
             return legacyConfig(on, config); // since we still use the old plugin file to override configs
           },
          ...
         }
    However, Datadog is asking to use something like this:
    Copy code
    typescript
    e2e: {
            setupNodeEvents: require('dd-trace/ci/cypress/plugin'),
            supportFile: 'cypress/plugins/index.ts',
          ...
         }
    When I use the one that Datadog suggests, I get this error: > Error: Webpack Compilation Error > ./node_modules/js-library-detector/library/libraries.js 1360:107 > Module parse failed: Unexpected token (1360:107) > You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders > | npm: 'nuxt', > | test: function(win) { > if (win.__NUXT__ || win.$nuxt || [...win.document.querySelectorAll('*')].some(el => el.__vue__?.nuxt)) { > | return { version: UNKNOWN_VERSION }; > | }
  • env data is not updating from terminal command line arguments
    w

    wooden-megabyte-23794

    03/21/2023, 8:16 AM
    I have noticed that the cypress env data on the cypress.config.js env data is not getting updated based on the command line arguments data , i am expecting the country, language & environment to be updated with the command line data however i still noticed that the values are still picking from cypress.config.js file The command I am passing from the terminal is: npx cypress run --spec cypress/integration/features/e2e.feature --headed -b chrome --env country='lebanon' --env lang='ar' --env environment='uat'
    g
    • 2
    • 1
  • all files are getting executed instead of just the feature matches tags
    w

    wooden-megabyte-23794

    03/21/2023, 8:28 AM
    I am using cucumber feature tags for the .feature files( few i am using within scenario level as well as file level tags), during the execution i am passing the tag details as a command line argument , While execution i could see all the files are getting executed instead of matched tags
  • Cypress open crashes - blank page
    r

    rough-flower-20110

    03/21/2023, 9:14 AM
    Hello, I'm trying to run cypress on my local machine. MacOS and the latest chrome (v111). npx cypress open works, I've seen Cypress welcome page. After that I click E2E Testing and choose Chrome. Button "Start testing in Chrome" opens browser and I see blank page. I tested many different versions of cypress and other browsers such as Firefox. Every time I get blank page... Could anyone help me in this case? I am not able to run tool.
    • 1
    • 3
  • Tests always work fine on local, but get timeout on GitHub CICD. Did anyone solve the situation?
    e

    early-rose-80739

    03/21/2023, 1:50 PM
    framework React 18 Nextjs 13 cypress 10.8.0 GitHub workflow---- e2e-test: runs-on: ubuntu-latest steps: - uses: actions/setup-node@v3 with: node-version: 16 - uses: actions/checkout@v3 - uses: cypress-io/github-action@v4 env: NEXT_PUBLIC_API_HOST: '***' NEXT_PUBLIC_GROWTHBOOK_API: $*** NODE_TLS_REJECT_UNAUTHORIZED: 0 with: browser: chrome start: yarn dev wait-on: 'https://localhost:3000' the error from: cy.visit('/products'); cy.get('img[class^="ProductCard_card-image"]').eq(0).parent().click(); cy.url({ timeout: 10000 }).should('contains',
    ${baseUrl}/products/
    ); It seems often occurred from cy.url() or cy.visit(). I guess and survey to the reasons: 1. react 18 useffect render twice, or next.js link 2. our test environment api response time is too unstable 3. GitHub ubuntu test environment I tried some workarounds: 1. use then chain -> failed 2. cy.wait(3000) -> success, but is not a good method 3. use intercept -> failed I found one solution is using node 18 and 127.0.0.1, but it will affect too much so I didnt do yet. could someone give me any advice?
    w
    w
    • 3
    • 5
  • Cypress continue to load or wait for events, UI freeze
    w

    wooden-helmet-43105

    03/21/2023, 3:45 PM
    Hi! I'm newbye in cypress. I'm starting to make simple test like visit pages and click buttons. My app is made ionic/vue3, when i cy.visit('/login') the page load but cypress is still waiting and the UI is freeze, i must close and re run. The same happend in various scenario, like click a button. Maybe Cypress are waiting something? Thanks
    e
    • 2
    • 5
  • May i to use cypress in my frontend? Like the user type the url and send for cy.visit ?
    s

    some-lifeguard-48779

    03/21/2023, 7:26 PM
    I intend to provide a tool for the user to test whether his website respects the Brazilian laws on LGPD and Accessibility. The user will type the url of his website in my frontend and I would like to call cypress, test his website and return the result on the screen. It's possible? Or is cypress just for backend.
    a
    • 2
    • 5
  • Svelte app redirecting to other page, but only in Cypress
    w

    worried-addition-53678

    03/21/2023, 8:39 PM
    I wonder if someone had simmilar adventures in testing Sveltes app in Cypress or is it just my poor code that causes the problems. The repo: https://github.com/pietranikm/svelteApp I try to create tests for Svelte app that I've wrote, but I got stuck on a page being redirected when I submit the form. In the app I use Svelte's trick to prevent redirection - adding on:submit|preventDefault and in a regular browser everything works fine. But when I run the tests in Cypress, after triggering some action on the page I'm being redirected to the page with response data from the api call. It happens often but not all the time on adding the todos tests, but always on removing todos. I have not found much in a topic of E2E testing for Svelte apps, but I have a suspicion that this migth be a common problem. Do you have any idea on how I could prevent the app to redirect, preferably inside the Cypress tests?
  • How to use a custom executor with Cypress orb v3.0 run job? [CircleCI]
    h

    happy-megabyte-98400

    03/22/2023, 3:16 AM
    I couldn't find any good examples and the only sample in the orb page is for commands where they define a custom job and use the run command. I'd like to know if it's possible to use custom executors in the run job like v2.2.0
  • How to mount a component with v-model ?
    b

    billowy-pharmacist-61146

    03/22/2023, 7:14 AM
    Hello, I'm trying to test a custom Vue component which is an enhanced
    input
    element. I can't find the way to mount it with
    v-model
    (or modelValue + @update). I've tried this unsuccessfully :
    Copy code
    cy.mount(MyField, {
          props: {
            modelValue: email,
            onUpdate: (val: string) => (email = val),
            'onUpdate:modelValue': (val: string) => (email = val),
            'onUpdate:model-value': (val: string) => (email = val),
          },
        })
    Thanks !
    • 1
    • 2
  • Conditionally run commands/assertions based on a property of an element?
    h

    hundreds-helicopter-24420

    03/22/2023, 8:48 AM
    I want a test to run and succeed in two versions (legacy/rewrite) of an app I’m working on. The problem is that some things are necessarily implemented differently. How can I run a different command/assertion depending on a property of some element? Here’s what it might look like (but doesn’t work so far):
    Copy code
    js
    let genreF = cy.get("[data-cy=genre-f]");
    
    if (genreF.its('tagName') === "DIV") {
       // New app
       genreF.parent().should('have.attr', 'aria-checked', 'true')
    } else {
       // Legacy app
       genreF.should('be.checked')
    }
    g
    • 2
    • 4
  • Unable to automate payment process
    b

    best-window-49967

    03/22/2023, 10:40 AM
    Hello all I need some help please, I am trying to automate the user journey which includes making the payment and receiving the confirmation on the page but after submitting the payment form it get stuck while receiving the conformation and page does not receive the confirmation,. I am sure there some small change I need to do to make it receive the payment confirmation, can I please get some advise what I need to do to, I have tried cy.wait() after making the payment.
    e
    g
    +2
    • 5
    • 14
  • My apps UI is moving up and off page with each click event
    n

    nice-airport-76935

    03/22/2023, 1:56 PM
    When use using cy.get with a .click my UI is scrolling up and the top starts to go off the page, and with each other click it goes up more and more. I've tried setting scrollBehavior: false in the config, giving each cy.get {scrollIntoView:'false'}, but none of those make a difference. My clicks show the right place on the screen but the UI is pushed up, the clicks are still clicking correct elements. This isn't effected my test but doesn't look nice on demos. I have search all over the place and couldn't find anyone having a similar issue. I attached a photo of the cypress application at the end of my test, you can see almost the entire screen is pushed up and off the page.
    • 1
    • 1
  • Cypress run reports falsely that the server is unavailable
    m

    most-table-70794

    03/22/2023, 3:00 PM
    Hello, I'm running a website on a deployment running in OpenShift behind a reverse proxy and when I try to use
    cypress run
    it incorrectly reports that my website is unavailable. When using
    cypress open
    it works fine and manage to run the spec just fine.
  • Using Cypress.add param on the reply of only part of a intercept and storing remainder of intercept
    b

    busy-agency-3812

    03/22/2023, 3:48 PM
    I created a command in Cypress.add which takes an array as a parameter and updates a cy.intercept response json body like so:
    Copy code
    Cypress.Commands.add('setExternalIds', (Array) => {
      cy.intercept(
        'GET',
        `**/${Cypress.env('API_BASE_URL')}/v2/divisions/*`,
        (req) => {
          req.reply({
            external_ids: Array,
            config: {
              entity_configurations: {
                entity: '82374982734',
              },
    I only included part of the json body because the entire json body is 500 lines long and at least 10 levels of nesting. When I include the json body and I send a param, the param displays correctly in the network tab when running the Cypress test. I just don't like having these very long response bodies in my support/commands file How can I move them outside this support file? I would love a base fixture that I can iterate and edit parts of. If I nest the cy.intercept within a cy.fixture call, it does not update the external id value using a spread operator for the rest of the fixture body. I have tried variations of the code below and I don't think it will work with this deeply nested of a structure.
    Copy code
    Cypress.Commands.add('setExternalIds', (Array) => {
      cy.fixture('../../fixtures/SetupFiles/divisions')
        .then((response) => {
        cy.intercept(
          'GET',
           `**/${Cypress.env('API_BASE_URL')}/v2/divisions/*`,
             (req) => {
               req.reply({
                 external_ids: Array,
                 ...response
    That said, how should I organize/store/call the remaining part of the reply? I could create multiple files within /support and keep the long response body, but have more organization around my different commands, but I'd like to know what other people are doing.
  • Handling .contains when text contains zero-width space
    p

    purple-ice-75399

    03/22/2023, 4:54 PM
    Hello! I thought I had this solved until it reared its ugly head again recently. Our platform uses zero-width spaces for some of our text. Very barebones example of the HTML: https://gist.github.com/jessica-jorgenson/780e53e3309fa03ee676592e3aa1228f Where I'm attempting to find the choice and grab its label
    Copy code
    js
    cy.get('[class*="spanWithText"]')
                .contains(option) // option could be 501-1000
                .closest('label')
    I attempted the examples here: https://glebbahmutov.com/cypress-examples/recipes/non-breaking-space.html#non-breaking-space, besides manually entering the zero-width code since not all choices will have zero-width spaces in our other cases, and would just like to enter what the human sees and without manipulating a large amount of HTML. Our developer used this: https://discord.com/channels/755913899261296641/961325024114008064/1086073596499214367 but the error message doesn't help when it goes wrong, so I was hoping to find something more Cypress-y to handle this, especially since I need to chain commands after finding the correct option. Does anyone know how I could go about this? Thanks!
  • Github Actions File Directory
    s

    salmon-holiday-61646

    03/22/2023, 7:35 PM
    Hello, Using latest Cypress 12 I'm using this as a template to get some Cypress tests running in pre-Merge: https://learn.cypress.io/tutorials/running-our-tests-with-github-actions But when I do ./cypress/e2e as seen in the screenshot Github actions looks for the tests at /home/runner/work/RootFolder/RootFolder/cypress/e2e What should my file path look like for the project directory?
    m
    • 2
    • 2
  • Use file object to upload in upload form
    p

    prehistoric-market-22707

    03/22/2023, 10:04 PM
    My customer upload file in form on my app and I need to get this file in server side and upload him with Cypress in another form of another web app. (not mine web app), how do I do this? In my server I get file object and I don't know how do I upload him with Cypress..
  • cy.go('back') shows the session results in non-Chromium browsers
    s

    straight-chef-47891

    03/23/2023, 4:00 AM
    Hi team, Using the latest version of Cypress, I am trying to use
    cy.go('forward')
    then
    cy.go('back')
    on my tests to check if it still shows the last state of the page. However, it seems no data is displayed in the table after doing the commands using Chrome and Edge. Works fine in Electron and Firefox. ![Before cy.go in Firefox](Before cy.go in Firefox.png) - shows 1 record ![After cy.go in Firefox](After cy.go in Firefox.png) - still shows 1 record === ![Before cy.go in Chrome](Before cy.go in Chrome.png) - shows 1 record ![After cy.go in Chrome](After cy.go in Chrome.png) - shows nothing I trie to disable as much as I can on my
    plugin/index.ts
    file with the following to no avail:
    Copy code
    typescript
            if (browser.name === 'chrome' || browser.name === 'edge') {
                launchOptions.args.push('--disable-features=SameSiteByDefaultCookies,CrossSiteDocumentBlockingIfIsolating,CrossSiteDocumentBlockingAlways,IsolateOrigins,site-per-process');
                return launchOptions;
            }
  • Component testing - check redirect via button
    f

    famous-eye-40764

    03/23/2023, 8:18 AM
    Hi, when using Component testing how can I test that by clicking on button that have href attr I will be redirected to that site? mount(
    <my-button href="https://www.google.com/">Link</my-button>
    );
  • Unable to submit a support ticket due to reCaptcha issue
    h

    hundreds-photographer-6057

    03/23/2023, 12:41 PM
    Hello, I'm trying to submit a support ticket, but it is not possible due to following error message : "Sorry, something went wrong Error details Could not perform reCAPTCHA, try disabling your ad-blocker and submit again" But I don't have any ad-blcoker or anything else, could please anyone help me with that ?
    e
    a
    • 3
    • 4
  • example for docker compose to run parallel tests
    l

    lively-balloon-98986

    03/23/2023, 2:26 PM
    someone have an example for docker compose to run parallel tests?
  • How do I setup configuration file in a folder?
    w

    wonderful-greece-63551

    03/23/2023, 5:08 PM
    Error: Cannot find module 'F:\SCHOOL' Require stack: - C:\Users\ΣΩΤΗΡΗΣ\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_require_async_child.js - C:\Users\ΣΩΤΗΡΗΣ\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\require_async_child.js at Module._resolveFilename (node:internal/modules/cjs/loader:1090:15) at Module._load (node:internal/modules/cjs/loader:934:27) at Module.require (node:internal/modules/cjs/loader:1157:19) at require (node:internal/modules/helpers:119:18) at loadFile (C:\Users\ΣΩΤΗΡΗΣ\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_require_async_child.js:89:14) at EventEmitter. (C:\Users\ΣΩΤΗΡΗΣ\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_require_async_child.js:116:38) at EventEmitter.emit (node:events:512:28) at process. (C:\Users\ΣΩΤΗΡΗΣ\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:33:22) at process.emit (node:events:512:28) at emit (node:internal/child_process:944:14) at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
  • How to read json data in feature files
    r

    red-diamond-5625

    03/23/2023, 5:53 PM
    Hi there I'm trying to read the user credentials from a json file in my feature file. JSON "Scenario: Success Sign In": { "email": "testuser@test.com", "password": "Test123" }, *Feature File * Background: Given A user is in the signin page Scenario: Success Sign in When A user enters the email "testuser@test.com", the password "Test123" and clicks on the signin button Then the user will signin successfully and the url will contain the home subdirectory Need help calling the email and password on the feature file
    e
    • 2
    • 1
1...161718...26Latest