fix(web-integration): avoid enametoolong in playwright report filenames - #2915
Open
xianglongfei-8888 wants to merge 1 commit into
Open
fix(web-integration): avoid enametoolong in playwright report filenames#2915xianglongfei-8888 wants to merge 1 commit into
xianglongfei-8888 wants to merge 1 commit into
Conversation
Contributor
Author
|
先修复CI的问题:#2919 再重新触发CI @yuyutaotao 可以帮忙review一下嘛,谢谢 |
Contributor
Author
|
@yuyutaotao 可以帮忙review下这个提交嘛 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
issues:#2905
根因分析:
一.1.7.3 正常的原因
当时 PlaywrightAiFixture 的 reportFileName 用的是:
playwright-${testInfo.testId}-${pageUuid}
文件名短且稳定,不依赖中文标题长度,所以不会触发 ENAMETOOLONG
二.1.10.4+ 出现异常的原因
后续版本引入了“可读标题文件名”逻辑
改成把长测试标题直接拼到 reportFileName
中文标题按 UTF-8 计字节,很容易超过单文件名上限 255 bytes
修复:
1.packages/web-integration/src/playwright/ai-fixture.ts
引入短文件名策略:
playwright-${短标题前缀}-${10位稳定hash}-${pageUuid}
使用 UTF-8 字节截断,而不是字符截断
保留可读性与唯一性,同时避免超长
2.packages/web-integration/src/playwright/reporter/index.ts
separate reporter 模式也采用同样的短文件名策略
避免最终 report 导出时再次因为长标题报错
测试修复 补充并执行了回归测试:
packages/web-integration/tests/unit-test/playwright-ai-fixture-report-filename.test.ts
packages/web-integration/tests/unit-test/playwright-reporter.test.ts
测试内容覆盖:
超长标题场景下,report 文件名不会继续无限增长
文件名包含稳定 hash 和唯一 page uuid
separate reporter 模式生成的最终文件名也受控
单测中的 longTitle 已改为英文长标题
断言改为基于 UTF-8 字节长度,更符合真实文件系统限制
执行结果:
Test Files 2 passed (2)
Tests 17 passed (17)