forked from opentiny/tiny-vue
fix:[modal,slider-bar] update e2e test (#1455)
* fix: update e2e test * fix: update test-e2e
This commit is contained in:
parent
e104ab69bb
commit
8bfb442ba4
|
@ -1,10 +1,10 @@
|
|||
import { test, expect } from '@playwright/test'
|
||||
|
||||
test('调整窗口后显示的最小宽度', async ({ page }) => {
|
||||
test('调整窗口后显示的最小宽高度', async ({ page }) => {
|
||||
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
||||
await page.goto('modal#min-width-height')
|
||||
|
||||
await page.getByRole('button', { name: '最小宽高度' }).click()
|
||||
await page.getByRole('button', { name: /最小宽高度/ }).click()
|
||||
const modal = page.locator('.tiny-modal.active .tiny-modal__box')
|
||||
// 获取弹窗位置
|
||||
const { x, y } = await modal.boundingBox()
|
||||
|
|
|
@ -5,6 +5,6 @@ test('控制显示头部及底部', async ({ page }) => {
|
|||
await page.goto('modal#show-header-footer')
|
||||
|
||||
const modal = page.locator('.tiny-modal.active')
|
||||
await page.getByRole('button', { name: '控制显示头部及底部' }).click()
|
||||
await page.getByRole('button', { name: /控制显示头部及底部/ }).click()
|
||||
await expect(modal.locator('.tiny-modal__header')).not.toBeVisible()
|
||||
})
|
||||
|
|
|
@ -11,7 +11,7 @@ test('基础用法', async ({ page }) => {
|
|||
await expect(slideBarList.locator('li').first()).toHaveCSS('border-color', 'rgba(153, 153, 153, 0.7)')
|
||||
await preview.locator('.icon-chevron-right').click()
|
||||
// 单个滚动块的宽度为 width + marginLeft,固定值为196px
|
||||
await expect(slideBarList).toHaveCSS('left', '-358px')
|
||||
await expect(slideBarList).toHaveCSS('left', '-360px')
|
||||
await preview.locator('.icon-chevron-left').click()
|
||||
await expect(slideBarList).toHaveCSS('left', '-179px')
|
||||
await expect(slideBarList).toHaveCSS('left', '-180px')
|
||||
})
|
||||
|
|
|
@ -9,9 +9,9 @@ test('每次滚动块数', async ({ page }) => {
|
|||
await slideBarList.first().click()
|
||||
await page.locator('.icon-chevron-right').click()
|
||||
// 单个滚动块的宽度固定为196px,所以应为 196px * 2
|
||||
await expect(slideBarList).toHaveCSS('left', '-358px')
|
||||
await expect(slideBarList).toHaveCSS('left', '-360px')
|
||||
await page.locator('.icon-chevron-right').click()
|
||||
await expect(slideBarList).toHaveCSS('left', '-716px')
|
||||
await expect(slideBarList).toHaveCSS('left', '-720px')
|
||||
await page.locator('.icon-chevron-left').click()
|
||||
await expect(slideBarList).toHaveCSS('left', '-358px')
|
||||
await expect(slideBarList).toHaveCSS('left', '-360px')
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue