fix:[modal,slider-bar] update e2e test (#1455)

* fix: update e2e test

* fix: update test-e2e
This commit is contained in:
James 2024-03-01 16:25:49 +08:00 committed by GitHub
parent e104ab69bb
commit 8bfb442ba4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 8 deletions

View File

@ -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()

View File

@ -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()
})

View File

@ -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')
})

View File

@ -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')
})