Playwright + JS · Lesson 8 of 35
Module 8: Node.js & npm Basics
Try it yourself
Implement getEnvironmentConfig:
The editor has a worked example. Read it, tweak it, then press Mark as complete.
package.json in Test Projects{
"name": "playwright-automation",
"version": "1.0.0",
"type": "module",
"scripts": {
"test": "playwright test",
"test:headed": "playwright test --headed",
"test:ui": "playwright test --ui",
"report": "playwright show-report"
},
"devDependencies": {
"@playwright/test": "^1.49.0",
"dotenv": "^16.4.5"
}
}.env)BASE_URL=https://staging.targetqa.com
HEADLESS=truePlaywright runs on top of the Node.js JavaScript runtime. In this lesson, we will explore Node.js, npm, package.json, npm scripts, and managing environment variables using .env files for automation configurations. Let's explore!
Part of the Playwright + JS course (Playwright with JavaScript). Practice this concept live in the Playwright Online Compiler or explore our free automation practice form.
It tells Node.js to use standard ES modules (import/export syntax) instead of legacy CommonJS (require).
Finished reading?
Review the worked example in the editor, then mark the lesson complete.