fix : naming convention session / main erasing with long test.title/tags
Motivation/Description of the PR
- Description of this PR, which problem it solves Solve issue in some use case where videos and traces of Playwright are not saved correctly when using multiple sessions
fix : naming convention session / main erasing with long test.title/tags
--> file name of traces and video have title limited to 245 char and contains sessions name at end and test status, which in case of gherkin/bdd is not enough, the session name is truncated. Meaning all traces/videos of sessions are written to same file. Changed the naming to have the session before test title, therefore, having always a different file name
fix: context is funtion in session and not property --> in the sessions iteration, the access to context is not a property but a function, it resulted in getting out of saving because no tracing property existed. Added the () to context usage for sessions loop
fix : dual saving main session --> main session is also in the list of sessions, generating a Playwright error as the traces are already savec for the main session, and having 2 times the session saved. Added a check on session name to exclude it from the sessions loop.
- Resolves #4981
Applicable helpers:
- [X] Playwright
- [ ] Puppeteer
- [ ] WebDriver
- [ ] REST
- [ ] FileHelper
- [ ] Appium
- [ ] TestCafe
Applicable plugins:
- [ ] allure
- [ ] autoDelay
- [ ] autoLogin
- [ ] customLocator
- [ ] pauseOnFail
- [ ] coverage
- [ ] retryFailedStep
- [ ] screenshotOnFail
- [ ] selenoid
- [ ] stepByStepReport
- [ ] stepTimeout
- [ ] wdio
- [ ] subtitles
Type of change
- [ ] :fire: Breaking changes
- [ ] :rocket: New functionality
- [X] :bug: Bug fix
- [ ] 🧹 Chore
- [ ] :clipboard: Documentation changes/updates
- [ ] :hotsprings: Hot fix
- [ ] :hammer: Markdown files fix - not related to source code
- [ ] :nail_care: Polish code
Checklist:
- [ ] Tests have been added
- [ ] Documentation has been added (Run
npm run docs) - [X] Lint checking (Run
npm run lint) - [X] Local tests are passed (Run
npm test)
@julien-ft-64 may you suggest if we could add some tests for those changes? https://github.com/codeceptjs/CodeceptJS/blob/3.x/test/helper/Playwright_test.js#L1431
Run our tests and still see the error, maybe this needs deeper investigation.
Error: tracing.stop: Must start tracing before stopping
Timeouts: 10000
› [Session] Starting singleton browser session
should sessions-playwright-traces @Puppeteer @Playwright
› Test Timeout: 10000s
› [New Session] {"ignoreHTTPSErrors":true,"acceptDownloads":true,"recordVideo":{"size":{"width":400,"height":600},"dir":"/Users/t/Desktop/projects/CodeceptJS/test/acceptance/output/videos/"}}
Scenario()
I am on page "/"
› Changed URL to base url + relative path: http://localhost:8000/
› [New Context] {}
john: I am on page "/form/bug1467"
› Changed URL to base url + relative path: http://localhost:8000/form/bug1467
› <screenshotOnFail> Test failed, try to save a screenshot
› [Screenshot] output/should_sessions-playwright-traces_@[email protected]
› [Screenshot] john - output/john_should_sessions-playwright-traces_@[email protected]
/Users/t/Desktop/projects/CodeceptJS/test/acceptance/output/trace/ff6dea66-928c-4c6c-a15c-f38cd36a6515_should_sessions-playwright-traces_@[email protected]
/Users/t/Desktop/projects/CodeceptJS/test/acceptance/output/trace/0b34d9c8-ba4b-4fe5-9aec-1e8b236b8b78_john_should_sessions-playwright-traces_@[email protected]
[1] <session:john> Error (Non-Terminated) | Error: tracing.stop: Must start tracing before stopping | e => error(e)...
Error: tracing.stop: Must start tracing before stopping
✔ OK in 619ms
OK | 1 passed // 1s
hi @julien-ft-64 we cherry-picked your commit and continue with added tests here https://github.com/codeceptjs/CodeceptJS/pull/5073 So, closing this for now. Thanks!