Automated end-to-end tests for Dokan.
Follow instructions on the node.js site to install Node.js.
Follow instructions in the NVM repository to install NVM.
Install Docker Desktop if you don't have it installed:
Copy all the required plugins into test/e2e/wp-content/plugins and make sure all plugin paths are in wp.env file
Run the following in a terminal/command line window
-
cd
to the test/e2e folder -
npm install
-
npm run start-env
-
Use
docker ps
to confirm that the Docker containers are running.
- Navigate to
http://localhost:8088/ (dev Site)
orhttp://localhost:8089/ (test site)
If everything went well, you should be able to access the site.
- Run
npm run stop-env
when you are done with running e2e tests and before making any changes to test site configuration.
To run e2e tests in headless mode use the following command:
npm run test-e2e
Tests run in headless mode by default. However, sometimes it's useful to observe the browser while running or developing tests. To do so, you can run tests in a non-headless (dev) mode:
npm run test-interactive
Puppeteer also has SlowMo mode. SlowMo slows down Puppeteer’s operations. This makes it easier to see what is happening in the browser.
By default, SlowMo mode adds a 50 millisecond delay between test steps. If you'd like to override the length of the delay and have the tests run faster or slower change the slowMo parameter in jest-puppeteer.config file
slowMo: 50,
The faster you want the tests to run, the lower the value should be of slowMO
should be.
For example:
slowMo:10
- will run tests fasterslowMo:50
- will run tests slower
Sometimes tests may fail for different reasons such as network issues, or lost connection. To mitigate against test flakiness, failed tests are rerun up to 3 times before being marked as failed. The amount of retry attempts can be adjusted by changing jest retryTimes value in spec file:
jest.retryTimes(3)
To run an individual test, use the direct path to the spec. For example:
cd tests/e2e
npm run wp-scripts test-e2e admin.spec.js
or
npm run wp-scripts test-e2e admin.spec.js -- --puppeteer-interactive