Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 18:18
    cscheffauer commented #299
  • 08:53
    cypress-bot[bot] commented #15356
  • 08:53
    Andarist opened #15356
  • Mar 06 23:19
    Never7Dice edited #15355
  • Mar 06 23:17
    Never7Dice edited #15355
  • Mar 06 23:17
    Never7Dice opened #15355
  • Mar 06 22:52
    cypress[bot] commented #15354
  • Mar 06 22:32
    elevatebart synchronize #15354
  • Mar 06 22:32

    elevatebart on ct-race-condition

    add comment (compare)

  • Mar 06 22:22
    elevatebart edited #15354
  • Mar 06 22:21
    cypress-bot[bot] commented #15354
  • Mar 06 22:21
    elevatebart review_requested #15354
  • Mar 06 22:21
    elevatebart opened #15354
  • Mar 06 21:51

    elevatebart on ct-race-condition

    fix: wait for iframe to exist t… (compare)

  • Mar 06 18:15
    jennifer-shehane commented #14988
  • Mar 06 18:11
    jennifer-shehane commented #14285
  • Mar 06 16:34
    cypress[bot] commented #14690
  • Mar 06 16:32
    jennifer-shehane commented #15343
  • Mar 06 16:27
    jennifer-shehane commented #15353
  • Mar 06 16:16
    jennifer-shehane labeled #15353
Gleb Bahmutov
@bahmutov
@onurtortamis open an issue there https://github.com/bahmutov/cypress-recurse, since it is a great use case, I should show it
Phil Merwin
@pmerwin

Started getting this error with chrome 89 and cypress 6.6 =>

Error: ffmpeg exited with code 1: Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!

It was random but now consistent... any one else?

cypress-io/cypress#15295 ???

known issue => cypress-io/cypress#15300

Thomas Mattacchione
@athomasoriginal

I'm testing network errors in my app by intercepting network calls and mocking responses. I've successfully mocked an external API network call (firebase auth) and everything seems to read correctly in Cypress, but the actual response received by my code looks something like:

{
   code: "auth/internal-error"
   message: "{"error":{"code":400}}"
}

The error in the message is what I actually mocked in cypress.

I wonder if anyone else has run into issue mocking firebase responses? Also, firebase doesn't use native promises, but their own from google closure library. I wonder if this might be an issue related to that? :thought_balloon:
Jason Tolotta
@jtolotta
Does the "parallel" feature still functions when we reach our monthly quota?
yashaswi s
@yashaswi_s_gitlab
I am not able to login to my cypress dashboard account, it is saying password is wrong, when i try to reset the password its not sending the recovery email to my email ID.
Tymoteusz Stępień
@htd-tstepien

Hello, I know that cy.route is obsolete right now but I need to understand it, and I have a small problem.
I have code like

describe("Route usage", () => {
  beforeEach(() => cy.server());
  afterEach(() => cy.server({ enable: false }));

  it("Change GET output", () => {
    cy.route("**/users", { id: "2121" }).as("getUsers");
    cy.request({
      method: "GET",
      url: "/users",
    });
    cy.wait("@getUsers");
  });
});

and cy.request get 200 code and response is right in dev tools, but I can't get the route/stubbing to work on wait, I'm getting
Timed out retrying after 5000ms: cy.wait() timed out waiting 5000ms for the 1st request to the route: getUsers. No request ever occurred.

Samundra
@dhakalsamundra
how can i use cypress to remove the upload file and re upload the new one? I succeed to upload the file but i can not able to click the remove button once it upload before saving the uploaded file
Terry Sposato
@tsposato
So, I'm trying to pass a Bearer token to my requests and I'm crashing Cypress completely. Obviously doing something wrong. Anyone have any valid examples out there?
Grant
@GWeaths_twitter
@tsposato can you show us your code how you're doing it now?
Gleb Bahmutov
@bahmutov
@onurtortamis check this recipe showing how to do this cypress-io/cypress-example-recipes#665
okyrylenko
@okyrylenko
hi everybody, I am having issue with cypress server. Following the getting started documentation I created sample_spec.js file and I am not seeing that generated in the cypress server. I could not find any information online. Can you someone point me to the right direction to fix this issue?
Craig
@craig-dae

Need some advice on a recurring problem that is creating flaky tests for us.

We have some toast popups. Sometimes, they cover things that we need to not have covered. So, I wrote a command to dismiss them:

Cypress.Commands.add('dismissToasts', () =>
  // eslint-disable-next-line cypress/no-unnecessary-waiting
  cy
    .wait(100)
    .then(() =>
      // Wrapping in .then gives DOM a chance to update properly
      cy
        .get('#toast-container .ngx-toastr .toast-close-button')
        .click({ multiple: true, force: true }),
    )
    .then(() => {
      cy.get('#toast-container .ngx-toastr .toast-close-button').should(
        'not.exist',
      );
    }),
);

Problem is that sometimes there is more than one toast, and I just want to dismiss them all. i wait 100ms to make sure that all the toasts have popped up, then I dismiss all of them. Sometimes another one pops up after they've been dismissed.

I don't want a ton of testing around these toasts. I just want to get rid of them so they don't interfere with testing. What do you recommend for how to get rid of them? Some tests check for them, but for the most part, I want them dismissed so tests run smoothly. Any advice?

Gleb Bahmutov
@bahmutov
@craig-dae that is pretty non-deterministic test: you don't know if a popup appears, or if multiple popups appear, or if they appear at different time intervals. Can you disable the popups from code? Maybe by setting a cookie or reaching into the app's state and setting the flag?
Craig
@craig-dae

So, that's the thing. 90% of the time, I don't care about the toasts. I just want them gone because these tests run so fast that soon I have 20 of them on the page, covering things. This is not a real-world scenario. People aren't that fast.

But I have some tests where I actually click the toasts because they have click events on them. So I don't want to disable them

95% of the time, I just don't want them covering buttons. 5% of the time, I'm actually interacting with them for a test.
They're not important for 95% of tests. They're just there to give the users some feedback that something happened. Our tests focus more on regression. Did something break? Toasts aren't important for that.
maga-polito
@maga-polito
I need to listen and assert service bus notifications, how can I do this on cypress?
Craig
@craig-dae
@bahmutov Plan is to see if https://github.com/NoriSte/cypress-wait-until will get me what I need. Will end my code with that on checking to see that no toasts exist. This behavior is flaky, and occasionally it will just have to wait 10 seconds for the toast to self-dismiss
Gleb Bahmutov
@bahmutov
@maga-polito create a spy on the bus service and assert it was called the expected number of times
Terry Sposato
@tsposato
@GWeaths_twitter Sure. Here it is below. There are 2 tokens my applications needs, being the user-token and permissions-token.
Cypress.Commands.add('loginAsClient', () => {
  cy.request({
    method: 'POST',
    url: 'http://localhost:8080/api/v1/auth/login',
    body: {
      email: 'email@address.here',
      password: 'Password'
    }
  })
  .then((resp) => {
    cy.log('User Token is ' + resp.body)
    cy.setLocalStorage('user-token', resp.body)
    cy.returnBody('http://localhost:8080/api/v1/auth/permission', JSON.stringify(resp.body))
    .then((returned_value) => {
      cy.log(returned_value)
    })
  })
});
Cypress.Commands.add('returnBody', (url, token) => { //API to return some values
  return cy.request({
    method: 'GET',
    url: url,
    auth: {
      bearer: token
    }
  })
  .then((response) => {
    // Stringify JSON the body.
    let body = JSON.stringify(response.body)
    cy.log(body)
  })
})
I correctly get the user-token. But when I use it to try and get the permissions-token I get a 403 and seemingly via postman the same request is successful.
Terry Sposato
@tsposato
Manually setting the Authorization: Bearer token header seems to work
Sajjad Hossain
@sajjadhossain
hey guys, need help with stripe elements, none of the older code from cypress-io/cypress#8992 or https://gist.github.com/mbrochh/460f6d4fce959791c8f947cb30bed6a7 work
Franck Ruysschaert
@Franckrst
Hello, i have same question to : https://github.com/cypress-io/cypress/discussions/9331. I need use cy.writeFile in reply of intercept. i don't found solution. Can you help me ?
Gleb Bahmutov
@bahmutov
@Franckrst save whatever you want to write in the intercept into a local variable and write after the intercept has finished and the variable has value
1 reply
@sajjadhossain something like this does not work? https://glebbahmutov.com/blog/tested-ecommerce/
Raghav-Ramanathan
@Raghav-Ramanathan

@bahmutov : My application works entirely on Iframes. So in order to handle all of them I followed your doc to actually move my application out of Cypress frame into a child window. ( This works great if I give a standard timeout and not do a check if my app has completely loaded). The problem I am facing here is upon checking if my frame document is ready, and I proceed into the test, I am unable to get the content frame as necessary. ( Again this works when I just give a settimeout as suggested by you instead of waiting for the page to load). Code as shown below. Could you please advice :
Cypress.Commands.add("openWindow", (url, features) => {
const w = Cypress.config("viewportWidth");
const h = Cypress.config("viewportHeight");
if (!features) {
features = width=${w}, height=${h};
}
console.log('openWindow %s "%s"', url, features);
// cy.log("Creating new Window");
return new Cypress.Promise((resolve) => {
if (window.top.aut) {
console.log("window exists already");
window.top.aut.close();
}
// https://developer.mozilla.org/en-US/docs/Web/API/Window/open
window.top.aut = window.top.open(url, "aut", features);

// letting page enough time to load and set "document.domain = localhost"
// so we can access it

Error Observed when trying to get my iframe :

setTimeout(() => {
  cy.state("document", window.top.aut.document);
  cy.state("window", window.top.aut);
}, 500);
const documentLoaded = setInterval(() => {
  let documentObj = window.top.aut.document;
  if (documentObj.readyState === "complete") {
    debugger;
    let frameDoc = "";
    let frame = documentObj.querySelector("#contentframe");
    if (frame !== null) {
      frameDoc = documentObj.querySelector("#contentframe").contentDocument
        .readyState;
    }
    if (frameDoc === "complete") {
      clearInterval(documentLoaded);
      cy.state("window", window.top.aut);
      resolve();
    }
  }
}, 500);

});
});

image.png
GAURAV YADAV
@DVGY

Hello. I have a react app for front end and node js backend. I have different repository for front end and for backend. Each repository has their own ci/cd (azure pipeline).
As of now if I run cypress locally all the test are working.

How do I start the backend server in ci env or locally since they are in two separate folder. ?
Do i even need to start a server ?

I have seen people using script to run backend dev server which exist within a single folder and that single folder has one front end folder and one backend folder

Gleb Bahmutov
@bahmutov
@Raghav-Ramanathan well if you set up a stand alone example with reproducible code, maybe someone would have time to look at this, but to be honest I am pretty short on time
@DVGY it is up to you. For example in the CI pipeline you could checkout both repos and start the backend. Or you could deploy the backend and then test the frontend against that backend already running somewhere (like staging). Basically I would recreate whatever you require your own developers to do while working on the frontend locally
Christus Arulanantham
@ChristusArulanantham
image.png
Hi I am a New bee using Cypres and want to set up Auth0 authentication for login in Cypress and following the doc in Cypress I have added the command and got this
Any idea why it does not lie the string
please let me know
Dovernh
@Dovernh

Has anyone got the cypress unit testing to work using: https://github.com/bahmutov/cypress-angular-unit-test? I followed the instructions and ran into an error (below). If clone the repo (which has a lot more), it works. But I want to implement the cypress unit testing in an existing project. To make sure nothing else is interfering I created an new angular 11 project, implemented changes per the article, same issue

Details: C:\Development\cypress-angular-unit\cypress\plugins\index.js:6
import * as cypressTypeScriptPreprocessor from "./cy-ts-preprocessor";
^^^^^^

SyntaxError: Cannot use import statement outside a module

trainbolt
@trainbolt
hey all... I've got my cypress setup in a separate project folder than my website control panel where I want to be able to trigger test runs...
so in my php admin I need to chdir() out to the e2e testing project and then execute the cypress run command
chdir(dirname(base_path(), 1) . "/e2e-testing");
$handle = popen('npx cypress run --browser chrome --env SITE=GSO --config-file "cypress.dev.json" --spec "cypress/sites/WEBSITE_A/performance.spec.js" --headless 2>&1', 'r');
Tests run perfectly fine when called within the e2e-testing project, but when I run them this way I get: env: node: No such file or directory
trainbolt
@trainbolt
UPDATE: I got it to start running by adding export PATH=/path to node bin but now I have a new error
onurtortamis
@onurtortamis
@bahmutov Thank you.
Michael Burns
@michael.burns.cubic_gitlab

How do I achieve the following in Cypress? (JS)
window.mapComponent.getTestHelper().testHookGetFeaturesForLayer('5452353c-24a6-4ba8-899c-13ed8857cd12').filter(e => e.feature.values_.Id==='2f6c245c-8755-5647-aca4-0de03c8c2338')

I cannot fathom how to get the filter included. I have so far
cy.window().its('mapComponent').invoke('getTestHelper').invoke('testHookGetFeaturesForLayer', '5452353c-24a6-4ba8-899c-13ed8857cd12')

Stan Jaworski
@mrstaneh
hello, jenkins is trying to install cypress with npm. I get an error: "Error: Failed downloading the Cypress binary" with the URL: https://download.cypress.io/desktop/6.0.1?platform=linux&arch=ia32 , however, when I press this URL it gives me a not found result, how do i make it target the right binaries?
Raghav-Ramanathan
@Raghav-Ramanathan
Any idea how i can get the custom commands to show up on my intelisense using just js and not ts?
Raghav-Ramanathan
@Raghav-Ramanathan
Also another question I have in mind is how do I get a screenshot of my application if I run it on a seperate window instead of Cypress Frame?
Grant
@GWeaths_twitter
Is there a good way of checking that a XHR request wasn't triggered after a button click... e.g when a button is disabled checking that it being disabled and clicked it still doesn't trigger a XHR request?
gweaths
@gweaths
anyone had issues with cypress where if I run describe.only() the test passes. But if I run the test with all other tests it fails. it's highly annoying and is rather flaky.