playwright-community / playwright-msteams-reporter

Microsoft Teams reporter for Playwright
https://www.npmjs.com/package/playwright-msteams-reporter
MIT License
10 stars 4 forks source link

linkToResultsUrl process only in processResults #10

Closed inluxc closed 3 months ago

inluxc commented 3 months ago

I would like to process linkToResultsUrl at the processResults, level. Like that, I could get the env. variable AZURE_PW_TEST_RUN_ID, from the https://github.com/alexneo2003/playwright-azure-reporter/.

Thanks.

estruyf commented 3 months ago

Hi @inluxc,

Thank you so much for your suggestion and all the effort you've put into the PR.

The changes you've proposed look good, and I can see the value they bring. However, I think it might be more beneficial for us to avoid depending on another reporter. To achieve greater flexibility, I suggest we update the linkToResultsUrl and linkUrlOnFailure properties to accept either a string or a function.

In your case, it would look as follows:

[
  'playwright-msteams-reporter',
  <MsTeamsReporterOptions>{
    linkToResultsUrl: () => `${process.env.AZURE_SERVER_URL}/${process.env.AZURE_PROJECT}/_testManagement/runs?runId=${process.env.AZURE_PW_TEST_RUN_ID}&_a=runCharts`,
  }
]
estruyf commented 3 months ago

I have implemented the change to the reporter to support this new functionality. Also, the documentation has been updated to show the example for using it in combination with the Playwright Azure Reporter: https://github.com/playwright-community/playwright-msteams-reporter/tree/dev?tab=readme-ov-file#combine-the-reporter-with-the-playwright-azure-reporter

You can try it out by installing the BETA version: 0.0.10-beta.1019653.

estruyf commented 3 months ago

@inluxc just released version 0.0.10. Thanks again for the suggestion and the work on the PR 🙏