playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Feature] Stacktrace in Debugger Mode

Open Jaguar20100 opened this issue 1 year ago • 3 comments

I have an easy function here as a reuseableComponent to click a button (Which i call in test scripts)

async clickButton(name: string) { await this.getByRole('button', {name}).click(); }

snippet of script: await vorsorgemodellPage.clickButton('Abbbrechen'); (there is a typo in the button name to showcase)

With running the script with the debugger (playwright:debug) you just get a timeout without stack trace pointing to the reuseableComponent file and you don't get the Stacktrace with the action/step in the script where it actually fails unlike in headless mode (playwright:test)

debugger mode:

image

Headlless mode:

image

can you please also add the stacktrace option in debug mode? I think this is really helpfull for debugging and others for sure will benefit from this as well

Jaguar20100 avatar Jan 30 '24 13:01 Jaguar20100

You should 'box' your helper function as stated here: https://playwright.dev/docs/release-notes#hide-implementation-details-box-test-steps

pavelfeldman avatar Jan 30 '24 16:01 pavelfeldman

Thank you fro the answer..i don't use this test.step() in my helper. what i wanted to have is to implement the same for all modes. why different?.. You can see in the debugger mode there is only one source and it pounts to the helper file

image

unlike in headles mode ..there is two sources where as the second one points to the failed test step in the script where the error actually occures

image

image

Jaguar20100 avatar Feb 01 '24 17:02 Jaguar20100

Yes, so you should use test.step to achieve your goal of boxing.

pavelfeldman avatar Feb 01 '24 17:02 pavelfeldman

Closing as per above

pavelfeldman avatar Feb 06 '24 00:02 pavelfeldman

Ok thank you for the reply and the tipp :)

Jaguar20100 avatar Feb 06 '24 10:02 Jaguar20100