Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 41012

Questions about using Cypress.io, an open source tool for testing anything that runs in a browser.

5 votes

Is Cypress set to replace Selenium as the preferred tool for automating web applications?

I've used both, so here's my opinion: Cypress seems better at handling waits (your point n. 2), this could be such a pain in other tools, but it's an internal part of Cypress, which usually makes you … So I don't really see why your Cypress should be more versatile in this regard. Cypress uses a different syntax, callbacks, JS, no conditional testing, chains etc. …
pavelsaman's user avatar
  • 4,548
4 votes

How can Cypress be seen as an End-to-end testing tool when it cannot travel across different...

What you're describing is mentioned here in the Cypress documentation. Cypress documentation also mentiones some workarounds. … That's the idea behind what Cypress says in the documentation. If this doesn't work for you, then Cypress is probably not a good choice for you. …
pavelsaman's user avatar
  • 4,548
4 votes
Accepted

How to wait till all components are loaded in Cypress?

There's no such concept of waiting or even writing your own waits (like with Selenium) in Cypress. Cypress has this built in. … mentioned here https://docs.cypress.io/guides/core-concepts/retry-ability.html#Commands-vs-assertions The point here is, you write something like: cy.get('.my_element') .should('have.length', 2) and Cypress
pavelsaman's user avatar
  • 4,548
4 votes

XHR requests are cancelled in Cypress

If that is the case, you need to explicitly tell Cypress to do just that. … For example, if I want Cypress to wait for a specific route, I write it like so: cy.intercept('http://example.com/route').as('getRoute'); cy.wait('@getRoute'); // once the route resolves, cy.wait will …
pavelsaman's user avatar
  • 4,548
4 votes

Conditional testing on checkbox in Cypress

Conditional testing is not recommended by Cypress, but it's possible to deal with this situation like this: html: <div> <input type="checkbox" id="mytestcheckbox" /> <label for="mytestcheckbox">Toggle … </label> </div> and in Cypress: cy .get('#mytestcheckbox') .as('checkbox') .invoke('is', ':checked') .then(checked => { if (checked) { cy .get('@checkbox') .uncheck() …
pavelsaman's user avatar
  • 4,548
3 votes

How to return a value from a then() block and use it in another then block in cypress

It's mentioned in the documentation mentioned in the comment section, I recommend reading it. Specifically, you can read this part about closures. What you can do is to put the other cy.get() inside t …
pavelsaman's user avatar
  • 4,548
3 votes
Accepted

How to get cookie value in cypress from a cy.request response?

cookie => { // parse cookies and do what you need with them }); }) Something more about this to read: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie https://github.com/cypress-io … /cypress/issues/5469 …
pavelsaman's user avatar
  • 4,548
2 votes
Accepted

visiting a dynamic link that opened in new tab in cypress

As per Cypress official documentation, this is not supported: https://docs.cypress.io/guides/references/trade-offs.html#Multiple-tabs Perhaps you can test that the link has some particular attributes: … cy.get('a[href="/foo"]').should('have.attr', 'target', '_blank') or you can follow this: https://github.com/cypress-io/cypress-example-recipes/tree/master/examples/testing-dom__tab-handling-links …
pavelsaman's user avatar
  • 4,548
2 votes
Accepted

Cypress: cy.type() requires a valid time with the format with the format HH:mm, HH:mm:ss or ...

HH:mm:ss.SSS (e.g. 12:00:00.384) You can also use .invoke() command: cy .get('[data-testid=time]') .invoke('val', '01:52:08 AM'); Basically whatever is possible in JavaScript is possible in Cypress
pavelsaman's user avatar
  • 4,548
1 vote

How to run a web browser automated test in mobile mode using cypress version 5?

how can i script it in cypress The script itself has no differences from the one for a desktop browser, all it depends is how you run it, what your config is. …
pavelsaman's user avatar
  • 4,548
1 vote

How do I deal with duplicated testing steps in Cypress?

I recommend reading this post: https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/issues/60 it deals with basically your situation with the exception that the same step definition names are … Although I haven't tried it myself now, it does seem from the discussion on the linked github page that cypress-cucumber in the past just used the first loaded step, but it was later changed in a way that …
pavelsaman's user avatar
  • 4,548
1 vote

How do I automate the setting of Cypress environment variables on a windows machine via a te...

You can create a batch file where you set all your environment variables. A batch file in Windows is just a text file with .bat extension, it could look like this: @ECHO OFF :: Assign all Path vari …
pavelsaman's user avatar
  • 4,548
1 vote

How to add two data attribute check in cypress?

You can concatenate them as jonrsharpe said in the comment section: cy.get('[data-component="tab"][data-value="first_tab"]') if you then need to access another element inside this one, you can use …
pavelsaman's user avatar
  • 4,548
1 vote

How to get list of disabled elements on page using Cypress

.: <input type="text" id="name" name="name" disabled> to find such elements in Cypress could be achieved with .get() command: cy .get('[disabled]') …
pavelsaman's user avatar
  • 4,548
1 vote
Accepted

How to avoid repeated requests in Cypress tests

Aliases in Cypress are removed between tests, that's why your response alias is not preserved. A discussion around this topic could be found e.g. here. …
pavelsaman's user avatar
  • 4,548

15 30 50 per page