Skip to content

Commit e6779c3

Browse files
committed
docs: adding setup with remote/devcontainers
1 parent 879f23b commit e6779c3

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,58 @@ EPICSHOP_EDITOR="C:\Program Files\Microsoft VS Code\bin\code.cmd"
143143
Make certain that if the path includes spaces that you wrap the path in quotes
144144
as above.
145145

146+
### Remote development/devcontainer setup
147+
148+
If you want or need to run this workshop in a remote environment, or if you're
149+
using devcontainer, then for the tests to work you need some additional setup.
150+
151+
Devcontainer is implemented differently in different editors, but in VS Code it's
152+
as simple as having the `Dev containers` extension installed and then creating a
153+
configuration file. There's a wizard that will walk you through the process of
154+
setting it up.
155+
156+
The minimal configuration needs would use the `Node.js & Typescript` template.
157+
From there you would need to add the following to the `devcontainer.json` file:
158+
159+
```json
160+
"remoteEnv": {
161+
// or the editor you use so that actions to open files
162+
// in the workshop will work correctly
163+
"EDITOR": "code",
164+
// this is for playwright remote server connection assuming
165+
// network host so no changes in the workshop code are required
166+
// in actual scenarios, you could use a docker compose file
167+
// then use the container name instead of localhost
168+
// (in which case, the playwright config would need to
169+
// change to point to the main container name instead of localhost)
170+
"PW_TEST_CONNECT_WS_ENDPOINT": "ws://localhost:3000/"
171+
},
172+
"initializeCommand": {
173+
// this stops and removes the container if it's already running
174+
// then starts a new one while starting the devcontainer
175+
// pay attention that the version of playwright matches the one in the workshop
176+
// check the docs for more information on how to run the playwright remote server
177+
// https://playwright.dev/docs/docker#remote-connection
178+
"playwright": "docker stop playwright || true && docker rm playwright || true && docker run --network=host -d --rm --name playwright --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.47.0-noble /bin/sh -c \"npx -y [email protected] run-server --port 3000 --host 0.0.0.0\""
179+
},
180+
// this is needed to simplify the setup process for the workshop
181+
"runArgs": [ "--network=host" ]
182+
```
183+
184+
After this, you can run the devcontainer, then run the `npm run setup` command
185+
to set up the environment.
186+
187+
Finally, on the `playground` folder, when running the playwright tests, you
188+
should use the following command:
189+
190+
```bash
191+
# you can change the port if needed
192+
npm run test:e2e:dev -- --ui-port=9292 --ui-host=0.0.0.0
193+
```
194+
195+
This will open the UI mode in a browser window instead of the native window.
196+
For more information: https://playwright.dev/docs/test-ui-mode#docker--github-codespaces
197+
146198
## Exercises
147199

148200
- `exercises/*.*/README.md`: Exercise background information

0 commit comments

Comments
 (0)