https://cypress.io logo
Join Discord
Powered by
# help
  • f

    future-city-90468

    06/13/2022, 7:04 AM
    What is the best way in the Cypress UI to debug and see what keys and values were present in Local Storage and Session Storage at a specific step? Background: I'm using cy.session() and it seems that while the UI says the session is restored before each test, some Storage values simply are not available. I tried, in the UI, to click on steps with F12 DevTool, but DevTool doesn't go 'back in time' with the steps
  • f

    fresh-doctor-14925

    06/13/2022, 7:06 AM
    I haven’t found a way to do it with time travel, so you might be stuck with trusty
    console.log
    🙂
  • a

    average-fountain-87572

    06/13/2022, 8:58 AM
    @gray-kilobyte-89541 I managed to get Cypress grep up and running the way you've instructed at your blog. Thanks! 🙂 I have a question though: Is there any way to stop Cypress from running beforeEach functions for each describe when I'm running only certain tests with grep? For example I have one '@smoke' tag and run it --> cypress still goes through all my test files and runs every beforeEach but skips every it().
  • g

    gray-kilobyte-89541

    06/13/2022, 10:33 AM
    cy.contains
    can be its own top-level command that finds the element on the page, no need to use cy.get with it.
  • g

    gray-kilobyte-89541

    06/13/2022, 10:34 AM
    I don't know why it would do this, please see the repo's README, maybe you want to use omit spec files option.
  • a

    average-fountain-87572

    06/13/2022, 10:36 AM
    Ok, thanks. I will read it right away. For some reason Cypress wants to run them for me and I have not figured out why. Because of the application structure my before and beforeEach functions can be quite long and they are actually the main culprits that make my tests time consuming.
  • f

    fresh-doctor-14925

    06/13/2022, 10:51 AM
    Got it. But to be clear it won’t retry a chained
    get()
    like
    should()
    would? I have a
    getByTestId()
    helper function to save us writing out
    [data-test-id=…]
    for every time we want to get an element. Just want to make sure I’ve not been giving bad advice the past couple of years
  • f

    flaky-airport-12178

    06/13/2022, 4:02 PM
    Thanks. Let me check
  • g

    gray-kilobyte-89541

    06/13/2022, 6:54 PM
    yes it will. And for more examples of selecting by text see https://glebbahmutov.com/cypress-examples/9.7.0/commands/querying.html and other recipes there
  • p

    purple-receptionist-78904

    06/13/2022, 8:19 PM
    hello! I have a problem with my company project after switching from ver 9 to 10. I am using windows 11. When I type:
    npx cypress open
    the cypress window is visible for a few seconds (to choose between e2e and component testing) and later disappears 😦 It is working fine when running in headless mode (
    npx cypress run
    ) and on CI/CD. What can I do with this? Thanks!
  • b

    bitter-vase-17481

    06/13/2022, 8:42 PM
    I see an issue in GitHub that seems similar to what you're describing here. It seems to be under investigation currently, but there may be an option within the discussion that resolves your issue: https://github.com/cypress-io/cypress/issues/22064
  • p

    purple-receptionist-78904

    06/13/2022, 8:55 PM
    many thanks! indeed a huge topic. But running the terminal as administrator works fine for me as a workaround 💪
  • a

    ancient-park-71356

    06/13/2022, 9:37 PM
    Hello guys, I have a little problem, I want to download cypress on client virtual machine but I have an error "Error: connect ETIMEDOUT" I've already add HTTP_PROXY provided by client Devops, I had the same problem on first step downloading cypress- with node_modules but after adding correct proxy it was solved, but now it's not working with cypress. Do you maybe know how to solve it? It's Windows, I tried in simple terminal and in Powershell, in Powershell after using "Get-ChildItem Env:" my HTTP_PROXY is displayed, so it's added. For HTTP_PROXY I have: 'http:// company.corp/repository/cypress/'
  • e

    eager-refrigerator-15324

    06/13/2022, 10:05 PM
    After upgrading to version 10, I'm getting the following error when trying to run `npx cypres open`:
    Copy code
    Error: Cannot find module 'C:\Users\User'
    Require stack:
    - internal/preload
        at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
        at Function.Module._load (node:internal/modules/cjs/loader:778:27)
        at Module.require (node:internal/modules/cjs/loader:1005:19)
        at Module._preloadModules (node:internal/modules/cjs/loader:1280:12)
        at loadPreloadModules (node:internal/bootstrap/pre_execution:476:5)
        at prepareMainThreadExecution (node:internal/bootstrap/pre_execution:77:3)
        at node:internal/main/run_main_module:7:1 {
      code: 'MODULE_NOT_FOUND',
      requireStack: [ 'internal/preload' ]
    }
    I feel like the problem is that there is a space in the file path (ex:
    C:\Users\User A\
    ). Has anyone else faced this issue and found a solution short of creating a new user?
    s
    h
    • 3
    • 7
  • i

    incalculable-fall-95048

    06/13/2022, 10:58 PM
    Hey guys! Do you know why I run
    npx cypress open
    the created files are .js and not .ts?
  • i

    incalculable-fall-95048

    06/13/2022, 10:59 PM
    I don't know how to control that
  • i

    incalculable-fall-95048

    06/13/2022, 11:04 PM
    This happens when I try to run the command in a folder that it's not my root directory
  • w

    worried-parrot-50579

    06/14/2022, 6:35 AM
    Hi guys, I need to automate a scenario where I am logged in as 2 users: as a regular user and as his supervisor. The user will perform an action and the test should verify how this action is reflected in the supervisor view. Then a user performs another action and we test supervisor screen appearance again. Etc for several additional scenarios. I tried to achieve it using the same tab and switching between the 2 kinds of users (logout+login) but this is not exactly the end-user flow. How can I better achieve it considering Cypress limitations of interacting with 2 tabs?
  • s

    swift-angle-95455

    06/14/2022, 7:09 AM
    Hello folks! Why
    cypress-realworld-app
    uses XState? Is XState a widely-used library? Does it act like Redux? I was digging into the code trying to understand how to test, but I ran into not knowing how the signup form (frontend) works because there are
    authService
    ,
    sendAuth
    ,
    useActor
    , and I was expecting something like axios or fetch doing a POST request to the backend.
  • s

    swift-angle-95455

    06/14/2022, 7:20 AM
    After upgrading to version 10 I m
  • e

    early-manchester-55187

    06/14/2022, 7:57 AM
    Hi everybody. I am facing following issue since upgrading to cypress v10: When I run my specs headlessly, I am receiving a report for single and for all specs. In both cases, the reference to the respective spec used to be a relative path below my integration folder (e.g. api/customer/example.spec.ts). Nw, since cypress v10, the reference is only the spec name (e.g. "example.spec.ts"). This makes especially the full result report rather hard to read, as I have various test with identical file names. Is there any way to configure the way the results are printed? See attachments for examples. Thanks, Max
  • f

    fresh-doctor-14925

    06/14/2022, 8:03 AM
    I think your approach is fine, considering Cypress can’t do multiple tabs Couple of points: You can use
    cy.session()
    to cache your users’ sessions, saving you from having sign in/sign out steps https://docs.cypress.io/api/commands/session If possible , you could consider doing some of the actions via API. Doing it all via UI sounds quite laborious
    w
    • 2
    • 3
  • b

    brave-processor-66066

    06/14/2022, 8:23 AM
    How to connect to debug a Web Page Site, locally vscode { "type": "chrome", "request": "launch", "name": "client: chrome", "url": "http://localhost:3000", "webRoot": "${workspaceFolder}", "resolveSourceMapLocations": [ "${workspaceFolder}/**", "!**/node_modules/**" ] } how do i connect to the site window in cypress, i have to use "Attach to Chrome"? but how ?!
  • g

    gentle-accountant-4760

    06/14/2022, 8:44 AM
    Hello people! Just came from vacation and I missed all the updates from 9.6 up to 10! Very nice with huge update however I do seem to have some issues going from 9.x to 10. I see there is a need to go from cypress.json to cypress.config.ts and I did it by doing:
    Copy code
    ts
    import { defineConfig } from 'cypress';
    
    export default defineConfig({
      chromeWebSecurity: false,
      reporter: 'spec',
    
      reporterOptions: {
        toConsole: true,
      },
    
      defaultCommandTimeout: 60000,
      experimentalInteractiveRunEvents: true,
      userAgent: 'KP-CYPRESS-TEST',
    });
    but whenever I run the script, Ic annot seem to find any of my test anymore
  • g

    gentle-accountant-4760

    06/14/2022, 8:50 AM
    It looks like you cannot find any test anymore through the integration folder anymore?
  • e

    early-manchester-55187

    06/14/2022, 9:03 AM
    The integration folder needs to be renamed to "e2e" (or "component" respectively). The "support/index.ts" file needs to be renamed to "support/e2e.ts" (or "support/component.ts" respectively). Running cypress open command, the ui should assist you in the migration process.
  • g

    gentle-accountant-4760

    06/14/2022, 9:05 AM
    Oh I see, what about the cypress/support/commands.ts ?
  • g

    gentle-accountant-4760

    06/14/2022, 9:05 AM
    because im getting this error atm:
  • f

    fresh-doctor-14925

    06/14/2022, 9:07 AM
    It looks like that environment variable isn’t being passed to Cypress
  • g

    gentle-accountant-4760

    06/14/2022, 9:07 AM
    Weird, I mean it worked fine before in 9.x so not sure what could have been changed since then
1...838485...252Latest