My 'example-spec.js' tests under the integration folder contain 15 tests, each time the Cypress.io will run all the 15 tests written in the 'example-spec.js'. I would like to choose and specify 'which' test needs to run, maybe 1 or 2 test at a time. The reason maybe I don't want to wait to see the output of all test while adding a 'new' test. Is there any way to control the test run in Cypress.io?
Asked
Active
Viewed 8,386 times
13
-
Does this answer your question? [Cypress: run only one test](https://stackoverflow.com/questions/55054337/cypress-run-only-one-test) – kuceb May 27 '20 at 19:03
3 Answers
19
I don't know if there's a way to do it from the user interface, but you can use mocha methods to run only chosen tests by:
- Replacing
it
withxit
tests you want to omit - Using
it.skip
on tests you want to omit - Using
it.only
on single test you want to run
To skip entire context/describe suite use context.skip()
or describe.skip()
which are identical.

Valera Tumash
- 628
- 7
- 16

Krzysztof Grzybek
- 8,818
- 2
- 31
- 35
-
1Awesome!, this is working. I too haven't seen any other option to disable the test from UI – soccerway Aug 15 '18 at 10:19
-
-
1
2
Use it.only()
and it.skip()
See cypress documentation: https://docs.cypress.io/guides/core-concepts/writing-and-organizing-tests.html#Excluding-and-Including-Tests

fkoessler
- 6,932
- 11
- 60
- 92
-1
I just tried this it.skip
and that didn't work for me.
But using this.skip();
is working a lot better.
it('test page', function () {
// skip this test for now
this.skip();
cy.visit('http://example.com/')
cy.contains('test page').click()
cy.url()
.should('include', '/test-page/')
})

Kevdog777
- 908
- 7
- 20
- 43