Skip to content

Automation Test Scripts - Dokan & Dokan-Pro Front-End

Notifications You must be signed in to change notification settings

Rat01047/Dokan-e2e-test

Repository files navigation

Dokan E2E Tests (Jest-Puppeteer)

Automated end-to-end tests for Dokan.

Table of contents

Pre-requisites

Install Node.js

Follow instructions on the node.js site to install Node.js.

Install NVM

Follow instructions in the NVM repository to install NVM.

Install Docker

Install Docker Desktop if you don't have it installed:

Running tests

Prep work for running tests

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) or http://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.

How to run tests in headless mode

To run e2e tests in headless mode use the following command:

npm run test-e2e

How to run tests in non-headless mode

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 faster
  • slowMo:50 - will run tests slower

How to retry failed tests

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)

How to run an individual test

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

About

Automation Test Scripts - Dokan & Dokan-Pro Front-End

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published