Update README with more accurate details on how to run e2e tests.

This commit is contained in:
Julia Amosova 2020-09-18 14:30:54 -04:00
parent 98edbef9a9
commit d66e7ef3b3
1 changed files with 23 additions and 30 deletions

View File

@ -5,7 +5,7 @@ Automated end-to-end tests for WooCommerce.
## Table of contents
- [Pre-requisites](#pre-requisites)
- [Install NodeJS](#install-nodejs)
- [Install Node.js](#install-node.js)
- [Install Docker](#install-docker)
- [Configuration](#configuration)
- [Test Environment](#test-environment)
@ -19,19 +19,16 @@ Automated end-to-end tests for WooCommerce.
- [How to skip tests](#how-to-skip-tests)
- [Writing tests](#writing-tests)
- [Debugging tests](#debugging-tests)
- [Docker basics](#docker-basics)
- [How to stop and restart Docker](#how-to-stop-and-restart-docker)
- [How to stop Docker and do a clean restart](#how-to-stop-docker-and-do-a-clean-restart)
## Pre-requisites
### Install NodeJS
### Install Node.js
Install NodeJS on Mac:
Follow [instructions on the node.js site](https://nodejs.org/en/download/) to install Node.js.
```bash
brew install node
```
### Install NVM
Follow instructions in the [NVM repository](https://github.com/nvm-sh/nvm) to install NVM.
### Install Docker
@ -88,6 +85,8 @@ Setup Wizard e2e test (located in `activate-and-setup` directory) will run befor
- `git checkout master` or checkout the branch where you need to run tests
- Run `nvm use`
- Run `npm install`
- Run `npm install jest --global`
@ -96,27 +95,29 @@ Setup Wizard e2e test (located in `activate-and-setup` directory) will run befor
- Run `npm run build:core`
- Run the following command to build the test site using Docker: `npm run docker:up` and watch the site being built. Note that it may take a few minutes the first time you do that. The process is considered completed when the messages letting you know that WordPress was installed, WooCommerce was activated and users created will be displayed:
- Run `npm run docker:up` - it will build the test site using Docker.
- Run `docker ps` - to confirm that the Docker containers were built and running. You should see the log that looks similar to below indicating that everything had been built as expected:
```
wordpress-cli_1 | Success: WordPress installed successfully.
wordpress-cli_1 | Plugin 'woocommerce' activated.
wordpress-cli_1 | Success: Activated 1 of 1 plugins.
wordpress-cli_1 | Success: Created user 2.
woocommerce_wordpress-cli_1 exited with code 0
woocommerce_wordpress-cli_1 exited with code 0
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c380e1964506 env_wordpress-cli "entrypoint.sh" 7 seconds ago Up 5 seconds woocommerce_wordpress-cli
2ab8e8439e9f wordpress:5.5.1 "docker-entrypoint.s…" 8 seconds ago Up 7 seconds 0.0.0.0:8084->80/tcp woocommerce_wordpress-www
4c1e3f2a49db mariadb:10.5.5 "docker-entrypoint.s…" 10 seconds ago Up 8 seconds 3306/tcp woocommerce_db
```
For more Docker commands, scroll down to [Docker basics](#docker-basics).
- Navigate to `http://localhost:8084/`
- Open new terminal window and `cd` to the current branch again.
If everything went well, you should be able to access the site. If you changed the port to something other than `8084`, use the appropriate port to access your site.
- Run the following command to make sure the containers were built and running: `docker ps`. You should see the 2 following containers:
As noted in [Test Variables](#test-variables) section, use the following Admin user details to login:
- `woocommerce_wordpress-woocommerce-dev`
- `mariadb:10.4`
```
Username: admin
PW: password
```
- Navigate to `http://localhost:8084/`. If everything went well, you should be able to access the site.
- Run `npm run docker:down` when you are done with running e2e tests or when making any changes to test suite.
### How to run tests in headless mode
@ -208,11 +209,3 @@ The following packages are used to write tests:
## Debugging tests
For Puppeteer debugging, follow [Google's documentation](https://developers.google.com/web/tools/puppeteer/debugging).
## Docker basics
### How to stop and restart Docker
- Press `Ctrl+C` in the terminal window where the containers are running
- Stop the container(s) using the following command: `npm run docker:down`
- Restart the containers using the following command: `npm run docker:up`