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

    limited-barista-33480

    10/26/2022, 10:29 PM
    Hy guys, does anyone know how to modify or configure the certificates that are generated in the cypress browser, since this does not allow a test to work
  • t

    tall-forest-29063

    10/26/2022, 11:03 PM
    @fresh-doctor-14925 @gray-kilobyte-89541 FYI https://github.com/cypress-io/cypress/issues/24418
  • g

    gray-kilobyte-89541

    10/26/2022, 11:10 PM
    I did not break it...
  • m

    mysterious-pilot-21916

    10/27/2022, 7:34 AM
    Hi guys, I am quite new to cypress and having problems with connecting my runs do dashboard. I am using cypress 9.7, node 14.17.5 on an Angular app that was generated using nx. When I try to connect to dashboard (enter the non-headless view or run in console with key) I get "connect ECONNREFUSED ::1:1234". For some reason address localhost:1234 is called instead of api.cypress.io. Is this issue known? How can I fix it?
  • f

    fresh-doctor-14925

    10/27/2022, 7:48 AM
    Why are you trying to connect to the dashboard? That will happen automatically if you provide a project id and pass in the
    record
    flag
  • a

    aloof-rocket-79742

    10/27/2022, 9:58 AM
    Hello everyone , Is the oob behaviour for every feature file should have separate .js implementation file. Is that possible to have common .js implementation file which can be utilized in multiple feature files ?
  • a

    aloof-rocket-79742

    10/27/2022, 10:02 AM
    Due to this i have to repeat common step defs in every .js implementation file , Could any one suggest if it is achievable to have common.js (single) file to use for multiple feature files
  • i

    incalculable-nightfall-21641

    10/27/2022, 10:17 AM
    how to point cypress to use src directory like using absolute path ?
  • f

    fresh-doctor-14925

    10/27/2022, 12:06 PM
    Hi Arun, we discussed this previously. If you're doing cypress component tests, is there any reason why you can't have a cypress folder in your source folder? https://discord.com/channels/755913899261296641/763114122065739818/1032939375664840727
  • f

    fresh-doctor-14925

    10/27/2022, 12:12 PM
    Otherwise @incalculable-nightfall-21641, did you take a look at the examples here? https://github.com/cypress-io/cypress-component-testing-apps/tree/main/react-next12-ts If you place the cypress folder in the same folder as your
    src
    , you can then import the components you need
  • a

    aloof-rocket-79742

    10/27/2022, 12:12 PM
    Hello everyone , Is the oob behaviour for every feature file should have separate .js implementation file. Is that possible to have common .js implementation file which can be utilized in multiple feature files ? Due to this i have to repeat common step defs in every .js implementation file , Could any one suggest if it is achievable to have common.js (single) file to use for multiple feature files
  • i

    incalculable-nightfall-21641

    10/27/2022, 12:16 PM
    @fresh-doctor-14925 i have added cypress folder within src folder, the issue is, every component within src has import paths which are absolute paths, which cypress not able to figure out
  • f

    future-baker-50174

    10/27/2022, 12:17 PM
    This is not working because cy commands are not allowed in there:
    Copy code
    js
        cy.intercept("POST", "/api/something", (req) => {
          req.on("before:response", () => {
            cy.get("#message").should("equal", "Request sent");
          });
          req.on("after:response", () => {
            cy.get("#message").should("equal", "Response received");
          });
          req.continue();
        });
    But what can I do instead?
  • f

    fresh-doctor-14925

    10/27/2022, 12:21 PM
    It looks to me like you're just looking to assert that the call was successful?
    Copy code
    cy.intercept("POST","/api/something").as('apiSomething')
    ...
    cy.wait('@apiSomething')
      .its('response.status')
      .should('be', 200)
  • f

    future-baker-50174

    10/27/2022, 12:21 PM
    No, I want to assert that the correct text is visible while I am waiting for the response
  • f

    fresh-doctor-14925

    10/27/2022, 12:23 PM
    Not something I've had to do myself, but maybe you can adapt this for your purposes? https://github.com/cypress-io/cypress/issues/3262#issuecomment-462646891
  • f

    fresh-doctor-14925

    10/27/2022, 12:28 PM
    That's not really what
    intercept()
    is intended to do. I suggest you have something like this in your test body:
    Copy code
    // Or whatever action you're doing
    cy.get('#submit').click()
    cy.get("#message").should("equal", "Request sent");
    cy.wait('@apiSomething');
    cy.get("#message").should("equal", "Request received");
  • t

    thankful-pencil-94627

    10/27/2022, 12:39 PM
    personally, I use a
    should('be.visible');
    to avoid static waits
  • t

    thankful-pencil-94627

    10/27/2022, 12:40 PM
    you can use
    cy.get('.search-button).should('have.length',number)
    or just a
    show('be.visible')
    to wait until appear
  • f

    future-baker-50174

    10/27/2022, 1:28 PM
    Yes, I tried this, but it did not work. Looks like the stuff behind the click() finishes up too fast.
  • f

    fresh-doctor-14925

    10/27/2022, 1:59 PM
    I don't really see why the order is important. As long as you can assert that the call completes and the two messages are presented, that should be enough? If it's the
    wait()
    that is holding you up here because the call resolves too quickly you could instead spy on the intercept and then assert there's been a successful call
    Copy code
    cy.intercept('/some/endpoint', cy.spy().as('someEndpoint'))
    ...
    
    cy.click()
    cy.contains('#message', 'Request sent')
    cy.contains('#message', 'Request received')
     cy.get("@fruitEndpoint")
        .should('have.been.calledOnce')
  • e

    early-article-61542

    10/27/2022, 2:13 PM
    are data-test or data-test-id meant to be unique like id or can they be used several times like classes ?
  • s

    stale-optician-85950

    10/27/2022, 2:54 PM
    The application code is not going to error if they are repeated but the goal of
    data-testid
    is to be unique, to allow the creation of strong integration tests. Documented here https://docs.cypress.io/guides/references/best-practices#Selecting-Elements
  • a

    acceptable-fall-11897

    10/27/2022, 4:19 PM
    I want run cypress test in parallel but problem is some test need to run first after other
  • a

    adorable-smartphone-87280

    10/27/2022, 4:56 PM
    Structuring your tests to be dependent on each other like this is an anti-pattern and should be avoided if possible.
  • m

    mysterious-belgium-25713

    10/27/2022, 4:58 PM
    If you have something that needs to be run before then it's a dependency of your test. So you should make a function out of what you want to have done before. I would not make a test that depends on a different test. If you do that than you will create a fail chain.
  • c

    careful-toothbrush-49639

    10/27/2022, 5:47 PM
    Good evening. I am triying to test an input field for OTP (One Time Password) that automatically moves to the next box when a number is entered in the previous one. That means you don't need to click the next box to enter data. Once the preceding box is filled, the next box is automatically focused. The challenge is that when I run the test, I get the error "cy.type() can only be called on a single element. Your subject contained 8 elements." Need help to fix this.
  • c

    careful-toothbrush-49639

    10/27/2022, 6:20 PM
    I was able to resolve the above error by targeting the parent element firstBox: () => cy.get('ng-otp-input input').first(),
  • c

    careful-toothbrush-49639

    10/27/2022, 6:20 PM
    But I would like to ask, how can I target the second input in cypress and the third and so on because the input is embeded in an ng-input of array
  • s

    stale-optician-85950

    10/27/2022, 6:53 PM
    I guess you are looking for
    .eq()
    index https://docs.cypress.io/api/commands/eq
1...131132133...192Latest