forked from opentiny/tiny-vue
test(bulletin-board):[bulletin-board] update bulletin-board E2E test (#1114)
* test(bullentin-board):[bullentin-board] update bullentin-board E2E test * test(bullentin-board):[bullentin-board] update bullentin-board E2E test * test(bulletin-board):[bulletin-board] update bulletin-board E2E test
This commit is contained in:
parent
021f54426d
commit
bedb81d3d2
|
@ -4,14 +4,13 @@ test('BulletinBoard 默认激活的选项卡', async ({ page }) => {
|
|||
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
||||
await page.goto('bulletin-board#active-name')
|
||||
|
||||
const preview = page.locator('#preview')
|
||||
const preview = page.locator('#active-name')
|
||||
const tabTitle = preview.locator('.tiny-tabs__item')
|
||||
const tabContent = preview.locator('.tiny-tab-pane')
|
||||
|
||||
// 激活第二项选项卡
|
||||
await expect(tabTitle.nth(1)).toHaveClass(/is-active/)
|
||||
await expect(tabTitle.nth(1)).toHaveCSS('color', 'rgb(94, 124, 224)')
|
||||
await expect(tabTitle.nth(1)).toHaveCSS('border-bottom', '3px solid rgb(94, 124, 224)')
|
||||
|
||||
await expect(tabContent.nth(1)).toHaveClass(/active-item/)
|
||||
await expect(tabContent.nth(1)).toBeVisible()
|
||||
|
|
|
@ -4,14 +4,14 @@ test('BulletinBoard 基本用法', async ({ page }) => {
|
|||
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
||||
await page.goto('bulletin-board#base')
|
||||
|
||||
const preview = page.locator('#preview')
|
||||
const preview = page.locator('#base')
|
||||
const tabTitle = preview.locator('.tiny-tabs__item')
|
||||
const tabContent = preview.locator('.tiny-tab-pane')
|
||||
|
||||
// 默认激活第一项选项卡
|
||||
await expect(tabTitle.first()).toHaveClass(/is-active/)
|
||||
await expect(tabTitle.first()).toContainText('TINY 更新日志')
|
||||
await expect(tabTitle.first()).toHaveCSS('color', 'rgb(94, 124, 224)')
|
||||
await expect(tabTitle.first()).toHaveCSS('border-bottom', '3px solid rgb(94, 124, 224)')
|
||||
await expect(tabContent.first()).toHaveClass(/active-item/)
|
||||
await expect(tabContent.first()).toBeVisible()
|
||||
|
||||
|
@ -25,7 +25,6 @@ test('BulletinBoard 基本用法', async ({ page }) => {
|
|||
await tabTitle.nth(i).click()
|
||||
await expect(tabTitle.nth(i)).toHaveClass(/is-active/)
|
||||
await expect(tabTitle.nth(i)).toHaveCSS('color', 'rgb(94, 124, 224)')
|
||||
await expect(tabTitle.nth(i)).toHaveCSS('border-bottom', '3px solid rgb(94, 124, 224)')
|
||||
await expect(tabContent.nth(i)).toHaveClass(/active-item/)
|
||||
await expect(tabContent.nth(i)).toBeVisible()
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ test('BulletinBoard 自定义新公告前缀', async ({ page }) => {
|
|||
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
||||
await page.goto('bulletin-board#icon')
|
||||
|
||||
const preview = page.locator('#preview')
|
||||
const preview = page.locator('#icon')
|
||||
const tabContent = preview.locator('.tiny-tab-pane')
|
||||
|
||||
// 自定义图标替代默认文字'NEW'
|
||||
|
|
|
@ -4,8 +4,14 @@ test('BulletinBoard 显示 “更多” 链接(', async ({ page }) => {
|
|||
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
||||
await page.goto('bulletin-board#more-link')
|
||||
|
||||
const preview = page.locator('#preview')
|
||||
const preview = page.locator('#more-link')
|
||||
const moreLink = preview.locator('.tiny-bulletin-board__more-link')
|
||||
|
||||
await expect(moreLink).toHaveCount(3)
|
||||
await expect(moreLink.nth(0)).toContainText('更多')
|
||||
await expect(moreLink.nth(1)).toContainText('更多')
|
||||
await expect(moreLink.nth(2)).toContainText('更多')
|
||||
|
||||
await expect(moreLink.nth(0)).toHaveAttribute('href', '/Alert')
|
||||
await expect(moreLink.nth(1)).toHaveAttribute('href', '/Alert')
|
||||
await expect(moreLink.nth(2)).toHaveAttribute('href', '/Alert')
|
||||
})
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { test, expect } from '@playwright/test'
|
||||
|
||||
test('BulletinBoard 基于Route的跳转(', async ({ page }) => {
|
||||
test('BulletinBoard 基于Route的跳转', async ({ page }) => {
|
||||
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
||||
await page.goto('bulletin-board#route')
|
||||
|
||||
const preview = page.locator('#preview')
|
||||
const preview = page.locator('#route')
|
||||
const contentTitle = preview.locator('.tiny-bulletin-board__textTitle')
|
||||
|
||||
// 判断a标签href属性值
|
||||
expect(await contentTitle.getAttribute('href')).toBe('/#/Alert')
|
||||
await expect(contentTitle).toHaveAttribute('href', '/#/Alert')
|
||||
})
|
||||
|
|
|
@ -4,7 +4,7 @@ test('BulletinBoard 选项卡标题(', async ({ page }) => {
|
|||
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
||||
await page.goto('bulletin-board#tab-title')
|
||||
|
||||
const preview = page.locator('#preview')
|
||||
const preview = page.locator('#tab-title')
|
||||
const tabTitle = preview.locator('.tiny-tabs__item')
|
||||
|
||||
await expect(tabTitle).toHaveCount(3)
|
||||
|
|
|
@ -4,7 +4,7 @@ test('BulletinBoard 公告牌标题(', async ({ page }) => {
|
|||
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
||||
await page.goto('bulletin-board#title')
|
||||
|
||||
const preview = page.locator('#preview')
|
||||
const preview = page.locator('#title')
|
||||
const title = preview.locator('.tiny-bulletin-board__title')
|
||||
|
||||
await expect(title).toBeVisible()
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { test, expect } from '@playwright/test'
|
||||
|
||||
test('BulletinBoard 基于Url的跳转(', async ({ page }) => {
|
||||
test('BulletinBoard 基于Url的跳转', async ({ page }) => {
|
||||
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
||||
await page.goto('bulletin-board#url')
|
||||
|
||||
const preview = page.locator('#preview')
|
||||
const preview = page.locator('#url')
|
||||
const contentTitle = preview.locator('.tiny-bulletin-board__textTitle')
|
||||
|
||||
// a标签href属性值
|
||||
expect(await contentTitle.getAttribute('href')).toBe('localhost:3000/#/webcore/zh-CN/guide/changelog')
|
||||
await expect(contentTitle).toHaveAttribute('href', 'localhost:3000/#/webcore/zh-CN/guide/changelog')
|
||||
})
|
||||
|
|
|
@ -7,7 +7,7 @@ export default {
|
|||
'name': { 'zh-CN': '基本用法', 'en-US': 'Basic Usage' },
|
||||
'desc': {
|
||||
'zh-CN':
|
||||
'<p>必须设置 <code>data</code> 属性设置公告牌公告信息数据,以及 <code>tab-title</code> 属性设置每个公告牌标题。</p>\n',
|
||||
'<p>通过 <code>data</code> 设置公告牌公告信息数据,<code>tab-title</code> 属性设置每个公告牌标题。</p>\n',
|
||||
'en-US':
|
||||
'<p>The <code>data</code> attribute must be set to set the bulletin information data, and the <code>tab-title</code> attribute must be set to set the title of each bulletin board. </p>\n'
|
||||
},
|
||||
|
@ -17,7 +17,7 @@ export default {
|
|||
'demoId': 'title',
|
||||
'name': { 'zh-CN': '公告牌标题', 'en-US': 'Billboard Title' },
|
||||
'desc': {
|
||||
'zh-CN': '<p>可通过 <code>title</code> 设置公告牌标题。</p>\n',
|
||||
'zh-CN': '<p>通过 <code>title</code> 设置公告牌标题。</p>\n',
|
||||
'en-US': '<p>You can use <code>title</code> to set the bulletin board title. </p>\n'
|
||||
},
|
||||
'codeFiles': ['title.vue']
|
||||
|
@ -26,7 +26,7 @@ export default {
|
|||
'demoId': 'active-name',
|
||||
'name': { 'zh-CN': '默认激活的选项卡', 'en-US': 'Default Activated Tab' },
|
||||
'desc': {
|
||||
'zh-CN': '<p>可通过 <code>active-name</code> 设置默认激活的选项卡,从 <code>1</code> 开始计算。</p>\n',
|
||||
'zh-CN': '<p>通过 <code>active-name</code> 设置默认激活的选项卡,从 <code>1</code> 开始计算。</p>\n',
|
||||
'en-US':
|
||||
'<p>You can set the default active tab by <code>active-name</code>, starting from <code>1</code>. </p>\n'
|
||||
},
|
||||
|
@ -36,7 +36,7 @@ export default {
|
|||
'demoId': 'tab-title',
|
||||
'name': { 'zh-CN': '选项卡标题', 'en-US': 'Tab Title' },
|
||||
'desc': {
|
||||
'zh-CN': '<p>可通过 <code>tab-title</code> 属性自定义选项卡标题。</p>\n',
|
||||
'zh-CN': '<p>通过 <code>tab-title</code> 设置自定义选项卡标题。</p>\n',
|
||||
'en-US': '<p>You can customize the tab title by using the <code>tab-title</code> attribute. </p>\n'
|
||||
},
|
||||
'codeFiles': ['tab-title.vue']
|
||||
|
@ -45,7 +45,8 @@ export default {
|
|||
'demoId': 'url',
|
||||
'name': { 'zh-CN': '基于Url的跳转', 'en-US': 'URL-based redirection' },
|
||||
'desc': {
|
||||
'zh-CN': '<p>基于 Url 的跳转是根据数据中的 <code>url</code> 和 <code>target</code> 字段进行跳转的。</p>\n',
|
||||
'zh-CN':
|
||||
'<p>基于 <code>Url</code> 的跳转是通过数据中的 <code>url</code> 和 <code>target</code> 字段进行设置的。</p>\n',
|
||||
'en-US':
|
||||
'<p>The URL-based redirection is based on the <code>url</code> and <code>target</code> fields in the data. </p>\n'
|
||||
},
|
||||
|
@ -55,7 +56,7 @@ export default {
|
|||
'demoId': 'route',
|
||||
'name': { 'zh-CN': '基于Route的跳转', 'en-US': 'Route-based redirection' },
|
||||
'desc': {
|
||||
'zh-CN': '<p>基于 Route 的跳转是根据数据中的 <code>route</code> 字段进行跳转的。</p>\n',
|
||||
'zh-CN': '<p>基于 <code>Route</code> 的跳转是通过数据中的 <code>route</code> 字段进行设置的的。</p>\n',
|
||||
'en-US': '<p>Route-based redirection is performed based on the <code>route</code> field in the data. </p>\n'
|
||||
},
|
||||
'codeFiles': ['route.vue']
|
||||
|
@ -65,7 +66,7 @@ export default {
|
|||
'name': { 'zh-CN': '显示 “更多” 链接', 'en-US': 'Show More links' },
|
||||
'desc': {
|
||||
'zh-CN':
|
||||
'<p>可通过 <code>more-link</code> 显示并设置更多链接。 <code>show-more</code> 设置是否显示更多按钮,默认为 true。</p>\n',
|
||||
'<p>通过 <code>more-link</code> 显示并设置更多链接。 <code>show-more</code> 设置是否显示更多按钮,默认为 true。</p>\n',
|
||||
'en-US':
|
||||
'<p>You can use <code>more-link</code> to display and set more links. <code>show-more</code> Sets whether to display the More button. The default value is true. </p>\n'
|
||||
},
|
||||
|
@ -75,7 +76,7 @@ export default {
|
|||
'demoId': 'icon',
|
||||
'name': { 'zh-CN': '自定义新公告前缀', 'en-US': 'User-defined bulletin prefix' },
|
||||
'desc': {
|
||||
'zh-CN': '<p>可通过 <code>icon</code> 自定义新公告前缀图标。</p>\n',
|
||||
'zh-CN': '<p>通过 <code>icon</code> 自定义新公告前缀图标。</p>\n',
|
||||
'en-US': '<p>You can use <code>icon</code> to customize the new bulletin prefix icon. </p>\n'
|
||||
},
|
||||
'codeFiles': ['icon.vue']
|
||||
|
@ -89,7 +90,7 @@ export default {
|
|||
{
|
||||
'name': 'active-name',
|
||||
'type': 'string',
|
||||
'defaultValue': '该属性的默认值为 1',
|
||||
'defaultValue': '1',
|
||||
'desc': {
|
||||
'zh-CN': "默认显示第1栏,可选'1' '2' '3'等",
|
||||
'en-US': 'By default, column 1 is displayed. You can select 1, 2, or 3.'
|
||||
|
@ -117,7 +118,7 @@ export default {
|
|||
{
|
||||
'name': 'show-more',
|
||||
'type': 'boolean',
|
||||
'defaultValue': '该属性的默认值为 true',
|
||||
'defaultValue': 'true',
|
||||
'desc': {
|
||||
'zh-CN': '是否显示更多按钮,默认显示,需要与 more-link 同时使用',
|
||||
'en-US':
|
||||
|
|
Loading…
Reference in New Issue