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.
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
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'
}]
],
// ...
};
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()
Root directory of the project.
Type: string
Default: process.cwd()
Environment file to be loaded before the server starts.
Type: string
Default: .env
Hostname to start the server on.
Type: string
Default: localhost
Port to start the server on.
Type: number
Default: process.env.NUXT_PORT || config.devServer.port
Set to true if test server should be started on https (certificates need to be configured in Nuxt config).
Type: boolean
Default: false
SSL certificate to be used for starting the server on https.
Type: string
SSL key to be used for starting the server on https.
Type: string
For more information on WebdriverIO see the homepage.