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

    bright-twilight-69276

    01/12/2023, 9:19 PM
    This specifically talks about the describe block, not the it/specify blocks.
  • g

    gray-kilobyte-89541

    01/12/2023, 11:11 PM
    please read it again. Test isolation is for each test.
  • s

    some-boots-12634

    01/13/2023, 4:20 AM
    Coming from the PHP world, I'm getting up to speed on more recent Javascript language constructs and Cypress simultaneously. I have a somewhat expensive operation I'd like to perform only once with the result being stored in a variable. The function is currently in commands.js. It seems my choices are: • a global variable (var) • a module • a plugin • create an object with a static variable • a closure (somehow; can't seem to get it to work even after seeing the closure variables in https://glebbahmutov.com/blog/import-cypress-fixtures) • a dataSession (plugin by Gleb; see https://glebbahmutov.com/blog/faster-user-creation/) Some options seem like overkill or inelegant (overkill to make a module or plugin, inelegant to make an object). What are people mostly using for this situation?
  • g

    gray-address-77532

    01/13/2023, 5:23 AM
    Hey, I'm getting a pretty annoying error with my Cypress installation. v10.11.0. Cypress was working as expected, and the entire project was ESM, including package.json type: "module" being set. Due to some other circumstances, I needed to change some of the config files like webpack to commonjs and remove module type from package.json. Also using Typescript. Now when trying to run Cypress with either CJS or ESM, I'm getting these errors:
    Copy code
    Your configFile is invalid: path-to-project\cypress.config.js
    Error [ERR_REQUIRE_ESM]: require() of ES Module C:\\account-billing-reports\node_modules\colorette\index.js from C:\\account-billing-reports\node_modules\listr2\dist\utils\colorette.js not supported.
    Instead change the require of index.js in C:\\account-billing-reports\node_modules\listr2\dist\utils\colorette.js to a dynamic import() which is available in all CommonJS modules.
    I've tried reinstalling Cypress, clearing cypress cache then reinstalling, deleting node_modules then reinstalling, etc. can cypress run in a commonjs project?
  • h

    helpful-zebra-52877

    01/13/2023, 8:00 AM
    Hello. I'm having trouble with the migration from Cypress 10 to 12. Currently, trying to run tests causes Cypress to complain that the following line inside the support/e2e.js file has been deprecated:
    Copy code
    Cypress.Cookies.defaults({
        preserve: ['.ASPXAUTH', 'Authentication' ,'.JwtAuth', 'IPValidateCookie', 'VX', 'Culture']
    })
    Removing that line will allow Cypress to continue running tests, but only the first test in each file. (subsequent tests fail since the user no longer automatically gets/stays logged in) Your migration guide suggested replacing the line above with the following:
    Copy code
    beforeEach(() => {
        cy.session('unique_identifier', cy.login, {
           validate () {
            cy.getCookies().should('have.length', 2)
           },
           cacheAcrossSpecs: true
      })
    })
    but that doesn't seem to have the desired effect as now even the first tests no longer log in. The migration guide seems to assume the Cypress.Cookies.defaults is part of a Describe, rather than a line in the e2e.js. Any idea how to get my tests running again?
  • n

    narrow-cpu-2218

    01/13/2023, 9:09 AM
    hello, how can I store data to a variable from a request ? I’m using cy.request and then I use something like var id = response.body.id but it doesn’t work
  • a

    acceptable-hamburger-48790

    01/13/2023, 9:15 AM
    Did you try https://docs.cypress.io/guides/core-concepts/variables-and-aliases
  • b

    brash-plumber-67474

    01/13/2023, 9:20 AM
    Hi, Is there a method given by Cypress using which we can achieve parameterization in Cypress? Just like in jest we have
    it.each()
    .
  • g

    gray-kilobyte-89541

    01/13/2023, 11:33 AM
    https://glebbahmutov.com/blog/network-requests-with-cypress/ (you can always find things by searching https://cypress.tips/search)
  • g

    gray-kilobyte-89541

    01/13/2023, 11:33 AM
    https://github.com/bahmutov/cypress-each (you can always find things by searching https://cypress.tips/search)
  • b

    bumpy-insurance-8581

    01/13/2023, 1:15 PM
    Hello. Is it possible to check that a number is equals with a tolerance of 0.001 ? In C# we can do it using
    equalTo(something).within(0.001)
  • p

    powerful-orange-86819

    01/13/2023, 1:25 PM
    expect(number).to.be.closeTo(10, 0.001); will return true on everything that is within 0.001 of 10 read more about closeTo from https://www.chaijs.com/api/bdd/
  • s

    stocky-salesclerk-42224

    01/13/2023, 2:49 PM
    Hi there. I need your help. I need to send notification in slack via request about all test results. The request works fine in hooks and inside a test, but i use in support/e2e.js this code Cypress.on("after:run", (results) => { cy.request({ method: 'POST',.....} and it does not work for me.
  • g

    gray-kilobyte-89541

    01/13/2023, 3:08 PM
    do you have any other
    after:run
    events? https://github.com/cypress-io/cypress/issues/24410
  • s

    stocky-salesclerk-42224

    01/13/2023, 3:11 PM
    No, I don't. Only
    test:after:run
    and
    after:run
  • g

    gray-kilobyte-89541

    01/13/2023, 3:18 PM
    wait, where are you doing this? Look how I do it https://github.com/bahmutov/cypress-slack-notify
  • s

    stocky-salesclerk-42224

    01/13/2023, 3:27 PM
    I added code to support/e2e.js file
  • g

    gray-kilobyte-89541

    01/13/2023, 3:51 PM
    there is no
    Cypress
    "after:run" browser event, see https://docs.cypress.io/api/plugins/writing-a-plugin#The-following-events-are-available and https://docs.cypress.io/api/events/catalog-of-events
  • s

    some-boots-12634

    01/13/2023, 8:31 PM
    @gray-kilobyte-89541 I'm working through your "skills required by an automation engineer" (thank you for that resource) and have come across a possible typo. The description below mentions CircleCI but the references are all for Github Actions: running Cypress tests in parallel on CircleCI 1 2 3
  • g

    gray-kilobyte-89541

    01/13/2023, 8:55 PM
    yeah, copy/paste error, fixing it
  • p

    powerful-orange-86819

    01/14/2023, 10:07 AM
    Hey there I''ve made a report for my discord channel with the test results, heeres my example repo https://github.com/bixelbg/cypress-discord-webhook you can get a slack webhook and just adjust the code for slack formatting, I might soon update this repo with the code that sends each failed test and failed attempts too, because i've changed it a lot as of the last few weeks This code is inside the index.js and utilizes the after:run results from pipeline execution
  • c

    colossal-table-38461

    01/14/2023, 3:34 PM
    Hello All Good Morning!!! I need help or work-around for 1 scenario. Scenario : I am visiting the URL for Backend Application using cy.visit('/'), after executing the spec file on Runner, I can see URL of Log in Page of Microsoft Online (Microsoft Dynamics 365). But also in Runner it is showing Blank Screen. so No Action is performed in runner side. Can someone help me into this ? Also I tried to get that MicrosoftOnline URL & try to hit that but in that case also nothing is happened. (Also that URL is very huge) @gray-kilobyte-89541 , @magnificent-finland-58048 , @nutritious-restaurant-91514 , @careful-insurance-62240
  • a

    aloof-waiter-92540

    01/14/2023, 6:02 PM
    Hello All, i have a question does cypress allow scenario chat on the website? (open 2 browsers simultaneously, normal chrome and incognito) for example user 1 open in chrome, user 2 open in incognito, user 1 send message 1 and then user 2 send message
  • p

    plain-mechanic-5738

    01/15/2023, 4:43 AM
    Hello all, does anyone know to fix this issue? I am having that issue but the image is really visible
  • a

    acceptable-hamburger-48790

    01/15/2023, 5:43 AM
    As the error says opacity is set to 0 , i believe the parent elements opacity is set to non zero . So suggestion is to check the dom parent element of this image where opacity is not zero
  • p

    plain-mechanic-5738

    01/15/2023, 9:49 AM
    yes, I already checked the DOM. even though the opacity is 0, the image is still displaying. Hence, it should not error using should('be.visible')
  • p

    plain-mechanic-5738

    01/15/2023, 9:50 AM
    does anyone encountered this. They look very same but it shows an error
  • p

    plain-mechanic-5738

    01/15/2023, 9:50 AM
    i am using should('contain.text')
  • b

    bitter-fountain-36713

    01/15/2023, 5:24 PM
    Its part of the visibility check for cypress. You can check another prop on the element.
  • b

    bitter-fountain-36713

    01/15/2023, 5:26 PM
    Could be spacing format in the text that does show up on text string, but will for hex
1...248249250251252Latest