[Dynamic configuration] [Playwright] Can't reconfigure configuration per scenario
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript, playwright
调研方向
在 dynamic-configuration/override-config.e2e-test.js 中运行复现,并将每个 Scenario 的 .config() 调用与正常工作的 Feature('Dynamic Configuration').config() 情况进行比较。跟踪 Scenario 配置如何传递到 Playwright helper,然后验证浏览器 override 对每个 Scenario 都生效,同时命令行 --override 的行为保持不变。
由索引模型根据 Issue 内容生成。
描述
What are you trying to achieve?
I'm trying to reconfigure browser configuration per scenario
What do you get instead?
Provide console output if related. Use
--verbosemode for more details.
CodeceptJS v3.0.4
Helpers: Playwright
Plugins: screenshotOnFail, retryFailedStep, tryTo
Dynamic Configuration --
[1] Starting recording promises
› [Session] Starting singleton browser session
should override browser in config per scenario try#1 @dynamic-configuration
› [Test Config] Playwright {"browser":"firefox"}
I am on page "/"
› [Browser:Warning]
I execute script () => !!window.chrome
› [Browser:Warning] JSHandle@THREE.WebGLProgram: gl.getProgramInfoLog() JSHandle@
› [Browser:Warning] JSHandle@THREE.WebGLProgram: gl.getProgramInfoLog() JSHandle@
› [Browser:Warning] JSHandle@THREE.WebGLProgram: gl.getProgramInfoLog() JSHandle@
› [Browser:Warning] JSHandle@THREE.WebGLProgram: gl.getProgramInfoLog() JSHandle@
› [Browser:Warning] JSHandle@THREE.WebGLProgram: gl.getProgramInfoLog() JSHandle@
✔ OK in 3224ms
› [Test Config] Reverted for Playwright
› [Session] cleaning cookies and localStorage
› [Browser:Warning] JSHandle@THREE.WebGLProgram: gl.getProgramInfoLog() JSHandle@
should override browser in config per scenario try#2 @dynamic-configuration
› [Test Config] Playwright {"Playwright":{"browser":"firefox"}}
I am on page "/"
› [Browser:Warning]
I execute script () => !!window.chrome
› [Browser:Warning] JSHandle@THREE.WebGLProgram: gl.getProgramInfoLog() JSHandle@
› [Browser:Warning] JSHandle@THREE.WebGLProgram: gl.getProgramInfoLog() JSHandle@
› [Browser:Warning] JSHandle@THREE.WebGLProgram: gl.getProgramInfoLog() JSHandle@
› [Browser:Warning] JSHandle@THREE.WebGLProgram: gl.getProgramInfoLog() JSHandle@
› [Browser:Warning] JSHandle@THREE.WebGLProgram: gl.getProgramInfoLog() JSHandle@
✔ OK in 611ms
› [Test Config] Reverted for Playwright
› [Session] cleaning cookies and localStorage
› [Browser:Warning] JSHandle@THREE.WebGLProgram: gl.getProgramInfoLog() JSHandle@
should override browser in config per scenario try#3 @dynamic-configuration
› [Test Config] Playwright {"helpers":{"Playwright":{"browser":"webkit"}}}
I am on page "/"
› [Browser:Warning]
I execute script () => !!window.chrome
› [Browser:Warning] JSHandle@THREE.WebGLProgram: gl.getProgramInfoLog() JSHandle@
› [Browser:Warning] JSHandle@THREE.WebGLProgram: gl.getProgramInfoLog() JSHandle@
› [Browser:Warning] JSHandle@THREE.WebGLProgram: gl.getProgramInfoLog() JSHandle@
› [Browser:Warning] JSHandle@THREE.WebGLProgram: gl.getProgramInfoLog() JSHandle@
› [Browser:Warning] JSHandle@THREE.WebGLProgram: gl.getProgramInfoLog() JSHandle@
✔ OK in 552ms
› [Test Config] Reverted for Playwright
› [Session] cleaning cookies and localStorage
› [Browser:Warning] JSHandle@THREE.WebGLProgram: gl.getProgramInfoLog() JSHandle@
OK | 3 passed // 5s
Provide test source code if related
const assert = require('assert');
Feature('Dynamic Configuration');
Scenario('should override browser in config per scenario try#1 @dynamic-configuration', async ({ I }) => {
I.amOnPage('/');
const isChrome = await I.executeScript(() => !!window.chrome);
assert(isChrome, 'should check that browser is chrome');
}).config({"browser": "firefox"});
Scenario('should override browser in config per scenario try#2 @dynamic-configuration', async ({ I }) => {
I.amOnPage('/');
const isChrome = await I.executeScript(() => !!window.chrome);
assert(isChrome, 'should check that browser is chrome');
}).config({"Playwright": {"browser": "firefox"}});
Scenario('should override browser in config per scenario try#3 @dynamic-configuration', async ({ I }) => {
I.amOnPage('/');
const isChrome = await I.executeScript(() => !!window.chrome);
assert(isChrome, 'should check that browser is chrome');
}).config({ "helpers": {"Playwright": {"browser": "webkit"}}});
Details
- CodeceptJS version: v3.0.4
- NodeJS Version: v12.18.3
- Operating System: macOS Catalina 10.15.7
- playwright
- Configuration file:
const { setHeadlessWhen } = require('@codeceptjs/configure');
// turn on headless mode when running with HEADLESS=true environment variable
// export HEADLESS=true && npx codeceptjs run
setHeadlessWhen(process.env.HEADLESS);
exports.config = {
tests: '*/*.e2e-test.js',
output: './output',
helpers: {
Playwright: {
url: 'http://github.com',
show: true,
browser: 'chromium'
}
},
include: {
I: './steps_file.js'
},
bootstrap: null,
mocha: {},
name: 'experiments-with-codeceptjs',
plugins: {
pauseOnFail: {},
retryFailedStep: {
enabled: true
},
tryTo: {
enabled: true
},
screenshotOnFail: {
enabled: true
}
}
}
NOTE:
But it works for the Feature
Feature('Dynamic Configuration').config({"browser": "firefox"})
and I can override the configuration in runtime by using --override or -o option in the command line, passing valid JSON as a value:
codeceptjs run -o '{ "helpers": {"Playwright": {"browser": "firefox"}}}'
Also here is the link to reproduce the issue:
https://github.com/elaichenkov/experiments-with-codeceptjs/blob/main/dynamic-configuration/override-config.e2e-test.js
- 主要语言
- JavaScript
- 星标
- 4.2k
- 派生
- 756
- 平均合并
- 2 天 9 小时
- 30 天内合并 PR
- 16
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
codeceptjs/CodeceptJS 的其他 Issue
-
stale
难度 2/5 1-3 小时 新手友好度 72/100
codeceptjs/CodeceptJS#5420 · 1 条评论 ·
-
stale
难度 2/5 1-3 小时 新手友好度 76/100
codeceptjs/CodeceptJS#5358 · 1 条评论 ·
-
stale
难度 2/5 1-3 小时 新手友好度 78/100
codeceptjs/CodeceptJS#4958 · 10 条评论 · 2 个 reaction ·
-
stale
难度 1/5 1 小时以内 新手友好度 72/100
codeceptjs/CodeceptJS#4778 · 3 条评论 ·
-
stale
难度 4/5 3-5 天 新手友好度 38/100
codeceptjs/CodeceptJS#5618 · 1 条评论 ·
查看 codeceptjs/CodeceptJS 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 75/100
docToolchain/docToolchain#1705 ·
-
Timezone select lists one option per character; duplicate "Failed" reason; shared tracker popover id 未关闭bug
难度 2/5 1-3 小时 新手友好度 75/100
nightscout/nocturne#1414 ·
-
bug v2
难度 2/5 1-3 小时 新手友好度 75/100
modelcontextprotocol/inspector#2458 · 1 条评论 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
难度 2/5 1-3 小时 新手友好度 70/100
carbon-design-system/ibm-products#9907 ·