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

    stale-furniture-7985

    11/15/2022, 9:33 PM
    How could I solve this "issue". I have invoked first date, and it shows the current date and hijri calendar. To make assertion, I have imported dayjs, localized it, and tried to compare between two calendar. Although, the text is nearly similar, i am getting this error, because obviously there is difference in text. What should I use to overrun this problem and to make this assertion correct.
  • s

    stale-ambulance-65138

    11/16/2022, 7:37 AM
    hi, I'm trying to programmatically register a user using cy.request. Can anyone advise me what to do about properties that contain hyphen? It causes syntax error:
  • b

    busy-wall-71096

    11/16/2022, 8:00 AM
    Wrap them with parentheses. E.g.:
    Copy code
    {
      'key-name': 'value',
    }
  • s

    stale-ambulance-65138

    11/16/2022, 8:11 AM
    thank you it helped
  • s

    stale-ambulance-65138

    11/16/2022, 8:34 AM
    also I would like to run different sets of tests based on environment, for example for e-commerce website project I would like to run full script but for production environment I would like to run only part of the script...so either running the same script but some functions would not run (paying with card in paygate) or have two separate scripts, one that would run only for test env and one that would run only for prod env. Is that possible?
  • b

    busy-wall-71096

    11/16/2022, 9:34 AM
    also I would like to run different sets
  • b

    busy-wall-71096

    11/16/2022, 9:57 AM
    πŸ‘† Bumping this up as I still were unable to resolve it while it seems to be a rather trivial problem on how to use
    cy.intercept
    correctly for such common use case πŸ€”
  • f

    few-oyster-82478

    11/16/2022, 10:35 AM
    for anyone using cucumber, is it possible to use
    And
    somehow in the steps?, it seems the selector it's not available from
    cypress-cucumber-preprocessor
    , should I just use
    Then
    instead?
    Copy code
    Example: And
      Given one thing
      And another thing
      And yet another thing
      When I open my eyes
      Then I should see something
      And I shouldn't see something else
  • m

    mysterious-belgium-25713

    11/16/2022, 10:40 AM
    Yeah in one of the latests versions of the cucumber plugin, they removed AND and another keyword. You should just chain WHEN and THEN and not use the AND keyword
  • b

    brash-scientist-28014

    11/16/2022, 10:55 AM
    Did anyone ever got this error? (uncaught exception)Error: sync:during:user:test:execution failed to receive a response from the primary Cypress spec bridge within 1 second. Error The following error originated from your test code, not from Cypress. It was caused by an unhandled promise rejection. > sync:during:user:test:execution failed to receive a response from the primary Cypress spec bridge within 1 second. When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
  • b

    brash-scientist-28014

    11/16/2022, 10:55 AM
    there is not a specific step where this error occurs
  • s

    stale-ambulance-65138

    11/16/2022, 12:14 PM
    I tend to use this:
  • s

    stale-ambulance-65138

    11/16/2022, 12:15 PM
    Cypress.on('uncaught:exception', (err, runnable) => { // returning false here prevents Cypress from // failing the test return false })
  • b

    brash-scientist-28014

    11/16/2022, 12:15 PM
    Where in the test do you put it?
  • s

    stale-ambulance-65138

    11/16/2022, 12:17 PM
    I think it should go right behind the line of code that triggers the error
  • s

    stale-ambulance-65138

    11/16/2022, 12:18 PM
    and if not then try it beforeπŸ˜„
  • b

    brash-scientist-28014

    11/16/2022, 12:18 PM
    yeah thats the thing. It does not happen on the same step all the time.
  • m

    mysterious-belgium-25713

    11/16/2022, 12:42 PM
    I add this code in the commands.js or in the index.js
  • s

    stale-ambulance-65138

    11/16/2022, 12:43 PM
    great idea, never occured to me this solution...
  • b

    brash-scientist-28014

    11/16/2022, 1:25 PM
    how would you add it to the commands.js
  • b

    brash-scientist-28014

    11/16/2022, 1:26 PM
    i am not using it yet.... still on the pageobjects method πŸ™ˆ
  • b

    brash-scientist-28014

    11/16/2022, 1:55 PM
    @mysterious-belgium-25713
  • m

    mysterious-belgium-25713

    11/16/2022, 1:57 PM
    Just add it in the file. Cypress loads the commands.js file from the start so you don't have to do anything special
  • m

    mysterious-belgium-25713

    11/16/2022, 1:57 PM
    The file should be created by Cypress
  • s

    stale-ambulance-65138

    11/16/2022, 3:33 PM
    just paste the whole block in...nothing complicated...
  • b

    big-sundown-77934

    11/16/2022, 3:39 PM
    A very beginner question. I created an empty project yesterday with
    npm init vue@latest
    , which runs create-vue, and I opted in to vitest for unit testing and cypress for e2e testing from the options there. I ran cypress with
    npx cypress open
    To run my first cypress e2e test, should I run
    npm run dev
    , or
    npm run build
    and set up a web server to go with it?
  • b

    big-sundown-77934

    11/16/2022, 3:48 PM
    Ah, from this video (at this time bookmark), it looks like it would be standard to run it with `npm run dev`:

    https://youtu.be/x0QuiEJUf6s?t=331β–Ύ

  • b

    big-sundown-77934

    11/16/2022, 3:53 PM
    I tried to do that and ran into problems. The first problem was the port -- npm started my server on 5173, and cypress was expecting 4173. I tried to adjust the ports by using these commands:
    Copy code
    npm run dev -- --port 4173
    npx cypress open -- --port 4173
    the warning that I saw before disappeared, so it seemed like that had resolved the port issue
  • b

    big-sundown-77934

    11/16/2022, 3:55 PM
    so in cypress I went to e2e testing, selected Chrome, and clicked the example test. This is still the default app created by
    npm init vue@latest
    , I haven't changed anything. But it made cypress error, saying my config file has crashed
  • b

    big-sundown-77934

    11/16/2022, 3:58 PM
    Would this be an issue with using vite instead of webpack? I see webpack was referenced in some paths:
    Copy code
    Error: error:0308010C:digital envelope routines::unsupported
        at new Hash (node:internal/crypto/hash:67:19)
        at Object.createHash (node:crypto:130:10)
        at module.exports (/home/jrefior/.cache/Cypress/10.11.0/Cypress/resources/app/node_modules/webpack/lib/util/createHash.js:135:53)
1...143144145...192Latest