Nuxt Service Service
wdio-nuxt-service is a 3rd party package, for more information please see GitHub | npm
This service helps you to launch your application when using Nuxt as build tool. It automatically starts the Nuxt server using your nuxt.conf.js
before launching the test.
Installation
If you are getting started with WebdriverIO you can use the configuration wizard to set everything up:
npm init wdio@latest .
It will detect your project as a Nuxt project and will install all necessary plugins for you. If you are adding this service on an existing setup, you can always install it via:
npm install wdio-nuxt-service --save-dev
Configuration
To enable the service, just add it to your services
list in your wdio.conf.js
file, e.g.:
// wdio.conf.js
export const config = {
// ...
services: ['nuxt'],
// ...
};
You can apply service option by passing in an array with a config object, e.g.:
// wdio.conf.js
export const config = {
// ...
services: [
['nuxt', {
rootDir: './packages/nuxt'
}]
],
// ...
};
Usage
If your config is set up accordingly, the service will set the baseUrl
option to point to your application. You can navigate to it via the url
command, e.g.:
await browser.url('/')
await expect(browser).toHaveTitle('Welcome to Nuxt!')
await expect($('aria/Welcome to Nuxt!')).toBePresent()