Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
48 changes: 48 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions e2e/send-transaction.mock.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,50 @@ async function getSendPageInputs(page: Page) {
return { addressInput, amountInput }
}

test.describe('发送交易 - assetType URL 参数测试', () => {
test('assetType 参数在 tokens 加载后正确生效', async ({ page }) => {
// 使用带有多个 token 的钱包数据
const walletWithMultipleTokens = {
...TEST_WALLET_DATA,
wallets: [{
...TEST_WALLET_DATA.wallets[0],
chainAddresses: [{
chain: 'ethereum',
address: '0x71C7656EC7ab88b098defB751B7401B5f6d8976F',
tokens: [
{ symbol: 'ETH', balance: '1.5', decimals: 18 },
{ symbol: 'USDT', balance: '1000', decimals: 6, contractAddress: '0xdAC17F958D2ee523a2206206994597C13D831ec7' },
{ symbol: 'CPCC', balance: '500', decimals: 8, contractAddress: '0x1234567890abcdef' },
],
}],
}],
}

await page.addInitScript((data) => {
localStorage.setItem('bfm_wallets', JSON.stringify(data.wallet))
localStorage.setItem('bfm_preferences', JSON.stringify({ language: 'zh-CN', currency: 'USD' }))
}, { wallet: walletWithMultipleTokens })

// 导航到带 assetType 参数的发送页面
await page.goto('/#/send?assetType=CPCC')
await page.waitForLoadState('networkidle')
await waitForAppReady(page)

// 等待 tokens 加载并验证选中的资产是 CPCC
const assetSelector = page.locator('[data-testid="send-asset-selector"]')
await expect(assetSelector).toContainText('CPCC', { timeout: 10000 })
})

test('assetType 参数指定不存在的资产时 fallback 到原生资产', async ({ page }) => {
await setupTestWallet(page, '/send?assetType=NONEXISTENT')
await waitForAppReady(page)

// 应该 fallback 到原生资产 ETH
const assetSelector = page.locator('[data-testid="send-asset-selector"]')
await expect(assetSelector).toContainText('ETH', { timeout: 10000 })
})
})

test.describe('发送交易 - 金额输入测试', () => {
test('输入有效金额', async ({ page }) => {
await setupTestWallet(page, '/send')
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 22 additions & 10 deletions miniapps/forge/e2e/helpers/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
/**
* Forge E2E 测试国际化辅助
* BioBridge E2E 测试国际化辅助
*/

import type { Page, Locator } from '@playwright/test'

export const UI_TEXT = {
app: {
title: { source: '锻造', pattern: /锻造|Forge/i },
subtitle: { source: '多链熔炉', pattern: /多链熔炉|Multi-chain Forge/i },
title: { source: '跨链通', pattern: /跨链通|BioBridge/i },
subtitle: { source: '跨链桥接', pattern: /跨链桥接|Cross-chain Bridge/i },
},
mode: {
recharge: { source: '充值', pattern: /充值|Recharge/i },
redemption: { source: '赎回', pattern: /赎回|Redemption/i },
},
connect: {
button: { source: '连接钱包', pattern: /连接钱包|Connect Wallet/i },
Expand All @@ -21,24 +25,32 @@ export const UI_TEXT = {
preview: { source: '预览交易', pattern: /预览交易|Preview/i },
},
confirm: {
title: { source: '确认锻造', pattern: /确认锻造|Confirm Forge/i },
button: { source: '确认锻造', pattern: /确认锻造|Confirm/i },
title: { source: '确认充值', pattern: /确认充值|Confirm Recharge/i },
button: { source: '确认充值', pattern: /确认充值|Confirm/i },
},
success: {
title: { source: '锻造完成', pattern: /锻造完成|Forge Complete/i },
continue: { source: '继续锻造', pattern: /继续锻造|Continue/i },
title: { source: '完成', pattern: /完成|Complete/i },
continue: { source: '继续', pattern: /继续|Continue/i },
},
token: {
select: { source: '选择锻造币种', pattern: /选择锻造币种|Select Token/i },
select: { source: '选择币种', pattern: /选择币种|Select Token/i },
selected: { source: '已选', pattern: /已选|Selected/i },
},
processing: {
signingExternal: { source: '签名外链交易', pattern: /签名外链交易|Signing External/i },
signingInternal: { source: '签名内链消息', pattern: /签名内链消息|Signing Internal/i },
submitting: { source: '提交锻造请求', pattern: /提交锻造请求|Submitting/i },
submitting: { source: '提交请求', pattern: /提交请求|Submitting/i },
},
error: {
sdkNotInit: { source: 'Bio SDK 未初始化', pattern: /Bio SDK 未初始化|SDK not initialized/i },
sdkNotInit: { source: 'Bio SDK not initialized', pattern: /Bio SDK not initialized|Bio SDK 未初始化/i },
},
redemption: {
title: { source: '赎回', pattern: /赎回|Redemption/i },
from: { source: '从', pattern: /从|From/i },
to: { source: '到', pattern: /到|To/i },
fee: { source: '手续费', pattern: /手续费|Fee/i },
preview: { source: '预览赎回', pattern: /预览赎回|Preview Redemption/i },
confirm: { source: '确认赎回', pattern: /确认赎回|Confirm Redemption/i },
},
} as const

Expand Down
Loading