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

    elegant-dress-62146

    05/26/2022, 1:48 PM
    Hey Josh! Do you have a repo or code block you can share? Initial thoughts would be to make sure you have
    dovenv
    installed to the project and that it's properly imported in to the plugin file. Check out this page for a good resource if you've not already. https://docs.cypress.io/guides/guides/environment-variables#Option-5-Plugins
  • f

    full-journalist-87924

    05/26/2022, 2:41 PM
    Good Morning all, I am trying out Cypress to test our application and am running into an issue. When clicking a button that allows an administrator to run as a user, a new tab opens. The html for the button does not include the target attribute. Rather what is happening is the button creates an api request that creates a cookie with a new session as the user we are running as by clicking the button. We are then directed to a new tab. On this new tab I need to be able to access the elements so I can continue testing the application. Any thoughts on how to handle this?
  • e

    elegant-dress-62146

    05/26/2022, 3:09 PM
    I think this article from @nutritious-restaurant-91514 would be a great place to start for resolving your issue. https://filiphric.com/opening-a-new-tab-in-cypress
  • f

    full-journalist-87924

    05/26/2022, 3:37 PM
    yeah this didn't help with my situation, thank you though. I wonder if there is a way to grab the api call and instead of redirecting the call to a new tab opening it in the same tab
  • p

    proud-gpu-14798

    05/26/2022, 3:39 PM
    I need to validate that my app has invoked specific API calls to an event endpoint, and validate some amount of the data in the request. In the case of a single API call I'd use
    cy.intercept()
    with an alias, call
    cy.wait()
    and assert the
    request.body
    contains the expected data. Works perfectly for a single request, or even a series of requests as long as the API calls are made in the same order every single time. However, in many cases the app invokes a half dozen or more API calls to the event endpoint and the order the API calls are completed are not guaranteed. I need some manner to assert the expected calls have been made, but without having to pop my way through the interception stack in a specific order. Thoughts/ideas?
    • 1
    • 2
  • f

    full-journalist-87924

    05/26/2022, 3:41 PM
    @proud-gpu-14798 in my instance I need to keep navigating through the site on the new tab
  • e

    elegant-dress-62146

    05/26/2022, 3:46 PM
    Is he tab url static or does it navigate to a dynamically generated link?
  • e

    elegant-dress-62146

    05/26/2022, 3:51 PM
    You can try something like this?
    Copy code
    json
    cy
      .get('[whatever the button selector is]')
      .invoke('removeAttr', 'target')
      .click();
  • h

    hundreds-action-33616

    05/26/2022, 4:33 PM
    Hello everyone! My app has a support chat. In ~50% of the cases cypress fails to load the app. Reasons: the app function( expecting the support chat) is called before the support chat is loaded. It doesn't happen just in chrome, and in cypress console I received following warnings. Which makes me think that *cypress modifies window.setTimeout, and that is causing the failure * Does anyone know how to make cypress not modify window options?
  • m

    magnificent-finland-58048

    05/26/2022, 4:39 PM
    I have a few examples for you https://dev.to/muratkeremozcan/effective-test-strategies-for-deployed-nodejs-services-using-launchdarkly-feature-flags-and-cypress-part2-testing-l49 https://dev.to/muratkeremozcan/effective-test-strategies-for-testing-front-end-applications-using-launchdarkly-feature-flags-and-cypress-part2-testing-2c72 just ctrl F
  • m

    magnificent-finland-58048

    05/26/2022, 4:41 PM
    if you had any reproducible examples, @gray-kilobyte-89541 would be very interested in this
  • h

    helpful-application-21484

    05/26/2022, 11:20 PM
    I'm considering going with the pay-for version of cypress and my company uses GitHub Enterprise. Do I have to go with the $300/mo option because that has the integration with GitHub Enterprise, or can I still use the $75/mo option with the regular GitHub integration (and just not have the github enterprise integration features)?
  • s

    sparse-angle-84185

    05/27/2022, 2:50 AM
    I am getting this error while doing drag and drop operation.
  • s

    sparse-angle-84185

    05/27/2022, 2:51 AM
    Can any body please help me with this.
  • g

    gray-kilobyte-89541

    05/27/2022, 5:38 AM
    yup, Cypress wraps those functions to implement its
    cy.clock
    features
  • w

    witty-appointment-97045

    05/27/2022, 6:01 AM
    Hi , i am new here. How are you all. I am facing an issue with my cypress. Can anyone help me?. Title: Error running plugin Message: We stopped running your tests because a plugin crashed. Your
    pluginsFile
    threw an error from:
    /Users/admin/Documents/Automation/cypress-automation-fwk/cypress/plugins/index.js
    Details: Error: connect ETIMEDOUT 10.50.12.140:6379 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) Stack trace:
    Copy code
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)
  • f

    faint-cat-31237

    05/27/2022, 8:51 AM
    Hello πŸ‘‹ I'm trying to create a docker-compose file to launch cypress tests on my application I created a docker image of the application , and the application using postgres image. So i added
    postgis/postgis:13-master
    inside the docker-compose file. I also created a Dockerfile from cypress included to launch the tests inside client folder. When i launch the docker-compose, my application + postgres start correctly (generating data + listening on port 8080) and even when i visit the page http://localhost:8080 it works (i can log in to my application using a username and a password that has been generated when the application started). But for some reason when the cypress container starts it can't login to the application (using those same credentials), therefore i got test failure. I have a theory: that the data has been generated on my local machine but the container didn't map the files πŸ˜• Can anyone help me please πŸ™ Here is the docker-compose file + video failing inside the container.
  • a

    average-fountain-87572

    05/27/2022, 11:31 AM
    Hi all! πŸ‘‹ We are developing a software that functions around a piple-like algorithm that is supposed to be done from start to end in a single run. It requires things to be done and certain data to be present in session storage for each part of the algorithm. This is why I've developed some sort of exportable "skipToCertainPart()" -functions that I've placed in a TS-file inside /support folder . In these functions I use cy-commands for actions on the application. This might not be the ideal way to do things because the cy-commands are used outside it -clauses. Everything works correctly when I run each test separately from the Cypress GUI or from the command line in headless mode. But when I try to run all integration tests from the UI I get this error: "The following error originated from your test code, not from Cypress. > Cannot call cy.contains() outside a running test. This usually happens when you accidentally write commands outside an it(...) test. If that is the case, just move these commands inside an it(...) test. Check your test file for errors. When Cypress detects uncaught errors originating from your test code it will automatically fail the current test. Cypress could not associate this error to any specific test. We dynamically generated a new test to display this failure.Learn more" Is there any way to make this work? I would not want to include all the skipping commands in each it -clause as it would make my test code messy and hard to read compared to using verbally named functions that I import to each place I need them at.
  • c

    cuddly-analyst-14369

    05/27/2022, 11:32 AM
    Hi everybody, anyone have experience in data layers testing with Cypress? Any repo for example? I am try to find a way to cancel a event (click button) and avoid loading the new page, to capture the DL event. ItΒ΄s possible?
  • a

    adorable-machine-81849

    05/27/2022, 11:45 AM
    Hi Team, I have a email id field in my application.when i enter the wrong email id and I am trying to click a button. I see a pop up message which disappears immediately. I am unable to inspect the element . But i need to validate the text inside the pop up. Has anybody come across this issue. Please suggest me.
  • h

    hundreds-action-33616

    05/27/2022, 2:34 PM
    Thanks for the clarification! Is there a workaround?
  • s

    sparse-angle-84185

    05/27/2022, 3:12 PM
    Hey anybody knows how to handle this issue
  • i

    icy-greece-31960

    05/27/2022, 6:09 PM
    I have a test where I have Cypress fill out and submit a form. I would like to intercept the request, get the
    id
    of the newly created record, then use this
    id
    to delete the record. I have the following implementation:
    Copy code
    js
    it.only("should let you create a new allocation", () => {
        cy.findByTestId("new-control").click();
    
        cy.intercept("POST", "/control-panel/data/allocations*", (req) => {
          req.on("response", (res) => {
            const id = res.body.allocation.id;
            cy.task("deleteAllocation", id);
          });
        });
    
        cy.findByTestId("form-dialog")
          .within(() => {
          cy.get("select[name=ranchId]").select("2155");
          cy.get("select[name=blockId]").select("SCH-CS-2013-8 (CS13 8)");
          cy.findByLabelText("Tons")
            .type("420");
          cy.findByLabelText("Acres")
            .type("42");
          cy.get("select[name=customerId]").select("Oswego");
    
          cy.get("button[type=submit]").click();
        });
    
        cy.findByTestId("table-filter-search")
          .type("SCH-CS-2013-8");
    
        cy.findByTestId("data-table")
          .findByText("420")
          .parent("tr")
          .within((tableRow) => {
            cy.get("td")
              .eq(0)
              .should("have.text", "2155")
          });
      });
    This gets me the
    id
    just fine. But, I get this error message:
  • i

    icy-greece-31960

    05/27/2022, 6:09 PM
    Any idea how to solve this? Or, is there another approach I should use?
  • g

    gray-kilobyte-89541

    05/27/2022, 10:10 PM
    does it fail though? Or just warns about it? Can you provide a small reproducible example showing a failure?
  • g

    gray-kilobyte-89541

    05/27/2022, 10:11 PM
    You cannot call
    cy...
    commands from callbacks in the
    cy.intercept
    See bonus lesson 12 in my "Cypress network testing exercises" course https://cypress.tips/courses/covt2fpsux
  • m

    mysterious-sandwich-43667

    05/30/2022, 12:22 AM
    Isn't it strange that the oneOf makes 2 assertions? In my case: expect(text).to.be.oneOf(real_names) where real_names is an array, Cypress tells me that real_names is an array before telling me that text is in real_names which is all I really care about. Why is that?
  • m

    mysterious-sandwich-43667

    05/30/2022, 12:23 AM
    Like this: assert expected [ Array(27) ] to be an array assert expected Space Cowboys to be one of [ Array(27)
  • i

    important-park-97069

    05/30/2022, 3:02 AM
    Is there a known issue around
    cy.intercept
    when using stubbing that it stubs literally every other time? If I refresh my test using a cy.intercept stubbed route, it fails to stub the first time (goes to origin), stubs correctly on the 2nd, goes to origin on the third, stubs on the 4th, and so on.
  • i

    important-park-97069

    05/30/2022, 3:03 AM
    This is extremely confusing behavior because it'll even do it when I refresh the entire test session.
1...717273...252Latest