# Nuxt Service Service

> wdio-nuxt-service is a 3rd party package, for more information please see [GitHub](https://github.com/webdriverio-community/wdio-nuxt-service) | [npm](https://www.npmjs.com/package/wdio-nuxt-service)

This service helps you to launch your application when using [Nuxt](https://nuxt.com/) as build tool. It automatically starts the Nuxt server using your `nuxt.conf.js` before launching the test.

## Installation[​](#installation "Direct link to 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[​](#configuration "Direct link to 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[​](#usage "Direct link to Usage")

If your config is set up accordingly, the service will set the [`baseUrl`](https://webdriver.io/docs/configuration#baseurl) option to point to your application. You can navigate to it via the [`url`](https://webdriver.io/docs/api/browser/url) command, e.g.:

```
await browser.url('/')
await expect(browser).toHaveTitle('Welcome to Nuxt!')
await expect($('aria/Welcome to Nuxt!')).toBePresent()
```

## Options[​](#options "Direct link to Options")

### `rootDir`[​](#rootdir "Direct link to rootdir")

Root directory of the project.

Type: `string`<br />Default: `process.cwd()`

### `dotenv`[​](#dotenv "Direct link to dotenv")

Environment file to be loaded before the server starts.

Type: `string`<br />Default: `.env`

### `hostname`[​](#hostname "Direct link to hostname")

Hostname to start the server on.

Type: `string`<br />Default: `localhost`

### `port`[​](#port "Direct link to port")

Port to start the server on.

Type: `number`<br />Default: `process.env.NUXT_PORT || config.devServer.port`

### `https`[​](#https "Direct link to https")

Set to true if test server should be started on https (certificates need to be configured in Nuxt config).

Type: `boolean`<br />Default: `false`

### `sslCert`[​](#sslcert "Direct link to sslcert")

SSL certificate to be used for starting the server on https.

Type: `string`

### `sslKey`[​](#sslkey "Direct link to sslkey")

SSL key to be used for starting the server on https.

Type: `string`

***

For more information on WebdriverIO see the [homepage](https://webdriver.io).
