From c4d758ad6e9c5b4bcc04e35efcce1aac60ca17bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=BF=94?= Date: Thu, 5 Mar 2026 14:32:46 +0800 Subject: [PATCH] feat: add network configuration for mobile testing --- e2e/src/config/network-configs.ts | 50 +++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 e2e/src/config/network-configs.ts diff --git a/e2e/src/config/network-configs.ts b/e2e/src/config/network-configs.ts new file mode 100644 index 0000000..971a965 --- /dev/null +++ b/e2e/src/config/network-configs.ts @@ -0,0 +1,50 @@ +export interface NetworkConfig { + name: string; + offline: boolean; + downloadThroughput?: number; + uploadThroughput?: number; + latency?: number; +} + +export const networkConfigs: Record = { + '2g-slow': { + name: '2G Slow', + offline: false, + downloadThroughput: 250 * 1024, + uploadThroughput: 50 * 1024, + latency: 2000, + }, + '3g-fast': { + name: '3G Fast', + offline: false, + downloadThroughput: 1.6 * 1024 * 1024, + uploadThroughput: 750 * 1024, + latency: 100, + }, + '4g-lte': { + name: '4G LTE', + offline: false, + downloadThroughput: 4 * 1024 * 1024, + uploadThroughput: 3 * 1024 * 1024, + latency: 20, + }, + 'wifi-fast': { + name: 'WiFi Fast', + offline: false, + downloadThroughput: 30 * 1024 * 1024, + uploadThroughput: 15 * 1024 * 1024, + latency: 2, + }, + 'offline': { + name: 'Offline', + offline: true, + }, +}; + +export function getNetworkConfig(key: string): NetworkConfig { + return networkConfigs[key] || networkConfigs['wifi-fast']; +} + +export function getAllNetworkConfigs(): NetworkConfig[] { + return Object.values(networkConfigs); +} \ No newline at end of file