From 8ae0fdfbf23bdd2b6ed431cac07a643c1e41cd59 Mon Sep 17 00:00:00 2001 From: gimmyhehe <975402925@qq.com> Date: Mon, 13 Jan 2025 20:01:28 +0800 Subject: [PATCH] test: update @playwright/test to 1.49.x and fix e2e case (#2792) * test: update @playwright/test to 1.49.x * test(grid): fix grid e2e test case * test(grid): fix grid e2e test case --- examples/docs/package.json | 2 +- .../pc/app/grid/custom/column-fixed.spec.js | 5 +++-- .../pc/app/grid/custom/column-sort.spec.js | 3 ++- .../grid/custom/column-visible-hidden.spec.js | 5 +++-- .../grid/custom/multiple-column-sort.spec.js | 13 ++++++------ .../app/grid/custom/ordercolumn-local.spec.js | 9 +++++---- .../app/grid/custom/reset-resizable.spec.js | 6 ++++-- .../pc/app/grid/edit/custom-editing.spec.js | 8 +------- .../demos/pc/app/grid/edit/editing.spec.js | 13 +----------- .../pc/app/grid/edit/has-row-change.spec.js | 14 +++++-------- .../pc/app/grid/edit/revert-data.spec.js | 14 ++----------- .../app/grid/edit/status-of-editing.spec.js | 7 +------ .../edit/trigger-mode-for-editing.spec.js | 16 ++------------- .../grid/edit/trigger-mode-hm-editing.spec.js | 12 +++-------- .../pc/app/grid/editor/inner-editor.spec.js | 7 ++----- .../app/grid/event/valid-error-event.spec.js | 7 +------ .../app/grid/faq/grid-in-dialog-box.spec.js | 7 +------ .../pc/app/grid/pager/show-save-msg.spec.js | 7 +------ .../pc/app/grid/toolbar/save-data.spec.js | 7 +------ .../tree-grid-insert-delete-update.spec.js | 3 +-- .../before-submit-validation.spec.js | 11 ++++------ .../pc/app/grid/validation/custcomp.spec.js | 8 ++------ .../editing-isvalidalways-validation.spec.js | 15 +++----------- .../validation/editing-validation.spec.js | 8 ++------ .../grid/validation/row-data-valid.spec.js | 3 ++- .../grid/validation/select-validation.spec.js | 16 ++++----------- .../pc/app/grid/validation/tipconfig.spec.js | 14 ++----------- .../validation-scroll-to-col.spec.js | 7 +------ .../demos/pc/app/time-picker/format.spec.ts | 12 +++++------ examples/sites/package.json | 12 +++++------ examples/vue2.7/package.json | 20 +++++++++---------- examples/vue2/package.json | 2 +- examples/vue3/package.json | 2 +- internals/playwright-config/package.json | 12 +++++------ package.json | 1 - pnpm-workspace.yaml | 1 + 36 files changed, 98 insertions(+), 211 deletions(-) diff --git a/examples/docs/package.json b/examples/docs/package.json index ea29be8f0f..f9984e12bd 100644 --- a/examples/docs/package.json +++ b/examples/docs/package.json @@ -20,6 +20,6 @@ "sortablejs": "1.15.0" }, "devDependencies": { - "@playwright/test": "~1.42.0" + "@playwright/test": "catalog:" } } diff --git a/examples/sites/demos/pc/app/grid/custom/column-fixed.spec.js b/examples/sites/demos/pc/app/grid/custom/column-fixed.spec.js index fd5027b5c4..8b4ad4a35b 100644 --- a/examples/sites/demos/pc/app/grid/custom/column-fixed.spec.js +++ b/examples/sites/demos/pc/app/grid/custom/column-fixed.spec.js @@ -2,10 +2,11 @@ import { test, expect } from '@playwright/test' test('列冻结', async ({ page }) => { page.on('pageerror', (exception) => expect(exception).toBeNull()) + const custom = page.locator('.tiny-grid-custom') await page.goto('grid-custom#custom-column-fixed') await page.locator('.tiny-grid-custom__setting-btn').click() - await page.getByRole('row', { name: '员工数 显示 未冻结' }).getByTitle('未冻结').getByRole('img').click() - await page.getByRole('row', { name: '员工数 显示 左冻结' }).getByTitle('左冻结').getByRole('img').click() + await custom.getByRole('row', { name: '员工数 ' }).getByTitle('未冻结').getByRole('img').click() + await custom.getByRole('row', { name: '员工数' }).getByTitle('左冻结').getByRole('img').click() await page.getByRole('button', { name: '确定' }).click() await expect(page.getByRole('cell', { name: '员工数' })).toHaveCSS('right', '0px') }) diff --git a/examples/sites/demos/pc/app/grid/custom/column-sort.spec.js b/examples/sites/demos/pc/app/grid/custom/column-sort.spec.js index 69f5436d6a..8bfc4d377a 100644 --- a/examples/sites/demos/pc/app/grid/custom/column-sort.spec.js +++ b/examples/sites/demos/pc/app/grid/custom/column-sort.spec.js @@ -2,9 +2,10 @@ import { test, expect } from '@playwright/test' test('个性化排序测试', async ({ page }) => { page.on('pageerror', (exception) => expect(exception).toBeNull()) + const custom = page.locator('.tiny-grid-custom') await page.goto('grid-custom#custom-column-sort') await page.locator('.tiny-grid-custom__setting-btn').click() - await page.getByRole('row', { name: '员工数 显示 未排序 未冻结' }).getByTitle('未排序').getByRole('img').click() + await custom.getByRole('row', { name: '员工数' }).getByTitle('未排序').getByRole('img').click() await page.getByRole('button', { name: '确定' }).click() await page.waitForTimeout(200) const sortBtn = await page.getByRole('cell', { name: '员工数' }).getByRole('img') diff --git a/examples/sites/demos/pc/app/grid/custom/column-visible-hidden.spec.js b/examples/sites/demos/pc/app/grid/custom/column-visible-hidden.spec.js index a9eb8f20c5..ee892590b7 100644 --- a/examples/sites/demos/pc/app/grid/custom/column-visible-hidden.spec.js +++ b/examples/sites/demos/pc/app/grid/custom/column-visible-hidden.spec.js @@ -2,9 +2,10 @@ import { test, expect } from '@playwright/test' test('列显示隐藏', async ({ page }) => { page.on('pageerror', (exception) => expect(exception).toBeNull()) + const custom = page.locator('.tiny-grid-custom') await page.goto('grid-custom#custom-column-visible-hidden') await page.locator('.tiny-grid-custom__setting-btn').click() - await page.getByRole('row', { name: '员工数 显示 未冻结' }).getByTitle('显示').getByRole('img').click() - await page.getByRole('button', { name: '确定' }).click() + await custom.getByRole('row', { name: '员工数' }).getByTitle('显示').getByRole('img').click() + await custom.getByRole('button', { name: '确定' }).click() await expect(page.getByRole('cell', { name: '员工数' })).not.toBeVisible() }) diff --git a/examples/sites/demos/pc/app/grid/custom/multiple-column-sort.spec.js b/examples/sites/demos/pc/app/grid/custom/multiple-column-sort.spec.js index 33e672bf93..8a1d565db4 100644 --- a/examples/sites/demos/pc/app/grid/custom/multiple-column-sort.spec.js +++ b/examples/sites/demos/pc/app/grid/custom/multiple-column-sort.spec.js @@ -2,16 +2,17 @@ import { test, expect } from '@playwright/test' test('多列排序', async ({ page }) => { page.on('pageerror', (exception) => expect(exception).toBeNull()) + const custom = page.locator('.tiny-grid-custom') await page.goto('grid-custom#custom-multiple-column-sort') await page.locator('.tiny-grid-custom__setting-btn').first().click() - await page.getByRole('row', { name: '员工数 显示 未排序 未冻结' }).getByTitle('未排序').locator('path').click() - await page.getByTitle('未排序').locator('path').click() - await page.getByRole('button', { name: '确定' }).click() + await custom.getByRole('row', { name: '员工数' }).getByTitle('未排序').locator('path').click() + await custom.getByTitle('未排序').locator('path').click() + await custom.getByRole('button', { name: '确定' }).click() await expect(page.locator('.tiny-grid-body__row').nth(3)).toContainText('GFD 科技有限公司') await page.locator('.tiny-grid-custom__setting-btn').nth(1).click() - await page.getByRole('row', { name: '员工数 显示 未排序 未冻结' }).getByTitle('未排序').getByRole('img').click() - await page.getByTitle('未排序').getByRole('img').click() - await page.getByRole('button', { name: '确定' }).click() + await custom.getByRole('row', { name: '员工数' }).getByTitle('未排序').getByRole('img').click() + await custom.getByTitle('未排序').getByRole('img').click() + await custom.getByRole('button', { name: '确定' }).click() await expect(page.locator('.tiny-grid-body__row').nth(10)).toContainText('YHN 科技有限公司') }) diff --git a/examples/sites/demos/pc/app/grid/custom/ordercolumn-local.spec.js b/examples/sites/demos/pc/app/grid/custom/ordercolumn-local.spec.js index 8f94cc81b5..fbb106a344 100644 --- a/examples/sites/demos/pc/app/grid/custom/ordercolumn-local.spec.js +++ b/examples/sites/demos/pc/app/grid/custom/ordercolumn-local.spec.js @@ -2,18 +2,19 @@ import { test, expect } from '@playwright/test' test('个性化按钮点击事件', async ({ page }) => { page.on('pageerror', (exception) => expect(exception).toBeNull()) + const custom = page.locator('.tiny-grid-custom') await page.goto('grid-custom#custom-ordercolumn-local') await page.locator('.tiny-grid-custom__setting-btn').click() - await page.getByRole('cell', { name: '显示 未冻结' }).getByTitle('显示').getByRole('img').click() - await page.getByRole('button', { name: '确定' }).click() + await custom.locator('.tiny-grid-body__row').first().getByTitle('显示').getByRole('img').click() + await custom.getByRole('button', { name: '确定' }).click() await expect( page.getByText('点击了确认按钮{"sortType":"page","pageSize":10,"columns":[{"property":"name","order":nu') ).toBeVisible() await page.getByRole('button', { name: '确定' }).click() await page.locator('.tiny-grid-custom__setting-btn').click() - await page.getByRole('button', { name: '重置' }).click() + await custom.getByRole('button', { name: '重置' }).click() await expect(page.getByText('点击了重置按钮')).toBeVisible() await page.getByRole('button', { name: '确定' }).nth(1).click() - await page.getByRole('button', { name: '取消' }).click() + await custom.getByRole('button', { name: '取消' }).click() await expect(page.getByText('点击了取消按钮 undefined')).toBeVisible }) diff --git a/examples/sites/demos/pc/app/grid/custom/reset-resizable.spec.js b/examples/sites/demos/pc/app/grid/custom/reset-resizable.spec.js index 111237fba2..ce160c13c0 100644 --- a/examples/sites/demos/pc/app/grid/custom/reset-resizable.spec.js +++ b/examples/sites/demos/pc/app/grid/custom/reset-resizable.spec.js @@ -30,10 +30,12 @@ test.describe('手动重置列操作', () => { test('重置列隐藏', async ({ page }) => { page.on('pageerror', (exception) => expect(exception).toBeNull()) + const custom = page.locator('.tiny-grid-custom') + await page.goto('grid-custom#custom-reset-resizable') await page.locator('.tiny-grid-custom__setting-btn').click() - await page.getByRole('row', { name: '员工数 显示 未冻结' }).getByTitle('显示').getByRole('img').click() - await page.getByRole('button', { name: '确定' }).click() + await custom.getByRole('row', { name: '员工数' }).getByTitle('显示').getByRole('img').click() + await custom.getByRole('button', { name: '确定' }).click() const thHeader = page.locator('th.tiny-grid-header__column').nth(1) await expect(thHeader).toContainText('地址') await page.getByRole('button', { name: '重置列的隐藏操作' }).click() diff --git a/examples/sites/demos/pc/app/grid/edit/custom-editing.spec.js b/examples/sites/demos/pc/app/grid/edit/custom-editing.spec.js index a02b460e18..0d6defbb79 100644 --- a/examples/sites/demos/pc/app/grid/edit/custom-editing.spec.js +++ b/examples/sites/demos/pc/app/grid/edit/custom-editing.spec.js @@ -6,11 +6,5 @@ test('自定义编辑规则', async ({ page }) => { await page.getByText('GFD 科技 YX 公司').first().click() await expect(page.getByText('GFD 科技 YX 公司').first()).toBeVisible() await page.getByText('WWWW 科技 YX 公司').first().click() - await expect( - page - .getByRole('row', { - name: '2 华南区 2014-02-14 14:14:14 1300 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。' - }) - .getByRole('textbox') - ).toBeVisible() + await expect(page.locator('.tiny-grid-default-input')).toBeVisible() }) diff --git a/examples/sites/demos/pc/app/grid/edit/editing.spec.js b/examples/sites/demos/pc/app/grid/edit/editing.spec.js index 3582b200bf..06a37e55b6 100644 --- a/examples/sites/demos/pc/app/grid/edit/editing.spec.js +++ b/examples/sites/demos/pc/app/grid/edit/editing.spec.js @@ -5,18 +5,7 @@ test('编辑方式', async ({ page }) => { await page.goto('grid-edit#edit-editing') // 单元格编辑 await page.getByRole('cell', { name: 'GFD 科技 YX 公司' }).first().click() - await page - .getByRole('row', { - name: '1 华东区 福州 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。' - }) - .getByRole('textbox') - .click() - await page - .getByRole('row', { - name: '1 华东区 福州 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。' - }) - .getByRole('textbox') - .fill('GFD 科技 Y 水电费第三方 X 公司') + await page.locator('.tiny-grid-default-input').fill('GFD 科技 Y 水电费第三方 X 公司') await page.getByRole('heading', { name: '单元格编辑:' }).click() await expect(await page.getByText('GFD 科技 Y 水电费第三方 X 公司')).toHaveCount(2) diff --git a/examples/sites/demos/pc/app/grid/edit/has-row-change.spec.js b/examples/sites/demos/pc/app/grid/edit/has-row-change.spec.js index f72ee40a3b..19d18c5e7e 100644 --- a/examples/sites/demos/pc/app/grid/edit/has-row-change.spec.js +++ b/examples/sites/demos/pc/app/grid/edit/has-row-change.spec.js @@ -2,18 +2,14 @@ import { test, expect } from '@playwright/test' test('检查数据是否改变', async ({ page }) => { page.on('pageerror', (exception) => expect(exception).toBeNull()) + const demo = page.locator('#edit-has-row-change') await page.goto('grid-edit#edit-has-row-change') - await page.getByText('GFD 科技 YX 公司').first().click() - await page.getByRole('row', { name: '1 保存' }).locator('input[type="text"]').fill('sdf') - await page.getByRole('row', { name: '1 保存' }).getByRole('button', { name: '保存' }).click() + await demo.getByText('GFD 科技 YX 公司').first().click() + await demo.locator('.tiny-grid-body__row').first().locator('input[type="text"]').fill('sdf') + await demo.locator('.tiny-grid-body__row').first().getByRole('button', { name: '保存' }).click() await expect(page.getByText('保存成功!')).toBeVisible() await page.getByRole('button', { name: '确定' }).click() - await page - .getByRole('row', { - name: '2 WWWW 科技 YX 公司 华南区 深圳福田区 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。 保存' - }) - .getByRole('button', { name: '保存' }) - .click() + await demo.locator('.tiny-grid-body__row').nth(1).getByRole('button', { name: '保存' }).click() await expect(page.getByText('当前数据未改变!')).toBeVisible() await page.getByRole('button', { name: '确定' }).click() }) diff --git a/examples/sites/demos/pc/app/grid/edit/revert-data.spec.js b/examples/sites/demos/pc/app/grid/edit/revert-data.spec.js index ad185c3fda..1f1c7019e4 100644 --- a/examples/sites/demos/pc/app/grid/edit/revert-data.spec.js +++ b/examples/sites/demos/pc/app/grid/edit/revert-data.spec.js @@ -4,19 +4,9 @@ test('表格编辑还原更改', async ({ page }) => { page.on('pageerror', (exception) => expect(exception).toBeNull()) await page.goto('grid-edit#edit-revert-data') await page.getByText('GFD 科技 YX 公司').first().click() - await page - .getByRole('row', { - name: '1 华东区 福州 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。 恢复' - }) - .getByRole('textbox') - .fill('sss') + await page.locator('.tiny-grid-default-input').fill('sss') await page.getByText('RFV 有限责任公司').first().click() - await page - .getByRole('row', { - name: '3 华南区 中山市 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。 恢复' - }) - .getByRole('textbox') - .fill('eee') + await page.locator('.tiny-grid-default-input').fill('eee') await page.locator('#edit-revert-data').getByRole('cell', { name: '名称' }).click() await page.getByRole('button', { name: '恢复全部' }).click() await expect(page.getByText('GFD 科技 YX 公司').first()).toBeVisible() diff --git a/examples/sites/demos/pc/app/grid/edit/status-of-editing.spec.js b/examples/sites/demos/pc/app/grid/edit/status-of-editing.spec.js index 39cb53b58f..88ccb3b8c6 100644 --- a/examples/sites/demos/pc/app/grid/edit/status-of-editing.spec.js +++ b/examples/sites/demos/pc/app/grid/edit/status-of-editing.spec.js @@ -4,12 +4,7 @@ test('开启编辑状态', async ({ page }) => { page.on('pageerror', (exception) => expect(exception).toBeNull()) await page.goto('grid-edit#edit-status-of-editing') await page.getByText('GFD 科技 YX 公司').first().click() - await page - .getByRole('row', { - name: '1 华东区 福州 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。' - }) - .getByRole('textbox') - .fill('sdfdf') + await page.locator('.tiny-grid-default-input').fill('sdfdf') await page.getByRole('heading', { name: '开启编辑状态:' }).click() await expect(page.getByRole('cell', { name: 'sdfdf' }).nth(0)).toHaveClass(/col__valid-success/) await expect(page.getByRole('cell', { name: 'sdfdf' }).nth(1)).not.toHaveClass(/col__valid-success/) diff --git a/examples/sites/demos/pc/app/grid/edit/trigger-mode-for-editing.spec.js b/examples/sites/demos/pc/app/grid/edit/trigger-mode-for-editing.spec.js index ba5e9ad796..8bd3a7dd33 100644 --- a/examples/sites/demos/pc/app/grid/edit/trigger-mode-for-editing.spec.js +++ b/examples/sites/demos/pc/app/grid/edit/trigger-mode-for-editing.spec.js @@ -4,21 +4,9 @@ test('触发编辑方式', async ({ page }) => { page.on('pageerror', (exception) => expect(exception).toBeNull()) await page.goto('grid-edit#edit-trigger-mode-for-editing') await page.getByText('GFD 科技 YX 公司').first().click() - await expect( - page - .getByRole('row', { - name: '1 华东区 福州 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。' - }) - .getByRole('textbox') - ).toBeVisible() + await expect(page.locator('.tiny-grid-default-input')).toBeVisible() await page.getByText('WWWW 科技 YX 公司').nth(1).dblclick() - await expect( - page - .getByRole('row', { - name: '2 华南区 深圳福田区 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。' - }) - .getByRole('textbox') - ).toBeVisible() + await expect(page.locator('.tiny-grid-default-input')).toBeVisible() }) diff --git a/examples/sites/demos/pc/app/grid/edit/trigger-mode-hm-editing.spec.js b/examples/sites/demos/pc/app/grid/edit/trigger-mode-hm-editing.spec.js index beb4a8df4a..1765e2ad64 100644 --- a/examples/sites/demos/pc/app/grid/edit/trigger-mode-hm-editing.spec.js +++ b/examples/sites/demos/pc/app/grid/edit/trigger-mode-hm-editing.spec.js @@ -2,18 +2,12 @@ import { test, expect } from '@playwright/test' test('手动触发编辑', async ({ page }) => { page.on('pageerror', (exception) => expect(exception).toBeNull()) + const demo = page.locator('#edit-trigger-mode-hm-editing') await page.goto('grid-edit#edit-trigger-mode-hm-editing') await page.getByText('GFD 科技 YX 公司').first().click() await expect(page.getByText('GFD 科技 YX 公司').first()).toBeVisible() - await page - .getByRole('row', { - name: '1 GFD 科技 YX 公司 华东区 福州 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。 编辑' - }) - .getByRole('button', { name: '编辑' }) - .click() - await expect( - page.getByRole('row', { name: '1 华东区 福州 公司技术和研发实力雄厚,是国家 863' }).getByRole('textbox') - ).toBeVisible() + await demo.locator('.tiny-grid-body__row').first().getByRole('button', { name: '编辑' }).click() + await expect(page.locator('.tiny-grid-default-input')).toBeVisible() await page.getByRole('row', { name: '3 RFV' }).getByRole('button').click() await expect(page.getByRole('combobox')).toBeVisible() diff --git a/examples/sites/demos/pc/app/grid/editor/inner-editor.spec.js b/examples/sites/demos/pc/app/grid/editor/inner-editor.spec.js index 0709af760d..af7890e534 100644 --- a/examples/sites/demos/pc/app/grid/editor/inner-editor.spec.js +++ b/examples/sites/demos/pc/app/grid/editor/inner-editor.spec.js @@ -2,13 +2,10 @@ import { test, expect } from '@playwright/test' test('Grid-编辑器 - 内置编辑器', async ({ page }) => { page.on('pageerror', (exception) => expect(exception).toBeNull()) + const demo = page.locator('#editor-inner-editor') await page.goto('grid-editor#grid_Example-gridEdit-inner-editor') await page.getByText('GFD 科技 YX 公司').first().click() - const input = page - .getByRole('row', { - name: '1 800 华东区 2014-04-30 00:56:00 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。' - }) - .getByRole('textbox') + const input = demo.locator('.tiny-grid-body__row input').first() // 内置编辑器 await expect(input).toHaveClass(/tiny-grid-default-input/) diff --git a/examples/sites/demos/pc/app/grid/event/valid-error-event.spec.js b/examples/sites/demos/pc/app/grid/event/valid-error-event.spec.js index bd725e068a..93aa45a75c 100644 --- a/examples/sites/demos/pc/app/grid/event/valid-error-event.spec.js +++ b/examples/sites/demos/pc/app/grid/event/valid-error-event.spec.js @@ -4,12 +4,7 @@ test('校验不通过事件', async ({ page }) => { page.on('pageerror', (exception) => expect(exception).toBeNull()) await page.goto('grid-event#event-valid-error-event') await page.getByText('GFD 科技 YX 公司').first().click() - await page - .getByRole('row', { - name: '1 华东区 福州 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。' - }) - .getByRole('textbox') - .clear() + await page.locator('.tiny-grid-default-input').clear() await page.waitForTimeout(400) await expect(page.getByText('触发校验不通过事件').first()).toBeVisible() }) diff --git a/examples/sites/demos/pc/app/grid/faq/grid-in-dialog-box.spec.js b/examples/sites/demos/pc/app/grid/faq/grid-in-dialog-box.spec.js index b217ca1fbb..afb6d677f2 100644 --- a/examples/sites/demos/pc/app/grid/faq/grid-in-dialog-box.spec.js +++ b/examples/sites/demos/pc/app/grid/faq/grid-in-dialog-box.spec.js @@ -5,12 +5,7 @@ test('弹窗框中表格编辑器失焦功能测试', async ({ page }) => { await page.goto('grid-faq#faq-grid-in-dialog-box') await page.getByRole('button', { name: '弹出 Dialog false' }).click() await page.getByText('GFD 科技有限公司').first().click() - await page - .getByRole('row', { - name: '1 华东区 福州 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。' - }) - .getByRole('textbox') - .fill('ss') + await page.locator('.tiny-grid-default-input').fill('ss') await page.getByText('消息').click() await expect(page.getByText('ss').first()).toBeVisible() diff --git a/examples/sites/demos/pc/app/grid/pager/show-save-msg.spec.js b/examples/sites/demos/pc/app/grid/pager/show-save-msg.spec.js index 859e035112..d23d89f3a1 100644 --- a/examples/sites/demos/pc/app/grid/pager/show-save-msg.spec.js +++ b/examples/sites/demos/pc/app/grid/pager/show-save-msg.spec.js @@ -4,12 +4,7 @@ test('保存', async ({ page }) => { page.on('pageerror', (exception) => expect(exception).toBeNull()) await page.goto('grid-pager#pager-show-save-msg') await page.getByText('GFD 科技 YX 公司').first().click() - await page - .getByRole('row', { - name: '1 华东区 福州 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。' - }) - .getByRole('textbox') - .fill('GFD 科技 YX 公司 ds') + await page.locator('.tiny-grid-default-input').fill('GFD 科技 YX 公司 ds') await page.locator('#pager-show-save-msg').getByRole('cell', { name: '名称' }).click() await page.getByRole('listitem').filter({ hasText: '2' }).click() await expect(page.getByText('有修改的数据,是否要保存?')).toBeVisible() diff --git a/examples/sites/demos/pc/app/grid/toolbar/save-data.spec.js b/examples/sites/demos/pc/app/grid/toolbar/save-data.spec.js index f019ceab41..568a83364a 100644 --- a/examples/sites/demos/pc/app/grid/toolbar/save-data.spec.js +++ b/examples/sites/demos/pc/app/grid/toolbar/save-data.spec.js @@ -4,12 +4,7 @@ test('服务端数据保存和删除方法', async ({ page }) => { page.on('pageerror', (exception) => expect(exception).toBeNull()) await page.goto('grid-toolbar#toolbar-save-data') await page.getByText('GFD 科技 YX 公司').first().click() - await page - .getByRole('row', { - name: '1 华东区 福州 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。' - }) - .getByRole('textbox') - .fill('dsfds') + await page.locator('.tiny-grid-default-input').fill('dsfds') await page.getByRole('row', { name: '名称 区域 地址 公司简介' }).getByText('名称').click() await page.getByRole('button', { name: '保存' }).click() await expect(page.getByText('dsfds').first()).toBeVisible() diff --git a/examples/sites/demos/pc/app/grid/tree-table/tree-grid-insert-delete-update.spec.js b/examples/sites/demos/pc/app/grid/tree-table/tree-grid-insert-delete-update.spec.js index 3472169ea4..4a931bcf0c 100644 --- a/examples/sites/demos/pc/app/grid/tree-table/tree-grid-insert-delete-update.spec.js +++ b/examples/sites/demos/pc/app/grid/tree-table/tree-grid-insert-delete-update.spec.js @@ -24,8 +24,7 @@ test.describe('树表增删改功能', () => { .first() .click() await page.getByRole('row', { name: '3 WWWW 科技股份有限子公司 华南区 720' }).getByText('华南区').first().click() - await page.getByRole('row', { name: '3 WWWW 科技股份有限子公司 720' }).getByRole('textbox').first().click() - await page.getByRole('row', { name: '3 WWWW 科技股份有限子公司 720' }).getByRole('textbox').fill('华南区 ee') + await page.locator('.tiny-grid-default-input').fill('华南区 ee') await page.getByText('WWWW 科技 YX 公司').first().click() await page.getByRole('button', { name: '获取修改' }).click() diff --git a/examples/sites/demos/pc/app/grid/validation/before-submit-validation.spec.js b/examples/sites/demos/pc/app/grid/validation/before-submit-validation.spec.js index f679f9dd2d..2d7c895346 100644 --- a/examples/sites/demos/pc/app/grid/validation/before-submit-validation.spec.js +++ b/examples/sites/demos/pc/app/grid/validation/before-submit-validation.spec.js @@ -2,14 +2,11 @@ import { test, expect } from '@playwright/test' test('提交前校验', async ({ page }) => { page.on('pageerror', (exception) => expect(exception).toBeNull()) + const demo = page.locator('#validation-before-submit-validation') await page.goto('grid-validation#validation-before-submit-validation') - await page.getByText('GFD 科技 YX 公司').first().click() - await page - .getByRole('row', { - name: '1 华东区 福州 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。' - }) - .getByRole('textbox') - .fill('') + await demo.getByText('GFD 科技 YX 公司').first().click() + await demo.locator('.tiny-grid-default-input').fill('') + await page.getByRole('button', { name: '提交数据' }).click() await expect(page.getByText('校验不通过', { exact: true })).toBeVisible() diff --git a/examples/sites/demos/pc/app/grid/validation/custcomp.spec.js b/examples/sites/demos/pc/app/grid/validation/custcomp.spec.js index 7452fb4ded..442fceffb5 100644 --- a/examples/sites/demos/pc/app/grid/validation/custcomp.spec.js +++ b/examples/sites/demos/pc/app/grid/validation/custcomp.spec.js @@ -2,14 +2,10 @@ import { test, expect } from '@playwright/test' test('自定义组件与插槽编辑器校验', async ({ page }) => { page.on('pageerror', (exception) => expect(exception).toBeNull()) + const demo = page.locator('#validation-custcomp') await page.goto('grid-validation#validation-custcomp') await page.getByText('GFD 科技 YX 公司').first().click() - await page - .getByRole('row', { - name: '1 华东区 福州 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。 1234567890' - }) - .getByRole('textbox') - .fill('') + await demo.locator('.tiny-grid-default-input').fill('') await expect(page.getByRole('tooltip', { name: '必填' })).toBeVisible() }) diff --git a/examples/sites/demos/pc/app/grid/validation/editing-isvalidalways-validation.spec.js b/examples/sites/demos/pc/app/grid/validation/editing-isvalidalways-validation.spec.js index b0055e6eaf..83a4eba672 100644 --- a/examples/sites/demos/pc/app/grid/validation/editing-isvalidalways-validation.spec.js +++ b/examples/sites/demos/pc/app/grid/validation/editing-isvalidalways-validation.spec.js @@ -2,19 +2,10 @@ import { test, expect } from '@playwright/test' test('隐藏列编辑时校验', async ({ page }) => { page.on('pageerror', (exception) => expect(exception).toBeNull()) + + const demo = page.locator('#validation-editing-isvalidalways-validation') await page.goto('grid-validation#validation-editing-isvalidalways-validation') - await page - .getByRole('row', { - name: '1 华东区 福州 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。' - }) - .getByRole('textbox') - .clear() - await page - .getByRole('row', { - name: '1 华东区 福州 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。' - }) - .getByRole('textbox') - .fill('GF') + await demo.locator('.tiny-grid-default-input').first().fill('GF') await expect(page.getByRole('tooltip', { name: '名称长度在 3 到 50 个字符' })).toBeVisible() }) diff --git a/examples/sites/demos/pc/app/grid/validation/editing-validation.spec.js b/examples/sites/demos/pc/app/grid/validation/editing-validation.spec.js index 3ea773d95b..702ab97ae5 100644 --- a/examples/sites/demos/pc/app/grid/validation/editing-validation.spec.js +++ b/examples/sites/demos/pc/app/grid/validation/editing-validation.spec.js @@ -2,14 +2,10 @@ import { test, expect } from '@playwright/test' test('表格校验', async ({ page }) => { page.on('pageerror', (exception) => expect(exception).toBeNull()) + const demo = page.locator('#validation-editing-validation') await page.goto('grid-validation#validation-editing-validation') await page.getByText('GFD 科技 YX 公司').first().click() - await page - .getByRole('row', { - name: '1 华东区 福州 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。' - }) - .getByRole('textbox') - .fill('') + await demo.locator('.tiny-grid-default-input').fill('') await expect(page.getByRole('tooltip', { name: '名称必填' })).toBeVisible() }) diff --git a/examples/sites/demos/pc/app/grid/validation/row-data-valid.spec.js b/examples/sites/demos/pc/app/grid/validation/row-data-valid.spec.js index 202159d661..f088ea2a70 100644 --- a/examples/sites/demos/pc/app/grid/validation/row-data-valid.spec.js +++ b/examples/sites/demos/pc/app/grid/validation/row-data-valid.spec.js @@ -2,9 +2,10 @@ import { test, expect } from '@playwright/test' test('数据关联校验', async ({ page }) => { page.on('pageerror', (exception) => expect(exception).toBeNull()) + const demo = page.locator('#validation-row-data-valid') await page.goto('grid-validation#validation-row-data-valid') await page.getByText('70').first().click() - await page.getByRole('row', { name: '1 100 0' }).getByRole('textbox').fill('700') + await demo.locator('.tiny-grid-default-input').fill('700') await expect(page.getByRole('tooltip', { name: '数值不能大于 100' })).toBeVisible() }) diff --git a/examples/sites/demos/pc/app/grid/validation/select-validation.spec.js b/examples/sites/demos/pc/app/grid/validation/select-validation.spec.js index db7ec65ccb..4562957c9f 100644 --- a/examples/sites/demos/pc/app/grid/validation/select-validation.spec.js +++ b/examples/sites/demos/pc/app/grid/validation/select-validation.spec.js @@ -2,21 +2,13 @@ import { test, expect } from '@playwright/test' test('选中时校验', async ({ page }) => { page.on('pageerror', (exception) => expect(exception).toBeNull()) + + const demo = page.locator('#validation-select-validation') await page.goto('grid-validation#validation-select-validation') await page.getByText('GFD 科技 YX 公司').first().click() - await page - .getByRole('row', { - name: '1 华东区 福州 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。' - }) - .getByRole('textbox') - .clear() + await demo.locator('.tiny-grid-default-input').fill('') await page.waitForTimeout(200) - await page - .getByRole('row', { - name: '1 华东区 福州 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。' - }) - .locator('span') - .click() + await demo.locator('.tiny-grid-body__row .tiny-grid-checkbox__icon').first().click() await page.getByRole('button', { name: '校验选中数据' }).click() await expect(page.getByText('校验不通过', { exact: true })).toBeVisible() diff --git a/examples/sites/demos/pc/app/grid/validation/tipconfig.spec.js b/examples/sites/demos/pc/app/grid/validation/tipconfig.spec.js index 30789e1485..8e0cdf6d52 100644 --- a/examples/sites/demos/pc/app/grid/validation/tipconfig.spec.js +++ b/examples/sites/demos/pc/app/grid/validation/tipconfig.spec.js @@ -2,20 +2,10 @@ import { test, expect } from '@playwright/test' test('错误提示配置项', async ({ page }) => { page.on('pageerror', (exception) => expect(exception).toBeNull()) + const demo = page.locator('#validation-tipconfig') await page.goto('grid-validation#validation-tipconfig') await page.getByText('GFD 科技 YX 公司').click() - await page - .getByRole('row', { - name: '1 华东区 福州 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。' - }) - .getByRole('textbox') - .click() - await page - .getByRole('row', { - name: '1 华东区 福州 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。' - }) - .getByRole('textbox') - .fill('') + await demo.locator('.tiny-grid-default-input').fill('') await expect(page.getByRole('tooltip', { name: '名称必填' })).toBeVisible() }) diff --git a/examples/sites/demos/pc/app/grid/validation/validation-scroll-to-col.spec.js b/examples/sites/demos/pc/app/grid/validation/validation-scroll-to-col.spec.js index 4a90ade787..df79e4da83 100644 --- a/examples/sites/demos/pc/app/grid/validation/validation-scroll-to-col.spec.js +++ b/examples/sites/demos/pc/app/grid/validation/validation-scroll-to-col.spec.js @@ -6,12 +6,7 @@ test('触发校验时自动定位到当前校验的单元格', async ({ page }) const demo = page.locator('#validation-validation-scroll-to-col') await page.getByText('GFD 科技 YX 公司').first().click() - await page - .getByRole('row', { - name: '1 华东区 福州 公司技术和研发实力雄厚,是国家 863 项目的参与者,并被政府认定为“高新技术企业”。' - }) - .getByRole('textbox') - .fill('') + await demo.locator('.tiny-input__inner').fill('') await demo.getByText('名称').click() const lastColumn = demo.getByText('公司简介') await lastColumn.scrollIntoViewIfNeeded() diff --git a/examples/sites/demos/pc/app/time-picker/format.spec.ts b/examples/sites/demos/pc/app/time-picker/format.spec.ts index 0a4c4c9bde..3b20e811f3 100644 --- a/examples/sites/demos/pc/app/time-picker/format.spec.ts +++ b/examples/sites/demos/pc/app/time-picker/format.spec.ts @@ -12,21 +12,21 @@ test('时间格式化', async ({ page }) => { await page.getByRole('textbox', { name: '19:40:00 pm' }).click() await page.waitForTimeout(100) - await page.getByRole('listitem').filter({ hasText: '08 pm' }).first().locator('span').click() + await page.locator('.tiny-time-panel[visible=true]').getByText('08 pm').click() await page.getByRole('button', { name: '确定' }).click() await page.waitForTimeout(100) await expect(page.getByRole('textbox', { name: '20:40:00 pm' })).toBeVisible() await page.getByRole('textbox', { name: '8:40:0 PM' }).click() await page.waitForTimeout(100) - await page.getByRole('listitem').filter({ hasText: '09 PM' }).locator('span').click() + await page.locator('.tiny-time-panel[visible=true]').getByText('09 PM').click() await page.getByRole('button', { name: '确定' }).click() await page.waitForTimeout(100) await expect(page.getByRole('textbox', { name: '9:40:0 PM' })).toBeVisible() await page.getByRole('textbox', { name: '21:40:0 PM' }).click() await page.waitForTimeout(100) - await page.getByRole('listitem').filter({ hasText: '10 PM' }).locator('span').click() + await page.locator('.tiny-time-panel[visible=true]').getByText('10 PM').click() await page.getByRole('button', { name: '确定' }).click() await page.waitForTimeout(100) await expect(page.getByRole('textbox', { name: '22:40:0 PM' })).toBeVisible() @@ -34,14 +34,14 @@ test('时间格式化', async ({ page }) => { // value-format: 选中值的格式 await page.getByRole('textbox', { name: '18:30:00' }).click() await page.waitForTimeout(100) - await page.getByRole('listitem').filter({ hasText: '19' }).first().click() + await page.locator('.tiny-time-panel[visible=true]').getByText('19').first().click() await page.getByRole('button', { name: '确定' }).click() await page.waitForTimeout(100) await expect(page.getByRole('textbox', { name: '19:30:00' })).toBeVisible() // picker-options.format: 下拉框中显示的格式 - const timePickerHour = page.getByRole('listitem').filter({ hasText: '18' }).first() - const timePickerMinute = page.getByRole('listitem').filter({ hasText: '40' }).first() + const timePickerHour = page.locator('.tiny-time-panel[visible=true]').getByText('18').first() + const timePickerMinute = page.locator('.tiny-time-panel[visible=true]').getByText('40').first() const timePickerSecond = page.locator('.of-hidden > div:nth-child(12) .tiny-scrollbar').nth(2) await page.getByRole('textbox', { name: '18:40:00' }).click() await page.waitForTimeout(200) diff --git a/examples/sites/package.json b/examples/sites/package.json index 66e43b493d..f23ac78cb2 100644 --- a/examples/sites/package.json +++ b/examples/sites/package.json @@ -22,6 +22,9 @@ "pub": "pnpm publish --no-git-checks --access=public" }, "dependencies": { + "@docsearch/css": "^3.8.0", + "@docsearch/js": "^3.8.0", + "@docsearch/react": "npm:@docsearch/css", "@opentiny/vue": "workspace:~", "@opentiny/vue-common": "workspace:~", "@opentiny/vue-design-aurora": "workspace:~", @@ -48,16 +51,12 @@ "tailwindcss": "^3.2.4", "vue": "^3.4.31", "vue-i18n": "^9.1.10", - "vue-router": "4.1.5", - "@docsearch/js": "^3.8.0", - "@docsearch/css": "^3.8.0", - "@docsearch/react": "npm:@docsearch/css" + "vue-router": "4.1.5" }, "devDependencies": { "@opentiny-internal/unplugin-virtual-template": "workspace:~", "@opentiny/vue-mobile": "workspace:~", - "@playwright/test": "~1.42.0", - "rollup-plugin-visualizer": "^5.12.0", + "@playwright/test": "catalog:", "@types/markdown-it": "^12.2.3", "@types/node": "^17.0.45", "@unocss/preset-icons": "^0.38.2", @@ -78,6 +77,7 @@ "markdown-it-table-of-contents": "^0.6.0", "markdown-it-toc-done-right": "^4.2.0", "prettier": "^2.7.1", + "rollup-plugin-visualizer": "^5.12.0", "stylelint": "^14.9.1", "stylelint-config-standard": "^26.0.0", "typescript": "catalog:", diff --git a/examples/vue2.7/package.json b/examples/vue2.7/package.json index 731175ada3..02785c9d7c 100644 --- a/examples/vue2.7/package.json +++ b/examples/vue2.7/package.json @@ -1,8 +1,8 @@ { "name": "vue2.7-example", "type": "module", - "private": true, "version": "0.1.6-mf.0", + "private": true, "files": [ "*" ], @@ -24,20 +24,26 @@ "@opentiny/vue-locale": "workspace:~", "@opentiny/vue-renderless": "workspace:~", "@opentiny/vue-theme": "workspace:~", - "@opentiny/vue-theme-saas": "workspace:~", "@opentiny/vue-theme-mobile": "workspace:~", + "@opentiny/vue-theme-saas": "workspace:~", "@opentiny/vue-vite-import": "workspace:~", - "@playwright/test": "~1.42.0", + "@playwright/test": "catalog:", + "@unocss/core": "^0.48.0", + "@unocss/preset-icons": "^0.61.9", + "@unocss/transformer-directives": "^0.48.0", "@vitejs/plugin-vue2": "^2.2.0", "@vitejs/plugin-vue2-jsx": "^1.1.0", "@vitest/ui": "^0.31.0", "@vue/babel-helper-vue-jsx-merge-props": "^1.4.0", "@vue/test-utils": "^1.3.3", + "js-sha256": "^0.9.0", "jsdom": "^21.0.0", + "onigasm": "^2.2.5", "postcss": "^8.4.16", "tailwindcss": "^3.2.4", "tailwindcss-vite-plugin": "^0.0.3", "typescript": "catalog:", + "unocss": "^0.61.9", "vite": "catalog:", "vite-plugin-checker": "^0.5.2", "vite-plugin-dynamic-import": "^1.2.4", @@ -49,12 +55,6 @@ "vue": "~2.7.10", "vue-i18n": "^8.9.0", "vue-template-compiler": "2.7.10", - "vue-tsc": "^1.0.16", - "js-sha256": "^0.9.0", - "onigasm": "^2.2.5", - "unocss": "^0.61.9", - "@unocss/core": "^0.48.0", - "@unocss/preset-icons": "^0.61.9", - "@unocss/transformer-directives": "^0.48.0" + "vue-tsc": "^1.0.16" } } diff --git a/examples/vue2/package.json b/examples/vue2/package.json index 8270354515..f52a430768 100644 --- a/examples/vue2/package.json +++ b/examples/vue2/package.json @@ -27,7 +27,7 @@ "@opentiny/vue-theme-mobile": "workspace:~", "@opentiny/vue-theme-saas": "workspace:~", "@opentiny/vue-vite-import": "workspace:~", - "@playwright/test": "~1.42.0", + "@playwright/test": "catalog:", "@tiptap/vue-2": "^2.1.0", "@unocss/core": "^0.48.0", "@unocss/preset-icons": "^0.61.9", diff --git a/examples/vue3/package.json b/examples/vue3/package.json index f54960a8b6..e8b1eb3ae4 100644 --- a/examples/vue3/package.json +++ b/examples/vue3/package.json @@ -30,7 +30,7 @@ "@opentiny/vue-theme-mobile": "workspace:~", "@opentiny/vue-theme-saas": "workspace:~", "@opentiny/vue-vite-import": "workspace:~", - "@playwright/test": "~1.42.0", + "@playwright/test": "catalog:", "@tiptap/vue-3": "^2.1.0", "@unocss/core": "^0.48.0", "@unocss/preset-icons": "^0.61.9", diff --git a/internals/playwright-config/package.json b/internals/playwright-config/package.json index 2a99228688..bc62b7a64b 100644 --- a/internals/playwright-config/package.json +++ b/internals/playwright-config/package.json @@ -1,15 +1,15 @@ { "name": "@opentiny-internal/playwright-config", - "private": true, "type": "module", "version": "1.0.1-beta.0", + "private": true, "description": "", - "main": "src/index.js", - "module": "src/index.js", - "keywords": [], "author": "", "license": "ISC", + "keywords": [], + "main": "src/index.js", + "module": "src/index.js", "dependencies": { - "@playwright/test": "~1.42.0" + "@playwright/test": "catalog:" } -} \ No newline at end of file +} diff --git a/package.json b/package.json index 63c59ac2bb..d78acd0d95 100644 --- a/package.json +++ b/package.json @@ -210,7 +210,6 @@ "@vue/runtime-core@3": "3.4.38", "@vue/runtime-dom@3": "3.4.38", "@vue/shared@3": "3.4.38", - "@playwright/test": "1.42.1", "cropperjs": "1.5.12", "echarts": "5.4.1", "follow-redirects": "1.14.8", diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index ab608b729a..810f563e80 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -9,3 +9,4 @@ catalog: 'vitest': '^2.1.8' 'vite': '^6.0.0' 'typescript': '~5.3.3' + '@playwright/test': '~1.49.0'