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

    eager-airplane-22433

    11/07/2022, 2:14 PM
    Hi 👋, I'm using cypress to interact with an external stub service (a local fork of a blockchain). I'm noticing that the support module is loaded several times. (once per test file plus one). Is there a way to prevent this as test setup being run several times at once, which is causing things to be put into an inconsistent state as it's effectively creating a race condition
  • f

    fresh-doctor-14925

    11/07/2022, 2:20 PM
    I think this is more about how you've currently set up your support steps. Are you running a
    beforeEach()
    instead of a
    before()
    ? Using the
    before()
    step means it's only done once before the spec file runs, rather than once for each
    it()
  • e

    eager-airplane-22433

    11/07/2022, 2:26 PM
    @fresh-doctor-14925 It is in a
    beforeEach()
    but that's intentional so that we can reset the state of the local chain between tests. The problem is that the module to loaded several times and that means all the hooks run several times as well, where instead I'd only expect them to run once
  • e

    eager-airplane-22433

    11/07/2022, 2:27 PM
    for example if i put this log in the support file:
    Copy code
    console.log("e2e", Math.random())
    It should only get run once, but I can see it being run several times when reloading the page or when switching between specs
  • f

    fresh-doctor-14925

    11/07/2022, 2:40 PM
    > It is in a beforeEach() > > It should only get run once I'm confused by this. Could you share your support file and examples of how you call the hook? That should make it easier for me to make a suggestion
  • e

    eager-airplane-22433

    11/07/2022, 2:54 PM
    @fresh-doctor-14925 Looks like the module reloading was a red herring. I've put some more detailed logs in and I can see the module essentially get unloaded before being loaded again
  • f

    fresh-doctor-14925

    11/07/2022, 4:55 PM
    That shouldn't be an issue as long as your setup in the support file is encapsulated in a
    before()
    . Though I'd need to see some code before I can provide any more specific help
  • m

    mysterious-belgium-25713

    11/07/2022, 5:40 PM
    !duplicate
  • s

    stale-optician-85950

    11/07/2022, 8:42 PM
    Hello
  • u

    user

    11/07/2022, 10:58 PM
    Hey folks. Very new to both cypress and discord so sorry If not the way to request help. My problem is the following, I'm trying to create some tests that require email interaction. Regular cases are to confirm account and reset password. I've tried the solution using ethereal email but my problem is that for some emails, the account and testing data are very complex to set up and it is not done by our system. So in the end I need a constant email box that does not get deleted. I will create my users with that email box and run all tests related. My question is, could you point me to a post or doc or some working solution that I could use for this? Maybe a local SMTP server, or some Email client that will allow me to login and interact through cypress?
  • c

    calm-barista-24237

    11/08/2022, 3:02 AM
    Hello Everyone, I am quite new to cypress, our team has a framework ready with react, ts and cypress e2e. I am not able to click on dialog box which appears intermittently. Please find below code which we are trying to execute:-
    Copy code
    cy.doEmailLogin(Cypress.env('userNameEmail'), Cypress.env('passwordEmail'));
    cy.wait(10000);
                
    cy.get("#secondaryButton").then((el) => {            #Failing at this step
         el.trigger('click')
        });
    
    cy.get('[data-action=openMenu]').click({ force: true });
    cy.get('[data-section=signed-in-user]').should('be.exist');
    Please find attached page DOM screenshots:-
  • b

    bitter-fountain-36713

    11/08/2022, 4:33 AM
    Looks like the modal is in an iframe. You'll have to enter the iframe and then query the button element
  • c

    crooked-article-40397

    11/08/2022, 6:16 AM
    Any help here ?
  • s

    stale-wire-41120

    11/08/2022, 6:20 AM
    please help me
  • g

    gray-helmet-2693

    11/08/2022, 7:13 AM
    thanks for the reply. im talking about the calls made by the application. the documentation is talking about intercepting a request or a list of specific requests. what i want to do is intercept all of them without knowing exactly what requests are going to be fired, as i will be going through different pages, each page having its own requests being fired and i basically want to make sure that everything is going okay. so for example if i intercept something like this:
    https://**
    which will match with everything, will it check the first request only or all of them ?
  • f

    fresh-doctor-14925

    11/08/2022, 8:06 AM
    Unless
    intercept
    is told otherwise, it will intercept all requests and not just the first
  • g

    gray-helmet-2693

    11/08/2022, 11:30 AM
    the command is:
    cy.get('@req').its('response.body').should('not.eq', [])
    shouldnt this be a fail ?
  • f

    fresh-doctor-14925

    11/08/2022, 11:32 AM
    try
    not.deep.equal
  • g

    gray-helmet-2693

    11/08/2022, 11:36 AM
    Thank you very much Liam 💪
  • b

    bright-park-76512

    11/08/2022, 2:40 PM
    Help request : I'm currently using cypress 7 with angular 9 and setting up code coverage reports. I followed https://github.com/skylock/cypress-angular-coverage-example Everything works fine when using cypress open command. Instrumentation is done and code coverage report is generated. But when running cypress run command.. it doesn't work. https://github.com/skylock/cypress-angular-coverage-example/issues/17 Can someone help me with what I'm missing ????
  • g

    gray-kilobyte-89541

    11/08/2022, 2:56 PM
    cy.get(network request alias)
    assumes the request has already happened. The difference from
    cy.wait
    and
    cy.get
    is one of the nice tiny bits of knowledge covered in my course https://cypress.tips/courses/network-testing
  • l

    limited-barista-33480

    11/08/2022, 4:30 PM
    Hey guys, someone has used this plugin cypressFirebasePlugin. how can it be configured and tested in the version of cypress 10.6
  • n

    nutritious-kilobyte-67622

    11/09/2022, 12:34 AM
    Hi all, Installed cypress 10.11.0 for my end to end tests. Reports are not generating for my test runs. I have installed mochawesome, mochawesome merge etc
  • b

    bright-park-76512

    11/09/2022, 4:34 AM
    Will this .nyc_output generated only with local runs ???
  • b

    bright-park-76512

    11/09/2022, 7:51 AM
    @gray-kilobyte-89541 Hey I have checked your forked repo of this. Is there a way we can get this working using 'cypress run' please help
  • f

    fresh-doctor-14925

    11/09/2022, 8:51 AM
    !duplicate
  • n

    nutritious-analyst-96582

    11/09/2022, 8:51 AM
    Uh oh, It looks like you have posted the same question in multiple channels. Help us prevent spam by removing any duplicates of your questions, Thanks! 😀
  • p

    purple-sandwich-78115

    11/09/2022, 11:18 AM
    Hi Guys, I'm new to testing. I have a few questions on Cypress, can anyone help ?
  • p

    purple-sandwich-78115

    11/09/2022, 11:21 AM
    Game Zone Games Add Game Delete Game I have 3 questions here - 1. how can I check the number of links present in navbar? 2. how can I fetch all the tags? which of the below options can I use ? cy.get('li') cy.get('[class="nav-item"]') cy.get('li[class="nav-item"]') 3. how to click on the third link present in navbar and then check if it redirects to "deleteGame" url ? Tried below code to click on third link and check redirection to deleteGame url - please correct me. it(navigates to Delete Game on click of nav link:, () =>{ cy.get('.nav-link').then( (navlink)=>{ navlink[2].click(); cy.url(should("contain", "deleteGame") }) })
  • g

    gray-kilobyte-89541

    11/09/2022, 11:36 AM
    it is working for me, and I don't see an issue with a reproducible example showing the problem unfortunately
1...138139140...192Latest