https://cypress.io logo
Join DiscordCommunities
Powered by
# e2e-testing
  • f

    flat-electrician-52949

    05/27/2021, 4:05 PM
    I noticed a false positive in some test because the interception did not happen
  • f

    flat-electrician-52949

    05/27/2021, 4:05 PM
    Was doing the assertion with an expect on the req.body
  • s

    stocky-dream-36427

    05/27/2021, 6:37 PM
    Right you're trying to do API testing. @User
  • f

    flat-electrician-52949

    05/27/2021, 9:00 PM
    Not really API testing.. for that I would use
    cy.request()
    and therefore know which endpoint I'l hitting and intercepting.
  • f

    flat-electrician-52949

    05/27/2021, 9:00 PM
    I'm intercepting with globs and if I mess up a glob it will be a false positive test
  • f

    flat-electrician-52949

    05/27/2021, 9:03 PM
    Have been looking a lot in the docs and for some good recipes to follow. There is a lot of info and a ton of ways to tests. I just noticed that the intercept has a counter on how many times it was hit - would like to get in and read that..
  • f

    flat-electrician-52949

    05/27/2021, 10:07 PM
    (side question but related: if I do a
    req.destroy()
    it get's handled by my error handling but I still see an POST failure error in the console.log (not causing tests to fail) - the docs mention the destroy() but that I need to do some catching or alike - is it just fine to have that error in the console?)
  • s

    stale-optician-85950

    06/01/2021, 9:00 PM
    @User I use this package in my GH workflow to copy the test assets (screenshots & videos) to GH Pages: https://github.com/peaceiris/actions-gh-pages It also creates a new branch in your repo called gh-pages with all these assets too. Super super useful.
  • f

    future-journalist-95278

    06/02/2021, 11:03 PM
    What's the best way to get the URL parameters when testing a NuxtJS project?
  • b

    bulky-sundown-74498

    06/02/2021, 11:04 PM
    Probably URLSearchParams https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams
  • b

    bulky-sundown-74498

    06/02/2021, 11:05 PM
    Remember, you are running all the tests in the browser (with a reporting in node)
  • b

    bulky-sundown-74498

    06/02/2021, 11:06 PM
    new URLSearchParams(window.location.href)
    will work on all browsers supported by cypress
  • b

    bulky-sundown-74498

    06/02/2021, 11:07 PM
    @User I might have misunderstood your question though. If so, can you precise where you want to access the params
  • f

    future-journalist-95278

    06/02/2021, 11:09 PM
    Thank you @User. I think that's exactly what I needed actually.
  • c

    cool-application-67821

    06/03/2021, 7:29 PM
    I was able to successfully setup compoent and e2e testing for my reach app using cypress, however I am trying to get the coverage setup
  • c

    cool-application-67821

    06/03/2021, 7:31 PM
    how do I get the coverage for both in a single file? When i do cypress run it runs just e2e, i dont think i should specific in config to incldue component files as well since that requires a sepearate web dev server Is there a single command to get coverage from both e2e and component coverage? or do i need to run them separately and then do a nyc merge?
  • b

    bulky-sundown-74498

    06/03/2021, 7:35 PM
    @User if I really wanted to combine both coverage, I would use the istanbul report since istanbul-combine is deprecated https://github.com/jamestalmage/istanbul-combine/issues/2
  • b

    bulky-sundown-74498

    06/03/2021, 7:43 PM
    But I always get that itch when I have to mix covergae from sources of different origins
  • b

    bulky-sundown-74498

    06/03/2021, 7:44 PM
    The coverage you obtain from e2e should be distinguishable from the one you get from component
  • b

    bulky-sundown-74498

    06/03/2021, 7:45 PM
    @User I take you to be the expert of coverage, what is your take on this approach ?
  • b

    bulky-sundown-74498

    06/03/2021, 7:48 PM
    I guess, according to this article from your blog, https://glebbahmutov.com/blog/combined-end-to-end-and-unit-test-coverage/ this is a good way to get to 100% test coverage...
  • b

    bulky-sundown-74498

    06/03/2021, 7:49 PM
    So in theory if you run both commands
    run
    &
    run-ct
    successively, you should get combined code coverage
  • c

    cool-application-67821

    06/03/2021, 10:39 PM
    Ok let me try that. ALso just curous why should the coverage from e2e be distinguishable from one u get from component? All that matters to a developer is an app X and it having a coverage y% including unit, integration and acceptance
  • c

    cool-application-67821

    06/03/2021, 10:45 PM
    This is my current plugin file, will using browserify-preprocessor make things any different since that is also just including babelrc?
  • c

    cool-application-67821

    06/03/2021, 10:50 PM
    P.S. I am not having issues with unit testing, it is mainly with component testing since the runner for component testing is different and doesnt run within cypress run or cypress open and instead runs using cypress open-ct or cypress run-ct, running cypress run --spec ..... or cypress run --group ....might not help is what I feel since component testing uses its own web dev server environment to run
  • c

    cool-application-67821

    06/03/2021, 10:51 PM
    "So in theory if you run both commands run & run-ct successively, you should get combined code coverage" If I do this i believe it just replaces one after another, is there a config location where I can specifcy where to save the coverage separately for component and e2e, may be i can merge them using nyc later
  • c

    cool-application-67821

    06/03/2021, 10:55 PM
    ah it looks like cypress run-ct saves the coverage in a separate components folder
  • c

    cool-application-67821

    06/03/2021, 10:59 PM
    u r right looks like running cypress run && cypress run-ct did combine them, awesome. Thanks a bunch. I had only triped cypress open and cypress open-ct, that replaces the coverage, cypress run & run-ct combines it
  • c

    cool-application-67821

    06/03/2021, 10:59 PM
    tried*
  • b

    bulky-sundown-74498

    06/03/2021, 11:10 PM
    Why should it be distinct: It comes down to why we test, why we component test and why we e2e test
1...678...192Latest