Session trace not cleaned up causing "tracing.stop" error in subsequent tests with Playwright
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- javascript, node.js, playwright
- 领域
- testing
调研方向
从 session() 辅助函数和 Playwright trace 生命周期开始,使用复现的 session_test.js 场景以及启用 trace 和 keepTraceForPassedTests 的配置。按顺序运行两个场景,并在会话上下文关闭后跟踪清理过程。完成标准是复现过程在没有 tracing.stop 错误的情况下完成,并且 trace 处理仍然正确。
由索引模型根据 Issue 内容生成。
描述
What are you trying to achieve?
I'm trying to run multiple test scenarios where the first scenario uses session() with Playwright helper and trace enabled. Both tests should pass without errors.
What do you get instead?
After the second test completes successfully, CodeceptJS throws an error:
Error: tracing.stop: Target page, context or browser has been closed
The session created in the first test is not properly cleaned up, and when the second test finishes, CodeceptJS attempts to save the trace for the old session that no longer exists.
Provide console output if related. Use
--verbosemode for more details.
Session Bug Reproduction --
D:\projects\codeceptjs-bug\session_test.js
First test with session
Scenario()
I am on page "/"
user1: I am on page "/"
user1: I see "Example Domain"
I see "Example Domain"
✓ OK in 4197ms
Second test - should fail with trace error
Scenario()
I am on page "/"
I see "Example Domain"
✓ OK in 630ms
Error: tracing.stop: Target page, context or browser has been closed
OK | 2 passed // 6s
Provide test source code if related
Feature('Session Bug Reproduction');
Scenario('First test with session', ({ I }) => {
I.amOnPage('/');
session('user1', () => {
I.amOnPage('/');
I.see('Example Domain');
});
I.see('Example Domain');
});
Scenario('Second test - should fail with trace error', ({ I }) => {
I.amOnPage('/');
I.see('Example Domain');
});
Details
- CodeceptJS version: 3.7.6
- NodeJS Version: v20+ (any recent version)
- Operating System: Windows / Linux / macOS (reproduced on all)
- Playwright version: 1.40.0
- Configuration file:
exports.config = {
tests: './*_test.js',
output: './output',
helpers: {
Playwright: {
url: 'https://example.com',
show: false,
browser: 'chromium',
trace: true,
keepTraceForPassedTests: true
}
},
bootstrap: null,
mocha: {},
name: 'codeceptjs-session-bug'
}
Additional context
The issue appears when:
- Multiple scenarios are run in sequence
- Trace is enabled (especially with
keepTraceForPassedTests: true) - One or more scenarios use
session()helper
The session context is closed after the first scenario ends, but CodeceptJS still tries to stop tracing for it when the next scenario completes.
Minimal reproduction repository available if needed.
- 主要语言
- 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
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
avniproject/avni-client#2135 ·
-
automated broken-link
难度 1/5 1 小时以内 新手友好度 85/100
-
agent/security hive/hosted-available-lke648397-260827-5n31 security
难度 2/5 1-3 小时 新手友好度 84/100
-
enhancement
难度 2/5 1-3 小时 新手友好度 70/100
babalae/bettergi-scripts-list#3674 ·
-
A-Release-Notes C-Editing D-Modest S-Ready-For-Implementation
难度 2/5 1-3 小时 新手友好度 72/100
bevyengine/bevy-website#2595 ·