@dargmuesli/nuxt-vio-testing 13.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/e2e/specs/pages/root/error-404.spec.ts +63 -0
  2. package/e2e/specs/pages/root/error-404.spec.ts-snapshots/visual-regression-consistent-appearance-system-chromium-linux.png +0 -0
  3. package/e2e/specs/pages/root/error-404.spec.ts-snapshots/visual-regression-consistent-appearance-system-firefox-linux.png +0 -0
  4. package/e2e/specs/pages/root/error-404.spec.ts-snapshots/visual-regression-consistent-appearance-system-webkit-linux.png +0 -0
  5. package/e2e/specs/pages/root/index.spec.ts +114 -0
  6. package/e2e/specs/pages/root/index.spec.ts-snapshots/schema-org-graph-dev-chromium-linux.json +30 -0
  7. package/e2e/specs/pages/root/index.spec.ts-snapshots/schema-org-graph-dev-firefox-linux.json +30 -0
  8. package/e2e/specs/pages/root/index.spec.ts-snapshots/schema-org-graph-dev-webkit-linux.json +30 -0
  9. package/e2e/specs/pages/root/index.spec.ts-snapshots/schema-org-graph-node-chromium-linux.json +1 -0
  10. package/e2e/specs/pages/root/index.spec.ts-snapshots/schema-org-graph-node-firefox-linux.json +1 -0
  11. package/e2e/specs/pages/root/index.spec.ts-snapshots/schema-org-graph-node-webkit-linux.json +1 -0
  12. package/e2e/specs/pages/root/index.spec.ts-snapshots/schema-org-graph-static-chromium-linux.json +1 -0
  13. package/e2e/specs/pages/root/index.spec.ts-snapshots/schema-org-graph-static-firefox-linux.json +1 -0
  14. package/e2e/specs/pages/root/index.spec.ts-snapshots/schema-org-graph-static-webkit-linux.json +1 -0
  15. package/e2e/specs/pages/root/index.spec.ts-snapshots/visual-regression-consistent-appearance-dark-chromium-linux.png +0 -0
  16. package/e2e/specs/pages/root/index.spec.ts-snapshots/visual-regression-consistent-appearance-dark-firefox-linux.png +0 -0
  17. package/e2e/specs/pages/root/index.spec.ts-snapshots/visual-regression-consistent-appearance-dark-webkit-linux.png +0 -0
  18. package/e2e/specs/pages/root/index.spec.ts-snapshots/visual-regression-consistent-appearance-light-chromium-linux.png +0 -0
  19. package/e2e/specs/pages/root/index.spec.ts-snapshots/visual-regression-consistent-appearance-light-firefox-linux.png +0 -0
  20. package/e2e/specs/pages/root/index.spec.ts-snapshots/visual-regression-consistent-appearance-light-webkit-linux.png +0 -0
  21. package/e2e/specs/pages/root/index.spec.ts-snapshots/visual-regression-consistent-appearance-system-chromium-linux.png +0 -0
  22. package/e2e/specs/pages/root/index.spec.ts-snapshots/visual-regression-consistent-appearance-system-firefox-linux.png +0 -0
  23. package/e2e/specs/pages/root/index.spec.ts-snapshots/visual-regression-consistent-appearance-system-webkit-linux.png +0 -0
  24. package/e2e/specs/pages/root/index.spec.ts-snapshots/visual-regression-consistent-appearance-with-cookie-banner-chromium-linux.png +0 -0
  25. package/e2e/specs/pages/root/index.spec.ts-snapshots/visual-regression-consistent-appearance-with-cookie-banner-firefox-linux.png +0 -0
  26. package/e2e/specs/pages/root/index.spec.ts-snapshots/visual-regression-consistent-appearance-with-cookie-banner-webkit-linux.png +0 -0
  27. package/e2e/specs/pages/root/index.spec.ts-snapshots/visual-regression-generates-the-open-graph-image-1-chromium-linux.png +0 -0
  28. package/e2e/specs/pages/root/index.spec.ts-snapshots/visual-regression-generates-the-open-graph-image-1-firefox-linux.png +0 -0
  29. package/e2e/specs/pages/root/index.spec.ts-snapshots/visual-regression-generates-the-open-graph-image-1-webkit-linux.png +0 -0
  30. package/e2e/specs/pages/root/index.spec.ts-snapshots/visual-regression-generates-the-open-graph-image-2-chromium-linux.png +0 -0
  31. package/e2e/specs/pages/root/index.spec.ts-snapshots/visual-regression-generates-the-open-graph-image-2-firefox-linux.png +0 -0
  32. package/e2e/specs/pages/root/index.spec.ts-snapshots/visual-regression-generates-the-open-graph-image-2-webkit-linux.png +0 -0
  33. package/e2e/specs/pages/root/legal-notice.spec.ts +50 -0
  34. package/e2e/specs/pages/root/legal-notice.spec.ts-snapshots/schema-org-graph-dev-chromium-linux.json +31 -0
  35. package/e2e/specs/pages/root/legal-notice.spec.ts-snapshots/schema-org-graph-dev-firefox-linux.json +31 -0
  36. package/e2e/specs/pages/root/legal-notice.spec.ts-snapshots/schema-org-graph-dev-webkit-linux.json +31 -0
  37. package/e2e/specs/pages/root/legal-notice.spec.ts-snapshots/schema-org-graph-node-chromium-linux.json +1 -0
  38. package/e2e/specs/pages/root/legal-notice.spec.ts-snapshots/schema-org-graph-node-firefox-linux.json +1 -0
  39. package/e2e/specs/pages/root/legal-notice.spec.ts-snapshots/schema-org-graph-node-webkit-linux.json +1 -0
  40. package/e2e/specs/pages/root/legal-notice.spec.ts-snapshots/schema-org-graph-static-chromium-linux.json +1 -0
  41. package/e2e/specs/pages/root/legal-notice.spec.ts-snapshots/schema-org-graph-static-firefox-linux.json +1 -0
  42. package/e2e/specs/pages/root/legal-notice.spec.ts-snapshots/schema-org-graph-static-webkit-linux.json +1 -0
  43. package/e2e/specs/pages/root/legal-notice.spec.ts-snapshots/visual-regression-consistent-appearance-1-chromium-linux.png +0 -0
  44. package/e2e/specs/pages/root/legal-notice.spec.ts-snapshots/visual-regression-consistent-appearance-1-firefox-linux.png +0 -0
  45. package/e2e/specs/pages/root/legal-notice.spec.ts-snapshots/visual-regression-consistent-appearance-1-webkit-linux.png +0 -0
  46. package/e2e/specs/pages/root/legal-notice.spec.ts-snapshots/visual-regression-generates-the-open-graph-image-1-chromium-linux.png +0 -0
  47. package/e2e/specs/pages/root/legal-notice.spec.ts-snapshots/visual-regression-generates-the-open-graph-image-1-firefox-linux.png +0 -0
  48. package/e2e/specs/pages/root/legal-notice.spec.ts-snapshots/visual-regression-generates-the-open-graph-image-1-webkit-linux.png +0 -0
  49. package/e2e/specs/pages/root/legal-notice.spec.ts-snapshots/visual-regression-generates-the-open-graph-image-2-chromium-linux.png +0 -0
  50. package/e2e/specs/pages/root/legal-notice.spec.ts-snapshots/visual-regression-generates-the-open-graph-image-2-firefox-linux.png +0 -0
  51. package/e2e/specs/pages/root/legal-notice.spec.ts-snapshots/visual-regression-generates-the-open-graph-image-2-webkit-linux.png +0 -0
  52. package/e2e/specs/pages/root/privacy-policy.spec.ts +40 -0
  53. package/e2e/specs/pages/root/privacy-policy.spec.ts-snapshots/visual-regression-consistent-appearance-1-chromium-linux.png +0 -0
  54. package/e2e/specs/pages/root/privacy-policy.spec.ts-snapshots/visual-regression-consistent-appearance-1-firefox-linux.png +0 -0
  55. package/e2e/specs/pages/root/privacy-policy.spec.ts-snapshots/visual-regression-consistent-appearance-1-webkit-linux.png +0 -0
  56. package/e2e/specs/pages/root/privacy-policy.spec.ts-snapshots/visual-regression-generates-the-open-graph-image-1-chromium-linux.png +0 -0
  57. package/e2e/specs/pages/root/privacy-policy.spec.ts-snapshots/visual-regression-generates-the-open-graph-image-1-firefox-linux.png +0 -0
  58. package/e2e/specs/pages/root/privacy-policy.spec.ts-snapshots/visual-regression-generates-the-open-graph-image-1-webkit-linux.png +0 -0
  59. package/e2e/specs/pages/root/privacy-policy.spec.ts-snapshots/visual-regression-generates-the-open-graph-image-2-chromium-linux.png +0 -0
  60. package/e2e/specs/pages/root/privacy-policy.spec.ts-snapshots/visual-regression-generates-the-open-graph-image-2-firefox-linux.png +0 -0
  61. package/e2e/specs/pages/root/privacy-policy.spec.ts-snapshots/visual-regression-generates-the-open-graph-image-2-webkit-linux.png +0 -0
  62. package/e2e/specs/server/headers.spec.ts +53 -0
  63. package/e2e/specs/server/headers.spec.ts-snapshots/csp-production-chromium-linux.txt +1 -0
  64. package/e2e/specs/server/headers.spec.ts-snapshots/csp-production-firefox-linux.txt +1 -0
  65. package/e2e/specs/server/headers.spec.ts-snapshots/csp-production-webkit-linux.txt +1 -0
  66. package/e2e/specs/server/robots.spec.ts +29 -0
  67. package/e2e/specs/server/robots.spec.ts-snapshots/robots-txt-content-development-chromium-linux.txt +4 -0
  68. package/e2e/specs/server/robots.spec.ts-snapshots/robots-txt-content-development-firefox-linux.txt +4 -0
  69. package/e2e/specs/server/robots.spec.ts-snapshots/robots-txt-content-development-webkit-linux.txt +4 -0
  70. package/e2e/specs/server/robots.spec.ts-snapshots/robots-txt-content-production-chromium-linux.txt +4 -0
  71. package/e2e/specs/server/robots.spec.ts-snapshots/robots-txt-content-production-firefox-linux.txt +4 -0
  72. package/e2e/specs/server/robots.spec.ts-snapshots/robots-txt-content-production-webkit-linux.txt +4 -0
  73. package/e2e/specs/server/sitemap.spec.ts +42 -0
  74. package/e2e/specs/server/sitemap.spec.ts-snapshots/sitemap-content-de-chromium-linux.txt +21 -0
  75. package/e2e/specs/server/sitemap.spec.ts-snapshots/sitemap-content-de-firefox-linux.txt +21 -0
  76. package/e2e/specs/server/sitemap.spec.ts-snapshots/sitemap-content-de-webkit-linux.txt +21 -0
  77. package/e2e/specs/server/sitemap.spec.ts-snapshots/sitemap-content-en-chromium-linux.txt +21 -0
  78. package/e2e/specs/server/sitemap.spec.ts-snapshots/sitemap-content-en-firefox-linux.txt +21 -0
  79. package/e2e/specs/server/sitemap.spec.ts-snapshots/sitemap-content-en-webkit-linux.txt +21 -0
  80. package/e2e/utils/constants.ts +37 -0
  81. package/e2e/utils/tests.ts +574 -0
  82. package/package.json +58 -0
  83. package/playwright.config.ts +100 -0
@@ -0,0 +1,63 @@
1
+ import { test, expect } from '@playwright/test'
2
+
3
+ import { SITE_URL } from '#src/utils/constants'
4
+ import { COOKIE_CONTROL_DEFAULT, PAGE_READY } from '../../../utils/constants'
5
+
6
+ test.beforeEach(async ({ context }) => {
7
+ await context.addCookies([
8
+ {
9
+ name: 'ncc_c',
10
+ value: COOKIE_CONTROL_DEFAULT,
11
+ url: SITE_URL,
12
+ },
13
+ ])
14
+ })
15
+
16
+ test.describe('page', () => {
17
+ test('status code', async ({ request }) => {
18
+ const resp = await request.get('/does-not-exit')
19
+ expect(resp.status()).toBe(404)
20
+ })
21
+ })
22
+
23
+ test.describe('internationalization', () => {
24
+ const textEnglish = '404 - Not Found'
25
+ const textGerman = '404 - Nicht gefunden'
26
+
27
+ test('English translations', async ({ page }) => {
28
+ await page.goto('/does-not-exit')
29
+ await expect(page.getByText(textEnglish)).toBeVisible()
30
+ })
31
+
32
+ test('German translations', async ({ page }) => {
33
+ await page.goto('/de/does-not-exit')
34
+ await expect(page.getByText(textGerman)).toBeVisible()
35
+ })
36
+ })
37
+
38
+ test.describe('visual regression', () => {
39
+ test('consistent appearance', async ({ page }) => {
40
+ await page.goto('/does-not-exit')
41
+ await PAGE_READY({
42
+ page,
43
+ options: {
44
+ isLoading: false,
45
+ },
46
+ })
47
+ await expect(page).toHaveScreenshot(
48
+ 'visual-regression-consistent-appearance-system.png',
49
+ {
50
+ fullPage: true,
51
+ },
52
+ )
53
+ })
54
+
55
+ // TODO: enable (https://github.com/harlan-zw/nuxt-og-image/issues/81)
56
+ // test('generates the open graph image', async ({ page }) => {
57
+ // await page.goto('/__og-image__/image/does-not-exist/og.png')
58
+ // await expect(page).toHaveScreenshot({ fullPage: true })
59
+
60
+ // await page.goto('/__og-image__/image/de/does-not-exist/og.png')
61
+ // await expect(page).toHaveScreenshot({ fullPage: true })
62
+ // })
63
+ })
@@ -0,0 +1,114 @@
1
+ import AxeBuilder from '@axe-core/playwright'
2
+ import { test, expect } from '@playwright/test'
3
+
4
+ import { SITE_URL } from '#src/utils/constants'
5
+ import { COOKIE_CONTROL_DEFAULT, PAGE_READY } from '../../../utils/constants'
6
+ import { testMetadata } from '../../../utils/tests'
7
+
8
+ test.beforeEach(async ({ context }) => {
9
+ await context.addCookies([
10
+ {
11
+ name: 'ncc_c',
12
+ value: COOKIE_CONTROL_DEFAULT,
13
+ url: SITE_URL,
14
+ },
15
+ ])
16
+ })
17
+
18
+ test.describe('accessibility', () => {
19
+ test('violations', async ({ page }) => {
20
+ await page.goto('/')
21
+ await PAGE_READY({ page })
22
+ const accessibilityScanResults = await new AxeBuilder({ page }).analyze()
23
+ expect(
24
+ accessibilityScanResults.violations
25
+ .map(
26
+ (x) =>
27
+ `${x.id}\n${x.nodes.map(
28
+ (y) => `${y.failureSummary}\n(${y.html}\n(${y.target})`,
29
+ )}`,
30
+ )
31
+ .join('\n'),
32
+ ).toEqual('')
33
+ // expect(accessibilityScanResults.violations.length).toEqual(0)
34
+ })
35
+ })
36
+
37
+ test.describe('page', () => {
38
+ test('status code', async ({ request }) => {
39
+ const resp = await request.get('/')
40
+ expect(resp.status()).toBe(200)
41
+ })
42
+ test('metadata', async ({ page }) => {
43
+ await testMetadata({ page, path: '/', title: 'Vio Playground' })
44
+ })
45
+ })
46
+
47
+ test.describe('internationalization', () => {
48
+ const textEnglish = 'Please check your input 🙈'
49
+ const textGerman = 'Bitte überprüfe deine Eingaben 🙈'
50
+
51
+ test('English translations', async ({ page }) => {
52
+ await page.goto('/')
53
+ await expect(page.getByText(textEnglish)).toBeVisible()
54
+ })
55
+
56
+ test('German translations', async ({ page }) => {
57
+ await page.goto('/de')
58
+ await expect(page.getByText(textGerman)).toBeVisible()
59
+ })
60
+ })
61
+
62
+ test.describe('visual regression', () => {
63
+ test('consistent appearance', async ({ page }) => {
64
+ await page.goto('/')
65
+ await PAGE_READY({ page })
66
+ await expect(page).toHaveScreenshot(
67
+ 'visual-regression-consistent-appearance-system.png',
68
+ {
69
+ fullPage: true,
70
+ },
71
+ )
72
+
73
+ await page.emulateMedia({ colorScheme: 'light' })
74
+ await expect(page).toHaveScreenshot(
75
+ 'visual-regression-consistent-appearance-light.png',
76
+ {
77
+ fullPage: true,
78
+ },
79
+ )
80
+
81
+ await page.emulateMedia({ colorScheme: 'dark' })
82
+ await expect(page).toHaveScreenshot(
83
+ 'visual-regression-consistent-appearance-dark.png',
84
+ {
85
+ fullPage: true,
86
+ },
87
+ )
88
+ })
89
+
90
+ test('consistent appearance with cookie banner', async ({
91
+ context,
92
+ page,
93
+ }) => {
94
+ // TODO: only remove the cookie control cookie (https://github.com/microsoft/playwright/issues/10143)
95
+ await context.clearCookies()
96
+
97
+ await page.goto('/')
98
+ await PAGE_READY({ page, options: { cookieControl: false } })
99
+ await expect(page).toHaveScreenshot(
100
+ 'visual-regression-consistent-appearance-with-cookie-banner.png',
101
+ {
102
+ fullPage: true,
103
+ },
104
+ )
105
+ })
106
+
107
+ test('generates the open graph image', async ({ page }) => {
108
+ await page.goto('/__og-image__/image/og.png')
109
+ await expect(page).toHaveScreenshot({ fullPage: true })
110
+
111
+ await page.goto('/__og-image__/image/de/og.png')
112
+ await expect(page).toHaveScreenshot({ fullPage: true })
113
+ })
114
+ })
@@ -0,0 +1,30 @@
1
+ {
2
+ "@context": "https://schema.org",
3
+ "@graph": [
4
+ {
5
+ "@id": "http://localhost:3000/#website",
6
+ "@type": "WebSite",
7
+ "description": "Vio is @dargmuesli's Nuxt layer.",
8
+ "inLanguage": "en",
9
+ "name": "Vio Playground",
10
+ "url": "http://localhost:3000"
11
+ },
12
+ {
13
+ "@id": "http://localhost:3000/#webpage",
14
+ "@type": "WebPage",
15
+ "description": "Vio is @dargmuesli's Nuxt layer.",
16
+ "url": "http://localhost:3000",
17
+ "isPartOf": {
18
+ "@id": "http://localhost:3000/#website"
19
+ },
20
+ "potentialAction": [
21
+ {
22
+ "@type": "ReadAction",
23
+ "target": [
24
+ "http://localhost:3000"
25
+ ]
26
+ }
27
+ ]
28
+ }
29
+ ]
30
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "@context": "https://schema.org",
3
+ "@graph": [
4
+ {
5
+ "@id": "http://localhost:3000/#website",
6
+ "@type": "WebSite",
7
+ "description": "Vio is @dargmuesli's Nuxt layer.",
8
+ "inLanguage": "en",
9
+ "name": "Vio Playground",
10
+ "url": "http://localhost:3000"
11
+ },
12
+ {
13
+ "@id": "http://localhost:3000/#webpage",
14
+ "@type": "WebPage",
15
+ "description": "Vio is @dargmuesli's Nuxt layer.",
16
+ "url": "http://localhost:3000",
17
+ "isPartOf": {
18
+ "@id": "http://localhost:3000/#website"
19
+ },
20
+ "potentialAction": [
21
+ {
22
+ "@type": "ReadAction",
23
+ "target": [
24
+ "http://localhost:3000"
25
+ ]
26
+ }
27
+ ]
28
+ }
29
+ ]
30
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "@context": "https://schema.org",
3
+ "@graph": [
4
+ {
5
+ "@id": "http://localhost:3000/#website",
6
+ "@type": "WebSite",
7
+ "description": "Vio is @dargmuesli's Nuxt layer.",
8
+ "inLanguage": "en",
9
+ "name": "Vio Playground",
10
+ "url": "http://localhost:3000"
11
+ },
12
+ {
13
+ "@id": "http://localhost:3000/#webpage",
14
+ "@type": "WebPage",
15
+ "description": "Vio is @dargmuesli's Nuxt layer.",
16
+ "url": "http://localhost:3000",
17
+ "isPartOf": {
18
+ "@id": "http://localhost:3000/#website"
19
+ },
20
+ "potentialAction": [
21
+ {
22
+ "@type": "ReadAction",
23
+ "target": [
24
+ "http://localhost:3000"
25
+ ]
26
+ }
27
+ ]
28
+ }
29
+ ]
30
+ }
@@ -0,0 +1 @@
1
+ {"@context":"https://schema.org","@graph":[{"@id":"http://localhost:3001/#website","@type":"WebSite","description":"Vio is @dargmuesli's Nuxt layer.","inLanguage":"en","name":"Vio Playground","url":"http://localhost:3001"},{"@id":"http://localhost:3001/#webpage","@type":"WebPage","description":"Vio is @dargmuesli's Nuxt layer.","name":"Vio Playground","url":"http://localhost:3001","isPartOf":{"@id":"http://localhost:3001/#website"},"potentialAction":[{"@type":"ReadAction","target":["http://localhost:3001"]}]}]}
@@ -0,0 +1 @@
1
+ {"@context":"https://schema.org","@graph":[{"@id":"http://localhost:3001/#website","@type":"WebSite","description":"Vio is @dargmuesli's Nuxt layer.","inLanguage":"en","name":"Vio Playground","url":"http://localhost:3001"},{"@id":"http://localhost:3001/#webpage","@type":"WebPage","description":"Vio is @dargmuesli's Nuxt layer.","name":"Vio Playground","url":"http://localhost:3001","isPartOf":{"@id":"http://localhost:3001/#website"},"potentialAction":[{"@type":"ReadAction","target":["http://localhost:3001"]}]}]}
@@ -0,0 +1 @@
1
+ {"@context":"https://schema.org","@graph":[{"@id":"http://localhost:3001/#website","@type":"WebSite","description":"Vio is @dargmuesli's Nuxt layer.","inLanguage":"en","name":"Vio Playground","url":"http://localhost:3001"},{"@id":"http://localhost:3001/#webpage","@type":"WebPage","description":"Vio is @dargmuesli's Nuxt layer.","name":"Vio Playground","url":"http://localhost:3001","isPartOf":{"@id":"http://localhost:3001/#website"},"potentialAction":[{"@type":"ReadAction","target":["http://localhost:3001"]}]}]}
@@ -0,0 +1 @@
1
+ {"@context":"https://schema.org","@graph":[{"@id":"https://localhost:3002/#website","@type":"WebSite","description":"Vio is @dargmuesli's Nuxt layer.","inLanguage":"en","name":"Vio Playground","url":"https://localhost:3002"},{"@id":"https://localhost:3002/#webpage","@type":"WebPage","description":"Vio is @dargmuesli's Nuxt layer.","name":"Vio Playground","url":"https://localhost:3002","isPartOf":{"@id":"https://localhost:3002/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://localhost:3002"]}]}]}
@@ -0,0 +1 @@
1
+ {"@context":"https://schema.org","@graph":[{"@id":"https://localhost:3002/#website","@type":"WebSite","description":"Vio is @dargmuesli's Nuxt layer.","inLanguage":"en","name":"Vio Playground","url":"https://localhost:3002"},{"@id":"https://localhost:3002/#webpage","@type":"WebPage","description":"Vio is @dargmuesli's Nuxt layer.","name":"Vio Playground","url":"https://localhost:3002","isPartOf":{"@id":"https://localhost:3002/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://localhost:3002"]}]}]}
@@ -0,0 +1 @@
1
+ {"@context":"https://schema.org","@graph":[{"@id":"https://localhost:3002/#website","@type":"WebSite","description":"Vio is @dargmuesli's Nuxt layer.","inLanguage":"en","name":"Vio Playground","url":"https://localhost:3002"},{"@id":"https://localhost:3002/#webpage","@type":"WebPage","description":"Vio is @dargmuesli's Nuxt layer.","name":"Vio Playground","url":"https://localhost:3002","isPartOf":{"@id":"https://localhost:3002/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://localhost:3002"]}]}]}
@@ -0,0 +1,50 @@
1
+ import { test, expect } from '@playwright/test'
2
+
3
+ import { SITE_URL } from '#src/utils/constants'
4
+ import { COOKIE_CONTROL_DEFAULT, PAGE_READY } from '../../../utils/constants'
5
+ import { testMetadata } from '../../../utils/tests'
6
+
7
+ const PAGE_PATH = '/legal-notice'
8
+
9
+ test.beforeEach(async ({ context }) => {
10
+ await context.addCookies([
11
+ {
12
+ name: 'ncc_c',
13
+ value: COOKIE_CONTROL_DEFAULT,
14
+ url: SITE_URL,
15
+ },
16
+ ])
17
+ })
18
+
19
+ test.describe('page', () => {
20
+ test('status code', async ({ request }) => {
21
+ const resp = await request.get(PAGE_PATH)
22
+ expect(resp.status()).toBe(200)
23
+ })
24
+
25
+ test('metadata', async ({ page }) => {
26
+ await testMetadata({
27
+ page,
28
+ path: PAGE_PATH,
29
+ title: 'Legal notice · Vio Playground',
30
+ })
31
+ })
32
+ })
33
+
34
+ test.describe('visual regression', () => {
35
+ test('consistent appearance', async ({ page }) => {
36
+ await page.goto(PAGE_PATH)
37
+ await PAGE_READY({ page })
38
+ await expect(page).toHaveScreenshot({
39
+ fullPage: true,
40
+ })
41
+ })
42
+
43
+ test('generates the open graph image', async ({ page }) => {
44
+ await page.goto('/__og-image__/image/legal-notice/og.png')
45
+ await expect(page).toHaveScreenshot({ fullPage: true })
46
+
47
+ await page.goto('/__og-image__/image/de/legal-notice/og.png')
48
+ await expect(page).toHaveScreenshot({ fullPage: true })
49
+ })
50
+ })
@@ -0,0 +1,31 @@
1
+ {
2
+ "@context": "https://schema.org",
3
+ "@graph": [
4
+ {
5
+ "@id": "http://localhost:3000/#website",
6
+ "@type": "WebSite",
7
+ "description": "Vio is @dargmuesli's Nuxt layer.",
8
+ "inLanguage": "en",
9
+ "name": "Vio Playground",
10
+ "url": "http://localhost:3000"
11
+ },
12
+ {
13
+ "@id": "http://localhost:3000/legal-notice/#webpage",
14
+ "@type": "WebPage",
15
+ "description": "Vio is @dargmuesli's Nuxt layer.",
16
+ "name": "Legal Notice",
17
+ "url": "http://localhost:3000/legal-notice",
18
+ "isPartOf": {
19
+ "@id": "http://localhost:3000/#website"
20
+ },
21
+ "potentialAction": [
22
+ {
23
+ "@type": "ReadAction",
24
+ "target": [
25
+ "http://localhost:3000/legal-notice"
26
+ ]
27
+ }
28
+ ]
29
+ }
30
+ ]
31
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "@context": "https://schema.org",
3
+ "@graph": [
4
+ {
5
+ "@id": "http://localhost:3000/#website",
6
+ "@type": "WebSite",
7
+ "description": "Vio is @dargmuesli's Nuxt layer.",
8
+ "inLanguage": "en",
9
+ "name": "Vio Playground",
10
+ "url": "http://localhost:3000"
11
+ },
12
+ {
13
+ "@id": "http://localhost:3000/legal-notice/#webpage",
14
+ "@type": "WebPage",
15
+ "description": "Vio is @dargmuesli's Nuxt layer.",
16
+ "name": "Legal Notice",
17
+ "url": "http://localhost:3000/legal-notice",
18
+ "isPartOf": {
19
+ "@id": "http://localhost:3000/#website"
20
+ },
21
+ "potentialAction": [
22
+ {
23
+ "@type": "ReadAction",
24
+ "target": [
25
+ "http://localhost:3000/legal-notice"
26
+ ]
27
+ }
28
+ ]
29
+ }
30
+ ]
31
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "@context": "https://schema.org",
3
+ "@graph": [
4
+ {
5
+ "@id": "http://localhost:3000/#website",
6
+ "@type": "WebSite",
7
+ "description": "Vio is @dargmuesli's Nuxt layer.",
8
+ "inLanguage": "en",
9
+ "name": "Vio Playground",
10
+ "url": "http://localhost:3000"
11
+ },
12
+ {
13
+ "@id": "http://localhost:3000/legal-notice/#webpage",
14
+ "@type": "WebPage",
15
+ "description": "Vio is @dargmuesli's Nuxt layer.",
16
+ "name": "Legal Notice",
17
+ "url": "http://localhost:3000/legal-notice",
18
+ "isPartOf": {
19
+ "@id": "http://localhost:3000/#website"
20
+ },
21
+ "potentialAction": [
22
+ {
23
+ "@type": "ReadAction",
24
+ "target": [
25
+ "http://localhost:3000/legal-notice"
26
+ ]
27
+ }
28
+ ]
29
+ }
30
+ ]
31
+ }
@@ -0,0 +1 @@
1
+ {"@context":"https://schema.org","@graph":[{"@id":"http://localhost:3001/#website","@type":"WebSite","description":"Vio is @dargmuesli's Nuxt layer.","inLanguage":"en","name":"Vio Playground","url":"http://localhost:3001"},{"@id":"http://localhost:3001/legal-notice/#webpage","@type":"WebPage","description":"Vio is @dargmuesli's Nuxt layer.","name":"Legal notice","url":"http://localhost:3001/legal-notice","isPartOf":{"@id":"http://localhost:3001/#website"},"potentialAction":[{"@type":"ReadAction","target":["http://localhost:3001/legal-notice"]}]}]}
@@ -0,0 +1 @@
1
+ {"@context":"https://schema.org","@graph":[{"@id":"http://localhost:3001/#website","@type":"WebSite","description":"Vio is @dargmuesli's Nuxt layer.","inLanguage":"en","name":"Vio Playground","url":"http://localhost:3001"},{"@id":"http://localhost:3001/legal-notice/#webpage","@type":"WebPage","description":"Vio is @dargmuesli's Nuxt layer.","name":"Legal notice","url":"http://localhost:3001/legal-notice","isPartOf":{"@id":"http://localhost:3001/#website"},"potentialAction":[{"@type":"ReadAction","target":["http://localhost:3001/legal-notice"]}]}]}
@@ -0,0 +1 @@
1
+ {"@context":"https://schema.org","@graph":[{"@id":"http://localhost:3001/#website","@type":"WebSite","description":"Vio is @dargmuesli's Nuxt layer.","inLanguage":"en","name":"Vio Playground","url":"http://localhost:3001"},{"@id":"http://localhost:3001/legal-notice/#webpage","@type":"WebPage","description":"Vio is @dargmuesli's Nuxt layer.","name":"Legal notice","url":"http://localhost:3001/legal-notice","isPartOf":{"@id":"http://localhost:3001/#website"},"potentialAction":[{"@type":"ReadAction","target":["http://localhost:3001/legal-notice"]}]}]}
@@ -0,0 +1 @@
1
+ {"@context":"https://schema.org","@graph":[{"@id":"https://localhost:3002/#website","@type":"WebSite","description":"Vio is @dargmuesli's Nuxt layer.","inLanguage":"en","name":"Vio Playground","url":"https://localhost:3002"},{"@id":"https://localhost:3002/legal-notice/#webpage","@type":"WebPage","description":"Vio is @dargmuesli's Nuxt layer.","name":"Legal notice","url":"https://localhost:3002/legal-notice","isPartOf":{"@id":"https://localhost:3002/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://localhost:3002/legal-notice"]}]}]}
@@ -0,0 +1 @@
1
+ {"@context":"https://schema.org","@graph":[{"@id":"https://localhost:3002/#website","@type":"WebSite","description":"Vio is @dargmuesli's Nuxt layer.","inLanguage":"en","name":"Vio Playground","url":"https://localhost:3002"},{"@id":"https://localhost:3002/legal-notice/#webpage","@type":"WebPage","description":"Vio is @dargmuesli's Nuxt layer.","name":"Legal notice","url":"https://localhost:3002/legal-notice","isPartOf":{"@id":"https://localhost:3002/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://localhost:3002/legal-notice"]}]}]}
@@ -0,0 +1 @@
1
+ {"@context":"https://schema.org","@graph":[{"@id":"https://localhost:3002/#website","@type":"WebSite","description":"Vio is @dargmuesli's Nuxt layer.","inLanguage":"en","name":"Vio Playground","url":"https://localhost:3002"},{"@id":"https://localhost:3002/legal-notice/#webpage","@type":"WebPage","description":"Vio is @dargmuesli's Nuxt layer.","name":"Legal notice","url":"https://localhost:3002/legal-notice","isPartOf":{"@id":"https://localhost:3002/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://localhost:3002/legal-notice"]}]}]}
@@ -0,0 +1,40 @@
1
+ import { test, expect } from '@playwright/test'
2
+
3
+ import { SITE_URL } from '#src/utils/constants'
4
+ import { COOKIE_CONTROL_DEFAULT, PAGE_READY } from '../../../utils/constants'
5
+
6
+ test.beforeEach(async ({ context }) => {
7
+ await context.addCookies([
8
+ {
9
+ name: 'ncc_c',
10
+ value: COOKIE_CONTROL_DEFAULT,
11
+ url: SITE_URL,
12
+ },
13
+ ])
14
+ })
15
+
16
+ test.describe('page', () => {
17
+ test('status code', async ({ request }) => {
18
+ const resp = await request.get('/privacy-policy')
19
+ expect(resp.status()).toBe(200)
20
+ })
21
+ })
22
+
23
+ test.describe('visual regression', () => {
24
+ test('consistent appearance', async ({ page }) => {
25
+ await page.goto('/privacy-policy')
26
+ await PAGE_READY({ page })
27
+ await expect(page).toHaveScreenshot({
28
+ fullPage: true,
29
+ timeout: 10000,
30
+ })
31
+ })
32
+
33
+ test('generates the open graph image', async ({ page }) => {
34
+ await page.goto('/__og-image__/image/privacy-policy/og.png')
35
+ await expect(page).toHaveScreenshot({ fullPage: true })
36
+
37
+ await page.goto('/__og-image__/image/de/privacy-policy/og.png')
38
+ await expect(page).toHaveScreenshot({ fullPage: true })
39
+ })
40
+ })