Skip to content
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

Add outputDir support for screenshots and videos #878

Open
vigneshshanmugam opened this issue Jan 3, 2024 · 0 comments
Open

Add outputDir support for screenshots and videos #878

vigneshshanmugam opened this issue Jan 3, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@vigneshshanmugam
Copy link
Member

Summary

Synthetics agent by default stores the screenshots and other attachments in the synthetics specific project folder path which is under .synthetics and does not expose any API for getting these screenshots and videos if captured via PW outDir folder. We would like to add support for the outputDIr option and also help users gather these written paths via the test results.

Proposal

outputDir Option

Users should be able to specific the outputDir path to the Synthetics runner via the config option/CLI flag etc to store all the screenshots/videos. If not specified, the runner will default to the previous folder .synthetics and store them under each test for backwards compatability

export default {
  outputDir: "./test-results"
}

Attachments Results

The Stored results from the test run, be it screenshots, videos, trace should be added to the Test results exporter interface where the users can retrive these information on demand. Our reporters should also use the TestResult/JourneyEnd interface and act on these screenshots instead of directly fetching it from .synthetics folder.

onJourneyEnd(result => {
  result.attachments.forEach(attachment => {
     console.log(a.name) // name of the attachment
     console.log(a. contentType) // Content type of this attachment - ex:  'application/json' or 'image/png'.
     console.log(a.path) // path on the filesystem to the attached file.
     console.log(a.body) // attachment body used instead of a file.
 })
});

API is inspired from Playwright Attachments API - https://playwright.dev/docs/api/class-testresult#test-result-attachments

With this, we should be able to support the usecases such as

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant