32 lines
1.5 KiB
TypeScript
32 lines
1.5 KiB
TypeScript
import { test, expect } from '@playwright/test'
|
|
|
|
test('禁用', async ({ page }) => {
|
|
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
|
await page.goto('link#dynamic-disable')
|
|
const demo = page.locator('#dynamic-disable')
|
|
let anchor = demo.locator('a').filter({ hasText: '默认链接' })
|
|
await expect(anchor).toHaveCSS('cursor', 'not-allowed')
|
|
await anchor.hover()
|
|
await expect(anchor).toHaveCSS('color', 'rgb(191, 191, 191)')
|
|
anchor = demo.locator('a').filter({ hasText: '主要链接' })
|
|
await expect(anchor).toHaveCSS('cursor', 'not-allowed')
|
|
await anchor.hover()
|
|
await expect(anchor).toHaveCSS('color', 'rgb(160, 207, 255)')
|
|
anchor = demo.locator('a').filter({ hasText: '成功链接' })
|
|
await expect(anchor).toHaveCSS('cursor', 'not-allowed')
|
|
await anchor.hover()
|
|
await expect(anchor).toHaveCSS('color', 'rgb(166, 195, 185)')
|
|
anchor = demo.locator('a').filter({ hasText: '警告链接' })
|
|
await expect(anchor).toHaveCSS('cursor', 'not-allowed')
|
|
await anchor.hover()
|
|
await expect(anchor).toHaveCSS('color', 'rgb(211, 198, 162)')
|
|
anchor = demo.locator('a').filter({ hasText: '危险链接' })
|
|
await expect(anchor).toHaveCSS('cursor', 'not-allowed')
|
|
await anchor.hover()
|
|
await expect(anchor).toHaveCSS('color', 'rgb(216, 186, 181)')
|
|
anchor = demo.locator('a').filter({ hasText: '信息链接' })
|
|
await expect(anchor).toHaveCSS('cursor', 'not-allowed')
|
|
await anchor.hover()
|
|
await expect(anchor).toHaveCSS('color', 'rgb(191, 191, 191)')
|
|
})
|