https://cypress.io logo
Join Discord
Powered by
# i-need-help
  • Cypress open crashes
    q

    quaint-flag-79692

    01/26/2023, 3:37 AM
    I just installed cypress to give it a try but running
    cypress open
    causes the following error:
    Copy code
    It looks like this is your first time using Cypress: 12.4.0
    
    √  Verified Cypress! C:\Users\me\AppData\Local\Cypress\Cache\12.4.0\Cypress
    
    Opening Cypress...
    
    [31056:0125/222133.282:ERROR:gpu_process_host.cc(969)] GPU process launch failed: error_code=18
    [31056:0125/222133.303:ERROR:display_layout.cc(563)] PlacementList must be sorted by first 8 bits of display_id
    [31056:0125/222133.376:ERROR:gpu_process_host.cc(969)] GPU process launch failed: error_code=18
    [31056:0125/222133.451:ERROR:display_layout.cc(563)] PlacementList must be sorted by first 8 bits of display_id
    [31056:0125/222133.515:ERROR:gpu_process_host.cc(969)] GPU process launch failed: error_code=18
    [31056:0125/222134.922:ERROR:gpu_process_host.cc(969)] GPU process launch failed: error_code=18
    [31056:0125/222135.084:ERROR:gpu_process_host.cc(969)] GPU process launch failed: error_code=18
    [31056:0125/222135.222:ERROR:gpu_process_host.cc(969)] GPU process launch failed: error_code=18
    [31056:0125/222135.405:ERROR:gpu_process_host.cc(969)] GPU process launch failed: error_code=18
    Error: ERR_FAILED (-2) loading 'http://localhost:59953/__launchpad/index.html'
        at rejectAndCleanup (node:electron/js2c/browser_init:165:7500)
        at EventEmitter.stopLoadingListener (node:electron/js2c/browser_init:165:7875)
        at EventEmitter.emit (node:events:527:28) {
      errno: -2,
      code: 'ERR_FAILED',
      url: 'http://localhost:59953/__launchpad/index.html'
    }
    I'm running on Windows 11, using node.js v16.13.0. I used jest on my old laptop but when I moved to my new laptop, it started giving me similar GPU-related failures, which I have had no luck in getting rid of. I was hoping I could use Cypress instead but it appears to be giving me the same trouble. Can anyone help diagnose this?
  • help/examples of custom devServer for component testing
    s

    shy-minister-18411

    01/26/2023, 6:33 AM
    I use Parcel to build my app and i'm trying to get started using component testing. However, i'm having an issue actually figuring out specify a custom dev server and the docs aren't super clear on how to specify a dev server: https://docs.cypress.io/guides/references/configuration#Custom-Dev-Server i did find these relevant issues but they're unresolved and not really super helpful. https://github.com/cypress-io/cypress-documentation/issues/4613 https://github.com/cypress-io/cypress/issues/17798
    • 1
    • 2
  • what level of support we can get from Cypress licence version
    b

    best-window-49967

    01/26/2023, 9:48 AM
    Hello, I want to know what level of support we can get from Cypress team as I was trying to setup Cypress in my work laptop but unable to do so, after installing and verifying Cypress on VS code, I am getting an error (Cypress executable not found at: C:\Users\Adnan.Siddiqi\AppData\Local\Cypress\Cache\12.4.0\Cypress\Cypress.exe). I can see the files are being removed from the download folder and Cypress.exe file is being removed. I need to know what is causing that, I have tried bypassing company VPN and tried switching off firewall settings, I have tried all so what I need here is tailored support for this issue, we will be looking to get licence version (Team) and if I can get some advice that this issue can be sorted via support from Cypress team if not can I be directed towards a paid support channel where I can get this sorted.
    t
    e
    • 3
    • 5
  • dockerfile with cypress and java
    s

    straight-microphone-66008

    01/26/2023, 11:14 AM
    Hey guys does anyone know where I can find a docker image wich has cypress [node and the browsers] and then also java jdk 8+, I need it to run my tests in ci and generate allure reports
    e
    • 2
    • 3
  • Command abstraction / strategy pattern for commands
    c

    colossal-umbrella-95675

    01/26/2023, 11:25 AM
    Hi, I have a question regarding a test strategy/setup. I made a commands to handle basic tasks on my website. E.g. selecting the correct menu item like cy.menuItemOpen(1) where 1 is the first menu item. No comes the challenge, i am building tests for more theme's that are functional the same, but do have a complete different layout and selectors. I want to keep my tests clean form IF / ELSE statements because then i need a tests to test my test .... I want to make a command for every theme when needed (if the command is theme dependant). I was thinging like
    cy.prittyTheme().menuItemOpen(1)
    or
    cy.pritty.menuItemOpen(1)
    . where menuItemOpen() is a new command for every theme. Is this possible? And so how or does anyone have a reference to documentation how i could make this? Thanks in advance! If not how do you deal with multiple theme's?
    m
    g
    • 3
    • 13
  • how to clear cy.stub() value?
    s

    stocky-intern-86590

    01/26/2023, 12:19 PM
    I'm using stub = cy.stub() in order to get the text from the alert. However the 1st test (happy path) works but when I run the 2nd test (wrong password) I expected validation failed as text but it's showing the privous message "validation succeeded". How can I do to run both test cases and they both work as expected? Cypress version 12
    g
    • 2
    • 1
  • component test run seems to ignore TS typeRoots
    s

    some-electrician-52054

    01/26/2023, 1:24 PM
    Hi there. I've got an issue with an Angular application when I run my component tests with cypress run --component. The tests work fine, the result is also correct. But: the log shows some TypeScript errors before the successful test results:
    Copy code
    ERROR in src/app/xxx....xxx.service.ts:1471:37 - error TS2339: Property 'remove' does not exist on type 'MyClass[]'.
    I configured the typeRoots in my tsconfig.json to tell TS about my extension method remove for arrays:
    Copy code
    json
        "typeRoots": [
          "node_modules/@types",
          "app/extensions/@types" <--- contains remove
        ],
    Has anybody had the same issue? Is a configuration missing? As I mentioned before, these errors don't effect the functionality of the test run, but it's a bit annoying to have hundreds of them in the output.
    o
    • 2
    • 7
  • Cypress: open Chrome never opens
    s

    sparse-napkin-20893

    01/26/2023, 2:58 PM
    v 12.4.0 chrome v109 when i try to run test in Chrome via open mode i get internal loading
    s
    b
    • 3
    • 8
  • Cypress and Vite problem
    f

    fast-france-85428

    01/26/2023, 3:09 PM
    hi guys, my app uses Quasar, Vite, Vue3, typescrypt. I don't know how to get variables from .env in cypress. I would like to set cypress.env variables based on .env Before we migrated to Vite, it worked with Webpack can somebody help? Thanks
    • 1
    • 1
  • Do you know of any mysql-ssh library that does not have high severity vulnerabilities?
    f

    faint-ocean-92094

    01/26/2023, 3:19 PM
    Hi friends, my suite highly depends on the DB connection, and the product I'm working with only supports DB connection through SSH. To sep up my connection, I've created a task "executeSqlQuery" and everything works smoothly. The problem I have is that the only way I found to connect cypress with DB through SSH, is by using mysql-ssh library. When I install or update the project, it gives me 2 High severity vulnerabilities that apparently have no solution. Do you know of any other way to set up a DB connection through SSH in cypress? Thanks!
  • Import file outside of cypress not working
    s

    stocky-insurance-27750

    01/26/2023, 3:33 PM
    I've exported an object from our .vue file but cannot get Cypress to find it. What's the correct up-to-date way of doing this? I've tried adding this
    import { icons } from '../../../folder/folder2/folder3/file.vue'
    but get errors stating
    Module not found /component-tests/e2e/Atoms/folder/folder2/folder3/file.vue
    I've tried a few other ways too, but always end up with this error. It's looking within the cypress directory only and not stepping back out as I expect it to.
    h
    • 2
    • 13
  • Clear Service Property in beforeEach
    b

    brave-address-8775

    01/26/2023, 4:18 PM
    I am using Cypress as Component Test for Angular. The component uses a service that changes a BehaviourSubject. After each test i need to reset the BehaviourSubject -> how can i access it? The Service is injected in the Constructor (but as private). In the cy-spec file i have it as provider but not as mock. Is there a way to call a clear method on the service? Or do i have to use a mock?
    • 1
    • 1
  • Cypress support for Prometheus / Grafana
    s

    stale-lifeguard-39024

    01/26/2023, 7:18 PM
    Hello Community Was wondering if anyone in the community has had any experience with integrating cypress with Prometheus / Grafana ? If so, do you have guidelines to achieve this? Even a quick few lines would be a massive help to push me in the right direction! Kindest Regards
    b
    p
    • 3
    • 6
  • Masking CC Details In Test
    r

    rough-coat-99762

    01/26/2023, 9:18 PM
    How can I mask sensitive information so it does not show in the cypress video recoding? I came across a way to not log cc details in the docs, but unfortunately, the sensitive information can still be seen in the video itself. If this is not possible, is there a way to turn of video recoding for a single spec file or even a single it block?
    n
    t
    g
    • 4
    • 7
  • How to override cy.request() and set up bearer authorization header globally?
    b

    best-lunch-5240

    01/27/2023, 10:15 AM
    I need to set the authorization bearer header for
    cy.request()
    globally to avoid setting it up multiple times. Here https://lightrun.com/answers/cypress-io-cypress-default-headers-for-cyrequest-command#:~:text=As%20a%20workaround%20I%20overwrite%20cy.request%20method%20with%20my%20custom%20command%3A I found some potential way to do it. So in my
    support/commands.ts
    I have:
    Copy code
    Cypress.Commands.overwrite('request', (originalFn, ...options) => {
        const optionsObject = options[0];
        if (optionsObject === Object(optionsObject)) {
          optionsObject.headers = {
            authorization: `Bearer ${Cypress.env('authorizationToken')}`,
            ...optionsObject.headers,
          };
          return originalFn(optionsObject);
        }
        return originalFn(...options);
    });
    And in the test I have:
    Copy code
    cy.request({
        method: 'POST',
        url: '/someEndpoint',
        body: someBody
    }).then(response => {
        expect(response.status).eq(200);
        return response.body;
    });
    And unfortunately, I get 401: Unauthorized error and it looks like the authorization bearer token was not added to headers: What do I do wrong here? I use Cypress v 10.10.0
    n
    s
    +4
    • 7
    • 12
  • Syntax Error
    a

    alert-author-4919

    01/27/2023, 1:24 PM
    Hello guys, i having a trouble with my code, if a use twice JSON.parse() in my code, the second give me a Syntax error, someone can explain me why?
    Copy code
    it("Should verify status", () => {
        login(usuario.user);
        cy.visit("arp/");
        var status = JSON.parse(localStorage.getItem("@AXS-login") || "");
        var ultimo = status.Cards.pop();
        var state = JSON.stringify(ultimo.status_arp);
        console.log(state);
        cy.request({
          method: "POST",
          url: "https://dev-iris.axsenergia.com.br/csp/representante/login/",
          header: "Content-Type: application/json",
          header: "accept: application/json",
          body: {
            email: "versebank@teste.com",
            senha: "teste123",
          },
        }).then((response) => {
          expect(response.status).to.equal(200);
          expect(state).to.equal('"Aguardando Aceite"')
        });
      });
    
      it("After checks, exclude card", () => {
        cy.wait(2000);
        var card = JSON.parse(localStorage.getItem("@AXS-Energia:LastIdCard") || "");                     //<- on this guy
        cy.log("Card capturado: "+ card)
        cy.request({
          method: "POST",
          url: "https://api.pipefy.com/graphql",
          auth: {
            bearer:
              "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJ1c2VyIjp7ImlkIjozMDIwMTgxMDQsImVtYWlsIjoiaGVucmlxdWUuc2F2aUBicGx1cy5jb20uYnIiLCJhcHBsaWNhdGlvbiI6MzAwMjE0OTM4fX0.Wxt8GX-pVkEpuZSH4dIVKlNXsQJ38PW1SLTLCP0h9D9nsIwjBaqmJvQcHx4V0AweCBReRyUr8kpz6h6pRLSw4Q",
          },
          header: "Content-Type: application/json",
          header: "accept: application/json",
          body: {
            query:
              "mutation{   deleteCard(input:{id: " +
              card +
              "}) {     clientMutationId     success   }}",
          },
        }).then((response) => {
          expect(response.status).to.equal(200);
        });
        cy.log("Card deleted successfully")
      });
  • Repositories using Cypress
    s

    square-ability-8372

    01/27/2023, 6:33 PM
    Hi, I am trying to figure out a way to search GitHub repositories that utilize Cypress for their e2e tests. Can anyone help in this regard, though github search/ github API anything? I need the repository names to conduct a research on web testing. The list of repositories would be great help. Also I am new here, apologies in advance if I have violated any community guidelines.
    a
    g
    • 3
    • 8
  • Create a library containing commands that need a plugin.
    m

    mammoth-energy-72910

    01/27/2023, 7:13 PM
    Hi people, in my company, we want to create a cross project solution, using commands packed in libraries. One of the libraries needs to use the xpath plugin, and I wanted to ask if there's any way to create the library in such a way that, when people install it, they don't need to import the plugin manually into their e2e.js file, or if there's no way around it. Sorry if this is more a JS question, but, since it involves Cypress, I thought it'd be a good idea to ask here. Thank you all for your attention!
    g
    • 2
    • 3
  • Environment variable CYPRESS_RECORD_KEY does not load
    b

    bright-noon-82211

    01/29/2023, 3:08 PM
    I am trying to set CYPRESS_RECORD_KEY through a .env file, My project structure looks like this:
    Copy code
    root/
      .env
      .git
      frontend/
        src/
        cypress/
        .env -> The CYPRESS_RECORD_KEY variable is located here
        cypress.config.ts
        package.json
      backend/
        ...
    In the cypress.config.ts I added this to load the correct .env:
    Copy code
    dotenv.config({ path: `.env` });
    dotenv.config();
    And now when I run cypress using
    npm run cypress-test
    which runs
    cypress run --record
    I get the error
    You passed the --record flag but did not provide us your Record Key.
    Can I get any help? - I tried adding the dotenv setup into
    plugins/index.ts
    - I tried adding the variables to cypress.env.json in the frontend folder. The only thing that seems to work is passing the env variables in the run command it self.
    • 1
    • 1
  • Plugin 'cypress-map' typing
    g

    great-oil-15113

    01/30/2023, 9:01 AM
    Hi I using 'cypress-map' https://github.com/bahmutov/cypress-map in my test script and it works, but since I am using typescript, the editor keeps complaining about map() method not found in cypress. Is there a typing I can install? Thanks
    g
    m
    • 3
    • 8
  • captcha is not defined
    e

    echoing-controller-6107

    01/30/2023, 9:10 AM
    hi I’m trying to automate web page And I have there save button When i press it should download json file I have there silent captcha when I click the save button … but nothing happens I check the console and the error is Captcha is not defined Pls help me I’m using cypress V11.1 And chrome V103
  • JavaScript heap out of memory
    l

    little-byte-59792

    01/30/2023, 10:01 AM
    My client tests are crashing cause heap out of memory. here is the message
    Copy code
    Running:  registration/registration.cy.ts                                               (26 of 38)
    
    <--- Last few GCs --->
    
    [1842:0x7fc7b8008000]   569883 ms: Mark-sweep 4051.8 (4143.5) -> 4036.2 (4144.0) MB, 1933.5 / 0.0 ms  (average mu = 0.119, current mu = 0.015) allocation failure scavenge might not succeed
    [1842:0x7fc7b8008000]   571794 ms: Mark-sweep 4045.7 (4144.0) -> 4036.2 (4144.0) MB, 1536.6 / 0.0 ms  (average mu = 0.155, current mu = 0.196) allocation failure GC in old space requested
    
    
    <--- JS stacktrace --->
    
    FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
     1: 0x101b7f5f5 node::Abort() (.cold.1) [path/to/node/v16.18.1]
     2: 0x100874f49 node::Abort() [path/to/node/v16.18.1]
     3: 0x10087512e node::OOMErrorHandler(char const*, bool) [path/to/node/v16.18.1]
     4: 0x1009ec3f0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [path/to/node/v16.18.1]
     5: 0x1009ec3b3 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [path/to/node/v16.18.1]
     6: 0x100b90095 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [path/to/node/v16.18.1]
     7: 0x100b940dd v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [path/to/node/v16.18.1]
     8: 0x100b909bd v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [path/to/node/v16.18.1]
    ...
    Documentation says : ## Memory * 4GB minimum, 8GB+ for longer test runs https://docs.cypress.io/guides/getting-started/installing-cypress#Memory What does longer test run means? I see a warning:
    Copy code
    Trace: The new-window event is deprecated and will be removed. Please use contents.setWindowOpenHandler() instead.
        at Object.log (node:electron/js2c/browser_init:225:603)
    Who can help? Cypress 12.4.1 npm 16.18.1
    f
    b
    • 3
    • 3
  • npm clean up
    b

    brief-kite-35331

    01/30/2023, 2:07 PM
    When I run the
    npm audit
    command I get this result (check the attachment) How can I resolve this issue? I already tried upgrading to the newest version of the got library and moving from the deprecated version of grep to cypress/grep. Nothing helped 😞
    g
    • 2
    • 5
  • Cypress app won't log in
    g

    gifted-gold-39106

    01/30/2023, 2:53 PM
    When I try to log in to Cypress app, it opens a browser window where I can log in, but the app is stuck in "Waiting for you to log in." I have tried reinstalling and cleaning the app cache, but it did not help. Thanks!
    b
    w
    +3
    • 6
    • 27
  • Adding API tests to existing UI tests
    s

    silly-student-97216

    01/30/2023, 4:46 PM
    Hello, I am trying to add my first API test to existing UI tests. My UI tests are in e2e folder and I added a new api folder for api tests. When I run cypress, the runner not picking up the api folder. I am not able to figure out the configuration for this. Can I please get some help here? This is my folder structure. Thanks.
    g
    b
    • 3
    • 4
  • Testing google analytics tracking codes and id's
    g

    gifted-tomato-54665

    01/30/2023, 6:07 PM
    Hi. I am trying to test that the proper google analytics codes (UA-121138725-17) and id's (G-R0YBPZ9SKQ) for page views and page events are showing on the google map page: outagemap.ma.nationalgridus.com. I searched and tried a couple things but nothing worked. Does anyone have an example custom command that would test this? One of the screenshots show the old style UA codes and the other shows the new GA style. I need to verify both in my cypress test. Thanks for any help!
    g
    • 2
    • 2
  • Cypress Github Action: Redirection on Login Times Out
    b

    blue-scientist-74268

    01/30/2023, 6:24 PM
    Hi, I previously posted this as an issue on the Github Action repository: https://github.com/cypress-io/github-action/issues/749 I'm running Cypress tests within an environment using Nx and Yarn. When I run tests for our login page they successfully pass on my machine but the test for a successful login always times out on the redirection and fails when running in a Github Action environment. Please see the issue link above for associated configurations and test files. Any suggestions you can offer are appreciated, thank you!
    e
    n
    • 3
    • 4
  • How can I replace a value in my cypress.config.js with a github secret?
    f

    faint-ocean-92094

    01/30/2023, 8:39 PM
    This may be a question for devops or something but I'm lost here. I define a task to entablish a DB connection through SSH in my cypress.config.js like this:
    Copy code
    on('task', {
      executeSql (sql, ...args) {
        return new Promise(async (resolve, reject)) => {
          try {
            let connection = await mysqlssh.connect(
              {
              host: "thisismyhostthatImnotsharing"
              user: "supersecretuser"
              privateKey: fs.readFileSync('cypress/fixtures/bd-ssh-key/id_rsa')
              },
              {
              host: "mysqlhost"
              user: "mysqluser"
              password: "mysqlpassword"
              database: "mysqlDatabase"
              });
            let result = await connection.promise().query(sql, args);
            mysqlssh.close();
            resolve(result[0][0]);
          } catch (err) {
            reject(err);
          }
        });
      }),
    })
    This is working perfectly fine locally because I have my SSH key file in the provided location
    privateKey: fs.readFileSync('cypress/fixtures/bd-ssh-key/id_rsa')
    The problem is that I can't commit this key into the repo. And what it has been requested is that I create a github secret with this key, and call it from there using
    ${{  secret.SSH_KEY  }}
    I have absolutely no idea how to do this. I though of storing the key in a variable, and passing it on as an argument in the execution command but it didn´t work. Any ideas?
    e
    n
    • 3
    • 5
  • Cypress conflicts with Jest
    e

    elegant-noon-34773

    01/30/2023, 9:22 PM
    Hello - I'm having issues with compiling my react project - I currently have jest setup perfectly fine, I'm trying to setup Cypress in my project. But it's conflicting with each other. Any ideas? my tsconfig.json :
    Copy code
    "types": ["cypress", "@testing-library/cypress", "node" ]
  • Any alternative packages to mysqlssh to create a DB connection through SSH?
    f

    faint-ocean-92094

    01/30/2023, 9:28 PM
    All tutorials or articles I found about connecting to a DB form cypress point to mysqlssh package. I've implemented and It works fine. I don't have any issues in cypress itself, but the package has 2 high severity vulnerabilities, so I'm been asked to replace it. Any recommendations on a good alternative?
12345...26Latest