-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
feat(tracing) Adding groups to trace via pw-api #33081
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@microsoft-github-policy-service agree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR!
I agree with your choice of ignoring group()
/groupEnd()
calls when not tracing or when groupEnd()
is unbalanced. That seems like the easiest one for the user.
We would need tests that should go into trace-viewer.spec.ts.
Take a look at testd like should have correct stack trace
, should show action source
and should open simple trace viewer
. In the last one, I'd click on a group to expand/collapse it and check the actions list.
I think this should automatically work with the test runner if you follow my other comments. Adding a test similar to this one will ensure that.
Overall, this looks very promising, thank you!
@@ -51,6 +52,18 @@ export class Tracing extends ChannelOwner<channels.TracingChannel> implements ap | |||
await this._startCollectingStacks(traceName); | |||
} | |||
|
|||
async group(name: string, options: { location?: { file: string, line?: number, column?: number } } = {}) { | |||
if (!options.location) { | |||
const filteredStack = filteredStackTrace(captureRawStack()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of handling the stack manually, we should fall back to the default machinery. That probably means calling _wrapApiCall()
and introducing an extra parameter to pass a custom location to it, instead of taking the stack trace. This way you'll get source collection and other goodies for free.
You would also need to opt-out of this._isInternalType
check inside to make this particular tracing.group()
call public. I think that making isInternal
argument be boolean | undefined
will allow to differentiate explicit false
to opt-into public call from default undefined
which aligns with this._isInternalType
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually i do not really understand what you are talking about here, but can it be that this is all irrelevant when using metadata.location
as i described in my comment before?
This comment has been minimized.
This comment has been minimized.
@dgozman Update: Test written |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
PS: It seems to me that you also have some flaky tests? Is it possible to give the users that do PRs the right, to re-run failed actions? |
@pavelfeldman @dgozman We would really love to see that in next Playwright Release, so that we could implement it in Robot Framework Browser as well. Thank you. |
@Snooz82 Sorry, I didn't get to this PR today, but I will tomorrow.
|
This comment has been minimized.
This comment has been minimized.
@dgozman Thanks for the feedback.
You may review again. There is one limitation though. Thanks for reviewing! |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Hi @dgozman, I am sorry that i might be annoying. Thank you. |
Signed-off-by: René <[email protected]>
Signed-off-by: René <[email protected]>
Signed-off-by: René <[email protected]>
Signed-off-by: René <[email protected]>
Co-authored-by: Dmitry Gozman <[email protected]> Signed-off-by: René <[email protected]>
Co-authored-by: Dmitry Gozman <[email protected]> Signed-off-by: René <[email protected]>
Signed-off-by: René <[email protected]>
Signed-off-by: René <[email protected]>
Signed-off-by: René <[email protected]>
Signed-off-by: René <[email protected]>
Signed-off-by: René <[email protected]>
Signed-off-by: René <[email protected]>
Signed-off-by: René <[email protected]>
This comment has been minimized.
This comment has been minimized.
Signed-off-by: René <[email protected]>
Test results for "tests 1"3 flaky36402 passed, 639 skipped Merge workflow run. |
This PR implements #33047 .
It shall be possible to add groups to trace logs so that also users that do not use Playwright-Test, like Playwright Python, Robot Framework, Cucumber etc., can also group their traces.
Similar to test.step visually.