Skip to content

Commit 0253dac

Browse files
committed
test: Adding a first e2e test
1 parent 609b1d6 commit 0253dac

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

tests/playground.e2e.test.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { describe, it, expect } from 'vitest'
2+
import { setup, $fetch } from '@nuxt/test-utils/e2e'
3+
4+
describe('Playground E2E Tests', async () => {
5+
await setup({
6+
rootDir: '.playground',
7+
})
8+
9+
it('should render the index page', async () => {
10+
const html = await $fetch('/')
11+
12+
// Check that the page renders
13+
expect(html).toContain('<main>')
14+
})
15+
16+
it('should display icons', async () => {
17+
const html = await $fetch('/')
18+
19+
// Check that AttributeIcon components are rendered with correct classes
20+
expect(html).toContain('icon--arrow-left')
21+
expect(html).toContain('icon--arrow-right')
22+
})
23+
24+
it('should render menu navigation', async () => {
25+
const html = await $fetch('/')
26+
27+
// Check that the menu items are rendered
28+
expect(html).toContain('Home')
29+
expect(html).toContain('About')
30+
expect(html).toContain('Contact')
31+
32+
// Check that menu items have proper HTML structure
33+
expect(html).toContain('<ul>')
34+
expect(html).toContain('<li>')
35+
expect(html).toContain('href="/"')
36+
})
37+
38+
it('should process markdown content', async () => {
39+
const html = await $fetch('/')
40+
41+
// Check that the markdown content section is rendered
42+
expect(html).toContain('class="text"')
43+
44+
// Check that the content from the YAML file is processed
45+
expect(html).toContain('Lorem')
46+
expect(html).toContain('Ispum')
47+
expect(html).toContain('Dolor')
48+
expect(html).toContain('Amet')
49+
})
50+
})

vitest.config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { defineVitestConfig } from '@nuxt/test-utils/config'
2+
3+
export default defineVitestConfig({
4+
test: {
5+
environment: 'nuxt',
6+
testTimeout: 60000,
7+
},
8+
})

0 commit comments

Comments
 (0)