test(icon): [icon] update icon E2E test (#997)

This commit is contained in:
chenxi-20 2023-12-01 17:27:44 +08:00 committed by GitHub
parent 54f659ca69
commit 6696dbf6df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 221 additions and 201 deletions

View File

@ -4,5 +4,12 @@ test('test', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('icon#basic-usage')
await expect(page.locator('.icon-demo > svg').first()).toHaveCSS('font-size', '48px')
const icons = page.locator('.icon-demo > svg')
await expect(icons.first()).toHaveCSS('font-size', '48px')
for (let i = 0; i < 5; i++) {
await expect(icons.nth(i)).toHaveCSS('width', '48px')
await expect(icons.nth(i)).toHaveCSS('height', '48px')
}
})

View File

@ -1,4 +1,199 @@
export const iconGroups = {
Arrow: [
'IconArrowDown',
'IconArrowLeft',
'IconArrowRight',
'IconArrowUp',
'IconAscending',
'IconChevronDown',
'IconChevronLeft',
'IconChevronRight',
'IconChevronUp',
'IconDefault',
'IconDeltaDownO',
'IconDeltaDown',
'IconDeltaLeftO',
'IconDeltaLeft',
'IconDeltaRightO',
'IconDeltaRight',
'IconDeltaUpO',
'IconDeltaUp',
'IconDoubleLeft',
'IconDoubleRight',
'IconDownO',
'IconDown',
'IconDownWard',
'IconEnd',
'IconLeftO',
'IconLeftWard',
'IconLeftWardArrow',
'IconLeft',
'IconPopup',
'IconRightO',
'IconRight',
'IconRightward',
'IconTriangleDown',
'IconUpO',
'IconUp',
'IconUpWard'
],
Brands: ['IconAngularjs', 'IconEspaceAuto', 'IconEspace', 'IconNodejs', 'IconReactjs', 'IconVuejs'],
Charts: ['IconAreaChart', 'IconDotChart', 'IconLineChart', 'IconPieChart', 'IconStatistics'],
Editor: [
'IconEditorAlignCenter',
'IconEditorAlignLeft',
'IconEditorAlignRight',
'IconEditorBackground',
'IconEditorBold',
'IconEditorCode',
'IconEditorDeleteline',
'IconEditorEraser',
'IconEditorItalic',
'IconEditorLeftBorder',
'IconEditorList',
'IconEditorListDot',
'IconEditorListNum',
'IconEditorMenuLeft',
'IconEditorMenuRight',
'IconEditorQuote',
'IconEditorRedo',
'IconEditorRightBorder',
'IconEditorSub',
'IconEditorSubtitle',
'IconEditorSuper',
'IconEditorTable',
'IconEditorTextcolor',
'IconEditorTitle',
'IconEditorUnderline',
'IconEditorUndo',
'IconEditorVideo',
'IconOperationfaildL',
'IconOuterLink',
'IconTextDecoration',
'IconUnderline',
'IconWriting'
],
IT: [
'IconAdministrator',
'IconDataSource',
'IconDesktopView',
'IconEmailAdd',
'IconEmailCircle',
'IconExcel',
'IconException',
'IconExclamation',
'IconLanguage',
'IconMailContent',
'IconMail',
'IconMarkOn',
'IconMobileView',
'IconMobile',
'IconPrintPreview',
'IconReplies',
'IconSent',
'IconShare',
'IconShareArrow',
'IconShoppingCard',
'IconTabletView',
'IconUnlock',
'IconUnsent',
'IconUser',
'IconVersiontree',
'IconWebPlus',
'IconJs'
],
Media: [
'IconCourse',
'IconCustom',
'IconCustomerService',
'IconDialog',
'IconDialog2',
'IconInformation',
'IconMessageCircle',
'IconPagerFirst',
'IconPagerLast',
'IconPagerNext',
'IconPagerPrev',
'IconPauseCircle',
'IconPause',
'IconPicture',
'IconStartCircle',
'IconStart',
'IconTime'
],
Objects: [
'IconBoat',
'IconCalculator',
'IconCalendar',
'IconClockWork',
'IconCloudDownload',
'IconCloudUpload',
'IconCoin',
'IconTaskCooperation',
'IconTelephoneCircle',
'IconTelephone'
],
Symbols: [
'IconBusy',
'IconCheck',
'IconCheckedLinear',
'IconCheckedSur',
'IconCloseCircle',
'IconCloseSquare',
'IconCode',
'IconCommission',
'IconCueL',
'IconCrop',
'IconDotIpv4',
'IconEllipsis',
'IconError',
'IconEyeclose',
'IconEyeopen',
'IconFrownO',
'IconFrown',
'IconGroup',
'IconHeartempty',
'IconHelpCircle',
'IconHelpQuery',
'IconHelpSolid',
'IconHelp',
'IconHelpful',
'IconLeave',
'IconLoading',
'IconLock',
'IconMale',
'IconMeh',
'IconMore',
'IconPlus',
'IconNodeOpen',
'IconNode',
'IconNone',
'IconOffLine',
'IconOnLine',
'IconPanelMax',
'IconPanelMini',
'IconPanelNormal',
'IconRadio',
'IconRadioselected',
'IconSmileO',
'IconSmile',
'IconStarActive',
'IconStarDisable',
'IconStarO',
'IconStop',
'IconSuccess',
'IconSuccessful',
'IconInfoSolid',
'IconInfoCircle',
'IconInfo',
'IconOperationfaild',
'IconUnknow',
'IconUnknown',
'IconWarning',
'IconWarningTriangle',
'IconClose',
'IconYes'
],
Tools: [
'IconAdd',
'IconAlignBaseline',
@ -119,200 +314,5 @@ export const iconGroups = {
'IconView',
'IconZoomIn',
'IconZoomOut'
],
Editor: [
'IconEditorAlignCenter',
'IconEditorAlignLeft',
'IconEditorAlignRight',
'IconEditorBackground',
'IconEditorBold',
'IconEditorCode',
'IconEditorDeleteline',
'IconEditorEraser',
'IconEditorItalic',
'IconEditorLeftBorder',
'IconEditorList',
'IconEditorListDot',
'IconEditorListNum',
'IconEditorMenuLeft',
'IconEditorMenuRight',
'IconEditorQuote',
'IconEditorRedo',
'IconEditorRightBorder',
'IconEditorSub',
'IconEditorSubtitle',
'IconEditorSuper',
'IconEditorTable',
'IconEditorTextcolor',
'IconEditorTitle',
'IconEditorUnderline',
'IconEditorUndo',
'IconEditorVideo',
'IconOperationfaildL',
'IconOuterLink',
'IconTextDecoration',
'IconUnderline',
'IconWriting'
],
Arrow: [
'IconArrowDown',
'IconArrowLeft',
'IconArrowRight',
'IconArrowUp',
'IconAscending',
'IconChevronDown',
'IconChevronLeft',
'IconChevronRight',
'IconChevronUp',
'IconDefault',
'IconDeltaDownO',
'IconDeltaDown',
'IconDeltaLeftO',
'IconDeltaLeft',
'IconDeltaRightO',
'IconDeltaRight',
'IconDeltaUpO',
'IconDeltaUp',
'IconDoubleLeft',
'IconDoubleRight',
'IconDownO',
'IconDown',
'IconDownWard',
'IconEnd',
'IconLeftO',
'IconLeftWard',
'IconLeftWardArrow',
'IconLeft',
'IconPopup',
'IconRightO',
'IconRight',
'IconRightward',
'IconTriangleDown',
'IconUpO',
'IconUp',
'IconUpWard'
],
Symbols: [
'IconBusy',
'IconCheck',
'IconCheckedLinear',
'IconCheckedSur',
'IconCloseCircle',
'IconCloseSquare',
'IconCode',
'IconCommission',
'IconCueL',
'IconCrop',
'IconDotIpv4',
'IconEllipsis',
'IconError',
'IconEyeclose',
'IconEyeopen',
'IconFrownO',
'IconFrown',
'IconGroup',
'IconHeartempty',
'IconHelpCircle',
'IconHelpQuery',
'IconHelpSolid',
'IconHelp',
'IconHelpful',
'IconLeave',
'IconLoading',
'IconLock',
'IconMale',
'IconMeh',
'IconMore',
'IconPlus',
'IconNodeOpen',
'IconNode',
'IconNone',
'IconOffLine',
'IconOnLine',
'IconPanelMax',
'IconPanelMini',
'IconPanelNormal',
'IconRadio',
'IconRadioselected',
'IconSmileO',
'IconSmile',
'IconStarActive',
'IconStarDisable',
'IconStarO',
'IconStop',
'IconSuccess',
'IconSuccessful',
'IconInfoSolid',
'IconInfoCircle',
'IconInfo',
'IconOperationfaild',
'IconUnknow',
'IconUnknown',
'IconWarning',
'IconWarningTriangle',
'IconClose',
'IconYes'
],
Media: [
'IconCourse',
'IconCustom',
'IconCustomerService',
'IconDialog',
'IconDialog2',
'IconInformation',
'IconMessageCircle',
'IconPagerFirst',
'IconPagerLast',
'IconPagerNext',
'IconPagerPrev',
'IconPauseCircle',
'IconPause',
'IconPicture',
'IconStartCircle',
'IconStart',
'IconTime'
],
Brands: ['IconAngularjs', 'IconEspaceAuto', 'IconEspace', 'IconNodejs', 'IconReactjs', 'IconVuejs'],
Objects: [
'IconBoat',
'IconCalculator',
'IconCalendar',
'IconClockWork',
'IconCloudDownload',
'IconCloudUpload',
'IconCoin',
'IconTaskCooperation',
'IconTelephoneCircle',
'IconTelephone'
],
Charts: ['IconAreaChart', 'IconDotChart', 'IconLineChart', 'IconPieChart', 'IconStatistics'],
IT: [
'IconAdministrator',
'IconDataSource',
'IconDesktopView',
'IconEmailAdd',
'IconEmailCircle',
'IconExcel',
'IconException',
'IconExclamation',
'IconLanguage',
'IconMailContent',
'IconMail',
'IconMarkOn',
'IconMobileView',
'IconMobile',
'IconPrintPreview',
'IconReplies',
'IconSent',
'IconShare',
'IconShareArrow',
'IconShoppingCard',
'IconTabletView',
'IconUnlock',
'IconUnsent',
'IconUser',
'IconVersiontree',
'IconWebPlus',
'IconJs'
]
}

View File

@ -1,8 +1,13 @@
import { test, expect } from '@playwright/test'
test('test', async ({ page }) => {
await page.goto('icon#show-title')
await page.getByText('显示 Title').nth(1).click()
await page.getByTitle('复制').locator('svg').click()
await expect(page.locator('//*[@id="preview"]/div[2]/div[2]')).toHaveAttribute('title', '复制')
test('图标集', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('icon#list')
const icons = page.locator('.svgs-item > .tiny-svg')
for (let i = 0; i < 10; i++) {
await expect(icons.nth(i)).toHaveCSS('width', '24px')
await expect(icons.nth(i)).toHaveCSS('height', '24px')
}
})

View File

@ -0,0 +1,8 @@
import { test, expect } from '@playwright/test'
test('显示title', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('icon#show-title')
await expect(page.getByTitle('复制')).toHaveCount(1)
})