@gasket/plugin-cypress
v7.0.6
Published
Integrates Cypress based testing into your Gasket application
Downloads
585
Readme
@gasket/plugin-cypress
Creates a Cypress-based testing environment for your Gasket application.
Installation
This plugin is only used by presets for create-gasket-app
and is not
installed manually for applications. It is automatically included when using
specific presets.
Usage
When you create a new Gasket application that includes the
@gasket/plugin-cypress
, it configures a Cypress-based testing environment. It
will automatically add the following scripts
to your package.json
:
npm run cypress
: Opens the Cypress Test Runner using the default configuration values fromcypress.config.js
. It runs all tests specified in the test folder.npm run cypress:headless
: Runs all Cypress tests to completion in headless mode. The tests should be located in the test folder, or in the folder defined byintegrationFolder
in thecypress.config.js
configuration.npm run e2e
: Starts the Next.js production server (next start
) and opens the Cypress Test Runner for end-to-end testing. The server runs athttp://localhost:3000
by default.npm run e2e:headless
: Similar tonpm run e2e
, but runs the Cypress tests to completion in headless mode.
Important Notes
- Before running
npm run cypress
ornpm run cypress:headless
, make sure the server is running in a separate terminal tab. You can start the server by runningnpm run start
(ornpm run start:local
). - Before starting the server for the first time, you must run
npm run build
to ensure that all necessary assets are built and available for testing.
Additional Configuration
The plugin automatically detects if your project is a React-based application and adjusts its setup accordingly:
- For React projects, it adds additional dependencies like
start-server-and-test
for easier server and test management. - Test files and configuration files will be added under a generator directory.