test(guide):[guide] update guide E2E test (#948)

This commit is contained in:
wuyiping0628 2023-11-28 18:05:39 -08:00 committed by GitHub
parent bf2b309375
commit 9192d30f06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 22 deletions

View File

@ -4,29 +4,31 @@ test('基础用法', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('guide#basic-usage')
const activeDom = await page.getByRole('button', { name: '基础新手引导开始' })
const activeDom = page.getByRole('button', { name: '基础新手引导' })
const startGuide = page.getByRole('button', { name: '开始引导' })
const step1 = page.getByRole('heading', { name: '新手引导标题1' })
const step2 = page.getByRole('heading', { name: '新手引导标题2' })
const step3 = page.getByRole('dialog').locator('div').nth(2)
const next = page.getByRole('button', { name: '下一步' })
const complate = page.getByRole('button', { name: '完成' })
const showBtn = page.getByRole('button', { name: '基础新手引导开始' })
const showBtn = page.getByRole('button', { name: '带滚动条新手引导' })
const closeBtn = page.getByRole('button', { name: 'Close Tour' })
// 打开页面即显示guide
await expect(activeDom).toBeVisible()
await startGuide.click()
await expect(step1).toBeVisible()
// 点击下一步,引导
await next.click()
await expect(step2).toBeVisible()
await next.click()
await expect(step3).toBeVisible()
await complate.click()
await expect(next).toBeHidden()
await expect(step3).toBeHidden()
// 引导显示后,点击关闭按钮可关闭
await showBtn.click()
await expect(step1).toBeVisible()
await startGuide.click()
await closeBtn.click()
await expect(step3).toBeHidden()
await expect(showBtn).toBeVisible()
})

View File

@ -4,42 +4,41 @@ test('窗口的事件回调', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('guide#callback')
const start = page.getByRole('button', { name: '展示前回调' })
const start = page.getByRole('button', { name: '展示回调' })
const showBtn = page.getByRole('button', { name: '展示之前', exact: true })
const nextBtn = page.getByRole('button', { name: '下一步' })
const cancelBtn = page.getByRole('button', { name: 'Close Tour' })
const completeBtn = page.getByRole('button', { name: '完成', exact: true })
const guide = page.getByRole('dialog')
const text = page.locator('.callback-content')
const text = page.locator('.shepherd-button')
await start.click()
await expect(guide).toBeVisible()
await expect(guide).toHaveText(/新手引导标题1/)
await expect(text).toHaveText(/beforeShow/)
await expect(text).toHaveText(/展示之前/)
await showBtn.click()
await expect(guide).toBeVisible()
await expect(guide).toHaveText(/新手引导标题2/)
await expect(text).toHaveText(/show/)
await expect(text.nth(2)).toHaveText(/下一步/)
await nextBtn.click()
await expect(guide).toBeVisible()
await expect(guide).toHaveText(/新手引导标题3/)
await expect(text).toHaveText(/show/)
await expect(text.nth(4)).toHaveText(/下一步/)
await nextBtn.click()
await expect(guide).toBeVisible()
await expect(guide).toHaveText(/新手引导标题4/)
await expect(text).toHaveText(/beforeHide/)
await expect(text.nth(6)).toHaveText(/隐藏/)
await nextBtn.click()
await expect(guide).toBeVisible()
await expect(guide).toHaveText(/新手引导标题5/)
await expect(text).toHaveText(/hide/)
await expect(text.nth(9)).toHaveText(/下一步/)
await cancelBtn.click()
await expect(guide).toBeHidden()
await expect(text).toHaveText(/cancel/)
await start.click()
await showBtn.click()
@ -49,8 +48,7 @@ test('窗口的事件回调', async ({ page }) => {
await nextBtn.click()
await expect(guide).toBeVisible()
await expect(guide).toHaveText(/新手引导标题6/)
await expect(text).toHaveText(/hide/)
await expect(text.nth(11)).toHaveText(/完成/)
await completeBtn.click()
await expect(guide).toBeHidden()
await expect(text).toHaveText(/destroy/)
})

View File

@ -4,12 +4,12 @@ test('高亮多处', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('guide#highlight-box')
const showBtn = page.getByRole('button', { name: '引导', exact: true })
const showBtn = page.getByRole('button', { name: '开始引导', exact: true })
const step1 = page.getByRole('button', { name: '新手引导1' })
const step2 = page.getByRole('button', { name: '新手引导2' })
const step3 = page.getByRole('button', { name: '新手引导3' })
const hightAlert1 = page.locator('.tiny-alert').nth(0)
const hightAlert2 = page.locator('.hight11')
const hightAlert2 = page.locator('.hight5')
const guide = page.getByRole('dialog')
await showBtn.click()

View File

@ -4,8 +4,8 @@ test('引导框偏移量', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('guide#offset')
const guideBtn1 = page.getByRole('button', { name: '新手引导1' })
const guideBtn2 = page.getByRole('button', { name: '新手引导2' })
const guideBtn1 = page.getByRole('button', { name: '默认' })
const guideBtn2 = page.getByRole('button', { name: '纵轴偏移 50px' })
const guide = page.getByRole('dialog')
// 引导1 没有设置

View File

@ -4,7 +4,7 @@ test('纯段落用户引导', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('guide#only-content')
const showBtn = page.getByRole('button', { name: '新手引导开始' })
const showBtn = page.getByRole('button', { name: '开始引导' })
const nextBtn = page.getByRole('button', { name: '下一步' })
const guideEle1 = page.getByRole('button', { name: '新手引导1' })
const guideEle2 = page.getByRole('button', { name: '新手引导2' })