mirror of
https://github.com/RealKai42/qwerty-learner.git
synced 2026-04-05 06:19:08 +08:00
* docs: update README, add deploy to vercel * docs: update README * feat: add e2e tests * feat: add main feature e2e tests with playwright * fix: ci env value and update gitignore * fix: ci job conditions for execution * chore: merge from main --------- Co-authored-by: KaiyiWing <Zhang.kaiyi42@gmail.com>
25 lines
762 B
TypeScript
25 lines
762 B
TypeScript
import { test, expect } from '@playwright/test'
|
|
|
|
test.describe('Theme switch', () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await page.goto('/')
|
|
await page.getByLabel('关闭提示').click()
|
|
})
|
|
|
|
test('Has theme switch button', async ({ page }) => {
|
|
await expect(await page.getByLabel('开关深色模式').isVisible()).toBeTruthy()
|
|
})
|
|
|
|
test('Theme mode switch', async ({ page }) => {
|
|
// light to dark
|
|
await page.getByLabel('开关深色模式').click()
|
|
await expect(await page.locator('html').getAttribute('class')).toBe('dark')
|
|
|
|
await page.waitForTimeout(500)
|
|
|
|
// dark to light
|
|
await page.getByLabel('开关深色模式').click()
|
|
await expect(await page.locator('html').getAttribute('class')).toBe('')
|
|
})
|
|
})
|