https://cypress.io logo
Join Discord
Powered by
# i-need-help
  • Cypress- Cucumber - BDD get the scenario execution for test rail integration
    w

    wooden-megabyte-23794

    02/10/2023, 6:34 AM
    I am trying to integrate the cypress cucumber framework with test rail, i have successfully completed calling testrail api with valid data, however i would like to have the dynamic data being passed for each test scenario , in order to do how can extract the test case id(if i pass this within scenario name), scenario test either pass or fail and the comments if its failed . Running on cypress: 12.2.0
    b
    m
    +2
    • 5
    • 11
  • Cypress + Vite : how to prevent reloading (due to optimized dependencies) causing the test to fail ?
    b

    billowy-pharmacist-61146

    02/10/2023, 7:18 AM
    When I'm running Cypress component test, sometimes i'm facing this :
    Copy code
    17:34:59 [vite] ✨ new dependencies optimized: vuetify/components, vuetify/lib/components/VAppBar/index.mjs, vuetify/lib/components/VDivider/index.mjs, vuetify/lib/components/VToolbar/index.mjs, @vueuse/core
    17:34:59 [vite] ✨ optimized dependencies changed. reloading
    
      1) An uncaught error was detected outside of a test
    And the test fails... If I relaunch tests a second time, everything is okay. Anything I can do to prevent this ? Thanks !
    • 1
    • 2
  • Cypress + Jenkins: "The system cannot find the file specified"
    b

    billowy-smartphone-68952

    02/10/2023, 7:34 AM
    I'm trying to run a build in Jenkins where I set as parameter "Script" with the options being the scripts I have in my package.json file. In Build Steps I execute the shell command: npm run "$Script" Also using a custom workspace where I added the path of my Cypress project. The build always fails with the error "The system cannot find the file specified".
  • Need to access .env baseUrl, without dotenv dependancy
    c

    creamy-mouse-54087

    02/10/2023, 2:50 PM
    Hello, originally I had
    dotenv
    imported into my
    cypress.config.ts
    and that's OK, but upgraded and now
    dotenv
    is included in my nuxt dependancy, so I no longer need it for anywhere else in the project, and im reluctant to keep it just for cypress - so I thought OK, what if I put that in
    nuxt.config.js
    like so
    Copy code
    export default {
      env: {
              baseUrl: process.env.BASE_URL
            }
    }
    and then back in
    cypress.config.ts
    I have
    Copy code
    import nuxtConfig from './nuxt.config.js'
    const { baseUrl } = nuxtConfig.env
    
    export default defineConfig({
      e2e: {
        env: {
          baseUrl,
        },
    // rest of file
    but this doesn't work. I also tried
    Copy code
    export default defineConfig({
      e2e: {
        baseUrl,
    but again no joy. eventually anyway in my test file I have
    cy.visit('/')
    but basically that baseUrl always results in the failrue
    • 1
    • 3
  • Use npm lib
    e

    eager-alarm-14284

    02/10/2023, 3:42 PM
    Hey, Can someone help me how can i use npm package with cypress 10.10? Idk how can I import lib to the project and use it in commands.ts.
    g
    • 2
    • 1
  • Any luck using TypeORM to seed your system under test ?
    g

    great-kite-11257

    02/10/2023, 7:44 PM
    I've tried to use TypeORM to reset my website database in the beforeeach hook without any success. Here's the exact error:
    Copy code
    TypeError: The following error originated from your test code, not from Cypress.
    
      > Cannot read properties of undefined (reading 'type')
    
    When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
      Here's how I create my connection:
    Copy code
    import {DataSource} from "typeorm";
    
    export const AppDataSource = new DataSource({
      type: "postgres",
      host: "localhost",
      port: 5432,
      username: "postgres",
      password: "123",
      database: "test_typeorm",
      synchronize: true,
      logging: true,
    })
    b
    • 2
    • 1
  • Webpack Compilation Error: Module parse failed: Unexpected end of JSON input while parsing near ''
    d

    delightful-guitar-3252

    02/11/2023, 1:01 AM
    I was trying to read data from a JSON file to fill inputs on test but i got this error on the line i put the JSON path on a variable to make a loop for each user. bellow you can see the code, the json and the error (the error its also in a .txt):
  • Cypress says my JSON is invalid but it is valid #help
    s

    some-cartoon-73108

    02/13/2023, 6:58 AM
    Did you try with other json files?
    d
    d
    n
    • 4
    • 8
  • Third party login iframe gets stuck on submit
    f

    few-cpu-19533

    02/12/2023, 3:47 PM
    Hi, i am trying to login into my application via a third-party-login form in an iframe. I can access the input fields, type in user and password etc., but shortly after i clicked on the submit button cypress seems to get stuck: nothing is logged into the bash anymore, any errormessages either. in open mode the spec window closes itself. Below you can see the code. I use the first ``cy.wait()`` to wait for the iframe to be loaded which i know is a bit ugly and wich i will replace later. Cypress seems to crash while the second ``cy.wait()`` after the form has been submitted.
    Copy code
    const selectors = require('../selectors');
    
    describe('This is a first test', () => {
    
    
        const getIframeBody= () => {
            return cy
                .get(selectors.loginIFrame)
                .its('0.contentDocument.body').should('not.be.empty')
                .then(cy.wrap)
        };
    
        it('should login user', () => {
    
    
            cy.clearCookies();
            cy.visit('/');
            cy.get('#onetrust-accept-btn-handler').click();
    
    
    
            cy.wait(5000);
            getIframeBody().find(selectors.loginInputUser).type(Cypress.env('usernameForm'));
            //
            getIframeBody().find(selectors.loginInputPassword).type(Cypress.env('passwordForm'));
            getIframeBody().find(selectors.loginInputSubmit).click();
    
            cy.wait(5000);
    
        });
    });
    I already read serveral github discussions and stackoverflow articles, handling similar topics, but unfortunately i did not find a solution yet.
  • Cypress.env.json
    l

    lemon-toothbrush-55306

    02/12/2023, 10:02 PM
    Hello good night, I have my
    Cypress.env.json
    with my env vars, is there any way to make a new file called for example:
    Cypress.env.local.json
    and then I can keep
    Cypress.env.json
    empty and only add the values in my
    Cypress.env.local.json
    ? Since It's a bit annoying do add the values when I'm in LocalHost and Remove when I'm pushing to environment. Thanks you.
    e
    • 2
    • 1
  • Rewrite to include javascript variables in cypress commands
    k

    kind-van-46599

    02/13/2023, 2:53 AM
    Greetings All, how do I retain and pass the value of the variables(index and dataTestId) to cypress commands?
    Copy code
    let indexInd = true;
        let index: number;
        indexInd ? (index = 0) : (index = 1);
    
        let dataTestIdInd = 'lyactuals'
        let dataTestId: string;
        /* Indicator to choose the Deals table according to the validation*/
        dataTestIdInd?.includes('lyactuals')
          ? (dataTestId = 'LastYearActualsTable')
          : dataTestIdInd?.includes('proposed')
          ? (dataTestId = 'ReadonlyProposedTable')
          : (dataTestId = 'SlottingBoardTable');
    
        cy.findByTestId(dataTestId)
          .scrollIntoView()
          .find('tfoot tr')
          .eq(index)
          .find('td'). then(() => {})
  • How to enable skipped tests option in cypress mochawesome report
    b

    brainy-queen-50380

    02/13/2023, 7:58 AM
    By default the html report which mochawesome generates doesn't show skipped test. How can we enable that
  • Generating JavaScript/TypeScript API client from Swagger
    m

    millions-flower-39293

    02/13/2023, 8:15 AM
    Hi everyone, does anyone here already tried to generate a JS/TS API client from Swagger (not sure if this is what they called codegen) ? I have a spec from swagger in a .json format and our team wants to create a class for it sort of like SDK to perform our HTTP request, I'm thinking if this is possible and also I'm considering some future problems like we won't be able to use the
    cy.request()
    if ever we implement it this way. One reason why we are planning to do this is to avoid writing the API request headers/body manually. Hope someone already tried this. Thanks!
  • Include coverage from micro frontend bundle
    w

    witty-van-98092

    02/13/2023, 8:31 AM
    Hello, I would like to see the code covered in on of my micro frontend but it seems that the window.__coverage__ is undefined because the micro frontend is not yet loaded (the app is loaded). The code of the micro-frontend is correctly instrumented but after debugging, I see that the support.js of cypress-coverage is execute too soon, how can I delay it ?
    • 1
    • 1
  • Skip test conditionally
    n

    nutritious-honey-65632

    02/13/2023, 9:20 AM
    I have following problem:
    Copy code
    someArray.forEach(item => {
     it('test', () => {
      if (item === 'foo') {
        cy.request('foobar').then(() => {
          if (bar) {
            // skip the rest of the test
          } 
        })
      }
     }
    }
    • 1
    • 1
  • Cypress for electron.js based desktop app automation
    r

    red-honey-44438

    02/13/2023, 10:50 AM
    I wanted to understand can we run cypress tests on electron application ?
    e
    • 2
    • 1
  • cypress-grep
    b

    broad-window-45549

    02/13/2023, 10:54 AM
    Hi everyone! Is anybody who knows if there is any way to filter the tests by tags and run them without running all the specs? Let's suppose this scenario: "We have 300 test suites, and only 2 of them have the "@test" tag. So each time I wanna run the test suites with the "@test" tag I need to wait about 20-30 minutes until it goes through all the specs and find the tests or test suites which have the "@test" tag. I am expecting to have a result in 2-3 minutes."
    r
    g
    +5
    • 8
    • 24
  • Waiting with cy.wait
    l

    lemon-toothbrush-55306

    02/13/2023, 1:40 PM
    Good morning, I need to wait until my Transaction gets executed and the data is in the BlockChain, so once I send the click appears one spinner and takes up to 10 seconds until the message of
    Congrats your HBAR has been sent successfully
    appear, I'm using
    cy.wait(10000)
    is there any other way to do this?
    Copy code
    js
    cy.getBySel('confirm-transaction').click();
          // Waiting for the transaction to be registered in Hedera
          // eslint-disable-next-line cypress/no-unnecessary-waiting
          cy.wait(10000);
          cy.contains('¡Tus HBAR se han enviado con éxito!').should('be.visible');
    a
    e
    +2
    • 5
    • 20
  • WebPack Preprocess vue-loader config help
    s

    stocky-insurance-27750

    02/13/2023, 4:05 PM
    I would like to import constants from the .vue components but get an error from WebPack
    Module parse failed: Unexpected token (1:0)
    I've npm installed
    vue-loader
    and
    vue-loader-plugin
    and added this to the cypress.config.ts:
    Copy code
    import preprocessor from '@cypress/webpack-preprocessor'
    
    e2e: {
        setupNodeEvents(on, config) {
    
          const options = webpackPreprocessor.defaultOptions
          options.webpackOptions.module.rules[0].use[0].options.presets.push('vue-loader')
    
          on('file:preprocessor', webpackPreprocessor(options))
    }
    But get the error:
    Module parse failed: Unexpected token (21:12)
    I get no errors if I'm not trying to import consts or have any webpack config in the cypress.config.ts. Read this as 'adding to the default options' - https://github.com/cypress-io/cypress/tree/master/npm/webpack-preprocessor#modifying-default-options We want to be able to handle .vue files and everything else continue as normal. Any ideas?
  • Parallel test runs with AWS Codebuild?
    g

    green-vr-66806

    02/13/2023, 5:44 PM
    Hi everyone, I'm trying to do these Parallelisation steps but through CloudFormation (infrastructure as code for AWS): https://docs.cypress.io/guides/continuous-integration/aws-codebuild#Parallelization I'm trying to do the steps under the subtitle 'Enabling batch builds in the CodeBuild UI for the project'. However, my manager wants me to do it through CloudFormation instead of doing it via the AWS UI. Does anyone know if there is any guide on what CloudFormation code I need to add to get this working? I have found it extremely difficult to find this information. Many thanks in advance!
    b
    • 2
    • 2
  • Mixing Async and Sync code
    k

    kind-van-46599

    02/13/2023, 9:15 PM
    Greetings Everyone, Implemented a Step definition (Cucumber) in cypress and I wanted to ensure the below code is not affected by https://docs.cypress.io/guides/core-concepts/introduction-to-cypress#Mixing-Async-and-Sync-code. The dataTestId variable is initialised before executing any cy commands. Can I seek advise in rewriting this code to avoid flake? `When( /the user clicks maximise button of (lyactuals|proposed|slotting) table/, (dataTestIdInd: string) => { let dataTestId: string; /* Indicator to choose the Deals table according to the validation*/ switch (true) { case dataTestIdInd?.includes('lyactuals'): dataTestId = 'LastYearActualsTable'; break; case dataTestIdInd?.includes('proposed'): dataTestId = 'ReadonlyProposedTable'; break; case dataTestIdInd?.includes('slotting'): dataTestId = 'SlottingBoardTable'; } cy.findByTestId(dataTestId) .find('section > div') .then(($div) => { if ($div.length > 1) { return; } cy.wrap($div).find(
    [type="button"]
    ).click(); }); }`
  • Help! Im trying to resize element but it wont work
    s

    salmon-hairdresser-39856

    02/13/2023, 10:23 PM
    Im newbie on QA world, and im working on my skills. So im trying to risize the element but is not working. Any ideas?
    s
    • 2
    • 2
  • I can't run my tests in parallel with circleCI
    i

    important-country-59976

    02/14/2023, 1:14 PM
    Hello all 👋 My tests run correctly in "normal" mode withe circleCI, but i have this error "Could not find a Cypress configuration file" when i try to run it in parallel mode. Here is my project tree : circleci/ config.yml cypress/ e2e/ spec.cy.ts fixtures/ support/ commands.js e2e.js cypress.config.js package-lock.json package.json I use : - Cypress 12.5.1 - Docker image : cypress/included:cypress-12.5.0-node-16.18.1-chrome-109.0.5414.74-1-ff-109.0-edge-109.0.1518.52-1' https://hub.docker.com/layers/cypress/included/cypress-12.5.0-node-16.18.1-chrome-109.0.5414.74-1-ff-109.0-edge-109.0.1518.52-1/images/sha256-fe744d706f7db2c9bc11d1a0bc4e2e09e059d1646ddff7d3180b5dbd8525df2b?context=explore I used several docker images but I still have the same problem Is there anyone who can help me please, I have searched in several forums and I still have not found a solution 😔 thanks in advance 🙏
    g
    • 2
    • 3
  • Need help for setting up docker, I am using cypress version 9.7.0. Could anyone share me the steps.
    g

    gorgeous-wolf-24355

    02/14/2023, 5:13 PM
    E23
    m
    • 2
    • 2
  • How can I use a variable for the next test?
    l

    lemon-toothbrush-55306

    02/14/2023, 7:46 PM
    Hello, good afternoon. I need to store one variable from one test, to use in another test, which is the best way to do that? Also another question... The value of my var is inside of this Copy Button at the right, but once I click the CopyButton to get the value, a PopUp appears with the value, but Idk how I can access to the value. I was trying something like this:
    Copy code
    js
    Cypress.Commands.add('getBySel', (selector, ...args) => {
      return cy.get(`[data-test-id="${selector}"]`, ...args);
    });
    Copy code
    js
     cy.getBySel('SUPPLY KEY').then((key) => {
            console.log('Key - cy.getBySel',key);
            let SUPPLY_KEY = key;
            cy.wrap(SUPPLY_KEY).as('wags');
          });
    But the val I'm getting is (Attach to second Image). Any help pls?
    g
    m
    +2
    • 5
    • 25
  • Error creating WebGL context
    h

    hundreds-jackal-17102

    02/14/2023, 10:27 PM
    Hello. I use cypress, it's a very nice product. My application uses three.js to display 3D models, when I run tests via cypress cloud I get an error: Error creating WebGL context. Tests fail on chrome, but everything is fine in firefox. Tell me what parameters you need to pass for chrome to make it work. I have tried passing --ignore-gpu-blocklist to before:browser:launch and removing --disable-gpu. Local tests pass.
    g
    e
    e
    • 4
    • 12
  • What's the best way to clear unmet peer dependencies?
    c

    cold-author-79999

    02/15/2023, 3:41 AM
    I get several warnings about unmet peer dependencies.What's the best workaround or solution to fix those warnings?
  • Uncaught exception: CKEditorError
    h

    hundreds-spoon-43121

    02/15/2023, 4:08 AM
    I got an uncaught exception CKEditorError when typing a text. It doesn't automatically fail the test but since I can't type anything on the required field, the test cannot proceed. What's the best workaround/fix for this issue?
    m
    • 2
    • 3
  • Hello All,
    c

    colossal-table-38461

    02/15/2023, 5:14 AM
    I need to validate 1 scenario using Cypress. Scenario : Validate the PDF content with XML File. For this as a pre-requisite, I need to convert XML File into Json. Any idea how we can convert in Cypress ?
    p
    • 2
    • 1
  • No cypress options in chrome
    h

    hallowed-ability-2849

    02/15/2023, 10:30 AM
    Hi, I'm trying to launch cypress for the first time. When I launch "Start E2E Testing in Chrome" in cypress (installed with npm) I get empty page with no cypress options. The only info I see is "Chrome is being controlled by automated test software". When I launch Electron, I see al the cypress options like Specs, Runs, Debug, Settings, Create your first spec, browser selection etc. None of this is showing in chrome. What could be the cause?
    a
    b
    +2
    • 5
    • 6
1...789...26Latest