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

    helpful-plumber-53987

    06/17/2022, 11:47 AM
    Hi Cypress Community. I intercepted and waited for my api call on my app which worked perfectly. It returned status - running as you can see on the screenshot the app is constantly fetching (until the status is completed) Now I'd like to do the same with cypress, 'wait until the status is completed' Anyone an idea how to do it?
    b
    • 2
    • 1
  • c

    careful-tent-30457

    06/17/2022, 11:49 AM
    Hey all. I'm in the middle of upgrading from Cypress 9 to Cypress 10 for a Vite / React project. I've gotten all my Component tests working fine but my e2e tests are failing with an Webpack error
    Copy code
    Error: Webpack Compilation Error
    ./node_modules/@fontsource/inter/300.css 2:0
    Module parse failed: Unexpected character '@' (2:0)
    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
    | /* inter-cyrillic-ext-300-normal*/
    > @font-face {
    |   font-family: 'Inter';
    |   font-style: normal;
     @ ./src/theme/Theme.tsx 3:0-35
     @ ./src/libs/contexts/AppTheme.tsx
     @ ./cypress/support/commands.tsx
     @ ./cypress/support/e2e.ts
    ...
  • a

    acoustic-magazine-89269

    06/17/2022, 1:37 PM
    Ive tried that The below works fine
    cy.route("**/user/list", user.standard).as("getUsers")
    but these do not
    cy.intercept("**/user/list", user.standard).as("getUsers")
    `cy.intercept("**/user/list", {fixture:"user.standard"}).as("getUsers")`// this will throw an error as it looks for the file extension
    cy.intercept("**/user/list", {fixture:user.standard}).as("getUsers")
  • f

    fresh-doctor-14925

    06/17/2022, 1:50 PM
    Ok, that sounds like a difference between how the two versions look for fixtures. It's been a long while since I moved away from
    cy.route()
    . Maybe you'll find something useful in the fixture docs: https://docs.cypress.io/api/commands/fixture#Syntax
  • a

    acoustic-magazine-89269

    06/17/2022, 1:51 PM
    ill take a look and see! Thanks @fresh-doctor-14925
  • g

    gray-kilobyte-89541

    06/17/2022, 2:14 PM
    https://glebbahmutov.com/blog/cypress-timestamps/
  • b

    brainy-engine-84010

    06/17/2022, 2:28 PM
    hello, I am trying to integrate Cypress with my jira but when i link cypress link to a jira issue it asks me to login to cypress but after login in to Cypress using github account i am getting error
  • c

    cuddly-notebook-88094

    06/17/2022, 2:43 PM
    Anyone know of a new tutorial for implementing cypress with cucumber? The package dont seem to work now with upgrade. Using JavaScript
  • l

    late-house-1562

    06/17/2022, 3:04 PM
    I've got this in a
    commands.ts
    file:
    Copy code
    ts
    Cypress.Commands.add("dbConnection", async () => {
      return await MongoClient.connect("mongodb://root:example@localhost:27017")
    })
    But when I try to use it in a test as
    const dbConnection = cy.dbConnection()
    I get an error:
    TypeError: url_1.URL is not a constructor
    If I include the
    connect
    code in a plugin file, it works. Any ideas why?
  • l

    late-house-1562

    06/17/2022, 3:08 PM
    Full stacktrace: https://pastebin.com/bXX10yXn
  • s

    swift-controller-90067

    06/17/2022, 3:14 PM
    hi, managed to get my e2e tests running in gitlab but some fail, all because of
    Copy code
    is being covered by another element:
    `<iframe id="webpack-dev-server-client-overlay"
    anyone else seen this? I can only find one google result which didn't help. my gitlab cicd yml is ```yml stages: - test test: image: cypress/browsers:node12.14.1-chrome85-ff81 stage: test script: - npm ci - npm start & - npx cypress run```it's a react project
  • n

    nutritious-honey-65632

    06/17/2022, 3:20 PM
    if you run these 3 commands locally, it should fail for the same reason
  • s

    swift-controller-90067

    06/17/2022, 3:28 PM
    that appears to be false. but even if it were true, how is it meant to help?
  • l

    late-house-1562

    06/17/2022, 3:36 PM
    I'm willing to do a bug report, but want to rule out something dumb on my part first.
  • s

    swift-controller-90067

    06/17/2022, 3:44 PM
    it's a react project, if that makes a difference
  • a

    astonishing-florist-44168

    06/17/2022, 4:09 PM
    Hi everyone! I need some help, I just started taking a look at Cypress 10 and I was wondering how could I load .env variables to use them in the cypress.config.ts file Thanks in advance!
  • c

    cuddly-thailand-33926

    06/17/2022, 4:19 PM
    How do I get my custom commands suggested when I type cy. ? (It's imported in index.js)
  • l

    late-house-1562

    06/17/2022, 4:22 PM
    In my
    support
    directory, I have an
    index.d.ts
    file:
    Copy code
    ts
    declare namespace Cypress {
      interface Chainable {
        dbConnection(),
        register(dbConnection, userId: string, apiToken: string): void
      }
    }
    This works for me to make vscode suggest them.
  • l

    late-house-1562

    06/17/2022, 4:54 PM
    This is a quote from learn.cypress.io: "You may be wondering why we have created this as a task instead of a Custom Cypress Command. The reason is that Cypress tasks run in Node, while Cypress Custom Commands run in the browser." Does this mean I shouldn't be trying to use custom commands if I'm not testing components or other browser code? If, instead, I'm only testing a nodejs app?
  • i

    incalculable-oyster-76116

    06/17/2022, 6:17 PM
    Hi! On https://learn.cypress.io/testing-your-first-application/installing-cypress-and-writing-our-first-test, "Create a new file called app.spec.js within the cypress/integration directory" is displayed yet there is no integration directory. Perhaps cypress-realworld-testing-todomvc\cypress\e2e is the correct directory for the app.spec.js file. Please confirm. Thanks!
  • b

    bitter-fountain-36713

    06/17/2022, 6:24 PM
    running api call
  • i

    incalculable-oyster-76116

    06/17/2022, 6:52 PM
    Similarly, the references to app.spec.js require revision for the E2E testing option; app.cy.js is accurate. My hope is that someone keeps learn.cypress.io current.
  • m

    magnificent-finland-58048

    06/17/2022, 6:57 PM
    you might have to "fill in the blanks" here and there one version of the solutions can be found here https://github.com/muratkeremozcan/nextjs-cypress
  • m

    magnificent-finland-58048

    06/17/2022, 6:58 PM
    can you share the link? I helped contribute to the content, but even I am confused by this šŸ™‚ Is it talking about cy.task there? That is the node code.
  • l

    late-house-1562

    06/17/2022, 7:16 PM
    https://learn.cypress.io/real-world-examples/custom-cypress-commands at the bottom of the
    cy.database
    section.
  • l

    late-house-1562

    06/17/2022, 7:18 PM
    So if I want to connect to a Mongo database, I need that code in a
    cy.task
    which I can then call from a custom command?
  • l

    late-house-1562

    06/17/2022, 7:28 PM
    I will try to follow the
    cy.database
    example more closely and see if I can resolve my issue above.
  • d

    dazzling-orange-32131

    06/17/2022, 7:31 PM
    Are you getting a webpack compilation error?
  • l

    late-house-1562

    06/17/2022, 8:02 PM
    Here is where I am now. My task:
    Copy code
    ts
            async dbConnection(url) {
              try {
                return await MongoClient.connect(url)
              } catch (error) {
                console.error("Couldn't connect.")
              }
            },
    My custom command:
    Copy code
    ts
    Cypress.Commands.add("getDbConnection", (url) => 
      cy.task("dbConnection", url))
    Running
    cy.getDbConnection
    leads to this error: https://pastebin.com/h6eCXQtZ
  • b

    big-house-71117

    06/17/2022, 8:24 PM
    Hi! I’m new
1...899091...252Latest