Skip to content

fix(pop-upload): Change the pop-upload e2e test case to ES6 import mode #3395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions examples/sites/demos/pc/app/pop-upload/basic-usage.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { test, expect } from '@playwright/test'
import { fileURLToPath } from 'node:url'
import path from 'node:path'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

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

Expand Down
6 changes: 5 additions & 1 deletion examples/sites/demos/pc/app/pop-upload/before-upload.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { test, expect } from '@playwright/test'
import { fileURLToPath } from 'node:url'
import path from 'node:path'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

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

await modalAppearBtn.click()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { test, expect } from '@playwright/test'
import { fileURLToPath } from 'node:url'
import path from 'node:path'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

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

await modalAppearBtn.click()
Expand Down
6 changes: 5 additions & 1 deletion examples/sites/demos/pc/app/pop-upload/file-limit.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { test, expect } from '@playwright/test'
import { fileURLToPath } from 'node:url'
import path from 'node:path'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

test('PopUpload 最大上传文件数', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
Expand All @@ -10,7 +15,6 @@ test('PopUpload 最大上传文件数', async ({ page }) => {
const alert = uploadModal.locator('.tiny-alert')
const selectFilesBtn = uploadModal.getByRole('button', { name: '选择批量文件' })
const lists = uploadModal.locator('.tiny-popupload__dialog-table-item')
const path = require('node:path')
const path1 = path.resolve(__dirname, '测试.jpg')
const path2 = path.resolve(__dirname, '测试.png')
const path3 = path.resolve(__dirname, '测试.svg')
Expand Down
7 changes: 5 additions & 2 deletions examples/sites/demos/pc/app/pop-upload/file-type.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { test, expect } from '@playwright/test'
import { fileURLToPath } from 'node:url'
import path from 'node:path'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

test('PopUpload 限制上传文件类型和大小', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
Expand All @@ -11,8 +16,6 @@ test('PopUpload 限制上传文件类型和大小', async ({ page }) => {
const selectFilesBtn = uploadModal.getByRole('button', { name: '选择文件' })
const uploadsBtn = uploadModal.getByRole('button', { name: '开始上传' })
const lists = uploadModal.locator('.tiny-popupload__dialog-table-item')
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
const path = require('node:path')
const path1 = path.resolve(__dirname, '测试.jpg')
const path2 = path.resolve(__dirname, '测试.png')
const path3 = path.resolve(__dirname, '测试.svg')
Expand Down
6 changes: 5 additions & 1 deletion examples/sites/demos/pc/app/pop-upload/http-request.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { test, expect } from '@playwright/test'
import { fileURLToPath } from 'node:url'
import path from 'node:path'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

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

await modalAppearBtn.click()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { test, expect } from '@playwright/test'
import { fileURLToPath } from 'node:url'
import path from 'node:path'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

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

await modalAppearBtn.click()
Expand Down
6 changes: 5 additions & 1 deletion examples/sites/demos/pc/app/pop-upload/upload-events.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { test, expect } from '@playwright/test'
import { fileURLToPath } from 'node:url'
import path from 'node:path'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

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