Questions tagged [cypress-conditional-testing]

30 questions
1
vote
2 answers

How to have two different tests for conditional tables that render on a page based upon the prop passed by parent?

I have a cypress test that checks the table on a page, however there are two different tables that could render depending on the table type conditional. If the type of the table is product one table will render, if the type is equipment a different…
1
vote
1 answer

how can i implement if else conditional statements in cypress? is it reliable?

I have an E-commerce application, in which i want to delete the products from my cart if anything is there before my automation tests starts(kind of cleaning up the cart before test starts). We are using cypress for test automation, i am not able to…
1
vote
2 answers

How to proper Conditional Testing

I just want to ask how to properly conditional testing? I have this code here cy.get('[data-slug="add-to-any"] > .plugin-title > strong').then(($slug) => { if (expect($slug).not.to.exist){ //It will passed }else if…
Noel Dulin
  • 321
  • 1
  • 3
  • 12
1
vote
5 answers

Cypress - Element not found

How can I overcome a situation when the element is not found. I am automating a form where intentionally I am giving a duplicate name so an error message will be shown "Limit Name already exist" based on that I have written …
0
votes
2 answers

How to rewrite if condition in groovy to Cypress?

I have some front-end test written in Groovy and I need to rewrite them in Cypress. I am currently having problem with rewriting an if condition to Cypress.If the popin window is displayed click on it, otherwise do nothing. if…
user19128690
0
votes
4 answers

How to avoid cy.wait() in cypress test

I am trying to avoid the wait() function on my tests. I'm aware, based on the official docs, that Cypress works async and we dont need to use the wait() function, especially the visit() command handles that because it loads the page and then it…
Theo Itzaris
  • 4,321
  • 3
  • 37
  • 68
0
votes
3 answers

Cypress: Value of Variable is not saved when go out IF statement

I have a table as image below. I try to check in checkboxes having 'ST - ' text then Delete them. Here my code: cy.get('td').invoke('text').then(text => { //1st IF if (text !== 'No data available') { let hasAuto…
0
votes
3 answers

Cypress, If else doesn't work it only going into if condition

I am trying to add else if /switch case in my test , but else if - it goes to only if case, if 'if' fail it doesn't go in else if it's happen in switch case also it('Deve cadastrar um CNPJ válido', () => { cy.get(':nth-child(2) >…
0
votes
3 answers

How I can Execute next command if current command element is not found in cypress?

Here is below code I want to search "select-dropdown" if its visible than execute if block , if not found than instead of returning error that "select-dropdown" not found, it should execute else block and should click on button. but it still return…
0
votes
1 answer

Cypress test if an element does't exist conditional

I'm working on a cypress test that toggles a checkbox that toggles items which causes the button to appear and it click the button. The test itself works as intended for when there are items togglable. The case when there aren't any items that can…
0
votes
2 answers

Is it possible to keep executing test if element wasn't found with Cypress

I have a case when I need to wait for element (advertising), if it's visible then needs to click it, but if element wasn't found after timeout then needs to keep executing a test. How to handle the situation with Cypress ?
Igor Vlasuyk
  • 514
  • 2
  • 10
  • 22
0
votes
3 answers

Conditional Tests in Cypress using data-cy attributes as selectors

I see some posts about this exact topic, but none of them using data classes like I am as selectors, so it makes this conditional test a bit harder to write. The idea is that I have a table with pagination on it. My idea is to check if the…
LovelyAndy
  • 841
  • 8
  • 22
0
votes
3 answers

cyoress test validate div tag ID contains value

On the HTML page nested div tags are there. And either div tag ID = x or tag ID =y. in different HTML pages. <--! example 1 -->
<--! example 2 -->
Chintan
  • 41
  • 3
0
votes
4 answers

Cypress results with "pointer-events: none" error when using condition, what should I do?

I want to click on Next button to test pagination, until its class is "disabled". I used the code below. But it continues to click even "Next" button has "disabled" class. And Cypress throws the error at the attachment. static pagination(){ …
-1
votes
1 answer

Cypress cy.its('length') does not work when single element appeared but works correctly for multiple elements

In Cypress, I am trying to write function to type in the editable field. If multiple elements found for the same locator, then enter the string in last editable field, else type the text in the detected editable field. My below code works very well…
Rama
  • 815
  • 2
  • 17
  • 37
1
2