I'm setting up some first playwright tests for my nextjs project. I already have environment variables in my .env.local
and I'd like to pull them into my test env.
I'm looking at the documentation and I see that I can add require("dotenv").config();
to my playwright.config.js
but nothing is happening when I do that (the scripts are erroring out because of undefined
.
I tried both calling process.env.foo
directly within the script, and also adding a use: {foo: process.env.FOO}
clause to the playwright.config.js
and moving my variables to .env
file instead of .env.local
but nothing worked.
Help would be much appreciated! thank you.