Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support starting and stopping trace by a keyword #3427

Open
aaltat opened this issue Feb 11, 2024 · 2 comments
Open

Support starting and stopping trace by a keyword #3427

aaltat opened this issue Feb 11, 2024 · 2 comments
Labels
enhancement New feature or request priority: critical
Milestone

Comments

@aaltat
Copy link
Member

aaltat commented Feb 11, 2024

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.

@aaltat aaltat added enhancement New feature or request priority: high labels Feb 11, 2024
@aaltat aaltat added this to the v18.2.0 milestone Feb 11, 2024
@Snooz82
Copy link
Member

Snooz82 commented Feb 11, 2024

This requires to update the js_keyword_interface, so that context (opt browser) is also available in the js keyword.

if trace is startet after page, many resources are missing, I.e. css .

Therefore it would be good to start it before opening page.

idea: enable tracing for new_page.

@aaltat
Copy link
Member Author

aaltat commented Feb 12, 2024

I have not thought about New Page keyword, I need to think about it. But sounds like possible idea. And fixed bug in the second example in above, one cannot call Start Trace twice in the same context.

@Snooz82 Snooz82 modified the milestones: v18.2.0, v18.3.0 Feb 16, 2024
@aaltat aaltat modified the milestones: v18.3.0, v18.4.0 Apr 1, 2024
@aaltat aaltat modified the milestones: v18.4.0, v18.5.0 May 2, 2024
@aaltat aaltat modified the milestones: v18.5.0, v18.6.0 May 16, 2024
@aaltat aaltat modified the milestones: v18.6.0, v18.7.0 Jun 21, 2024
@aaltat aaltat modified the milestones: v18.7.0, v18.8.0 Aug 9, 2024
@aaltat aaltat modified the milestones: v18.8.0, v18.9.0 Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority: critical
Projects
None yet
Development

No branches or pull requests

2 participants