Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Liam Defty committed Apr 7, 2020
1 parent 4b6f06c commit 5f92e89
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
## Contents

- [Why](#why)
- [TL;DR](#tl;dr)
- [Requirements](#requirements)
- [Installation](#installation)
- [Getting Started](#getting-started)
Expand All @@ -25,14 +24,6 @@ We make it easier to:
- Seed the database with test data
- Perform WordPress specific actions when writing tests

## TL;DR

1. `yarn add cypress --dev`
1. `yarn add wp-cypress --dev`
1. `import 'wp-cypress';` in `support/index.js`
1. `yarn run wp-cypress start`
1. `yarn run cypress open`

## Requirements

- Yarn
Expand All @@ -44,13 +35,10 @@ We make it easier to:

Ensure [Cypress](https://github.com/cypress-io/cypress/) is installed, then install WP Cypress.

TODO - not on npm yet

```sh
yarn add wp-cypress --dev
```

After installation, a new directory will be created in the project root called `wp-cypress`. To add the additional cypress commands you need to import the package in cypress directories `support/index.js` file.
To add the additional cypress commands you need to import the package in cypress directories `support/index.js` file.

```javascript
// ***********************************************************
Expand All @@ -71,6 +59,16 @@ After installation, a new directory will be created in the project root called `
import 'wp-cypress';
```

By default the testing environment will run on `http://localhost`. Ensure you have nothing else running on port 80 and add the base URL to your cypress config.

###### /cypress.json
```json
{
"baseUrl": "http://localhost",
"pageLoadTimeout": 30000
}
```

## Getting Started

### CLI
Expand All @@ -88,10 +86,12 @@ resetDB | Reset the database in the running container to it's initial state | `y

### Env

To start the test environment run `yarn run wp-cypress start` in your project root directory.
To start the test environment run `yarn run wp-cypress start` in your project root directory.

This may take a while as it builds and starts a new docker container. However, you only need to run this once. This commands also acts as a restart, firstly removing any containers and volumes before starting the docker container.

> Having trouble? Use File sharing to allow local directories on the Mac to be shared with Linux containers. See more https://docs.docker.com/docker-for-mac/#file-sharing
Once it is running there is no need to re-start it every time you run cypress. WP Cypress will reset the database to it's initial state between each suite of integration tests to ensure that each integration will have a clean slate.

In the `wp-cypress` directory you can add environment variables to the `.env` file. You can use this to specify the version of WordPress and which plugins/themes to install. All plugins will be activated and the first theme in the list will be activated. If this file is changed, you will need to re-run `wp-cypress start` to see the changes take effect.
Expand Down

0 comments on commit 5f92e89

Please sign in to comment.