MarketSquare / MarketSquare/robotframework-browser
Support starting and stopping trace by a keyword
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 655
- Forks
- 147
- Avg merge
- 5h 27m
- Merged PRs (30d)
- 59
Description
**Is your feature request related to a problem? Please describe.**
Currently it is only possible to start trace when context is opened. Also trace is stopped when context is closed. There has been several discussions in Slack that user would like to control trace better. This is possible with Playwright [Trace](https://playwright.dev/docs/api/class-tracing)
**Describe the solution you'd like**
Create keyword which allows to stop and and start trace. In simplest form there could be two keywords this:
```robotframework
Test
Start Trace trace.zip
New Page ${URL}
Stop Trace
```
The downside seems to be, based on docs, that one can start and stop trace only one time.
Also we could expose other options from Trace, like [chunks](https://playwright.dev/docs/api/class-tracing#tracing-start-chunk) and options from trace. This allows to create multiple traces files inside of the same context. I think this would be even better.
```robotframework
Test 0
New Context
Test 1
Start Trace screenshots=True snapshots=False sources=True title=Some name
Start Trace Chunk trace1.zip
New Page ${URL}
Close Page
Stop Trace Chunk
Test 2
Start Trace Chunk trace2.zip
New Page ${URL}
Close Page
Stop Trace Chunk
```
I am leaning towards the later way and exposing `startChunk` and `stopChunk` functionality from PW side. I am not sure without testing do we need in later case also the `Stop Trace` keyword, perhaps not. The later way gives better control for users and allows, for example, give trace a name based on the test. This allows finding the correct trace easier.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Playwright Trace API, especially tracing.startChunk and tracing.stopChunk, and compare it with the proposed Start Trace and Stop Trace keywords. Determine which keyword behavior supports multiple named trace files, then verify it with Robot Framework examples covering context, test, and chunk lifecycles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- playwright, python
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100