Relative Content

Tag Archive for typescriptcypress

Cypress. How to pass the same data to “it” functions within one “describe” function

I am testing 2 products. 1 for users and 1 for employees. The user creates a request and then it is processed by the employee. I generate an object with random test data. Based on this data, I create a request on product 1 and want to process it on product 2. Firstly, to find it, and secondly, to check the correctness of the data transfer. My problem is that different data is generated for each “it” function, despite the fact that I generate them outside the “it” functions. As I understand it, the problem is that I call “cy.visit” in each “it” function, because I am testing 2 products. And because of this, the state is reset between tests. The object itself does not change during the tests, only data is pulled from there.

Cypress – How to create a synchronous for loop?

I want to click a series of elements in a web page and check if each of those actions produces the correct API request URL. For that, I made an array of settings for each element and iterated over them, clicked the respective element and asserted the results.

Recursive function crashes Cypress test

In my test I need to fill particular cells in table. In tested app, cells do not exist in DOM unless they are visible in the scrolled view. So I need a method that will check if the cell with particular ID exist in DOM, if no scroll horizontal to right by 100px and check again. If it still doesn’t exist scroll again and so on.