mirror of
https://github.com/RealKai42/qwerty-learner.git
synced 2026-04-04 22:09:04 +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>
27 lines
1017 B
TypeScript
27 lines
1017 B
TypeScript
import { test, expect, Page } from '@playwright/test'
|
|
|
|
test.describe('Practice List', () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
test.slow()
|
|
await page.goto('/')
|
|
await page.getByLabel('关闭提示').click()
|
|
await page.waitForTimeout(1000)
|
|
|
|
// should use testId
|
|
await page.locator('#root > div').locator('.fixed').locator('svg').last().click()
|
|
await page.waitForTimeout(1000)
|
|
})
|
|
|
|
test('Practice list button click to open the list ', async ({ page }) => {
|
|
await expect(await page.getByRole('heading', { name: 'CET-4 第 1 章' }).isVisible()).toBeTruthy()
|
|
// should use testId
|
|
await page.locator('#headlessui-portal-root').locator('div > p', { hasText: 'cancel' }).click()
|
|
})
|
|
|
|
test('Close practice list', async ({ page }) => {
|
|
await page.getByRole('heading', { name: 'CET-4 第 1 章' }).getByRole('img').click()
|
|
await page.waitForTimeout(1000)
|
|
await expect(await page.locator('h3', { hasText: 'CET-4 第 1 章' }).isVisible()).not.toBeTruthy()
|
|
})
|
|
})
|