Allow component tests to be run via the module API
See original GitHub issueCurrent behavior
We start our Cypress tests by using the Cypress module API. This has worked fine for us until the release Cypress 7 and its Component Test Runner. We don’t know how to run the component tests from the API anymore.
Desired behavior
I expect to be able to write cypress.runCT({...})
in my JS script to run the component tests.
Versions
Cypress 7.2.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Module API - Cypress Documentation
cypress.run(). Runs Cypress tests via Node.js and resolve with all test results. See the Cypress Module API recipe.
Read more >What is Component Testing Or Module Testing (Learn With ...
Component Testing is performed after unit testing. Components are tested as soon as they are created, so there are chances that the results ......
Read more >Component testing scenarios - Angular
The waitForAsync() utility hides some asynchronous boilerplate by arranging for the tester's code to run in a special async test zone. You don't...
Read more >Testing Components depending on Services - Testing Angular
How to write unit and integration tests for Components with Service dependencies.
Read more >API Testing: Approaches, Tools, and Frameworks - AltexSoft
Usually, API testing is performed on APIs produced by the in-house development team. We don't test third-party APIs, but we can test the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @DamienCassou, thanks for the issue report! I proposed an API below. Looking for input before going ahead and scheduling this work. @brian-mann, any changes needed here?
Motivation
Passing
testingMode
within the Cypress module API’s options would allow the user to swap betweencypress run
andcypress run-ct
from within node.Proposed API
We’ll do an options-object approach and pass that through to run/open. Since 7.x we have the concept of
testingType
.Cypress’s module API is options-based, so we should continue that pattern and add another property to the options object. The property
testingType
is already used within Cypress internally and exposed on the Cypress config object. Currently, testingType’s main use is within the plugins file to support users that run both CT + E2E. It allows users to swap between Component-only plugins and E2E-only plugins. I think it makes sense to use it within the Cypress module API as well.We would extend the existing options defined in the module API docs with the following:
Property:
testingType
Valid values:e2e
,component
Default:e2e
Released in
7.3.0
.This comment thread has been locked. If you are still experiencing this issue after upgrading to Cypress v7.3.0, please open a new issue.