Skip to content

Commit 8a72dda

Browse files
authored
fix: 修改pop-upload测试用例为es6导入方式 (#3395)
1 parent c048fdc commit 8a72dda

File tree

8 files changed

+40
-11
lines changed

8 files changed

+40
-11
lines changed

examples/sites/demos/pc/app/pop-upload/basic-usage.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
import { test, expect } from '@playwright/test'
2+
import { fileURLToPath } from 'node:url'
3+
import path from 'node:path'
4+
5+
const __filename = fileURLToPath(import.meta.url)
6+
const __dirname = path.dirname(__filename)
27

38
test('PopUpload 基本用法', async ({ page }) => {
49
page.on('pageerror', (exception) => expect(exception).toBeNull())
@@ -13,8 +18,6 @@ test('PopUpload 基本用法', async ({ page }) => {
1318
const cancelBtn = uploadModal.getByRole('button', { name: '取消' })
1419
const lists = uploadModal.locator('.tiny-popupload__dialog-table-item')
1520
const deleteIcon = lists.locator('.del-col')
16-
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
17-
const path = require('node:path')
1821
const path1 = path.resolve(__dirname, '测试.jpg')
1922
const path2 = path.resolve(__dirname, '测试.png')
2023

examples/sites/demos/pc/app/pop-upload/before-upload.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
import { test, expect } from '@playwright/test'
2+
import { fileURLToPath } from 'node:url'
3+
import path from 'node:path'
4+
5+
const __filename = fileURLToPath(import.meta.url)
6+
const __dirname = path.dirname(__filename)
27

38
test('PopUpload 阻止上传文件', async ({ page }) => {
49
page.on('pageerror', (exception) => expect(exception).toBeNull())
@@ -11,7 +16,6 @@ test('PopUpload 阻止上传文件', async ({ page }) => {
1116
const selectFilesBtn = uploadModal.getByRole('button', { name: '选择文件' })
1217
const uploadsBtn = page.getByRole('button', { name: '开始上传' })
1318
const lists = uploadModal.locator('.tiny-popupload__dialog-table-item')
14-
const path = require('node:path')
1519
const currentPath = path.resolve(__dirname, '测试.jpg')
1620

1721
await modalAppearBtn.click()

examples/sites/demos/pc/app/pop-upload/custom-request-headers.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
import { test, expect } from '@playwright/test'
2+
import { fileURLToPath } from 'node:url'
3+
import path from 'node:path'
4+
5+
const __filename = fileURLToPath(import.meta.url)
6+
const __dirname = path.dirname(__filename)
27

38
test('PopUpload 自定义请求头', async ({ page }) => {
49
page.on('pageerror', (exception) => expect(exception).toBeNull())
@@ -9,8 +14,6 @@ test('PopUpload 自定义请求头', async ({ page }) => {
914
const uploadModal = page.locator('.tiny-popupload__modal')
1015
const selectFilesBtn = uploadModal.getByRole('button', { name: '选择文件' })
1116
const uploadsBtn = uploadModal.getByRole('button', { name: '开始上传' })
12-
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
13-
const path = require('node:path')
1417
const currentPath = path.resolve(__dirname, '测试.jpg')
1518

1619
await modalAppearBtn.click()

examples/sites/demos/pc/app/pop-upload/file-limit.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
import { test, expect } from '@playwright/test'
2+
import { fileURLToPath } from 'node:url'
3+
import path from 'node:path'
4+
5+
const __filename = fileURLToPath(import.meta.url)
6+
const __dirname = path.dirname(__filename)
27

38
test('PopUpload 最大上传文件数', async ({ page }) => {
49
page.on('pageerror', (exception) => expect(exception).toBeNull())
@@ -10,7 +15,6 @@ test('PopUpload 最大上传文件数', async ({ page }) => {
1015
const alert = uploadModal.locator('.tiny-alert')
1116
const selectFilesBtn = uploadModal.getByRole('button', { name: '选择批量文件' })
1217
const lists = uploadModal.locator('.tiny-popupload__dialog-table-item')
13-
const path = require('node:path')
1418
const path1 = path.resolve(__dirname, '测试.jpg')
1519
const path2 = path.resolve(__dirname, '测试.png')
1620
const path3 = path.resolve(__dirname, '测试.svg')

examples/sites/demos/pc/app/pop-upload/file-type.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
import { test, expect } from '@playwright/test'
2+
import { fileURLToPath } from 'node:url'
3+
import path from 'node:path'
4+
5+
const __filename = fileURLToPath(import.meta.url)
6+
const __dirname = path.dirname(__filename)
27

38
test('PopUpload 限制上传文件类型和大小', async ({ page }) => {
49
page.on('pageerror', (exception) => expect(exception).toBeNull())
@@ -11,8 +16,6 @@ test('PopUpload 限制上传文件类型和大小', async ({ page }) => {
1116
const selectFilesBtn = uploadModal.getByRole('button', { name: '选择文件' })
1217
const uploadsBtn = uploadModal.getByRole('button', { name: '开始上传' })
1318
const lists = uploadModal.locator('.tiny-popupload__dialog-table-item')
14-
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
15-
const path = require('node:path')
1619
const path1 = path.resolve(__dirname, '测试.jpg')
1720
const path2 = path.resolve(__dirname, '测试.png')
1821
const path3 = path.resolve(__dirname, '测试.svg')

examples/sites/demos/pc/app/pop-upload/http-request.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
import { test, expect } from '@playwright/test'
2+
import { fileURLToPath } from 'node:url'
3+
import path from 'node:path'
4+
5+
const __filename = fileURLToPath(import.meta.url)
6+
const __dirname = path.dirname(__filename)
27

38
test('PopUpload 覆盖默认请求', async ({ page }) => {
49
page.on('pageerror', (exception) => expect(exception).toBeNull())
@@ -10,7 +15,6 @@ test('PopUpload 覆盖默认请求', async ({ page }) => {
1015
const selectFilesBtn = uploadModal.getByRole('button', { name: '选择文件' })
1116
const uploadsBtn = uploadModal.getByRole('button', { name: '开始上传' })
1217
const lists = uploadModal.locator('.tiny-popupload__dialog-table-item')
13-
const path = require('node:path')
1418
const currentPath = path.resolve(__dirname, '测试.jpg')
1519

1620
await modalAppearBtn.click()

examples/sites/demos/pc/app/pop-upload/prevent-delete-file.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
import { test, expect } from '@playwright/test'
2+
import { fileURLToPath } from 'node:url'
3+
import path from 'node:path'
4+
5+
const __filename = fileURLToPath(import.meta.url)
6+
const __dirname = path.dirname(__filename)
27

38
test('PopUpload 阻止删除文件', async ({ page }) => {
49
page.on('pageerror', (exception) => expect(exception).toBeNull())
@@ -11,7 +16,6 @@ test('PopUpload 阻止删除文件', async ({ page }) => {
1116
const selectFilesBtn = uploadModal.getByRole('button', { name: '选择文件' })
1217
const lists = uploadModal.locator('.tiny-popupload__dialog-table-item')
1318
const deleteIcon = lists.locator('.del-col')
14-
const path = require('node:path')
1519
const currentPath = path.resolve(__dirname, '测试.jpg')
1620

1721
await modalAppearBtn.click()

examples/sites/demos/pc/app/pop-upload/upload-events.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
import { test, expect } from '@playwright/test'
2+
import { fileURLToPath } from 'node:url'
3+
import path from 'node:path'
4+
5+
const __filename = fileURLToPath(import.meta.url)
6+
const __dirname = path.dirname(__filename)
27

38
test('事件是否正常触发', async ({ page }) => {
49
page.on('pageerror', (exception) => expect(exception).toBeNull())
@@ -11,7 +16,6 @@ test('事件是否正常触发', async ({ page }) => {
1116
const uploadsBtn = page.getByRole('button', { name: '开始上传' })
1217
const lists = uploadModal.locator('.tiny-popupload__dialog-table-item')
1318
const deleteIcon = lists.locator('.del-col')
14-
const path = require('node:path')
1519
const currentPath1 = path.resolve(__dirname, '测试.jpg')
1620
const currentPath2 = path.resolve(__dirname, '测试.png')
1721
const currentPath3 = path.resolve(__dirname, '测试.svg')

0 commit comments

Comments
 (0)