https://cypress.io logo
Join Discord
Powered by
# i-need-help
  • Extending the cypress debugging?
    c

    colossal-oxygen-29599

    05/05/2023, 2:58 AM
    Niche question, here: Does anyone have any examples of how we can extend the debugging in cypress so that I can log various things at the CLI during
    cypress run
    ?
    e
    m
    • 3
    • 12
  • Configuration error
    b

    brave-portugal-44828

    05/05/2023, 5:52 AM
    Hi, i'm cannot run cypress open after install cypress again even though last project no problem hope you guys help me to run cypress thank you ---------------------------------------------------------------- Error: Your application tried to access bluebird, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound.

    https://cdn.discordapp.com/attachments/1103922036872589382/1103922037027782778/Screenshot_2566-05-05_at_12.44.35.png▾

    m
    • 2
    • 6
  • How can i import my standard vue app in my tests?
    h

    helpful-receptionist-4197

    05/05/2023, 2:03 PM
    I have a bunch of plugins and config and stuff. I don't want to have to duplicate it. like
    Copy code
    ts
    // cypress/support/component.ts
    import "./commands";
    import { mount } from "cypress/vue";
    import { app } from "../src/main.js";
    
    // do something with `app` so it's actually used
    
    Cypress.Commands.add('mount', mount)
    • 1
    • 5
  • Test restart/retry if api call fails
    d

    damp-flag-99346

    05/05/2023, 2:47 PM
    I have a spec file with few tests in it. One of the tests, mostly the last one will fail on a network request intermittently. The status returned is 401. It doesn't happen in all the run. I'm not sure why it happens sometimes. Is there a way I can intercept this request and if 401 is returned then restart or retry the test? What other suggestions do you have?
    e
    • 2
    • 3
  • Problem with custom commands with typescript
    s

    silly-lawyer-32382

    05/05/2023, 3:19 PM
    Hi everyone, I am trying to use custom_commands with typescript and cucumber configuration, when i change the supportFile: "./cypress/support/e2e.ts" the execution get stuck in the loading phase (see screenshot). however when i set it to supportFile: false, i get the message loginToWimoQa is not a function. you can see also in the screenshots my test, e2e.ts and index.d.ts. thank you

    https://cdn.discordapp.com/attachments/1104064720341844039/1104064720530591824/image.png▾

    https://cdn.discordapp.com/attachments/1104064720341844039/1104064720861925476/image.png▾

    https://cdn.discordapp.com/attachments/1104064720341844039/1104064721142956052/image.png▾

    https://cdn.discordapp.com/attachments/1104064720341844039/1104064721675636867/image.png▾

    https://cdn.discordapp.com/attachments/1104064720341844039/1104064721948250152/image.png▾

    m
    • 2
    • 5
  • specPattern not loading tests in order
    f

    flat-painter-96557

    05/05/2023, 7:24 PM
    I've listed my spec file paths in the cypress.config.ts under specPattern but tests are still being run in alphabetical order.
  • Get the element count and assign to a variable if the element exists
    p

    plain-potato-68806

    05/05/2023, 8:22 PM
    I am trying to get the element count if the elements exists to assign to a variable and used something like:
    Copy code
    javascript
    cy.get('.my-class-name).then((list) => { 
       const count = list.length
    })
    However, the test will fail when the element is not visible at all. Please could you help?
  • Verifying if a value is present or not, in a table.
    q

    quiet-dream-68129

    05/06/2023, 4:14 AM
    Hi, I have a scenario where I add a value to a table with multiple rows and columns. I need to iterate through the table and find the value, if its present then print its location or a success message. And if the value is not found then fail the test. How can I do this efficiently? Can someone help?
    g
    t
    • 3
    • 13
  • Issue when I'm trying to iterate on fixture with foreach ,
    q

    quick-activity-91603

    05/07/2023, 7:56 AM
    Hello, I'm using fixtures for the first time and took a snippet of code from cypress github but I can't get it to work. I want to iterate with foreach to read each item but I always have this error message : examples.forEach is not a function code I'm currently using : it('gets its data from a fixture', function() { cy.fixture('examples') .then((examples) => { //
    examples
    contains the full contents of the fixture examples.forEach((example) => { // Do something with each example }); }); }); content of the fixture file (examples.json) : { "email": "sam_blogs@webdriveruni.com", "otheremail": "sam_blogs@webdriveruni.com" } Do you have any idea what I'm doing wrong please ? Thanks ! Leila

    https://cdn.discordapp.com/attachments/1104678206390423583/1104678206633685073/fixture_issue.png▾

    e
    • 2
    • 2
  • Import custom command files into e2e.js at the folder level
    m

    millions-flower-39293

    05/07/2023, 12:36 PM
    Hi, every time we add new custom command file(s) in the support folder we need to import the file in the e2e.js. What would be the best way to import those files at their folder level instead of writing the whole path and the file name one by one? This will be beneficial if I automatically add new custom command file under existing folder. Example, given I have this custom command files: branchCommands.js depositoryAccountCommands.js transactionCategoriesCommands.js
    Copy code
    import "./api-commands/administration/organization/branchCommands";
    import "./api-commands/administration/organization/depositoryAccountCommands";
    import "./api-commands/administration/generalledger/transactionCategoriesCommands";
    How can I import these at their folder level like:
    Copy code
    import "./api-commands/administration/organization
    import "./api-commands/administration/generalledger
    So that whatever custom command files will be added in the existing folder, I'll no longer specify the whole path including its file name? Thanks!
  • Firefox error loading dynamically imported module
    w

    wonderful-army-80507

    05/07/2023, 5:09 PM
    I have a pretty basic test that clicks a link and checks that the resulting page has a certain title:
    Copy code
    it('Post button works', () => {
      cy.contains('Posts').click();
      cy.get('h1').should('include.text', 'Posts 1–5 of ');
    });
    This works fine when run in chrome or electron, but fails in firefox with the error
    Copy code
    > error loading dynamically imported module
    My site is a sveltekit site. I searched but didn't find any obvious solutions. Any suggestions?
  • Support for multiple browser tabs.
    a

    adorable-terabyte-75237

    05/07/2023, 9:35 PM
    I saw that one of Cypress trade-offs is: support for multiple browser tabs. Is there workaround? I am learning cypress and so far I like it, but if this is a case I need to look for another option, since I need to deal with opening another tab and looking for a elements on that second tab. Anyone have experience with this? Thanks
    c
    • 2
    • 2
  • setupNodeEvents writing fixtures in BitBucket pipeline
    f

    flat-painter-96557

    05/08/2023, 3:03 PM
    How do I set up a Bitbucket pipeline to write test fixtures with before:spec via setupNodeEvents() ?
  • How to skip a test based on environment variables?
    w

    wonderful-carpenter-84941

    05/08/2023, 3:15 PM
    Hope everyone is doing well, I'm trying to find a way to skip a few test cases in my localhost, any idea how I can implement that with a tag or condition skip?
    f
    • 2
    • 3
  • cypress component testing styled components
    b

    big-quill-7500

    05/08/2023, 5:29 PM
    Currently I am testing out cypress component testing but running into some issues. As tech stack I am using vite + react + mui. The issue I am having is that a styled component renders on it's own but not when it's a child component. I have read that there needs to something implemented, but the docs only talk about general CSS. The vite server shows everything correctly but the cypress page not. Does anyone know why this happens? PS hopefully the video helps https://cdn.discordapp.com/attachments/1105184840803946636/1105184841043038318/2023-05-08_19-28-28.mp4
    e
    • 2
    • 4
  • Quick question regarding Gitlab CI setup
    e

    elegant-insurance-66438

    05/08/2023, 6:52 PM
    In the "Basic Setup" section (https://docs.cypress.io/guides/continuous-integration/gitlab-ci#Basic-Setup) it references the NPM script
    start:ci
    - there is no mention of what commands are in this script elsewhere in the documentation that I could find - if someone knows that would be great.
    m
    • 2
    • 13
  • Hi All, any idea on how to run cypress tests in chrome incognito
    r

    red-jordan-59778

    05/08/2023, 11:33 PM
    I already have this in index.js file - module.exports = (on, config) => { on("before:browser:launch", (browser, launchOptions) => { console.log(launchOptions.args); if (browser.name === "chrome") { launchOptions.args.push("--incognito"); } return launchOptions; }); 2. Can i pass something in CLI like --incognito option, cypress gives error unknown incognito option 3. Also the cypress open option doesn't seem to work - npx cypress open --browser chrome --config chromeWebSecurity=false --incognito
  • browser page is not launched in English(need help)
    w

    wide-evening-76256

    05/09/2023, 1:58 PM
    Hi, everybody🧐 I run jenkins test > jenkins is loaded in russian - i run it through localhost - does it depend on language on laptop? - how can i fix this? Thank you!

    https://cdn.discordapp.com/attachments/1105494008815419464/1105494009222275134/Screenshot_399.png▾

    m
    • 2
    • 7
  • [SOLVED] Vite component testing: fetch() not working
    h

    helpful-receptionist-4197

    05/09/2023, 2:59 PM
    inside a component i'm testing there's a
    fetch("path/to/dump.yaml").then(...)
    it returns 200, but it's this HTML instead of the YAML i'm expecting. works fine outside of cypress. components which don't load this work fine too.
    Copy code
    html
    <!DOCTYPE html>
    <html>
      <head>
            <script type="module" src="/__cypress/src/@vite/client"></script>
          
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width,initial-scale=1.0">
        <title>Components App</title>
      </head>
      <body>
        <div data-cy-root></div>
      
            <script>// This file is merged in a <script type=module> into index.html
    // it will be used to load and kick start the selected spec
    
    const CypressInstance = window.Cypress = parent.Cypress
    
    const importsToLoad = []
    
    /* Support file import logic, this should be removed once we
     * are able to return relative paths from the supportFile
     * Jira #UNIFY-1260
     */
    const supportFile = CypressInstance.config('supportFile')
    const projectRoot = CypressInstance.config('projectRoot')
    const devServerPublicPathRoute = CypressInstance.config('devServerPublicPathRoute')
    
    if (supportFile) {
      let supportRelativeToProjectRoot = supportFile.replace(projectRoot, '')
    
      if (CypressInstance.config('platform') === 'win32') {
        const platformProjectRoot = projectRoot.replaceAll('/', '\\')
    
        supportRelativeToProjectRoot = supportFile.replace(platformProjectRoot, '')
      }
    
      // We need a slash before /cypress/supportFile.js, this happens by default
      // with the current string replacement logic.
      importsToLoad.push({
        load: () => import(`${devServerPublicPathRoute}${supportRelativeToProjectRoot}`),
        absolute: supportFile,
        relative: supportRelativeToProjectRoot,
        relativeUrl: `${devServerPublicPathRoute}${supportRelativeToProjectRoot}`,
      })
    }
    
    // Using relative path wouldn't allow to load tests outside Vite project root folder
    // So we use the "@fs" bit to load the test file using its absolute path
    // Normalize path to not include a leading slash (different on Win32 vs Unix)
    const normalizedAbsolutePath = CypressInstance.spec.absolute.replace(/^\//, '')
    const testFileAbsolutePathRoute = `${devServerPublicPathRoute}/@fs/${normalizedAbsolutePath}`
    
    /* Spec file import logic */
    // We need a slash before /src/my-spec.js, this does not happen by default.
    importsToLoad.push({
      load: () => import(testFileAbsolutePathRoute),
      absolute: CypressInstance.spec.absolute,
      relative: CypressInstance.spec.relative,
      relativeUrl: testFileAbsolutePathRoute,
    })
    
    if (!CypressInstance) {
      throw new Error('Tests cannot run without a reference to Cypress!')
    }
    
    // load the support and spec
    CypressInstance.onSpecWindow(window, importsToLoad)
    
    // then start the test process
    CypressInstance.action('app:window:before:load', window)
    
    // Before all tests we are mounting the root element,
    // Cleaning up platform between tests is the responsibility of the specific adapter
    // because unmounting react/vue component should be done using specific framework API
    // (for devtools and to get rid of global event listeners from previous tests.)
    CypressInstance.on('test:before:run', () => {
      // leave the error overlay alone if it exists
      if (document.body.querySelectorAll('vite-error-overlay').length) {
        // make the error more readable by giving it more space
        Cypress.action('cy:viewport:changed', { viewportWidth: 1000, viewportHeight: 500 })
    
        return
      }
    
      // reset the viewport to default when in normal mode
      Cypress.action('cy:viewport:changed', {
        viewportWidth: Cypress.config('viewportWidth'),
        viewportHeight: Cypress.config('viewportHeight'),
      })
    })
    
    // Make usage of node test plugins possible
    window.global = window
    window.process = typeof process !== 'undefined' ? process : {}
    </script>
            </body>
    </html>
    w
    • 2
    • 8
  • I need help to implement cypress with single-spa
    l

    little-nail-2574

    05/09/2023, 4:13 PM
    Good morning, I'm having a problem with my component tests. I created a TEST file just for configuration and the scenario has only:
    Copy code
    describe('TEST.cy.tsx', () => {
      it('playground', () => {
        cy.mount(<BillingListPage/>)
        cy.log( 'true' )
      })
    })
    The project uses React, **Webpack **bundler, and Single-SPA. The idea is to run it in standalone mode, but this is not happening. Initially, the project was running on version 6.0.0, and I am migrating it to version ^12.0.0. When executing the project, the component return this var_ = _non_webpack_require__(... : and in the console: My cypress.config.ts file:
    Copy code
    import { defineConfig } from 'cypress';
    import webpackConfig from './webpack.config';
    
    export default defineConfig({
      component: {
        devServer: {
          framework: 'react',
          bundler: 'webpack',
          webpackConfig,
        },
        viewportWidth: 1000,
        viewportHeight: 660,
      },
    });
    Is there any missing configuration to be able to execute the components in standalone mode?

    https://cdn.discordapp.com/attachments/1105527942697721887/1105527943242973275/b64013aa-92a8-45c4-b41f-8ba26f62bfbc.png▾

    https://cdn.discordapp.com/attachments/1105527942697721887/1105527943616274514/5698335f-412a-4811-a11d-d79d7335f16b.png▾

    w
    • 2
    • 7
  • I need help. I just followed the 'The real world app' tutorial but it didn't display as expected.
    g

    gorgeous-butcher-63283

    05/09/2023, 4:17 PM
    https://learn.cypress.io/real-world-examples/cypress-real-world-app-overview

    https://cdn.discordapp.com/attachments/1105529078938869892/1105529079316348948/Screenshot_2023-05-09_at_17.16.30.png▾

    m
    • 2
    • 14
  • I update to node 18 and now cypess is not woking.
    p

    proud-answer-20715

    05/09/2023, 4:31 PM
    Hello, I need some help with cypress, Before my cypress code was working, and I update to node 18 cypess is not woking now and I am not getting any error message.
    m
    • 2
    • 9
  • Vue component exposed values never initialized
    h

    helpful-receptionist-4197

    05/09/2023, 4:37 PM
    Copy code
    html
    <script setup>
    defineExpose({foo: 1337})
    </script>
    
    <template>
      Hello!
    </template>
    Copy code
    ts
    describe("<MyComponent />", () => {
      it("renders", () => {
        cy.mount(MyComponent).then(({wrapper, component}) => {
          expect(component.foo).to.equal(1337) // fails; component.foo is undefined
        })
      });
    });
  • Testing gRPC APIs
    m

    magnificent-lamp-44201

    05/09/2023, 8:00 PM
    Hi! I'm in a project where the stack is new for me (they use Elixir + Phoenix and Protobuf). I want to perform integration testing (API testing) using TypeScript, and I would like to know if is it possible to test gRPC APIs with Cypress. I haven't found samples of that (just samples using REST APIs). Thanks in advance for your answers. Have a great day!
  • E: Unable to locate package jq - using cypress/browsers:node18.12.0-chrome106-ff106
    d

    dazzling-salesclerk-15570

    05/09/2023, 8:45 PM
    For some reason im not being able to simply install jq using this newer Cypress image. I was able to do it very well with cypress/browsers:node16.16.0-chrome107-ff107-edge but not with this one. Any workarounds?
  • .children() can't find elements even when there is a children of the element
    s

    square-toothbrush-32850

    05/10/2023, 6:57 AM
    I am calling .get('the parent element').children() and getting an error of time out because can't find the element, even when finding only the parent, the screenshot reveals that the children also loaded. So I don't know what to do. It refuses to find any children or element inside the parent element. I can provide with the html and code (is just the get)

    https://cdn.discordapp.com/attachments/1105750462562582528/1105750462835195934/cypresserror.png▾

    w
    • 2
    • 3
  • cy.intercept() with cy.wait()
    c

    curved-dress-90603

    05/10/2023, 9:47 AM
    Hi, I have issue with cy.intercept('getitems').as('getItems'), so I can see request that I want to intercept in cypress runner left sidebar before cy.intercept line, but test step fail on cy.wait('@getItems').then(interception) => { if (parseInt(JSON.stringify(interception.response?.body.data.itmes[0].item.length))) { console.log(JSON.stringify(interception)) } else { cy.log(JSON.stringify(interception); } }
  • Why I got this error of loading page when clicking on a link ?
    b

    bumpy-insurance-8581

    05/10/2023, 10:08 AM
    Hello, as you can see on the screenshot, I got an error to load a page. But I just click on a link that launch a download, I don’t want to load a page and the download is fully done in less than 2/3 seconds (so I really don’t understand why it wait for 60 seconds).

    https://cdn.discordapp.com/attachments/1105798408704368661/1105798408872144906/IMG_4128.jpg▾

    • 1
    • 1
  • TypeError : minimatch is not a function
    b

    brash-nest-96339

    05/10/2023, 10:28 AM
    Hello friends, I am a first time user of Cypress. i tried to run npx run cypress and i got this error. i dont know what to do? should i uninstall?

    https://cdn.discordapp.com/attachments/1105803451855818772/1105803452057141268/cypress_error.png▾

    m
    a
    • 3
    • 7
  • Angualar New Tab
    c

    cold-branch-74205

    05/10/2023, 10:28 AM
    Here is the Scenario : There is button where its open a new tab But due to usage of angular its kind of dynamic . How I can resolve this ? Is there any workaround to catch the URL when I click on this button ? Help me . Plzzzzz

    https://cdn.discordapp.com/attachments/1105803599101034556/1105803599222685777/image.png▾

    w
    • 2
    • 4
1...212223...26Latest