Skip to main content

Questions tagged [cypress-conditional-testing]

The tag has no usage guidance.

cypress-conditional-testing
0 votes
2 answers
42 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 ...
Natalia Orzeł's user avatar
0 votes
0 answers
9 views

can't running tester login with cypress

when I write a script like this the output results on cypress are not running "timed out retriying after 4000ms: expected to find element: a, but never found it" describe('Login with inputs',...
Nurul Fitri A's user avatar
0 votes
3 answers
80 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 ...
Bilal Hussain's user avatar
-2 votes
1 answer
66 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 =...
George Beres's user avatar
0 votes
0 answers
4 views

Can we handle multiple browser windows in cypress while Button is not having href?

Unable to handle multiple windows in cypress. Steps: Loading browser with url Now click on button which will open new window. The button is not having href attribute.
Shashi's user avatar
  • 61
0 votes
1 answer
34 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 ...
Kim Jay Luta's user avatar
1 vote
1 answer
68 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--...
KiritoLyn's user avatar
  • 720
2 votes
1 answer
250 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 ...
grabury's user avatar
  • 5,379
-1 votes
1 answer
202 views

How to scroll the table in a page and catch all the elements using each in cypress? [closed]

I have 30 rows in a table and I need to perform scroll twice or it may be thrice if rows increases in future. I am using each and store first 20 element with 1 scroll but the element I need will need ...
Surya Singh's user avatar
-1 votes
1 answer
72 views

How to be able to handle both cases of element exists and does not exist? [duplicate]

I would like to have the ability to handle the situation of both cases: the element exists and does not exist. All my trials ended with an exception when it didn't find the item and therefore I couldn'...
dushkin's user avatar
  • 2,103
1 vote
2 answers
115 views

Do stuff according to whether an element exists or not

I want to know whether an element exists or not and do stuff according to that. I tried many options but failed. For example: cy.get(deleteCellButtonLocator).then(($el) => { if ($el.length > ...
dushkin's user avatar
  • 2,103
1 vote
2 answers
133 views

Cypress doesn't recommend conditional testing, what are the other ways to achieve this without writing flaky tests

We have a table in our application: if the table length is more than 5 it shows the pagination and if the length is less than 5 it doesn't Cypress doesn't consider it a good practice to use conditions ...
Zain Sadaqat's user avatar
0 votes
5 answers
537 views

how to pass an assertion in if condition using cypress without halting the execution in case of assertion failure

I am trying to pass an assertion to if condition and execute a logic when the condition is met and another logic when condition is failed. Since the test is failing on failure of assertion i am not ...
sandy qa's user avatar
2 votes
2 answers
250 views

Unable to find the element to check if it exists in the before() hook in cypress.io [duplicate]

I have the following lines of code in my before() hook. before(() ==> { cy.get(this.testPopup).then(($el) => { if ($el.length) { cy.get(this.testPopupCloseButton).click(); cy.get(...
Eddy's user avatar
  • 21
1 vote
1 answer
153 views

Pagination in Cypress

Use case: I have to search and click the course. I have 10 pages, each page contains 20 courses. I need to find the course(which is random). If the course is available in the first page, it will click ...
BugBee's user avatar
  • 147

15 30 50 per page