-
-
Notifications
You must be signed in to change notification settings - Fork 249
Expand file tree
/
Copy pathemotion-plugin.spec.ts
More file actions
53 lines (40 loc) · 1.81 KB
/
emotion-plugin.spec.ts
File metadata and controls
53 lines (40 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { expect, test } from '@playwright/test'
import { expectColor, setupBuildAndPreview, setupDevServer, setupWaitForLogs } from '../../utils.ts'
test('Emotion plugin build', async ({ page }) => {
const { testUrl, server } = await setupBuildAndPreview('emotion-plugin')
await page.goto(testUrl)
const button = page.locator('button')
await button.hover()
await expectColor(button, 'color', '#646cff')
await button.click()
await expect(button).toHaveText('count is 1')
const code = page.locator('code')
await expectColor(code, 'color', '#646cff')
await server.httpServer.close()
})
test('Emotion plugin HMR', async ({ page }) => {
const { testUrl, server, editFile } = await setupDevServer('emotion-plugin')
const waitForLogs = await setupWaitForLogs(page)
await page.goto(testUrl)
await waitForLogs('[vite] connected.')
const button = page.locator('button')
await button.hover()
await expectColor(button, 'color', '#646cff')
await button.click()
await expect(button).toHaveText('count is 1')
const code = page.locator('code')
await expectColor(code, 'color', '#646cff')
editFile('src/Button.jsx', ['background-color: #d26ac2;', 'background-color: #646cff;'])
await waitForLogs('[vite] hot updated: /src/Button.jsx')
await expect(button).toHaveText('count is 1')
await expectColor(button, 'backgroundColor', '#646cff')
editFile('src/App.jsx', ['color="#646cff"', 'color="#d26ac2"'])
await waitForLogs('[vite] hot updated: /src/App.jsx')
await expect(button).toHaveText('count is 1')
await expectColor(button, 'color', '#d26ac2')
editFile('src/Button.jsx', ['color: #646cff;', 'color: #d26ac2;'])
await waitForLogs('[vite] hot updated: /src/Button.jsx')
await expect(button).toHaveText('count is 1')
await expectColor(code, 'color', '#d26ac2')
await server.close()
})