Skip to content

Support starting and stopping trace by a keyword #3427

@aaltat

Description

@aaltat

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

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:

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 and options from trace. This allows to create multiple traces files inside of the same context. I think this would be even better.

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions