Enabling Cypress extension
This is an experimental feature.
The enableCypressExtension
experimental feature flag allows you to leverage Cypress (opens in a new tab) extensions within your FastStore project, enabling you to seamlessly run custom Cypress tests.
Cypress extensions enhance the testing capabilities of your Faststore project by enabling the incorporation of custom Cypress tests alongside the native integration tests provided by Faststore.
With enableCypressExtension
, you can implement custom integration tests into a dedicated Cypress folder within your storefront project. This integration ensures the smooth execution of both the native tests and the custom ones you create as part of the continuous integration (CI) pipeline.
Learn how to add custom integration tests in the following steps.
Before you begin
-
Please be aware that this feature is experimental and may not be suitable for all use cases.
-
Refer to Cypress documentation (opens in a new tab) for more information on this testing tool.
-
Ensure that you are using
@faststore/core
version2.1.56
or above and@faststore/cli
version2.2.6
or above. If you have a version that is lower than this requirement, change the following:- In your storefront project, open the
package.json
file. - Navigate to the
@faststore/core
and update it to be at least2.1.56
. - Navigate to the
@faststore/cli
and update it to be at least2.2.6
. - Run
yarn dev
to update your changes.
- In your storefront project, open the
Step 1: Enabling enableCypressExtension
- Open the
faststore.config.js
file. - Add the
experimental
object with theenableCypressExtension
as it property. - Set the
enableCypressExtension
value totrue
:
},
experimental: {
enableCypressExtension: true,
}
Step 2: Integrating custom Cypress tests into your FastStore project
Just like any other project using Cypress, all standard Cypress folders and configuration files are supported. (see official Cypress configuration guide here (opens in a new tab))
- In the root directory of your storefront project, create a new folder named
cypress
. - Add your custom integration tests within the
cypress/integration
folder. - With the local server running, run
yarn test
to open the Cypress app and to check your tests execution. - Open a pull request with the changes you have made.
- Within the pull request, navigate to Checks > Integration Tests and check the Details section.
- Review the results to check the execution status of your custom integration tests.