@@ -85,7 +85,7 @@ npm run build:firefox
8585npm run build:safari
8686```
8787
88- ### 5. Testing Your Extension
88+ ### 5. Debugging
8989
9090#### Chrome/Edge
9191
@@ -126,23 +126,24 @@ This will generate coverage reports in the `coverage/` directory.
126126
127127#### Setup E2E Testing
128128
129- 1 . Build the test environment:
129+ Use the provided setup script to initialize the e2e testing environment:
130130
131131``` shell
132- npm run dev:e2e
133- npm run build
132+ # Initialize e2e environment (install dependencies and build outputs)
133+ bash script/setup-e2e.sh --init --build
134+
135+ # Start test servers
136+ bash script/setup-e2e.sh --start-servers
134137```
135138
136- 2 . Start test servers :
139+ The setup script will :
137140
138- ``` shell
139- npm install -g http-server pm2
140-
141- pm2 start ' http-server ./test-e2e/example -p 12345'
142- pm2 start ' http-server ./test-e2e/example -p 12346'
143- ```
141+ - Install/upgrade global dependencies (` http-server ` , ` pm2 ` )
142+ - Download browser for Puppeteer (if needed)
143+ - Build e2e test output (` dist_e2e/ ` )
144+ - Start test servers on ports 12345 and 12346
144145
145- 3 . Run E2E tests:
146+ #### Run E2E Tests
146147
147148``` shell
148149npm run test-e2e
@@ -157,6 +158,35 @@ export USE_HEADLESS_PUPPETEER=true
157158npm run test-e2e
158159```
159160
161+ #### Stop Test Servers
162+
163+ After testing, stop the servers:
164+
165+ ``` shell
166+ pm2 stop all && pm2 delete all
167+ ```
168+
169+ #### Setup Script Options
170+
171+ The ` setup-e2e.sh ` script supports multiple options:
172+
173+ ``` shell
174+ # Show help
175+ bash script/setup-e2e.sh --help
176+
177+ # Initialize only (install dependencies)
178+ bash script/setup-e2e.sh --init
179+
180+ # Build e2e output only
181+ bash script/setup-e2e.sh --build
182+
183+ # Initialize and build
184+ bash script/setup-e2e.sh --init --build
185+
186+ # Run all steps (init + build + build production)
187+ bash script/setup-e2e.sh --all
188+ ```
189+
160190## Code Quality
161191
162192### Code Formatting
@@ -234,7 +264,8 @@ time-tracker-4-browser/
234264├── types/ # TypeScript declarations
235265├── rspack/ # Build configuration
236266├── script/ # Build and utility scripts
237- │ └── android-firefox.sh # Android development helper
267+ │ ├── android-firefox.sh # Android development helper
268+ │ └── setup-e2e.sh # E2E test environment setup
238269├── public/ # Static assets
239270├── doc/ # Documentation
240271├── dist_dev/ # Chrome/Edge dev build
0 commit comments