Closed bc-rajesh closed 7 months ago
We recommend setting attachments inside tests - you can read them later on in the reporter via https://playwright.dev/docs/api/class-testresult#test-result-attachments. This is commonly used to attach either files or just some text based data. Would that work for you?
Thank you. This works for me 🙇♂️
Trying to move away from global setup to project dependencies.
I have a setup project which executes first. Then a project (e2e) for executing the tests. And then a cleanup project.
I am setting up an environment variable
process.env.FOO
for the first time in one of the tests in the setup project. This variable's value is accessible in the tests in e2e project and also in the cleanup project. I use a custom reporter and could not access the environmental variable process.env.FOO in this custom reporter. It isundefined
inonEnd
,OnTestEnd
for all the tests, in all the projects even though it is perfectly accessible in the e2e and cleanup projects. Can anyone pls provide some info of whether is this a bug or is this how the environment variables are supposed to behave?Pls note that this variable was accessible when it was created in global setup. It is not accessible only when it is created in the setup project.
code snippet below Playwright.config.ts
AdminLogin.setup.ts
CustomReporter.ts