'Cypress: parent package runs its cypress/integration test and its dependencies cypress/integration tests

Question: Can a parent Cypress npm project import/add/run the Cypress tests of its dependencies Cypress npm projects?

The response from the question is this link works, breaking up a monolith Cypress test package into multiple Cypress test package and using Module API. However, I have had to rethink my question. What I did not address was that there are dependencies (custom commands) between npm cypress packages.

Cypress: Import tests into "./cypress/integration" from multiple npm dependencies?

Example:

  • npm package cy_test_A has dependency on npm package cy_test_B custom commands,
  • npm package cy_test_B has dependency on npm package cy_test_C custom commands.

Each of these packages has cypress integration for specs and src for custom commands:

cy_test_***

├── cypress
│   ├── integration
│   │   └── tests
│   └── support
│       └── specs
├── src
│   └── commands

Can Cypress integration tests be imported from its dependency? When I perform a test run, I want to see a combined tests including both the dependencies' cypress tests + the parent's cypress test.

npm package cy_test_A is dependent on custom commands within npm package cy_test_B, which are used in cy_test_A cypress integration tests. When building npm package cy_test_B, it has its own cypress integration tests before committing to npm repository. I want cy_test_A to run its own cypress integration tests but cypress integration tests of its dependency cy_test_B as well.

├── cypress
│   ├── integration
│   │   └── tests_A <<< Dependent on src/commands **cy_test_B**
│   │   └── tests_B <<< Imported cypress/integration/tests from **cy_test_B**
│   └── support
│       └── specs
├── src
│   └── commands
├── node_module
│   └── **cy_test_B**
│       └── ***
│       └── ***

Ideas? Thank you



Sources

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

Source: Stack Overflow

Solution Source