Skip to content

Commit acde9ca

Browse files
committed
test(e2e): update bioforest prefix assertions to b
Bioforest default bnid prefix is now 'b' (prod); update E2E fixtures/assertions accordingly. Keep manual chain-config case expecting prefix 'c' for custom demo chain.
1 parent f474f03 commit acde9ca

3 files changed

Lines changed: 19 additions & 20 deletions

File tree

‎e2e/bioforest-chains.spec.ts‎

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { test, expect } from '@playwright/test'
44
* BioForest 链 E2E 测试
55
*
66
* 测试 BioForest 链(BFMeta, PMChain, CCChain)的特定功能
7-
* - 地址格式验证 ('c' 前缀)
7+
* - 地址格式验证(生产默认 'b' 前缀)
88
* - 链切换
99
* - 地址复制
1010
*/
@@ -21,9 +21,9 @@ const TEST_WALLET_WITH_BIOFOREST = {
2121
{ chain: 'ethereum', address: '0x71C7656EC7ab88b098defB751B7401B5f6d8976F', tokens: [] },
2222
{ chain: 'bitcoin', address: '1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa', tokens: [] },
2323
{ chain: 'tron', address: 'TJCnKsPa7y5okkXvQAidZBzqx3QyQ6sxMW', tokens: [] },
24-
{ chain: 'bfmeta', address: 'cKe7R6wVdPvHqvRxe5Q9ZvWr7CpPn5Mk5', tokens: [] },
25-
{ chain: 'pmchain', address: 'cKe7R6wVdPvHqvRxe5Q9ZvWr7CpPn5Mk5', tokens: [] },
26-
{ chain: 'ccchain', address: 'cKe7R6wVdPvHqvRxe5Q9ZvWr7CpPn5Mk5', tokens: [] },
24+
{ chain: 'bfmeta', address: 'b7ADmvZJJ3n3aDxkvwbXxJX1oGgeiCzL11', tokens: [] },
25+
{ chain: 'pmchain', address: 'b7ADmvZJJ3n3aDxkvwbXxJX1oGgeiCzL11', tokens: [] },
26+
{ chain: 'ccchain', address: 'b7ADmvZJJ3n3aDxkvwbXxJX1oGgeiCzL11', tokens: [] },
2727
],
2828
encryptedMnemonic: { ciphertext: 'test', iv: 'test', salt: 'test' },
2929
createdAt: Date.now(),
@@ -63,9 +63,9 @@ test.describe('BioForest 链功能', () => {
6363
// 验证链选择器显示 BFMeta
6464
await expect(page.locator('[data-testid="chain-selector"]')).toContainText('BFMeta')
6565

66-
// 验证地址以 'c' 开头
66+
// 验证地址以 'b' 开头(生产默认 bnid)
6767
const addressText = await page.locator('.font-mono').first().textContent()
68-
expect(addressText?.startsWith('c')).toBe(true)
68+
expect(addressText?.startsWith('b')).toBe(true)
6969
})
7070

7171
test('切换到 PMChain 链显示正确地址', async ({ page }) => {
@@ -79,7 +79,7 @@ test.describe('BioForest 链功能', () => {
7979
await expect(page.locator('[data-testid="chain-selector"]')).toContainText('PMChain')
8080

8181
const addressText = await page.locator('.font-mono').first().textContent()
82-
expect(addressText?.startsWith('c')).toBe(true)
82+
expect(addressText?.startsWith('b')).toBe(true)
8383
})
8484

8585
test('切换到 CCChain 链显示正确地址', async ({ page }) => {
@@ -93,7 +93,7 @@ test.describe('BioForest 链功能', () => {
9393
await expect(page.locator('[data-testid="chain-selector"]')).toContainText('CCChain')
9494

9595
const addressText = await page.locator('.font-mono').first().textContent()
96-
expect(addressText?.startsWith('c')).toBe(true)
96+
expect(addressText?.startsWith('b')).toBe(true)
9797
})
9898

9999
test('BioForest 地址复制功能', async ({ page }) => {
@@ -114,10 +114,10 @@ test.describe('BioForest 链功能', () => {
114114
await page.click('button[aria-label="复制地址"]')
115115
await page.waitForTimeout(100)
116116

117-
// 验证剪贴板内容以 'c' 开头
117+
// 验证剪贴板内容以 'b' 开头(生产默认 bnid)
118118
const clipboardContent = await page.evaluate(() => window.__CLIPBOARD__)
119119
expect(typeof clipboardContent).toBe('string')
120-
expect(clipboardContent.startsWith('c')).toBe(true)
120+
expect(clipboardContent.startsWith('b')).toBe(true)
121121
})
122122

123123
test('链切换后发送页面显示正确链信息', async ({ page }) => {
@@ -150,10 +150,8 @@ test.describe('BioForest 链功能', () => {
150150
await page.click('text=收款')
151151
await page.waitForURL('**/receive')
152152

153-
// 验证显示的地址以 'c' 开头
154-
const addressElement = page.locator('.font-mono').first()
155-
const addressText = await addressElement.textContent()
156-
expect(addressText?.includes('c')).toBe(true)
153+
// 验证显示的地址以 'b' 开头(生产默认 bnid)
154+
await expect(page.getByRole('button', { name: /^复制\s*b[1-9A-HJ-NP-Za-km-z]+$/ })).toBeVisible()
157155
})
158156

159157
test('所有 BioForest 链共用相同地址', async ({ page }) => {
@@ -232,8 +230,8 @@ test.describe('BioForest 链地址派生', () => {
232230
for (const chain of bioforestChains) {
233231
const chainAddr = wallet.chainAddresses.find((ca: { chain: string }) => ca.chain === chain)
234232
expect(chainAddr, `应该有 ${chain} 地址`).toBeDefined()
235-
// BioForest 地址以 'c' 开头
236-
expect(chainAddr.address.startsWith('c')).toBe(true)
233+
// BioForest 地址以 'b' 开头(生产默认 bnid)
234+
expect(chainAddr.address.startsWith('b')).toBe(true)
237235
// 地址长度合理
238236
expect(chainAddr.address.length).toBeGreaterThan(20)
239237
expect(chainAddr.address.length).toBeLessThan(50)

‎e2e/wallet-create.spec.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,9 @@ test.describe('钱包创建流程 - 功能测试', () => {
242242
for (const chain of bioforestChains) {
243243
const chainAddr = wallet.chainAddresses.find((ca: { chain: string }) => ca.chain === chain)
244244
expect(chainAddr, `应该有 ${chain} 地址`).toBeDefined()
245-
// BioForest 地址以 'c' 开头
246-
expect(chainAddr.address.startsWith('c')).toBe(true)
245+
const expectedPrefix = chain === 'bf-demo' ? 'c' : 'b'
246+
// BioForest 地址以 chain-config 的 prefix 开头(默认生产链是 'b',手动添加可用 'c')
247+
expect(chainAddr.address.startsWith(expectedPrefix)).toBe(true)
247248
}
248249
})
249250

‎e2e/wallet-import.spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ test.describe('钱包导入流程 - 功能测试', () => {
151151
for (const chain of bioforestChains) {
152152
const chainAddr = wallet.chainAddresses.find((ca: { chain: string }) => ca.chain === chain)
153153
expect(chainAddr, `应该有 ${chain} 地址`).toBeDefined()
154-
// BioForest 地址以 'c' 开头
155-
expect(chainAddr.address.startsWith('c')).toBe(true)
154+
// BioForest 地址以 'b' 开头(生产默认 bnid)
155+
expect(chainAddr.address.startsWith('b')).toBe(true)
156156
}
157157
})
158158

0 commit comments

Comments
 (0)