Testing
This page describes how to test your app.
Unit tests
The web-app-skeleton repository comes with a vitest setup. Run the unit tests with:
pnpm test:unit
Test helpers
The @opencloud-eu/web-test-helpers package provides utilities for mounting components with a mocked OpenCloud Web
context. Without them, every component that uses a composable of web-pkg fails to mount.
tests/unit/App.spec.ts
import { defaultPlugins, mount } from '@opencloud-eu/web-test-helpers'
import App from '../../src/App.vue'
describe('App', () => {
it('renders the title', () => {
const wrapper = mount(App, { global: { plugins: [...defaultPlugins()] } })
expect(wrapper.text()).toContain('My app')
})
})
For details, please refer to the package's README.md.
End to end tests
For end to end tests with Playwright, the web and web-extensions repositories contain working examples.