vitalets/playwright-bdd

Bug: Not able to open traceviewer directlly from within the BDD report

NikkTod opened this issue · 11 comments

Given
We have a fail test and traces are enabled and we have set correct attchmentsBaseURL

When
I open the BDD report and go to the test that failed

Then
I click on the link to open directlly the traceviewer and see the trace for that fail test

Bug:
Clicking on the link does not open the traces zip file. I compared vs the link in the playwright html report and I saw that the generated URL is missing a /reports before the /trace/index.html?trace=......

Playwright html:
server:port/reports/trace/index.html?trace=https://localhost:port/data/traceID.zip

Environment
Playwright-bdd v7.5.0

Actually this /reports path is coming from me

My attachmentBaseURL is: https://host:port/reports/data
With this settings I am not able to open the traceviewer with the zip inside the BDD report, it produces for me URL like:

https://host:port/trace/index.html?trace=https://host:port/reports/data/traceID.zip

Playwright traceview URL, which is working is:

https://host:port/reports/trace/index.html?trace=https://host:port/reports/data/traceID.zip

image

image

Ahhh I think the problem is that my bdd report is called cucumber.html and not index.html

From the config I see that /reports is set for outputFolder in Playwright html reporter, not for Cucumber html reporter.
Could you for now disable Playwright html reporter and generate Cucumber html with attachmentBaseURL = https://host:port/data ?

Hi @vitalets, I tried as you suggested, the problem is that my URL has a part that is changing for every build.

eg. https://host:port/repositry/download/id_of_build_that_is_changing

So when I set the attachmentBaseURL = https://host:port/data

Then I am produced with the following URL within the bdd report

https://host:port/repositry/download/id_of_build_that_is_changing/trace/index.html?trace=https://host:port/data/traceID.zip

After ?trace= I not able to set correct path to the zip, it seems I will have to catch that changable build id and set it in the attachmentBaseURL, so that I should get the following:

https://host:port/repositry/download/id_of_build_that_is_changing/trace/index.html?trace=https://host:port/repositry/download/id_of_build_that_is_changing/data/traceID.zip

Closing the ticket, adding the build id as configuration parameter to the attachmentBaseURL did the trick.

Thanks for the help @vitalets

You are welcome!

@NikkTod could you share your final config (without private details)?
I'll add it as example to docs for other Teamcity users.

Sure, here you go! Maybe it is important to mention that report should be called index.html

playwright-report for folder is not a good name, maybe write it as bdd-report :)

cucumberReporter('html', {
  outputFile: 'playwright-report/index.html',
  externalAttachments: true,
  attachmentsBaseURL: `https://host:port/repository/download/${process.env.TCBuildTypeID}/${process.env.TCBuildID}:id/data`
});

cc: @vitalets

Thank you!
Just curios, should not playwright-report appear somewhere in attachmentsBaseURL? As attachments are stored inside that dir.

Good point, usually yes, but in my case I have the posiblity to point where the atrifact path is, directlly in the settings of team city, so the playwright-report is there.

image

Ok, will mention that as well!