Skip to content
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion e2e/authorize.mock.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect } from '@playwright/test'
import { test, expect } from './fixtures'
import { UI_TEXT } from './helpers/i18n'

/**
Expand Down
2 changes: 1 addition & 1 deletion e2e/contact-scanner.mock.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2. 分享联系人名片
*/

import { test, expect, type Page } from '@playwright/test'
import { test, expect, type Page } from './fixtures'

const DEFAULT_PATTERN = [0, 1, 2, 5]

Expand Down
2 changes: 1 addition & 1 deletion e2e/ecosystem-miniapp.mock.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect, type Page } from '@playwright/test'
import { test, expect, type Page } from './fixtures'

/**
* Bio 小程序生态 E2E 截图测试
Expand Down
12 changes: 11 additions & 1 deletion e2e/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@
* 提供统一的测试 fixtures,包括:
* - 控制台错误检测:测试结束时如果有未处理的控制台错误则失败
* - 页面错误检测:捕获未处理的 JavaScript 错误
*
* 使用方式:在测试文件中替换导入
* ```typescript
* // 替换原有导入
* // import { test, expect } from '@playwright/test'
* import { test, expect } from './fixtures'
* ```
*/

import { test as base, expect } from '@playwright/test'
import { test as base, expect, type Page } from '@playwright/test'

/** 允许的控制台错误模式(这些不会导致测试失败) */
const ALLOWED_ERROR_PATTERNS = [
Expand Down Expand Up @@ -36,6 +43,8 @@ export interface ConsoleMessage {

/**
* 扩展的 test fixture,包含控制台错误检测
*
* consoleErrors 和 pageErrors 会自动收集错误,测试结束时断言
*/
export const test = base.extend<{
/** 收集的控制台错误 */
Expand Down Expand Up @@ -101,3 +110,4 @@ export const test = base.extend<{
})

export { expect }
export type { Page }
2 changes: 1 addition & 1 deletion e2e/miniapp-ui.mock.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect, type Page } from '@playwright/test'
import { test, expect, type Page } from './fixtures'

/**
* 小程序 UI 截图测试
Expand Down
2 changes: 1 addition & 1 deletion e2e/pages.mock.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect, type Page } from '@playwright/test'
import { test, expect, type Page } from './fixtures'

/**
* 页面截图 E2E 测试
Expand Down
2 changes: 1 addition & 1 deletion e2e/send-transaction.mock.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect, type Page } from '@playwright/test'
import { test, expect, type Page } from './fixtures'
import { UI_TEXT } from './helpers/i18n'

/**
Expand Down
2 changes: 1 addition & 1 deletion e2e/services.mock.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect } from '@playwright/test';
import { test, expect } from './fixtures';
import { UI_TEXT } from './helpers/i18n';

/**
Expand Down
2 changes: 1 addition & 1 deletion e2e/staking.mock.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect } from '@playwright/test'
import { test, expect } from './fixtures'

/**
* Staking 页面 E2E 测试
Expand Down
2 changes: 1 addition & 1 deletion e2e/token-context-menu.mock.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect, type Page } from '@playwright/test'
import { test, expect, type Page } from './fixtures'
import { UI_TEXT } from './helpers/i18n'

/**
Expand Down
2 changes: 1 addition & 1 deletion e2e/token-menu-transfer-flow.mock.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect, type Page } from '@playwright/test'
import { test, expect, type Page } from './fixtures'

/**
* Token Menu Transfer Flow - Complete E2E Test with Screenshots
Expand Down
2 changes: 1 addition & 1 deletion e2e/transaction-history.mock.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect, type Page } from '@playwright/test'
import { test, expect, type Page } from './fixtures'
import { UI_TEXT } from './helpers/i18n'

/**
Expand Down
2 changes: 1 addition & 1 deletion e2e/transaction-history.real-fixtures.mock.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect, type Page } from '@playwright/test'
import { test, expect, type Page } from './fixtures'
import fs from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
Expand Down