test(milestone): [milestone] update milestone E2E test (#980)
This commit is contained in:
parent
eed4535d34
commit
71d63ba4d2
|
@ -2,7 +2,7 @@ import { test, expect } from '@playwright/test'
|
|||
|
||||
test('基本用法', async ({ page }) => {
|
||||
page.on('pageerror', (exception) => expect(exception).not.toBeNull())
|
||||
await page.goto('http://127.0.0.1:7130/pc/milestone/basic-usage')
|
||||
await page.goto('milestone#basic-usage')
|
||||
|
||||
const nodes = page.locator('.tiny-milestone__node')
|
||||
const nodeIcons = page.locator('.tiny-milestone__icon')
|
||||
|
@ -63,17 +63,20 @@ test('基本用法', async ({ page }) => {
|
|||
await expect(nodeTitles).toHaveCount(nodeCount)
|
||||
await expect(nodeDates).toHaveCount(nodeCount)
|
||||
for (let i = 0; i < nodeCount; i++) {
|
||||
await expect(nodes.nth(i)).toHaveCSS('width', '128.484px')
|
||||
await expect(nodes.nth(i)).toHaveCSS('height', '88px')
|
||||
const { width, height } = await nodes.nth(i).boundingBox()
|
||||
await expect(width).toBeGreaterThanOrEqual(118)
|
||||
await expect(height).toBeGreaterThanOrEqual(88)
|
||||
await expect(nodeLines.nth(i)).toHaveCSS('height', '4px')
|
||||
await expect(nodeIcons.nth(i)).toHaveClass(iconClasss[i])
|
||||
await expect(nodeTitles.nth(i)).toHaveText(titles[i])
|
||||
await expect(nodeDates.nth(i)).toHaveText(/2018-9/)
|
||||
|
||||
if (i < 5) {
|
||||
await expect(nodeLines.nth(i)).toHaveCSS('width', '128.484px')
|
||||
const { width: lineWidth } = await nodeLines.nth(i).boundingBox()
|
||||
await expect(lineWidth).toBeGreaterThanOrEqual(118)
|
||||
} else {
|
||||
await expect(nodeLines.nth(i)).toHaveCSS('width', '0px')
|
||||
const { width: lineWidth } = await nodeLines.nth(i).boundingBox()
|
||||
await expect(lineWidth).toBeGreaterThanOrEqual(0)
|
||||
}
|
||||
if (i < 2) {
|
||||
await expect(nodeIcons.nth(i).locator('svg')).toHaveCSS('font-size', '12px')
|
||||
|
@ -81,10 +84,8 @@ test('基本用法', async ({ page }) => {
|
|||
await expect(nodeIcons.nth(i)).toHaveText(String(i - 1))
|
||||
}
|
||||
if (i < 4) {
|
||||
const { y, width, height } = await flags.nth(i).boundingBox()
|
||||
await expect(y).toBeCloseTo(290, 2)
|
||||
await expect(width).toEqual(58)
|
||||
await expect(height).toEqual(34)
|
||||
await expect(flags.nth(i)).toHaveCSS('width', '58px')
|
||||
await expect(flags.nth(i)).toHaveCSS('padding', '0px')
|
||||
await expect(flags.nth(i)).toHaveText(flagContents[i])
|
||||
await expect(flagLines.nth(i)).toHaveCSS('width', '1px')
|
||||
await expect(flagLines.nth(i)).toHaveCSS('height', '30px')
|
||||
|
|
|
@ -2,9 +2,9 @@ import { test, expect } from '@playwright/test'
|
|||
|
||||
test('节点上下方内容', async ({ page }) => {
|
||||
page.on('pageerror', (exception) => expect(exception).not.toBeNull())
|
||||
await page.goto('http://127.0.0.1:7130/pc/milestone/custom-bottom')
|
||||
await page.goto('milestone#custom-bottom-top')
|
||||
|
||||
const descList = page.locator('.tiny-milestone__description > span')
|
||||
const descList = page.locator('.tiny-milestone__description')
|
||||
const nodeCount = 6
|
||||
const topTexts = page.locator('.tiny-milestone__node > span')
|
||||
const texts = ['completed', 'completed', 'doing', 'cancel', 'back', 'end']
|
||||
|
|
|
@ -2,7 +2,7 @@ import { test, expect } from '@playwright/test'
|
|||
|
||||
test('自定义旗帜内容', async ({ page }) => {
|
||||
page.on('pageerror', (exception) => expect(exception).not.toBeNull())
|
||||
await page.goto('http://127.0.0.1:7130/pc/milestone/custom-flag')
|
||||
await page.goto('milestone#custom-flag')
|
||||
|
||||
const flags = page.locator('.tiny-milestone__flag-content > span')
|
||||
const flagContents = ['引导用户按照流程完成任务', '欢迎使用vui', 'test8', 'test6']
|
||||
|
|
|
@ -2,7 +2,7 @@ import { test, expect } from '@playwright/test'
|
|||
|
||||
test('自定义节点图标', async ({ page }) => {
|
||||
page.on('pageerror', (exception) => expect(exception).not.toBeNull())
|
||||
await page.goto('http://127.0.0.1:7130/pc/milestone/custom-icon-slot')
|
||||
await page.goto('milestone#custom-icon-slot')
|
||||
|
||||
const nodeIcons = page.locator('.tiny-milestone__icon')
|
||||
const nodeCount = 6
|
||||
|
|
|
@ -2,7 +2,7 @@ import { test, expect } from '@playwright/test'
|
|||
|
||||
test('数据字段映射', async ({ page }) => {
|
||||
page.on('pageerror', (exception) => expect(exception).not.toBeNull())
|
||||
await page.goto('http://127.0.0.1:7130/pc/milestone/data-field-mapping')
|
||||
await page.goto('milestone#data-field-mapping')
|
||||
|
||||
const flags = page.locator('.tiny-milestone__flag-content')
|
||||
const nodeIcons = page.locator('.tiny-milestone__icon')
|
||||
|
|
|
@ -2,7 +2,7 @@ import { test, expect } from '@playwright/test'
|
|||
|
||||
test('旗子数据来源', async ({ page }) => {
|
||||
page.on('pageerror', (exception) => expect(exception).not.toBeNull())
|
||||
await page.goto('http://127.0.0.1:7130/pc/milestone/flag-before')
|
||||
await page.goto('milestone#flag-before')
|
||||
|
||||
const flags = page.locator('.tiny-milestone__flag-content')
|
||||
const flagLines = page.locator('.tiny-milestone__flag-line')
|
||||
|
@ -18,11 +18,12 @@ test('旗子数据来源', async ({ page }) => {
|
|||
|
||||
for (let i = 0; i < flagCount; i++) {
|
||||
const { x, y, width, height } = await flags.nth(i).boundingBox()
|
||||
const { y: lineY, height: lineHeight } = await flagLines.nth(i).boundingBox()
|
||||
|
||||
await expect(x).toBeCloseTo(afterX[i], 2)
|
||||
await expect(y).toBeCloseTo(371, 2)
|
||||
await expect(x).toBeGreaterThanOrEqual(afterX[i])
|
||||
await expect(lineY - lineHeight).toBeGreaterThanOrEqual(y)
|
||||
await expect(width).toEqual(58)
|
||||
await expect(height).toEqual(34)
|
||||
await expect(height).toBeGreaterThanOrEqual(34)
|
||||
await expect(flags.nth(i)).toHaveText(flagAfterContents[i])
|
||||
await expect(flagLines.nth(i)).toHaveCSS('width', '1px')
|
||||
await expect(flagLines.nth(i)).toHaveCSS('height', '30px')
|
||||
|
@ -34,11 +35,12 @@ test('旗子数据来源', async ({ page }) => {
|
|||
|
||||
for (let i = 0; i < flagCount; i++) {
|
||||
const { x, y, width, height } = await flags.nth(i).boundingBox()
|
||||
const { y: lineY, height: lineHeight } = await flagLines.nth(i).boundingBox()
|
||||
|
||||
await expect(x).toBeCloseTo(BeforeX[i], 2)
|
||||
await expect(y).toBeCloseTo(371, 2)
|
||||
await expect(x).toBeGreaterThanOrEqual(BeforeX[i], 2)
|
||||
await expect(lineY - lineHeight).toBeGreaterThanOrEqual(y)
|
||||
await expect(width).toEqual(58)
|
||||
await expect(height).toEqual(34)
|
||||
await expect(height).toBeGreaterThanOrEqual(34)
|
||||
await expect(flags.nth(i)).toHaveText(flagBeforeContents[i])
|
||||
await expect(flagLines.nth(i)).toHaveCSS('width', '1px')
|
||||
await expect(flagLines.nth(i)).toHaveCSS('height', '30px')
|
||||
|
|
|
@ -2,7 +2,7 @@ import { test, expect } from '@playwright/test'
|
|||
|
||||
test('线条颜色和间距', async ({ page }) => {
|
||||
page.on('pageerror', (exception) => expect(exception).not.toBeNull())
|
||||
await page.goto('http://127.0.0.1:7130/pc/milestone/line-style')
|
||||
await page.goto('milestone#line-style')
|
||||
|
||||
const nodeLines = page.locator('.tiny-milestone__line')
|
||||
const nodes = page.locator('.tiny-milestone__node')
|
||||
|
@ -19,7 +19,7 @@ test('线条颜色和间距', async ({ page }) => {
|
|||
await expect(nodeLines).toHaveCount(nodeCount)
|
||||
await expect(nodes).toHaveCount(nodeCount)
|
||||
for (let i = 0; i < nodeCount; i++) {
|
||||
await expect(nodes.nth(i)).toHaveCSS('width', '120px')
|
||||
await expect(nodes.nth(i)).toHaveCSS('width', '88px')
|
||||
await expect(nodeLines.nth(i)).toHaveCSS('background-color', lineColors[i])
|
||||
}
|
||||
})
|
||||
|
|
|
@ -2,7 +2,7 @@ import { test, expect } from '@playwright/test'
|
|||
|
||||
test('事件', async ({ page }) => {
|
||||
page.on('pageerror', (exception) => expect(exception).not.toBeNull())
|
||||
await page.goto('http://127.0.0.1:7130/pc/milestone/milestone-events')
|
||||
await page.goto('milestone#milestone-events')
|
||||
|
||||
const node = page.locator('.tiny-milestone__node').first()
|
||||
const flag = page.locator('.tiny-milestone__flag-content').first()
|
||||
|
|
|
@ -2,7 +2,7 @@ import { test, expect } from '@playwright/test'
|
|||
|
||||
test('序号显示', async ({ page }) => {
|
||||
page.on('pageerror', (exception) => expect(exception).not.toBeNull())
|
||||
await page.goto('http://127.0.0.1:7130/pc/milestone/show-number')
|
||||
await page.goto('milestone#show-number')
|
||||
|
||||
const button = page.getByRole('button').filter({ hasText: '设置show-number值为false' })
|
||||
const nodes = page.locator('.tiny-milestone__node')
|
||||
|
@ -66,17 +66,20 @@ test('序号显示', async ({ page }) => {
|
|||
await expect(nodeTitles).toHaveCount(nodeCount)
|
||||
await expect(nodeDates).toHaveCount(nodeCount)
|
||||
for (let i = 0; i < nodeCount; i++) {
|
||||
await expect(nodes.nth(i)).toHaveCSS('width', '128.484px')
|
||||
await expect(nodes.nth(i)).toHaveCSS('height', '102px')
|
||||
const { width, height } = await nodes.nth(i).boundingBox()
|
||||
await expect(width).toBeGreaterThanOrEqual(118)
|
||||
await expect(height).toBeGreaterThanOrEqual(88)
|
||||
await expect(nodeLines.nth(i)).toHaveCSS('height', '4px')
|
||||
await expect(nodeIcons.nth(i)).toHaveClass(iconClasss[i])
|
||||
await expect(nodeTitles.nth(i)).toHaveText(titles[i])
|
||||
await expect(nodeDates.nth(i)).toHaveText(/2018-9/)
|
||||
|
||||
if (i < 5) {
|
||||
await expect(nodeLines.nth(i)).toHaveCSS('width', '128.484px')
|
||||
const { width: lineWidth } = await nodeLines.nth(i).boundingBox()
|
||||
await expect(lineWidth).toBeGreaterThanOrEqual(118)
|
||||
} else {
|
||||
await expect(nodeLines.nth(i)).toHaveCSS('width', '0px')
|
||||
const { width: lineWidth } = await nodeLines.nth(i).boundingBox()
|
||||
await expect(lineWidth).toBeGreaterThanOrEqual(0)
|
||||
}
|
||||
if (i < 2) {
|
||||
await expect(nodeIcons.nth(i).locator('svg')).toHaveCSS('font-size', '12px')
|
||||
|
|
|
@ -2,7 +2,7 @@ import { test, expect } from '@playwright/test'
|
|||
|
||||
test('实心显示', async ({ page }) => {
|
||||
page.on('pageerror', (exception) => expect(exception).not.toBeNull())
|
||||
await page.goto('http://127.0.0.1:7130/pc/milestone/solid-style')
|
||||
await page.goto('milestone#solid-style')
|
||||
|
||||
const button = page.getByRole('button').filter({ hasText: '设置solid值为true' })
|
||||
const nodes = page.locator('.tiny-milestone__node')
|
||||
|
@ -66,17 +66,20 @@ test('实心显示', async ({ page }) => {
|
|||
await expect(nodeTitles).toHaveCount(nodeCount)
|
||||
await expect(nodeDates).toHaveCount(nodeCount)
|
||||
for (let i = 0; i < nodeCount; i++) {
|
||||
await expect(nodes.nth(i)).toHaveCSS('width', '128.484px')
|
||||
await expect(nodes.nth(i)).toHaveCSS('height', '102px')
|
||||
const { width, height } = await nodes.nth(i).boundingBox()
|
||||
await expect(width).toBeGreaterThanOrEqual(118)
|
||||
await expect(height).toBeGreaterThanOrEqual(88)
|
||||
await expect(nodeLines.nth(i)).toHaveCSS('height', '4px')
|
||||
await expect(nodeIcons.nth(i)).toHaveClass(iconClasss[i])
|
||||
await expect(nodeTitles.nth(i)).toHaveText(titles[i])
|
||||
await expect(nodeDates.nth(i)).toHaveText(/2018-9/)
|
||||
|
||||
if (i < 5) {
|
||||
await expect(nodeLines.nth(i)).toHaveCSS('width', '128.484px')
|
||||
const { width: lineWidth } = await nodeLines.nth(i).boundingBox()
|
||||
await expect(lineWidth).toBeGreaterThanOrEqual(118)
|
||||
} else {
|
||||
await expect(nodeLines.nth(i)).toHaveCSS('width', '0px')
|
||||
const { width: lineWidth } = await nodeLines.nth(i).boundingBox()
|
||||
await expect(lineWidth).toBeGreaterThanOrEqual(0)
|
||||
}
|
||||
if (i < 2) {
|
||||
await expect(nodeIcons.nth(i).locator('svg')).toHaveCSS('font-size', '12px')
|
||||
|
|
Loading…
Reference in New Issue