https://cypress.io logo
Join Discord
Powered by
# e2e-testing
  • o

    orange-fall-1554

    07/01/2022, 9:58 PM
    Hi all! Trying to upgrade from cypress 8 to cypress 10. Hoping to maintain compatibility with
    @vue/cli-plugin-e2e-cypress
    . Unfortunately it looks like something changed with
    package.json
    between cypress 8 and 10. I am not the best at understanding
    package.json
    specifics, but I've observed that cypress 8 did not have an
    exports
    section in its
    package.json
    whereas cypress 10 does have that
    exports
    section. A little spelunking in the
    @vue/cli-plugin-e2e-cypress
    source code indicates it is depending on
    @vue/cli-shared-utils
    's
    modules
    package, which functions to discover the filesystem location of the cypress executable with cypress 8, but does not in cypress 10. Instead, with cypress 10 it swallows this exception:
    Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './bin/cypress' is not defined by "exports" in /Users/.../repos/<my project>/node_modules/cypress/package.json".
  • o

    orange-fall-1554

    07/01/2022, 10:02 PM
    So, on a lark, locally in
    node_modules/cypress/package.json
    I added this code:
    Copy code
    ... "exports": { ...
         "./bin/cypress": {
          "import": "./bin/cypress",
          "require": "./bin/cypress"
        },
        ...
      }
    . Now, I have no idea what that actually does in terms of what the
    exports
    section is intended for. But it does restore compatibility of cypress 10 with
    @vue/cli-plugin-e2e-cypress
    . My question is: is this an illegitimate hack? Should the binary executable not actually be placed in the exports section of package.json, despite that this fixes that plugin? Or is it something that's acceptable to do, and
    @vue/cli-shared-utils
    is actually correct in expecting that export before determining that executable `bin/cypress`'s location?
  • o

    orange-fall-1554

    07/01/2022, 10:29 PM
    Actually, maybe this is pressing my luck, but ... if that's a hack, and it's not something that's appropriate to petition to be changed in cypress, then I'm still stuck. Another thing I tried was locally modifying
    node_modules/@vue/cli-plugin-e2e-cypress/index.js
    to no longer make that call to `@vue/cli-shared-utils`'s
    modules
    package in order to determine the location of the
    cypress
    executable. Instead, just use
    #{__dirname}/../../cypress/bin/cypress
    . Is there something horribly wrong with this? It does work, but if it did not bring problems with it I would've expected this implementation to begin with, rather than the complex
    require
    -based approach in
    @vue/cli-shared-utils/lib/module.js
    , which seems to expect that the binary be in the
    exports
    section of cypress 10's
    package.json
    . What's the right way to go about trying to achieve cypress 10 compatibility with
    @vue/cli-plugin-e2e-cypress
    given the nature of this issue?
    • 1
    • 1
  • f

    fresh-nail-30646

    07/02/2022, 2:35 AM
    I've got a question. Using Typescript, if I'm trying to pass the result of a
    cy.get()
    call as a parameter, what's the best type to use for the parameter. Below is an example of what I'm trying to do with the ?? as the placeholder for the type I'm trying to figure out.
    Copy code
    tableHead = () => { return cy.get(".MuiTableCellhead") }
    clickTableHead(element: ??) {
        element.click();
    }
    My IDE is suggesting
    () => Cypress.Chainable<JQuery<HTMLElement>>
    , but that just ends up throwing more errors.
  • c

    careful-train-38757

    07/02/2022, 9:40 PM
    Hey guys, I'm trying to test prefers-color-scheme and I keep running into this error. Can you help me solve this?
  • w

    wooden-teacher-96595

    07/04/2022, 7:39 AM
    hey all, is there any way to test the response time of a call or how long a component takes to load?
  • b

    bitter-match-90736

    07/04/2022, 10:29 AM
    Why you use beforeEach for your test? for my opinion is enough to check once
  • g

    gray-kilobyte-89541

    07/04/2022, 1:06 PM
    I cover this in my "Cypress Network Testing Exercises" course https://cypress.tips/courses/network-testing
  • f

    fresh-doctor-14925

    07/04/2022, 1:25 PM
    Can recommend. I'm working through this course atm and I am learning a lot
  • w

    wooden-teacher-96595

    07/04/2022, 2:04 PM
    awesome stuff, this will really be helpful as the info I found was quite sparse
  • b

    better-tomato-32700

    07/04/2022, 3:10 PM
    Heyy guys - Good day Is there a way to start an automated testing at a specific part or period in time. ? For example , I want to start a automated test when I have bypassed or perform certain action(s) in the web application I am testing. Then I want to run that test once I have done that.
  • c

    careful-train-38757

    07/04/2022, 5:14 PM
    When I remove beforeEach with cy.visit, my tests fail.
  • b

    bitter-fountain-36713

    07/04/2022, 5:40 PM
    That is something from the application code, not related to your Cypress tests. You can either have it fixed or use
    Cypress.on('uncaught:exception')
    to ignore that app error.
    Copy code
    Cypress.on('uncaught:exception', (err, runnable) => {
      // returning false here prevents Cypress from
      // failing the test
      if(err.message.includes('sql.addListener is not a function')) {
        return false
      }
    })
  • b

    bulky-manchester-97357

    07/04/2022, 8:30 PM
    I want to put a modified 3rd-party addon into the cypress/commands.ts file since leaving it inside the original node-modules folder is a no-no. How should I go about doing this?
  • b

    bulky-manchester-97357

    07/04/2022, 8:31 PM
    Currently, commands.ts seems to initialize the entire thing by importing the command.js file from the node-modules folder (the one with the modified addon) and calling it:
  • b

    bulky-manchester-97357

    07/04/2022, 8:31 PM
    Copy code
    const compareSnapshotCommand = require('cypress-image-diff-js/dist/command');
    compareSnapshotCommand();
  • b

    bulky-manchester-97357

    07/04/2022, 8:32 PM
    The inverse command is the modified bit I want to move to being defined inside commands.ts
  • f

    fresh-crowd-34032

    07/04/2022, 9:18 PM
    hi everyone, we are using cy.request in our test project, mainly for creating test data using our application REST. we enabled 'retryOnStatusCodeFailure' property but noticed the retryIntervals are too short for us and wanted to increase them. when trying to set retryIntervals on our cy.request TSC is screaming it does not exist in type 'Partial. so how do change retryIntervals default value ?
  • q

    quaint-kangaroo-22871

    07/05/2022, 6:46 AM
    Hello guys, I am using
    next-auth0
    and trying to do the login using
    cy.origin
    but the login result keep failing and showing this error in the page
    checks.state argument is missing
    But when I do manual login outside cypress, it is working fine. Let me know if you find the same issue and solve it before
  • s

    swift-kitchen-62493

    07/05/2022, 7:19 AM
    Hi, how can i run multiple test case?
  • m

    magnificent-finland-58048

    07/05/2022, 11:16 AM
    Arrange | Act | Assert are you asking what you are allowed to do in Arrange / Setup? Anything. Seed the database, make api calls, get things ready so that you can act and assert
  • m

    magnificent-finland-58048

    07/05/2022, 11:18 AM
    no multiple. You run 1 or you run all in open mode. Or you can just use cy:run here's a PR for the run-all workaround https://github.com/muratkeremozcan/react-hooks-in-action-with-cypress/pull/153/files then you have Gleb's blog post https://glebbahmutov.com/blog/run-all-specs-cypress-v10/
  • b

    better-tomato-32700

    07/05/2022, 11:18 AM
    Heyy Murat, ohh something like that That really isnt the issue to be honest. But was just thinking out loud to know. Do you think its possible ?
  • m

    magnificent-finland-58048

    07/05/2022, 11:19 AM
    it is at Extend they were using WebdriverJs a long time ago they would have to set things up with Postman, and run e2e locally after that... We brought cypress, you can do both automated
    b
    • 2
    • 14
  • b

    better-tomato-32700

    07/05/2022, 11:19 AM
    The initial issue is that I am unable to bypass the Cookies Must be enabled for Github section when I am doing authentication there
  • m

    magnificent-finland-58048

    07/05/2022, 11:20 AM
    I see login is hard, but this can help https://github.com/lirantal/cypress-social-logins I haven't had to use it
    b
    • 2
    • 10
  • a

    ancient-park-71356

    07/05/2022, 11:45 AM
    Hello guys, is there any option to get div element which have child span with some text but not yield the child span element, I mean something like this: cy.get('element1').contains('childElement_with_text').should('element1')
  • a

    ancient-park-71356

    07/05/2022, 11:46 AM
    I want to work on first element and I need to find it via text but '.contains()' yields span with text
  • m

    magnificent-finland-58048

    07/05/2022, 12:22 PM
    maybe
    prev()
    or
    parent()
    , or a combo https://docs.cypress.io/api/commands/prev
  • a

    ancient-park-71356

    07/05/2022, 12:23 PM
    But the problem is that it's bigger structure like: element1>div>div>span
1...636465...192Latest