You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Click the green play button (▶️) to start debugging.
64
+
The browser will open in headed mode, and you can step through your code, inspect variables, and use all VS Code debugging features.
65
+
66
+
You can customize the environment variables and arguments as needed for your test run.
67
+
For more details, see VS Code Debugging Documentation.
68
+
69
+
🐞 Debugging Tests with Playwright Debugger
70
+
You can debug your Playwright tests using the built-in Playwright Inspector or VS Code debugger. The project provides a convenient script for running tests in debug mode with environment variables pre-set.
71
+
72
+
Using the Debug Script
73
+
To run tests in debug mode with your environment settings, use:
74
+
npm run test:env:debug -- [test-file-or-pattern] --debug
75
+
test:env:debug is the script defined under package.json file
The --debug flag opens the Playwright Inspector for interactive debugging.
79
+
Example
80
+
npm run test:env:debug -- tests/login.spec.ts --debug
81
+
What Happens
82
+
The script runs Playwright tests with your specified environment.
83
+
The Playwright Inspector UI will open, allowing you to step through your tests, inspect selectors, and interact with the browser.
84
+
Tips
85
+
You can pass any test file or pattern after -- to target specific tests.
86
+
Use breakpoints in your test code or add await page.pause() to pause execution at a specific point.
87
+
Add this section to your README.md to help contributors debug tests using your custom script and Playwright’s debugging tools. Let me know if you want this inserted automatically!
33
88
34
89
## 🧪 Running Tests Locally
35
90
@@ -85,33 +140,18 @@ docker run --rm -v $(pwd)/allure-report:/app/allure-report my-playwright-runner
85
140
86
141
## 📂 Project Structure
87
142
88
-
```
89
143
e2e-playwright-framework/
90
-
├── tests/ # Test specs
91
-
├── pages/ # Page Object Models
92
-
├── utils/ # Custom utilities
93
-
├── storage/ # Session files
94
-
├── allure-results/ # Allure raw data
95
-
├── allure-report/ # Allure HTML reports
96
-
├── playwright.config.ts # Playwright test config
144
+
├── tests/ # Test specs
145
+
├── pages/ # Page Object Models
146
+
├── utils/ # Custom utilities
147
+
├── storage/ # Session files
148
+
├── allure-results/ # Allure raw data
149
+
├── allure-report/ # Allure HTML reports
150
+
├── playwright.config.ts # Playwright test config
97
151
├── DockerFile.playwright # Dockerfile for CI/CD
98
-
├── .github/workflows/ # GitHub Actions workflows
99
-
```
100
-
## 🌐 Overriding baseURL
101
-
102
-
- By default, `baseURL` is loaded from your environment file (e.g., `env/.env.dev1`).
103
-
- To override for a specific run, set the `BASE_URL` variable:
104
-
105
-
```sh
106
-
BASE_URL=https://another-url.com npm test
107
-
```
152
+
├── .github/workflows/ # GitHub Actions workflows
108
153
109
-
- Or use a different environment:
110
154
111
-
```sh
112
-
TEST_ENV=dev1 npm test
113
-
```
114
-
---
115
155
116
156
## ✅ GitHub Actions CI/CD
117
157
@@ -125,7 +165,6 @@ This project uses **GitHub Actions** to automate test execution and reporting.
125
165
126
166
### 📁 Workflow Location
127
167
128
-
```
129
168
.github/workflows/playwright.yml
130
169
```
131
170
@@ -164,8 +203,6 @@ This project uses **GitHub Actions** to automate test execution and reporting.
0 commit comments