Skip to content

Commit 71d7bdf

Browse files
committed
push
1 parent e6459f4 commit 71d7bdf

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gracefnr/synpress",
3-
"version": "1.0.8",
3+
"version": "1.0.9",
44
"packageManager": "pnpm@9.1.3",
55
"description": "Synpress is e2e testing framework based around Cypress.io & playwright with included MetaMask support. Test your dapps with ease.",
66
"keywords": [

plugins/index.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ module.exports = (on, config) => {
2828

2929
console.log(`✅ 准备使用 Chrome for Testing: ${chromeBinaryPath}`);
3030

31-
// 注意:在 before:browser:launch 中无法直接设置自定义浏览器路径
32-
// 正确的方式是通过命令行参数 --browser 来指定
33-
// 这里我们只能设置环境变量,供其他工具使用
31+
// 尝试通过 launchOptions.args 设置自定义浏览器路径
32+
// 这是 Cypress 支持的方式
33+
arguments_.args.push(`--browser=${chromeBinaryPath}`);
34+
35+
// 同时设置环境变量作为备用方案
3436
process.env.CHROME_BIN = chromeBinaryPath;
3537
process.env.CHROME_FOR_TESTING_PATH = chromeBinaryPath;
3638

37-
console.log(`⚠️ 注意:在 before:browser:launch 中无法直接设置自定义浏览器路径`);
38-
console.log(`💡 建议:使用命令行参数 --browser "${chromeBinaryPath}" 来指定 Chrome for Testing`);
39+
console.log(`🔧 已通过 launchOptions.args 设置浏览器路径: ${chromeBinaryPath}`);
3940
console.log(`🔧 已设置环境变量 CHROME_BIN: ${chromeBinaryPath}`);
4041

4142
console.log(`🔍 Browser 对象信息:`, {
@@ -47,7 +48,8 @@ module.exports = (on, config) => {
4748

4849
console.log(`🔍 LaunchOptions 信息:`, {
4950
extensions: arguments_.extensions.length,
50-
args: arguments_.args.length
51+
args: arguments_.args.length,
52+
extensionPaths: arguments_.extensions
5153
});
5254
} catch (error) {
5355
console.warn(`⚠️ Chrome for Testing 准备失败: ${error.message}`);

0 commit comments

Comments
 (0)