Skip to content
This repository was archived by the owner on Mar 2, 2026. It is now read-only.
Open
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
19 changes: 10 additions & 9 deletions _raw/manifest/manifest.dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,19 @@
"background": {
"service_worker": "background.js"
},
"content_scripts": [
{
"js": ["content-script.js", "script.js"],
"matches": ["file://*/*", "http://*/*", "https://*/*"],
"all_frames": true
}
],
"content_security_policy": {
"extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self' 'wasm-unsafe-eval';"
},
"permissions": ["storage", "activeTab", "tabs", "notifications", "identity", "camera"],
"host_permissions": ["https://api.mixpanel.com/*"],
"permissions": [
"storage",
"activeTab",
"tabs",
"notifications",
"identity",
"camera",
"scripting"
],
"host_permissions": ["<all_urls>"],
Comment thread
tombeckenham marked this conversation as resolved.
"web_accessible_resources": [
{
"resources": [
Expand Down
20 changes: 11 additions & 9 deletions _raw/manifest/manifest.pro.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,20 @@
"background": {
"service_worker": "sw.js"
},
"content_scripts": [
{
"js": ["content-script.js", "script.js"],
"matches": ["file://*/*", "http://*/*", "https://*/*"],
"all_frames": true
}
],
"content_security_policy": {
"extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self' 'wasm-unsafe-eval';"
},
"permissions": ["storage", "activeTab", "tabs", "notifications", "identity", "camera", "*://*/*"],
"host_permissions": ["https://api.mixpanel.com/*"],
"permissions": [
"storage",
"activeTab",
"tabs",
"notifications",
"identity",
"camera",
"scripting",
"*://*/*"
],
"host_permissions": ["<all_urls>"],
"web_accessible_resources": [
{
"resources": [
Expand Down
1 change: 0 additions & 1 deletion build/prepareManifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ async function prepare() {
manifest.description = '__MSG_appDescriptionBeta__';
manifest.key = process.env.BETA_MANIFEST_KEY;
manifest.oauth2.client_id = process.env.BETA_OAUTH2_CLIENT_ID;

} else {
manifest.version = version;
manifest.name = '__MSG_appName__';
Expand Down
1 change: 1 addition & 0 deletions build/webpack.common.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const config = (env: { config: 'dev' | 'pro' | 'none' }): webpack.Configuration
entry: {
background: paths.rootResolve('src/background/index.ts'),
'content-script': paths.rootResolve('src/content-script/index.ts'),
'message-bridge': paths.rootResolve('src/content-script/message-bridge.ts'),
pageProvider: paths.rootResolve('src/content-script/pageProvider/eth/index.ts'),
// pageProvider: paths.rootResolve(
// 'node_modules/@rabby-wallet/page-provider/dist/index.js'
Expand Down
45 changes: 45 additions & 0 deletions e2e/d-app/eip6963-d-app.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { spawn } from 'child_process';
import path from 'path';

import { importAccountBySeedPhrase, importSenderAccount } from '../utils/helper';
import { test, expect } from '../utils/loader';

let serverProcess: ReturnType<typeof spawn>;

test.beforeAll(async ({ page, extensionId }) => {
// Load the extension first
await page.goto(`chrome-extension://${extensionId}/index.html#/dashboard`);
await page.waitForLoadState('domcontentloaded');
await page.waitForURL(/.*unlock|.*welcome/);

await importSenderAccount({ page, extensionId });

// Start the static server
serverProcess = spawn('npx', ['serve', '.', '-l', '3000'], {
cwd: import.meta.dirname,
stdio: 'inherit',
shell: true,
});

// Wait a bit for the server to start (or poll the port)
await new Promise((resolve) => setTimeout(resolve, 3000));
Comment on lines +24 to +25

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a fixed delay (setTimeout) to wait for server startup is unreliable and could lead to flaky tests. Consider implementing a proper server readiness check by polling the server endpoint until it responds, with a reasonable timeout:

async function waitForServer(port: number, timeout = 10000) {
  const start = Date.now();
  while (Date.now() - start < timeout) {
    try {
      await fetch(`http://localhost:${port}`);
      return true;
    } catch {
      await new Promise(resolve => setTimeout(resolve, 100));
    }
  }
  throw new Error('Server failed to start');
}


await page.goto('http://localhost:3000/test-eip6963.html');
});

test.afterAll(async () => {
if (serverProcess) {
serverProcess.kill();
}
});

/// Work in progress
test.describe.skip('Wallet Discovery', () => {
test('should discover wallets', async ({ page, extensionId }) => {
await page.waitForLoadState('domcontentloaded');

await page.goto('http://localhost:3000/test-eip6963.html');
await page.pause();
await expect(page.getByText('com.flowfoundation.wallet')).toBeVisible();
});
});
Loading
Loading