'How to test testcase wise in cypress

Just like @Test (TestNG) in Selenium. Is there a way to test cases one by one and each test case not affecting the subsequent one in cypress?



Solution 1:[1]

The order of running .spec.js files can be defined within cypress.json.

For example:

{
    "testFiles": [
      "test_1.spec.js",
      "test_2.spec.js",
      "test_3.spec.js"
    ]    
}

If you are talking about the order of tests within a single .spec.js file, this is based on the order of your tests. You can choose to include only some of them by using the .only suffix on your it functions (in case you are using mocha). This will work for any number of functions.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 antunb