Skip to content

Commit 3471a73

Browse files
committed
Add snapshot
1 parent 35ee4bd commit 3471a73

32 files changed

Lines changed: 1203 additions & 4 deletions

e2e/components-pages.spec.ts

Lines changed: 278 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,278 @@
1+
import { expect, test } from '@playwright/test'
2+
3+
test.describe('Components Pages', () => {
4+
test.describe('Components link availability', () => {
5+
test('header has Components link pointing to /components/overview', async ({
6+
browser,
7+
}) => {
8+
const context = await browser.newContext({
9+
javaScriptEnabled: false,
10+
viewport: { width: 1440, height: 900 },
11+
})
12+
const page = await context.newPage()
13+
await page.goto('/')
14+
await page.waitForTimeout(500)
15+
16+
const link = page.locator('a[href="/components/overview"]').first()
17+
await expect(link).toBeVisible()
18+
await expect(link).toHaveAttribute('href', '/components/overview')
19+
await context.close()
20+
})
21+
22+
test('Components link text is correct', async ({ browser }) => {
23+
const context = await browser.newContext({
24+
javaScriptEnabled: false,
25+
viewport: { width: 1440, height: 900 },
26+
})
27+
const page = await context.newPage()
28+
await page.goto('/')
29+
await page.waitForTimeout(500)
30+
31+
const link = page
32+
.locator('a[href="/components/overview"]')
33+
.filter({ hasText: 'Components' })
34+
await expect(link).toBeVisible()
35+
await context.close()
36+
})
37+
38+
test('Components link is hidden on mobile', async ({ browser }) => {
39+
const context = await browser.newContext({
40+
javaScriptEnabled: false,
41+
viewport: { width: 375, height: 812 },
42+
})
43+
const page = await context.newPage()
44+
await page.goto('/')
45+
await page.waitForTimeout(500)
46+
47+
const link = page
48+
.locator('a[href="/components/overview"]')
49+
.filter({ hasText: 'Components' })
50+
const isVisible = await link.isVisible().catch(() => false)
51+
expect(isVisible).toBeFalsy()
52+
await context.close()
53+
})
54+
55+
test('Components link is visible on desktop', async ({ browser }) => {
56+
const context = await browser.newContext({
57+
javaScriptEnabled: false,
58+
viewport: { width: 1440, height: 900 },
59+
})
60+
const page = await context.newPage()
61+
await page.goto('/')
62+
await page.waitForTimeout(500)
63+
64+
const link = page
65+
.locator('a[href="/components/overview"]')
66+
.filter({ hasText: 'Components' })
67+
await expect(link).toBeVisible()
68+
await context.close()
69+
})
70+
})
71+
72+
test.describe('Storybook link', () => {
73+
test('header has Storybook link', async ({ browser }) => {
74+
const context = await browser.newContext({
75+
javaScriptEnabled: false,
76+
viewport: { width: 1440, height: 900 },
77+
})
78+
const page = await context.newPage()
79+
await page.goto('/')
80+
await page.waitForTimeout(500)
81+
82+
const link = page.locator('a[href="/storybook/index.html"]').first()
83+
await expect(link).toBeVisible()
84+
await context.close()
85+
})
86+
87+
test('Storybook link is hidden on mobile', async ({ browser }) => {
88+
const context = await browser.newContext({
89+
javaScriptEnabled: false,
90+
viewport: { width: 375, height: 812 },
91+
})
92+
const page = await context.newPage()
93+
await page.goto('/')
94+
await page.waitForTimeout(500)
95+
96+
const link = page
97+
.locator('a[href="/storybook/index.html"]')
98+
.filter({ hasText: 'Storybook' })
99+
const isVisible = await link.isVisible().catch(() => false)
100+
expect(isVisible).toBeFalsy()
101+
await context.close()
102+
})
103+
})
104+
105+
test.describe('Benchmark section (component showcase on home page)', () => {
106+
test('has Comparison Benchmarks section', async ({ browser }) => {
107+
const context = await browser.newContext({
108+
javaScriptEnabled: false,
109+
viewport: { width: 1440, height: 900 },
110+
})
111+
const page = await context.newPage()
112+
await page.goto('/')
113+
await page.waitForTimeout(500)
114+
115+
await expect(page.getByText('Comparison Bechmarks').first()).toBeVisible()
116+
await context.close()
117+
})
118+
119+
test('shows Devup UI benchmark card', async ({ browser }) => {
120+
const context = await browser.newContext({
121+
javaScriptEnabled: false,
122+
viewport: { width: 1440, height: 900 },
123+
})
124+
const page = await context.newPage()
125+
await page.goto('/')
126+
await page.waitForTimeout(500)
127+
128+
const benchSection = page.getByText('Comparison Bechmarks').first()
129+
await benchSection.scrollIntoViewIfNeeded()
130+
131+
// The Devup UI card is inside a client-side animation wrapper that keeps
132+
// it visually hidden (opacity/transform) when JS is disabled. Verify the
133+
// element exists in the DOM instead.
134+
await expect(
135+
page.locator('.typo-h5', { hasText: 'Devup UI' }).first(),
136+
).toBeAttached()
137+
await context.close()
138+
})
139+
140+
test('shows competitor benchmarks', async ({ browser }) => {
141+
const context = await browser.newContext({
142+
javaScriptEnabled: false,
143+
viewport: { width: 1440, height: 900 },
144+
})
145+
const page = await context.newPage()
146+
await page.goto('/')
147+
await page.waitForTimeout(500)
148+
149+
const benchSection = page.getByText('Comparison Bechmarks').first()
150+
await benchSection.scrollIntoViewIfNeeded()
151+
await page.waitForTimeout(500)
152+
153+
// Check that several competitor names are visible
154+
await expect(page.getByText('Chakra UI').first()).toBeVisible()
155+
await expect(page.getByText('Tailwindcss').first()).toBeVisible()
156+
await context.close()
157+
})
158+
159+
test('desktop benchmark section screenshot', async ({ browser }) => {
160+
const context = await browser.newContext({
161+
javaScriptEnabled: false,
162+
viewport: { width: 1440, height: 900 },
163+
})
164+
const page = await context.newPage()
165+
await page.goto('/')
166+
await page.waitForTimeout(500)
167+
168+
const benchSection = page.getByText('Comparison Bechmarks').first()
169+
await benchSection.scrollIntoViewIfNeeded()
170+
await page.waitForTimeout(500)
171+
172+
await expect(page).toHaveScreenshot(
173+
'components-benchmark-section-desktop.png',
174+
{
175+
fullPage: false,
176+
maxDiffPixelRatio: 0.02,
177+
},
178+
)
179+
await context.close()
180+
})
181+
182+
test('mobile benchmark section screenshot', async ({ browser }) => {
183+
const context = await browser.newContext({
184+
javaScriptEnabled: false,
185+
viewport: { width: 375, height: 812 },
186+
})
187+
const page = await context.newPage()
188+
await page.goto('/')
189+
await page.waitForTimeout(500)
190+
191+
const benchSection = page.getByText('Comparison Bechmarks').first()
192+
await benchSection.scrollIntoViewIfNeeded()
193+
await page.waitForTimeout(500)
194+
195+
await expect(page).toHaveScreenshot(
196+
'components-benchmark-section-mobile.png',
197+
{
198+
fullPage: false,
199+
maxDiffPixelRatio: 0.02,
200+
},
201+
)
202+
await context.close()
203+
})
204+
205+
test('dark mode benchmark section screenshot', async ({ browser }) => {
206+
const context = await browser.newContext({
207+
javaScriptEnabled: false,
208+
viewport: { width: 1440, height: 900 },
209+
colorScheme: 'dark',
210+
})
211+
const page = await context.newPage()
212+
await page.goto('/')
213+
await page.waitForTimeout(500)
214+
215+
const benchSection = page.getByText('Comparison Bechmarks').first()
216+
await benchSection.scrollIntoViewIfNeeded()
217+
await page.waitForTimeout(500)
218+
219+
await expect(page).toHaveScreenshot(
220+
'dark-components-benchmark-section-desktop.png',
221+
{
222+
fullPage: false,
223+
maxDiffPixelRatio: 0.02,
224+
},
225+
)
226+
await context.close()
227+
})
228+
})
229+
230+
test.describe('Community section', () => {
231+
test('has Join our community section', async ({ browser }) => {
232+
const context = await browser.newContext({
233+
javaScriptEnabled: false,
234+
viewport: { width: 1440, height: 900 },
235+
})
236+
const page = await context.newPage()
237+
await page.goto('/')
238+
await page.waitForTimeout(500)
239+
240+
const community = page.getByText('Join our community').first()
241+
await community.scrollIntoViewIfNeeded()
242+
await expect(community).toBeVisible()
243+
await context.close()
244+
})
245+
246+
test('has Discord link', async ({ browser }) => {
247+
const context = await browser.newContext({
248+
javaScriptEnabled: false,
249+
viewport: { width: 1440, height: 900 },
250+
})
251+
const page = await context.newPage()
252+
await page.goto('/')
253+
await page.waitForTimeout(500)
254+
255+
const discordLink = page
256+
.locator('a[href="https://discord.gg/8zjcGc7cWh"]')
257+
.first()
258+
await expect(discordLink).toBeVisible()
259+
await context.close()
260+
})
261+
262+
test('has KakaoTalk link', async ({ browser }) => {
263+
const context = await browser.newContext({
264+
javaScriptEnabled: false,
265+
viewport: { width: 1440, height: 900 },
266+
})
267+
const page = await context.newPage()
268+
await page.goto('/')
269+
await page.waitForTimeout(500)
270+
271+
const kakaoLink = page
272+
.locator('a[href="https://open.kakao.com/o/giONwVAh"]')
273+
.first()
274+
await expect(kakaoLink).toBeVisible()
275+
await context.close()
276+
})
277+
})
278+
})
726 KB
Loading
148 KB
Loading
725 KB
Loading

0 commit comments

Comments
 (0)