-
Notifications
You must be signed in to change notification settings - Fork 289
Description
Version
1.49.0, Microsoft.Playwright.MSTest
Steps to reproduce
- create project:
dotnet new mstest-playwright -n test-pw-junit - add screenshot-code to test-example:
await Page.ScreenshotAsync(new(){Path = "stuff.jpeg"});TestContext.AddResultFile("stuff.jpeg"); - add logger-package
dotnet add package JunitXml.TestLogger -v 7.0.2 - run tests:
dotnet test --logger:junit --results-directory ./test-results
Expected behavior
Notice below how the trx-logger does it. it has attachments added the test-results, and the references in the trx-file has relative references to those attachments. That means I can easily move the test-results folder, and use it for test-results in Azure-pipelines:
Actual behavior
The test-results directory is empty, except for the report-file.
There's results in there for a while during the test-run, but they dissappear before the test-run is over:
I tried out TestContext.ResultsDirectory for attachments. Notice that attachments are gone from the test-results-directory. This seems to be an issue with the logger and playwright - the junit-report is referencing paths that don't exist.
Just like the default trx-logger, the junit-logger for playwright with Node.js also does this well:
- It produces test-attachments in the test-results-directory.
- The report has relative paths to the attachments.
Additional context
Here's my original issue on the dotnet junit-logger: spekt/testlogger#201
They've agreed that I can implement configuration to generate relative-paths in the test-report. What I need in this issue, is to not have the system delete the test-results if I write attachments to the directory.
Environment
- Operating System: win11
- CPU: x86 64 something
- Browser: N/A
- .NET Version (TFM): net9.0
- Other info: