mirror of
https://github.com/iflytek/skillhub.git
synced 2026-09-14 23:21:08 +00:00
Migrated from local desktop work (rescued from un-pushed commit 3b970865). 64 test cases with stable semantic selectors, covering pages that were previously untested.
42 lines
1.5 KiB
TypeScript
42 lines
1.5 KiB
TypeScript
import { expect, test } from '@playwright/test'
|
|
import { setEnglishLocale } from './helpers/auth-fixtures'
|
|
import { registerSession } from './helpers/session'
|
|
|
|
test.describe('Notification Settings (Real API)', () => {
|
|
test.beforeEach(async ({ page }, testInfo) => {
|
|
await setEnglishLocale(page)
|
|
await registerSession(page, testInfo)
|
|
})
|
|
|
|
test('TC_NOTIF_001: displays notification settings page', async ({ page }) => {
|
|
await page.goto('/settings/notifications')
|
|
|
|
await expect(page.getByRole('heading', { name: 'Notification Settings' })).toBeVisible({ timeout: 15_000 })
|
|
})
|
|
|
|
test('TC_NOTIF_002: page eventually leaves loading state', async ({ page }) => {
|
|
await page.goto('/settings/notifications')
|
|
|
|
await page.waitForTimeout(2000)
|
|
const isLoading = await page.getByText('Loading...').isVisible().catch(() => false)
|
|
expect(isLoading).toBeFalsy()
|
|
})
|
|
|
|
test('TC_NOTIF_003: notification toggles are interactive when present', async ({ page }) => {
|
|
await page.goto('/settings/notifications')
|
|
await page.waitForTimeout(3000)
|
|
|
|
const toggle = page.getByRole('switch').first()
|
|
const hasToggle = await toggle.isVisible().catch(() => false)
|
|
|
|
if (hasToggle) {
|
|
const initialState = await toggle.getAttribute('aria-checked')
|
|
await toggle.click()
|
|
await page.waitForTimeout(500)
|
|
const newState = await toggle.getAttribute('aria-checked')
|
|
expect(newState).not.toBe(initialState)
|
|
} else {
|
|
expect(true).toBeTruthy()
|
|
}
|
|
})
|
|
})
|