All Questions
Tagged with cypress-conditional-testing cypress
65 questions
0
votes
1
answer
34
views
In cypress, I wanted to execute a flow based on a web locator visiblity. How to achieve it? [duplicate]
In my web page I have a locator which is identified by...
cy.get('.app-text')
In my case, I want to execute different flows based on the visibility of the above locator in the page.
If above locator ...
3
votes
1
answer
58
views
Cypress - How to only click button if it contains "chevron_right"
This button has 2 states, "chevron_right" when disabled. And "expand_more" when enabled.
Its default state is "chevron_right"
The following code will click on the button ...
0
votes
0
answers
20
views
Conditional testing in cypress/typescript [duplicate]
Need help with conditional testing of cypress/typescript.
After pressing button ".button1", I need to check for the presence of button ".button2", and if it exists - press it and ...
0
votes
0
answers
35
views
Cannot break .each() even though if condition true in cypress [duplicate]
Below is my it block code which has each loop and it does not breaking even though I passed return false when the if condition true and continue executing the loop.
cy.get('@gemTitle').then((gemTitle) ...
-2
votes
1
answer
68
views
Cypress If-Else using Contains [closed]
My script looks like below
const item ["a1", "a2",..............,"a45"]
const regex = new RegExp(`${item .join('|')}`, 'g')
if(cy.get('body').contains(regex)){
...
1
vote
1
answer
54
views
How to skip failing part in Cypress test script
what is expected from the below code is get_plz_ChooseGroup will be skipped and not trigger a test failure if the element is not visible after 5000 seconds
Login_Page_POS.get_plz_ChooseGroup({ timeout:...
0
votes
0
answers
39
views
Cypress e2e.js file giving error while connecting SQL server using Cucumber [duplicate]
I am not able connect DB connection using Cypress. Facing issue e2e.js by giving loadDBCommand.
DBConnection.feature
Scenanrio: Connect DB using SQL Server
Given Update the Agent Details
Package.json
...
0
votes
1
answer
35
views
Making a function inside an if statement run until you get a false value for the conditional using JS in Cypress
I am writing a test in Cypress where I enter two values into two separate inputs and then compare them by clicking a button. If the button displays "=", I need to reset and reenter two new ...
0
votes
2
answers
228
views
cypress - how to continue running loop after assertion error
I have test that opens every item on the list. Then it validates if there are no empty ('--') fields. I want to log in console that there were empty fields and go to another item and run the loop till ...
-1
votes
2
answers
64
views
If condition fails and does not go in else block as using 'contains' [closed]
In the Material UI table there is one record which can exist or not.
The scenario is if that row is present based on 'Name' column then delete it, otherwise go to the else block and log that record is ...
0
votes
3
answers
202
views
I am facing a problem to verify element visibility if element in visible or not using cypress
When I try
cy.get('div.userId')
I want to add condition div.userId is exists/not in dom.
I am expecting not to fail test before checking existence of element in dom.
Like sometimes div.userId is not ...
-2
votes
1
answer
173
views
CSS property: display: none Cypress error - Cannot click Add buttons to add products to basket
I'm currently building a e2e regression test suit for an eCommerce website developed in Angular JS, I have written a loop and provided a condition in it, this is my code:
const productText =...
0
votes
1
answer
58
views
How to handle hidden elements in Cypress with if statement? [duplicate]
I have an element job-ad which is dynamic i want it to be handle when it’s displayed and not displayed
For example if .job-ad is displayed log me a text it’s Visible, but else log it’s hidden. I tried ...
1
vote
1
answer
88
views
if-else containing a cy.get as an condition
I am trying to create an if-else condition that includes cy.get()
if (!cy.get('.modal.modal--active')) {
cy.reload()
} else {
// some codes here
}
Upon testing the code the .modal.modal--...
2
votes
1
answer
559
views
How to wait until all images have loaded before running Cypress test?
I have a Nextjs project that is using Percy (with Cypress integration) to run visual tests. My project fetches images from a CMS. How can I make sure all images on the page have loaded before (taking ...