|
| 1 | +# @vue/cli-plugin-e2e-webdriverio |
| 2 | + |
| 3 | +> e2e-webdriverio plugin for vue-cli |
| 4 | +
|
| 5 | +## Injected Commands |
| 6 | + |
| 7 | +- **`vue-cli-service test:e2e`** |
| 8 | + |
| 9 | + Run end-to-end tests with [WebdriverIO](https://webdriver.io/). |
| 10 | + |
| 11 | + Options: |
| 12 | + |
| 13 | + ``` |
| 14 | + --remote Run tests remotely on SauceLabs |
| 15 | +
|
| 16 | + All WebdriverIO CLI options are also supported. |
| 17 | +
|
| 18 | + ``` |
| 19 | + |
| 20 | + Additionally, all [WebdriverIO CLI options](https://webdriver.io/docs/clioptions.html) are also supported. |
| 21 | + E.g.: `--baseUrl`, `--bail` etc. |
| 22 | + |
| 23 | + |
| 24 | +## Project Structure |
| 25 | + |
| 26 | +The following structure will be generated when installing this plugin: |
| 27 | + |
| 28 | +``` |
| 29 | +tests/e2e/ |
| 30 | + ├── pageobjects/ |
| 31 | + | └── app.js |
| 32 | + ├── specs/ |
| 33 | + | ├── app.spec.js |
| 34 | + └── globals.js |
| 35 | +``` |
| 36 | + |
| 37 | +In addition to that there will be 3 configuration files generated: |
| 38 | + |
| 39 | +- `wdio.shared.conf.js`: a shared configuration with all options defined for all environments |
| 40 | +- `wdio.local.conf.js`: a local configuration for local testing |
| 41 | +- `wdio.sauce.conf.js`: a remote configuration for testing on a cloud provider like [Sauce Labs](https://saucelabs.com/) |
| 42 | + |
| 43 | +The directories contain: |
| 44 | + |
| 45 | +#### `pageobjects` |
| 46 | +Contains an example for an page object. Read more on using [PageObjects](https://webdriver.io/docs/pageobjects.html) with WebdriverIO. |
| 47 | + |
| 48 | +#### `specs` |
| 49 | +Your e2e tests. |
| 50 | + |
| 51 | +## Installing in an Already Created Project |
| 52 | + |
| 53 | +``` sh |
| 54 | +vue add e2e-webdriverio |
| 55 | +``` |
| 56 | + |
| 57 | +For users with older CLI versions you may need to run `vue add @vue/e2e-webdriverio`. |
| 58 | + |
| 59 | +## Running Tests |
| 60 | + |
| 61 | +By default, all tests inside the `specs` folder will be run using Chrome. If you'd like to run end-to-end tests against Chrome (or Firefox) in headless mode, simply pass the `--headless` argument. Tests will be automatically run in parallel when executed in the cloud. |
| 62 | + |
| 63 | +```sh |
| 64 | +$ vue-cli-service test:e2e |
| 65 | +``` |
| 66 | + |
| 67 | +**Running a single test** |
| 68 | + |
| 69 | +To run a single test supply the filename path. E.g.: |
| 70 | + |
| 71 | +```sh |
| 72 | +$ vue-cli-service test:e2e --spec tests/e2e/specs/test.js |
| 73 | +``` |
| 74 | + |
| 75 | +**Skip Dev server auto-start** |
| 76 | + |
| 77 | +If the development server is already running and you want to skip starting it automatically, pass the `--url` argument: |
| 78 | + |
| 79 | +```sh |
| 80 | +$ vue-cli-service test:e2e --baseUrl=http://localhost:8080/ |
| 81 | +``` |
0 commit comments