Skip to content

Commit

Permalink
test: add a few more basic examples for e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Nov 6, 2023
1 parent 0caf44d commit 490753c
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
15 changes: 15 additions & 0 deletions examples/app/test/browser.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { fileURLToPath } from 'node:url'
import { createPage, setup } from '@nuxt/test-utils'
import { describe, expect, it } from 'vitest'

await setup({
rootDir: fileURLToPath(new URL('../', import.meta.url)),
browser: true,
})

describe('browser', async () => {
it('runs a test', async () => {
const page = await createPage('/')
expect(page.getByRole('heading').innerText()).toContain('Welcome to Nuxt!')
})
})
17 changes: 17 additions & 0 deletions examples/app/test/dev.e2e.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { fileURLToPath } from 'node:url'
import { $fetch, setup } from '@nuxt/test-utils'
import { describe, expect, it } from 'vitest'

await setup({
rootDir: fileURLToPath(new URL('../', import.meta.url)),
dev: true,
})

describe('server (dev)', async () => {
it('runs a test', async () => {
const html = await $fetch('/')
expect(html.slice(0, 15)).toMatchInlineSnapshot(`
"<!DOCTYPE html>"
`)
})
})
File renamed without changes.

0 comments on commit 490753c

Please sign in to comment.