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

    important-park-97069

    05/30/2022, 3:08 AM
    This feels like a bug in Cypress. I'm nearly certain that my code is correct, the API for intercept is not complicated and through stack trace/console logs I'm able to confirm that my setup code runs identically every time, but the cypress intercept behavior fails and lets requests through to origin exactly 50% of the time.
  • i

    important-park-97069

    05/30/2022, 3:08 AM
    Unfortunately I don't have more time to look at this and will be reverting to .server and .route for now 😦
  • d

    dazzling-thailand-64429

    05/30/2022, 3:58 AM
    Hey guys. First, congratulations for developing cypress, I'm using it on a work project and the experience has been incredible. I have a cypress problem with imports using aliases. I have an application made in react + CRACO, and I made the import aliases in craco.config like this:
  • d

    dazzling-thailand-64429

    05/30/2022, 3:58 AM
    My cypress/plugins file with adaptation for CRACO is like this (I don't know if it's right)
  • d

    dazzling-thailand-64429

    05/30/2022, 3:59 AM
    But when I go to run a specific test suite, cypress gives me this error
  • d

    dazzling-thailand-64429

    05/30/2022, 4:00 AM
    I don't know what it could be, but apparently "node_modules" is being placed at the end of the paths
  • d

    dazzling-thailand-64429

    05/30/2022, 4:01 AM
    Does anyone have an idea what it could be? It's a problem that's been going on for a while now, and I've searched the forums and couldn't find anything. Thank you for your help
  • b

    big-electrician-80156

    05/30/2022, 1:31 PM
    Hello. Maybe someone faced such an issue? Dashboard just closes just after starting loading. I've already tried recreating the project, different versions, cache cleaning, --save-dev installation and some other pieces of advice which were found on StackOverflow, GitHub issues and cypress forums but still have this problem. Maybe you have any ideas? The most annoying is that there are no any errors :c Thank you
  • p

    powerful-gigabyte-69168

    05/30/2022, 2:29 PM
    I figured out how to directly test pinia stores with cypress when using vue3 composition! The trick is very similar to the vue2 way (which uses @gray-kilobyte-89541 's trick of exposing the vue app instance directly on the window object during testing), but instead you expose the individual stores themselves (because the components don't get automatic access to the stores). It works like this
    Copy code
    // main.js
    import { useCounterStore } from '@/stores/counter';
    if (window.Cypress) {
        const counterStore = useCounterStore();
        window.counterStore = counterStore;
    }
    now you can access the exposed store during testing like
    Copy code
    // Get the pinia store directly off the window object
    cy
      .window()
      .its('counterStore')
      .then((counterStore) => {
        expect(counterStore.counter).to.eq(0);
      });
    Big thanks to the folks here for helping me think through the problem. Here's my recipe repo: https://github.com/itsalaidbacklife/cypress-pinia-composition
  • g

    gray-kilobyte-89541

    05/30/2022, 2:35 PM
    I have never seen such behavior (and I authored "Cypress Network Testing Exercises" course https://cypress.tips/courses/covt2fpsux) so without a reproducible example showing the problem, I would say there is something about how you right the code / control caching, etc
  • g

    gray-kilobyte-89541

    05/30/2022, 2:36 PM
    No need to use
    cy.then
    since it breaks the retry-ability, just write
    Copy code
    js
    // Get the pinia store directly off the window object
    cy
      .window()
      .its('counterStore.counter').should('equal', 0)
  • p

    powerful-gigabyte-69168

    05/30/2022, 2:38 PM
    Ah okay that makes sense. So
    .then()
    doesn't have retry built in because it anticipates potential side effects, whereas should is purely for assertions and will automatically retry?
  • g

    gray-kilobyte-89541

    05/30/2022, 2:40 PM
    yup. Read https://glebbahmutov.com/cypress-examples/9.7.0/recipes/retry-ability.html and https://on.cypress.io/retry-ability explain it
  • p

    powerful-gigabyte-69168

    05/30/2022, 2:42 PM
    Excellent, thank you. I've updated my recipe repo accordingly. So I would use
    .then()
    if I wanted to use cypress to trigger a store action with side effects (like firing off an api call through application logic) but
    .should()
    to read state for assertions
  • i

    important-park-97069

    05/30/2022, 3:15 PM
    Is it true in a scenario where multiple intercepts that match a url that the first intercept is the one that handles the call? So:
    Copy code
    cy.intercept('https://api.somesite.com/test-url', ...handler);
    cy.intercept('test-url/**', ...handler);
    In this case, the first handler would be the one that is used when, say, a GET reaches out to
    https://api.somesite.com/test-url/12345
    ?
  • i

    important-park-97069

    05/30/2022, 3:17 PM
    Essentially I'm trying to set up cypress stubbing for all requests to my API generically and then override the stubs on a per-test basis with more specific ones. So using a catch-all regex that stubs all requests and lets nothing hit the API with overrides per given test.
  • i

    important-park-97069

    05/30/2022, 3:17 PM
    Both forms are working fine - just, literally, every other time
  • i

    important-park-97069

    05/30/2022, 3:17 PM
    So strange.
  • a

    adventurous-dinner-77554

    05/30/2022, 5:09 PM
    Hi folks, I am trying to write a test that hits an API rate limit. Currently: I run a first request, check success, run 10 requests, check one more request, it should get a 429. Instead, how can I setup cypress to run requests until one gets a 429 OR I reach some hard limit. For instance I want to test that the rate limiter is triggered somewhere below 100 requests, but I don't care if its 50 or 70, this can change. I wonder how to code that using cy.request
  • m

    mysterious-sandwich-43667

    05/30/2022, 5:33 PM
    I'd probably try writing a normal js function to handle that and stick it in commands.js. Or cy.wrap it
  • c

    cool-engineer-68430

    05/31/2022, 8:49 AM
    Hello everybody! I need your help: Is it possible to install Cypress Dashboard on an Atlassian Data Center, Version 8.20?
  • r

    red-butcher-91574

    05/31/2022, 11:18 AM
    Hi i want to append timestamp or any counter after merge in mochaawesome-bundle json. It's a combined report. Please advice
  • p

    proud-printer-45627

    05/31/2022, 1:15 PM
    Hi, I'm new to cypress where I'm facing issue and not able to move on, the problem that I'm currently facing is, i can't login to application with google account, i refer to this article to handling connection with google account https://filiphric.com/google-sign-in-with-cypress , but when i start running cypress open , every thing work fine, but with cypress run ,my test fail always . i need to do cypress run to generate report . please help me.
  • e

    elegant-dress-62146

    05/31/2022, 2:38 PM
    Your Cypress tests are going to fail using the run commands because of the way Google does their 2FA. As far as I know, there is not a workaround for authenticating with Google, Okta or MS in a headless browser. I'm very happy to be wrong on this as well if anyone else has better insight.
    p
    • 2
    • 1
  • f

    few-easter-79970

    05/31/2022, 2:42 PM
    Hi! Im trying to install a browser plugin, and then a task is running, but it seems that cypress does an unnecessary refresh, and the task just dies with timeout. Anybody seen something like that?
  • n

    narrow-gigabyte-35813

    05/31/2022, 4:15 PM
    Hello there! I have a small question, please. I am using localStorage and Cypress cookies when I run the tests on the browser "cypress open" it's working fine. But it fails when I run them through the terminal. So does anyone has any idea? If it's related to "localStorage" or "Cookies" should i use something else? Thanks in advance.
    p
    • 2
    • 2
  • p

    powerful-gigabyte-69168

    05/31/2022, 7:22 PM
    Hello there
  • p

    powerful-gigabyte-69168

    05/31/2022, 7:25 PM
    Is there any documentation on the logging behavior of
    .equal()
    ? It's really interesting that if you provide a second (string) argument that has a ',' in it, it seems to log the beginning of the string upon success and the entire string upon failure, which makes for some pretty nice reporting:
    • 1
    • 2
  • p

    proud-printer-45627

    06/01/2022, 7:18 AM
    Your Cypress tests are going to fail
  • g

    green-book-63455

    06/01/2022, 8:19 AM
    Hi Everyone, does anyone have experience of using cypress to test apps developed with Mendix? Are there any specific gotcha's? Though visit() finds the page, the page is empty hence contains() fails. I have noted 404 - file not found for file: index.html/theme.compiled.css 404 - file not found for file: index.html/mxclientsystem/mxui/mxui.js in both mendix and cypress logs. Testing manually works as expected. Looking at the page source in the browser outside of cypress, I see Now obviously the browser can find that. But when running under cypress, it is looking under index.html which is not a folder so the file does not exist. Why is cypress looking for the js file under index.html?
1...727374...252Latest