Vue.js
Vue.js is an approachable, performant and versatile framework for building web user interfaces. You can test Vue.js components directly in a real browser using WebdriverIO and its browser runner.
Setup
To setup WebdriverIO within your Vue.js project, follow the instructions in our component testing docs. Make sure to select vue
as preset within your runner options, e.g.:
// wdio.conf.js
export const config = {
// ...
runner: ['browser', {
preset: 'vue'
}],
// ...
}
If you are already using Vite as development server you can also just re-use your configuration in vite.config.ts
within your WebdriverIO config. For more information, see viteConfig
in runner options.
The Vue preset requires @vitejs/plugin-vue
to be installed. Also we recommend using Testing Library for rendering the component into the test page. Therefor you'll need to install the following additional dependencies:
- npm
- Yarn
- pnpm
npm install --save-dev @testing-library/vue @vitejs/plugin-vue
yarn add --dev @testing-library/vue @vitejs/plugin-vue
pnpm add --save-dev @testing-library/vue @vitejs/plugin-vue