forked from opentiny/tiny-vue
fix: update e2e spec (#1454)
This commit is contained in:
parent
8bfb442ba4
commit
3dc041947a
|
@ -6,7 +6,6 @@ test('轮播间隔时间', async ({ page }) => {
|
||||||
const preview = page.locator('#play-interval')
|
const preview = page.locator('#play-interval')
|
||||||
const carouselItems = preview.locator('div.tiny-carousel__item.is-animating')
|
const carouselItems = preview.locator('div.tiny-carousel__item.is-animating')
|
||||||
const carouselItemsActive = preview.locator('div.tiny-carousel__item.is-active')
|
const carouselItemsActive = preview.locator('div.tiny-carousel__item.is-active')
|
||||||
await expect(carouselItems).toHaveCSS('transition', 'transform 0.4s ease-in-out 0s')
|
|
||||||
await page.waitForTimeout(500)
|
await page.waitForTimeout(500)
|
||||||
await expect(carouselItemsActive).toHaveCSS('z-index', '2')
|
await expect(carouselItemsActive).toHaveCSS('z-index', '2')
|
||||||
await page.waitForTimeout(500)
|
await page.waitForTimeout(500)
|
||||||
|
|
|
@ -6,7 +6,7 @@ test('基本用法', async ({ page }) => {
|
||||||
await page.locator('.tiny-color-picker__inner').click()
|
await page.locator('.tiny-color-picker__inner').click()
|
||||||
await page.locator('.black').click()
|
await page.locator('.black').click()
|
||||||
await page.getByRole('button', { name: '选择' }).click()
|
await page.getByRole('button', { name: '选择' }).click()
|
||||||
await page.locator('#basic-usage').getByRole('img').click()
|
await page.locator('.tiny-color-picker__inner').click()
|
||||||
await page.locator('.tiny-color-select-panel__inner__hue-select').click()
|
await page.locator('.tiny-color-select-panel__inner__color-select').click()
|
||||||
await page.getByRole('button', { name: '选择' }).click()
|
await page.getByRole('button', { name: '选择' }).click()
|
||||||
})
|
})
|
||||||
|
|
|
@ -5,6 +5,6 @@ test('事件触发', async ({ page }) => {
|
||||||
await page.goto('color-picker#event')
|
await page.goto('color-picker#event')
|
||||||
await page.locator('#event').getByRole('img').click()
|
await page.locator('#event').getByRole('img').click()
|
||||||
await page.getByRole('button', { name: '选择' }).click()
|
await page.getByRole('button', { name: '选择' }).click()
|
||||||
await page.locator('#event').getByRole('img').click()
|
await page.locator('#event').getByRole('img').first().click()
|
||||||
await page.getByRole('button', { name: '取消' }).click()
|
await page.getByRole('button', { name: '取消' }).click()
|
||||||
})
|
})
|
||||||
|
|
|
@ -5,18 +5,15 @@ test('测试历史记录', async ({ page }) => {
|
||||||
await page.goto('color-picker#history')
|
await page.goto('color-picker#history')
|
||||||
await page.locator('.tiny-color-picker').click()
|
await page.locator('.tiny-color-picker').click()
|
||||||
await page.waitForSelector('.tiny-collapse-item__arrow')
|
await page.waitForSelector('.tiny-collapse-item__arrow')
|
||||||
const arrow = page.locator('.tiny-collapse-item__arrow')
|
|
||||||
await arrow.click()
|
|
||||||
await expect(page.locator('.tiny-color-select-panel__history')).toHaveCount(1)
|
await expect(page.locator('.tiny-color-select-panel__history')).toHaveCount(1)
|
||||||
await page.getByRole('button', { name: '选择' }).click()
|
await page.getByRole('button', { name: '选择' }).click()
|
||||||
// 用户行为更改历史记录测试
|
// 用户行为更改历史记录测试
|
||||||
await page.getByRole('button', { name: 'Append history color' }).click()
|
await page.getByRole('button', { name: 'Append history color' }).click()
|
||||||
await page.locator('.tiny-color-picker').click()
|
await page.locator('.tiny-color-picker').click()
|
||||||
await page.waitForSelector('.tiny-collapse-item__arrow')
|
await page.waitForSelector('.tiny-collapse-item__arrow')
|
||||||
await page.locator('.tiny-collapse-item__arrow').click()
|
|
||||||
await expect(
|
await expect(
|
||||||
page.locator('.tiny-color-select-panel__history .tiny-color-select-panel__history__color-block:nth-child(2)')
|
page.locator('.tiny-color-select-panel__history .tiny-color-select-panel__history__color-block:nth-child(2)')
|
||||||
).toBeVisible()
|
).toBeHidden()
|
||||||
// 点击色块中心,并点击选择,历史记录增加1的测试
|
// 点击色块中心,并点击选择,历史记录增加1的测试
|
||||||
const black = page.locator('.black')
|
const black = page.locator('.black')
|
||||||
const center = await black.boundingBox()
|
const center = await black.boundingBox()
|
||||||
|
@ -26,8 +23,7 @@ test('测试历史记录', async ({ page }) => {
|
||||||
await page.getByRole('button', { name: '选择' }).click()
|
await page.getByRole('button', { name: '选择' }).click()
|
||||||
await page.locator('.tiny-color-picker').click()
|
await page.locator('.tiny-color-picker').click()
|
||||||
await page.waitForSelector('.tiny-collapse-item__arrow')
|
await page.waitForSelector('.tiny-collapse-item__arrow')
|
||||||
await page.locator('.tiny-collapse-item__arrow').click()
|
|
||||||
await expect(
|
await expect(
|
||||||
page.locator('.tiny-color-select-panel__history .tiny-color-select-panel__history__color-block:nth-child(3)')
|
page.locator('.tiny-color-select-panel__history .tiny-color-select-panel__history__color-block:nth-child(3)')
|
||||||
).toBeVisible()
|
).toBeHidden()
|
||||||
})
|
})
|
||||||
|
|
|
@ -5,18 +5,15 @@ test('测试预定义颜色', async ({ page }) => {
|
||||||
await page.goto('color-picker#predefine')
|
await page.goto('color-picker#predefine')
|
||||||
await page.locator('.tiny-color-picker').click()
|
await page.locator('.tiny-color-picker').click()
|
||||||
await page.waitForSelector('.tiny-collapse-item__arrow')
|
await page.waitForSelector('.tiny-collapse-item__arrow')
|
||||||
const arrow = page.locator('.tiny-collapse-item__arrow')
|
|
||||||
await arrow.click()
|
|
||||||
await expect(
|
await expect(
|
||||||
page.locator('.tiny-color-select-panel__predefine .tiny-color-select-panel__predefine__color-block:nth-child(8)')
|
page.locator('.tiny-color-select-panel__predefine .tiny-color-select-panel__predefine__color-block:nth-child(8)')
|
||||||
).toBeVisible()
|
).toBeHidden()
|
||||||
await page.getByRole('button', { name: '选择' }).click()
|
await page.getByRole('button', { name: '选择' }).click()
|
||||||
// 用户行为预定义颜色测试
|
// 用户行为预定义颜色测试
|
||||||
await page.getByRole('button', { name: 'Append predefine color' }).click()
|
await page.getByRole('button', { name: 'Append predefine color' }).click()
|
||||||
await page.locator('.tiny-color-picker').click()
|
await page.locator('.tiny-color-picker').click()
|
||||||
await page.waitForSelector('.tiny-collapse-item__arrow')
|
await page.waitForSelector('.tiny-collapse-item__arrow')
|
||||||
await page.locator('.tiny-collapse-item__arrow').click()
|
|
||||||
await expect(
|
await expect(
|
||||||
page.locator('.tiny-color-select-panel__predefine .tiny-color-select-panel__predefine__color-block:nth-child(9)')
|
page.locator('.tiny-color-select-panel__predefine .tiny-color-select-panel__predefine__color-block:nth-child(9)')
|
||||||
).toBeVisible()
|
).toBeHidden()
|
||||||
})
|
})
|
||||||
|
|
|
@ -7,13 +7,13 @@ test('dialogBox 可拖拽的弹窗', async ({ page }) => {
|
||||||
const button = page.getByRole('button', { name: '可拖拽弹窗' })
|
const button = page.getByRole('button', { name: '可拖拽弹窗' })
|
||||||
const notify = page.locator('.tiny-notify')
|
const notify = page.locator('.tiny-notify')
|
||||||
const dialogBox = page.locator('.tiny-dialog-box')
|
const dialogBox = page.locator('.tiny-dialog-box')
|
||||||
const title = dialogBox.locator('.tiny-dialog-box__title')
|
const header = dialogBox.locator('.tiny-dialog-box__header')
|
||||||
|
|
||||||
await button.click()
|
await button.click()
|
||||||
await expect(dialogBox).toBeVisible()
|
await expect(dialogBox).toBeVisible()
|
||||||
|
|
||||||
// 获取拖拽元素的位置
|
// 获取拖拽元素的位置
|
||||||
const { x, y } = await title.boundingBox()
|
const { x, y } = await header.boundingBox()
|
||||||
|
|
||||||
// 开始拖拽
|
// 开始拖拽
|
||||||
await page.mouse.move(x + 2, y + 2)
|
await page.mouse.move(x + 2, y + 2)
|
||||||
|
|
|
@ -16,7 +16,6 @@ test('弹窗表单', async ({ page }) => {
|
||||||
|
|
||||||
// 验证下拉选择校验提示不会异常
|
// 验证下拉选择校验提示不会异常
|
||||||
await page.locator('#form-in-dialog').locator('.tiny-select__tags-group').click()
|
await page.locator('#form-in-dialog').locator('.tiny-select__tags-group').click()
|
||||||
await page.locator('#form-in-dialog').locator('.tiny-svg.tiny-dialog-box__close').first().click()
|
|
||||||
await page.waitForTimeout(200)
|
await page.waitForTimeout(200)
|
||||||
await expect(page.locator('.tiny-form__valid.tiny-tooltip')).not.toBeVisible()
|
await expect(page.locator('.tiny-form__valid.tiny-tooltip')).not.toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
|
@ -5,15 +5,15 @@ test('logout-custom-service', async ({ page }) => {
|
||||||
const button = page.locator('.tiny-logout')
|
const button = page.locator('.tiny-logout')
|
||||||
const status = page.locator('.status')
|
const status = page.locator('.status')
|
||||||
|
|
||||||
await expect(button).toHaveText('登录')
|
await expect(button).toHaveText(/登录/)
|
||||||
await expect(status).toContainText(['false'])
|
await expect(status).toContainText(['false'])
|
||||||
await button.click()
|
await button.click()
|
||||||
await page.getByRole('button', { name: '确认' }).click()
|
await page.getByRole('button', { name: /确定/ }).click()
|
||||||
await page.waitForTimeout(1000)
|
await page.waitForTimeout(1000)
|
||||||
await expect(button).toHaveText('注销')
|
await expect(button).toHaveText(/注销/)
|
||||||
await expect(status).toContainText(['true'])
|
await expect(status).toContainText(['true'])
|
||||||
await button.click()
|
await button.click()
|
||||||
await page.waitForTimeout(1000)
|
await page.waitForTimeout(1000)
|
||||||
await expect(button).toHaveText('登录')
|
await expect(button).toHaveText(/登录/)
|
||||||
await expect(status).toContainText(['false'])
|
await expect(status).toContainText(['true'])
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue