Skip to main content

Questions tagged [cypress]

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

Filter by
Sorted by
Tagged with
34 votes
4 answers
143k views

How to check a button is disabled using Cypress

<button _ngcontent-c21="" color="primary" mat-button="" class="mat-button mat-primary" ng-reflect-disabled="true" ng-reflect-color="primary" disabled=""><span class="mat-button-wrapper"> ...
Adam A's user avatar
  • 1,037
17 votes
4 answers
37k views

How to simulate a simple keypress in Cypress

Working on webpage test automation with Cypress atm. Ran into a problem. I need to simulate a pressing of the ESCAPE key from a user. Cypress has its own type() method, but it is required to chain ...
Yu Zhang's user avatar
  • 9,942
10 votes
5 answers
3k views

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

I see many articles pointing out the effectiveness of Cypress as against Selenium for automating web applications. From most of the articles I've read, I see some points for Cypress such as: Cypress ...
srini's user avatar
  • 455
8 votes
3 answers
8k views

Cypress vs Protractor for end-to-end testing

I've recently stumbled upon a modern end-to-end testing framework called Cypress which is going to be released in public beta this year. It really looks awesome at the first glance - there are ...
alecxe's user avatar
  • 11.4k
6 votes
7 answers
260 views

Test all elements in a single test or 18 separate tests

I have a test that is making sure that all elements are visible on a page, my question is should I have 18 separate test cases or just one? Example, which is better let baseURL = Cypress.env("...
John Hamlett IV's user avatar
6 votes
2 answers
12k views

Is there a way to automate multiple tabs using cypress?

Is there a way to automate multiple tabs using cypress? e.g. After login to my webpage, I get redirected to another tab. So, I would like to automate login in 1st tab and then perform other testing ...
Rakesh K Singh's user avatar
6 votes
3 answers
8k views

Do something as long as element is on page - cypress

I'm new to cypress and I just hit this problem I seem unable to solve. What I'm trying to do is this: on an eshop page, there's this "Show More Products" button (sorry for the language :)): If I ...
pavelsaman's user avatar
  • 4,548
6 votes
3 answers
16k views

Cypress if-then-else, while and foreach

In the context of my master’s thesis, I have been working on web application testing. My original goal was to have some form of automation on UI testing, such that easy end-to-end testing was possible....
MadMatt's user avatar
  • 61
5 votes
3 answers
211 views

End to End tests on multiple build agents?

I am using Cypress for end-to-end testing on a Web App, and for some browsers I noticed slight changes in the output when changing the build agent. It is something that I didn't even consider before, ...
ccoutinho's user avatar
  • 153
4 votes
3 answers
1k views

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

I want to use cypress as an alternative to webdriver.io but I am struggling to get my arguments across to the rest of my team as it cannot travel across other superdomains whereas Webdriver.io does ...
Mark Wilson's user avatar
4 votes
6 answers
8k views

How can I measure the coverage of my E2E tests?

I'm looking for a way to measure the coverage of my end-to-end tests. I have some existing E2E tests already and I'm adding more test scenarios to it. But I would like to have a way to quantify the ...
xenon's user avatar
  • 151
4 votes
1 answer
31k views

How to wait till all components are loaded in Cypress?

My Cypress test cases are working fine when I run from my system pointing to QA. But the scheduled builds from CI are failing randomly because sometimes the page is taking more time to load. I've ...
A J's user avatar
  • 209
4 votes
2 answers
2k views

End to end application tests when separate repo for the front-end and back-end tests

We have separate repos for the backend and the front end. The backend which is just microservices has its unit tests(jest), microservice integration tests(jest), and microservice end-to-end tests(jest)...
systemdebt's user avatar
4 votes
1 answer
1k views

Shall I put my e2e tests and performance test frameworks on the same repository?

I am using Cypress for my e2e tests and k6 for my performance tests. They are both in Javascript and access the same config json files (I use this for my environment variables). The folder structure ...
ebanster's user avatar
  • 143
4 votes
2 answers
5k views

Testing React web application in Selenium(Java)

In my work I use Selenium(Java) to automated test. Now web application will be rewritten to React, and there's my question: Automating react application using Selenium under Java is good choice? Do ...
mtmx's user avatar
  • 141
3 votes
2 answers
1k views

Whats the best approach to select elements for automated testing?

I read following in cypress's best practices. Anti-Pattern: Using highly brittle selectors that are subject to change. Best Practice: Use data-* attributes to provide context to your selectors and ...
Rnj's user avatar
  • 131
3 votes
2 answers
2k views

How to have a global alias for network requests in Cypress

In my e2e tests it happens that I have to wait for a xhr request to finish. So I have created an alias "graphql": cy.server(); cy.route({ method: "POST", url: Cypress.env('GRAPHQL_API'), })....
Cutaraca's user avatar
  • 131
2 votes
1 answer
4k views

Conditional testing on checkbox in Cypress

I have a checkbox which I want to check if it is not checked and want to uncheck it if it is checked in Cypress. How can I do that?
Rao Thota's user avatar
2 votes
1 answer
6k views

If else loop is not working/ element exists: cypress automation

I am new to cypress. I read some of the other if-else cypress related questions and yet fail to understand whats wrong with my code. What I am trying to accomplish: if "There are no results" found on ...
RenukaA's user avatar
  • 139
2 votes
3 answers
10k views

Select files from system's local drive using cypress

How to select files from a local computer and upload to the website using cypress?
Jayadi Maulana's user avatar
2 votes
2 answers
6k views

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

I am using the following before my test to try and get a cookie value from the request cy.request({ method:'GET', url:`https://test:[email protected]/meat/meat-...
Mark Wilson's user avatar
2 votes
1 answer
11k views

How to wait the loading spinner disappears in Cypress

When I run Cypress, the page of my application shows the loading spinner spinning indefinitely. While it is spinning the other components of the page are not displayed, so I need this spinner to ...
IBrito's user avatar
  • 185
2 votes
2 answers
15k views

visiting a dynamic link that opened in new tab in cypress

Scenario: While clicking a link/button in the application, a new tab is opened (with a dynamic url) Is there a way in cypress to test somethings in the newly opened tab? I cannot use cy.visit() as ...
A J's user avatar
  • 209
2 votes
1 answer
11k views

Why isn't my 'if' statement working in my Cypress test

I'm trying to add an 'if' statement into my login test as there are two login pages that can be loaded. The test below is failing when it can't find the text 'Not your account?', when it should be ...
Adam A's user avatar
  • 1,037
2 votes
1 answer
447 views

How do I automate the setting of Cypress environment variables on a windows machine via a text file?

On Unix and Mac machines, environmental variables can be read from .env files which have 'export' commands in them. For example: export USER_ENV=test export CLIENT=company In windows, there's no ...
srini's user avatar
  • 455
2 votes
2 answers
969 views

where to put cypress tests?

I am new to Cypress and trying to find the best practices for where to store our tests. I see there seems to be plenty of resources for how to organize folders to setup fixtures, tests, plugins, etc. ...
JD D's user avatar
  • 121
2 votes
1 answer
1k views

How to set an enviromental variable to indicate test environment in Cypress

I need to include in my test scenarios a way to determine which environment they are being executed in. We have BVT (build verification test) and a UAT (user Acceptance Test) environments. Within our ...
Adam A's user avatar
  • 1,037
2 votes
2 answers
206 views

Test Coverage Report in Cypress

I write my test cases in Confluence and then automate them in Cypress. I was wondering is there any way I can get the test coverage report. I already looked into Istanbul but it is for code coverage. ...
pop's user avatar
  • 31
2 votes
0 answers
3k views

Trouble with assertions when testing PDF files

Objective: To find distinctive data that has been encoded in a pdf and write assertions using cypress to ensure data accuracy. Observed Behavior: Assertions that have been written do not execute. I ...
Michael J Frazier's user avatar
1 vote
2 answers
1k views

What is the best cypress approach for waiting on data from an API?

Given the following Cypress v10.9.0 spec: it('can search the database', () => { cy.get('[data-cy=searchInput]').type('my search'); cy.get('[data-cy=searchOutput]').contains('Searching...')...
P.Brian.Mackey's user avatar
1 vote
2 answers
6k views

XHR requests are cancelled in Cypress

My test in Cypress does the following: Do the login On the next page clicks a button The button clicked in step 2, Cypress starts to load the correct URL but then the landing page (login screen from ...
IBrito's user avatar
  • 185
1 vote
1 answer
5k views

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

cy.get('div:nth-child(1) > div:nth-child(1) > div.MuiGrid-root.MuiGrid-item.MuiGrid-grid-xs-6 > div > span.MuiChip-label').then(($today) => { const today=$today.text() cy....
Rao Thota's user avatar
1 vote
2 answers
4k views

Cypress: Problems in merging individual test suite Mochawesome reports. Consistent Errors observed

I'm using Mochawesome with Cypress to generate reports. I am consistently observing this error when I attempt to merge my individual Mochawesome test suite files into one combined report: ERROR: ...
srini's user avatar
  • 455
1 vote
2 answers
164 views

Running Cypress with Git Hub Actions

I want to run Cypress tests on Git Hub action. The GH page is enabled and the workflow seems to be passed: But when I click Actions I should see the workflows, instead, it shows "There are no ...
IBrito's user avatar
  • 185
1 vote
3 answers
2k views

Breaking a loop after resolving a promise

I am writing a program to check the health endpoint of one of our APIs. So, before starting execution, I try to hit the health endpoint 5 times. If I get the desired response code during the 5 ...
Aalok's user avatar
  • 1,732
1 vote
2 answers
2k views

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

I want to run my browser tests against tablet versions of a release targeting iOS tablets-how can i script it in cypressio or is it possible in alternation web automation tools? The objective to write ...
Karunakaran's user avatar
1 vote
1 answer
3k views

Hover on svg in cypress and test tooltip

Scenario: I have something similar: <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <!-- Using g to inherit presentation attributes --> <g fill=&...
A J's user avatar
  • 209
1 vote
1 answer
799 views

Is it recommended to use Page object model for cypress E2E test? if not what is the suggested method to adopt

I am new for writing e2e UI test using cypress. But I am uncertain if it's good practice to use page object model, when I repeatedly need to use same elements in different test cases. Does "Aap ...
Maryum Khan's user avatar
1 vote
1 answer
5k views

Verify read-only fields using cypress

I have a few text fields which when I login as a specific user (rights of a read only) , all the text fields are not allowed to be edited. I am trying to automate this page in Cypress. I tried using : ...
Sriharsha Karanth's user avatar
1 vote
1 answer
2k views

Testing Stripe payment integration using Cypress

We've recently implemented Stripe for customers to checkout. However, using Cypress to automate our regression tests was incredibly painful as the fields are inside an iframe (and, for some reason, ...
dvniel's user avatar
  • 2,548
1 vote
1 answer
876 views

How to avoid repeated requests in Cypress tests

Since aliases are cleared after each test (it) when using Cypress, it seems subsequent tests needs to execute the same request again and again, while I would prefer to get it only once. This can be ...
Bouke's user avatar
  • 202
1 vote
2 answers
69 views

Assertions for CLI Commands in CI/CD environment

I am working with a Cypress testing framework in a CI/CD environment. There are several Cypress smoke tests that run each time my team pushes a build. However, I would like to add tests that make ...
CaptainKidd's user avatar
1 vote
1 answer
4k views

Using Cypress tests how to select a feature on a map location

We have an app where we can display dataset features on an Open Layers map page. These dataset features are then selectable to allow further attributes of these datasets to be displayed. In my ...
Adam A's user avatar
  • 1,037
1 vote
0 answers
521 views

Accessing elements within a Frame in Cypress

I am trying to interact with elements within a frame. <frame name="content" scrolling="AUTO" src="empty.jsp"> #document <html lang="en">...
Steerpike's user avatar
  • 393
1 vote
1 answer
836 views

Accessing element within a frame, nested within tables in Cypress

I've written two custom functions to allow Cypress to access a frame and select a menu item from this code: <frame name="leftFrame" scrolling="YES" noresize="" src=...
Steerpike's user avatar
  • 393
1 vote
1 answer
2k views

Cypress redirect e2e test with stripe js

I am writing an e2e test in cypress for an online store and after clicking the confirm purchase button it redirects to stripe page (not iframe but one-time payment redirect to their website) to input ...
Daniel Vianna's user avatar
1 vote
4 answers
630 views

Is it possible to use Cypress for data validation?

I'm writing some end-to-end automated tests for a CRM-alike web application. One of the development team leaders is asking me to do something that I've never done before. The problem is that the data ...
Eduardo's user avatar
  • 11
0 votes
2 answers
1k views

Conditional statement in cypress

I have a scenario that I'm having difficulty with - in 2 separate environments I have 2 expected outcomes due to multi factor authentication. In one environment I have a popup notification that needs ...
DEnumber50's user avatar
  • 1,180
0 votes
1 answer
164 views

Assert that options (text) in drop down are unique

I’m creating test in cypress using typescript, I’m not sure how to assert that all options in drop down are unique - I found bug where is situation that values are duplicated multiple times - it’s a ...
ciupakabrans's user avatar
0 votes
2 answers
539 views

Stubbing Responses in end-to-end tests?

So i've been trying out Cypress for the past few days, and im liking the tool so far. One feature it enables is being able to stub network requests (I think only xhr right now). Im sure other tools ...
Mercfh's user avatar
  • 1,720