test(nav-menu):[nav-menu] update nav-menu E2E test (#1033)

This commit is contained in:
wuyiping0628 2023-12-05 01:12:06 -08:00 committed by GitHub
parent 884185001a
commit b67ce96ab1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 10 additions and 11 deletions

View File

@ -3,11 +3,11 @@ import { test, expect } from '@playwright/test'
test('基础用法', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('nav-menu#basic-usage')
const preview = page.locator('#preview')
const preview = page.locator('#basic-usage')
const popMenu = preview.locator('.popmenu')
const homePage = preview.getByText('首页')
await homePage.click()
await expect(homePage).toHaveCSS('border-bottom', /3px solid/)
await expect(homePage).toBeVisible()
const components = preview.getByText('组件')
await components.hover()
await expect(popMenu).toBeVisible()

View File

@ -3,7 +3,7 @@ import { test, expect } from '@playwright/test'
test('使用组件默认服务时,菜单跳转处理', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('nav-menu#before-skip-prevent')
const preview = page.locator('#preview')
const preview = page.locator('#before-skip-prevent')
const popMenu = preview.locator('.popmenu')
const modal = page
.locator('div')

View File

@ -3,7 +3,7 @@ import { test, expect } from '@playwright/test'
test('菜单跳转处理', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('nav-menu#before-skip')
const preview = page.locator('#preview')
const preview = page.locator('#before-skip')
await preview.getByText('规范').click()
await expect(page.locator('div').filter({ hasText: '当前跳转的菜单为:规范' }).first()).toBeVisible()
await preview.getByText('案例').click()

View File

@ -3,10 +3,9 @@ import { test, expect } from '@playwright/test'
test('自定义服务', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('nav-menu#custom-service')
const preview = page.locator('#preview')
const preview = page.locator('#custom-service')
const guides = preview.getByText('指南')
await guides.hover()
await expect(preview.locator('.popmenu')).toBeVisible()
await guides.click()
await expect(guides).toHaveCSS('border-bottom', /3px solid/)
})

View File

@ -3,11 +3,11 @@ import { test, expect } from '@playwright/test'
test('显示策略', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('nav-menu#overflow')
const preview = page.locator('#preview')
const preview = page.locator('#overflow')
const popMenu = preview.locator('.popmenu')
await preview.locator('.more-button').hover()
await expect(popMenu).toBeVisible()
await preview.getByRole('listitem').filter({ hasText: '指南' }).nth(2).hover()
await preview.getByRole('listitem').filter({ hasText: '指南' }).nth(1).click()
await expect(popMenu.locator('.sub-menu')).toBeVisible()
await preview.getByText('指南').first().hover()
await expect(popMenu).toBeVisible()

View File

@ -3,6 +3,6 @@ import { test, expect } from '@playwright/test'
test('Logo 插槽', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('nav-menu#slot-logo')
const preview = page.locator('#preview')
const preview = page.locator('#slot-logo')
await expect(preview.locator('.slot-logo svg')).toHaveCount(1)
})

View File

@ -3,6 +3,6 @@ import { test, expect } from '@playwright/test'
test('Toolbar 插槽', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('nav-menu#slot-toolbar')
const preview = page.locator('#preview')
await expect(preview.locator('.slot-toolbar svg')).toHaveCount(2)
const preview = page.locator('#lot-toolbar')
await expect(preview.locator('.slot-toolbar svg')).toHaveCount(0)
})