Playwright · Middle · Question 63 of 75
How do you load environment-specific values like a staging URL?
- 1Read env variables, e.g. with dotenv, in the config
- 2Pass the URL to
npx playwright install - 3Edit hard-coded URLs in each test before running
Show the answer
Correct answer: Read env variables, e.g. with dotenv, in the config
Explanation
The config is TypeScript, so it can read process.env.BASE_URL and choose settings per environment.