forked from opentiny/tiny-vue
test(site/loading): [loading] e2e test case completion (#896)
This commit is contained in:
parent
4e14521326
commit
cf2a85d34c
|
@ -4,5 +4,5 @@ test('自定义遮罩背景色', async ({ page }) => {
|
|||
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
||||
await page.goto('loading#background')
|
||||
const loadingBg = page.locator('.tiny-loading__mask')
|
||||
await expect(loadingBg).toHaveCSS('background-color', 'rgba(0, 0, 0, 0.3)')
|
||||
await expect(loadingBg).toHaveCSS('background-color', 'rgba(0, 0, 0, 0.2)')
|
||||
})
|
||||
|
|
|
@ -5,6 +5,6 @@ test('自定义样式', async ({ page }) => {
|
|||
await page.goto('loading#custom-class')
|
||||
const loadingBg = page.locator('.tiny-loading__mask')
|
||||
const loadingText = page.locator('.new-loading')
|
||||
await expect(loadingBg).toHaveCSS('background-color', 'rgba(0, 0, 0, 0.8)')
|
||||
await expect(loadingBg).toHaveCSS('background-color', 'rgba(0, 0, 0, 0.7)')
|
||||
await expect(loadingText).toBeVisible()
|
||||
})
|
||||
|
|
|
@ -2,7 +2,12 @@ import { test, expect } from '@playwright/test'
|
|||
|
||||
test('修饰符', async ({ page }) => {
|
||||
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
||||
await page.goto('loading#body')
|
||||
const loadingText = page.locator('.tiny-loading__text')
|
||||
await expect(loadingText).toHaveText('同 v——loading 指令中的 body 修饰符')
|
||||
await page.goto('loading#directive')
|
||||
|
||||
await expect(page.getByText('v-loadingText')).not.toBeVisible()
|
||||
await page.getByRole('button', { name: 'change loading' }).click()
|
||||
await expect(page.getByText('v-loadingText')).toBeVisible()
|
||||
|
||||
await page.getByRole('button', { name: 'change loading' }).click()
|
||||
await expect(page.getByText('v-loadingText')).not.toBeVisible()
|
||||
})
|
||||
|
|
|
@ -3,7 +3,6 @@ import { test, expect } from '@playwright/test'
|
|||
test('全局加载', async ({ page }) => {
|
||||
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
||||
await page.goto('loading#fullscreen')
|
||||
const loadingText = page.locator('.tiny-loading__text')
|
||||
await page.getByRole('button', { name: '指令方式加载全屏Loading' }).click()
|
||||
const vLoading = page.locator('.circular')
|
||||
await expect(vLoading).toBeVisible()
|
||||
|
|
|
@ -4,5 +4,5 @@ test('自定义加载提示文本', async ({ page }) => {
|
|||
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
||||
await page.goto('loading#loading-tip-text')
|
||||
const loadingText = page.locator('.tiny-loading__text')
|
||||
await expect(loadingText).toBeVisible()
|
||||
await expect(loadingText).toContainText('加载中')
|
||||
})
|
||||
|
|
|
@ -4,13 +4,8 @@ test('自定义加载图标', async ({ page }) => {
|
|||
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
||||
await page.goto('loading#spinner')
|
||||
const loadingText = page.locator('.tiny-loading__text')
|
||||
const sloading = page.locator('.tiny-loading__spinner-small')
|
||||
const mloading = page.locator('.tiny-loading__spinner-medium')
|
||||
const lloading = page.locator('.tiny-loading__spinner-large')
|
||||
const svg = page.locator('.tiny-loading__spinner-large > svg > defs > linearGradient > stop').nth(1)
|
||||
await expect(loadingText).toHaveText(['自定义loading图标', '自定义loading图标', '自定义loading图标'])
|
||||
await expect(sloading).toBeVisible()
|
||||
await expect(mloading).toBeVisible()
|
||||
await expect(lloading).toBeVisible()
|
||||
await expect(svg).toHaveAttribute('stop-color', '#191919')
|
||||
|
||||
const svg = page.locator('#tiny-demo-loading-spinner .tiny-icon-loading')
|
||||
await expect(loadingText).toContainText('自定义loading图标')
|
||||
await expect(svg).toHaveClass(/tiny-icon-loading/)
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue