Closed pamelafox closed 1 year ago
I tried to reproduce it, but was not able to. See here my attempt: https://github.com/mxschmitt/python-vscode-dev-containers-demo
What I found is that you pass --platform=amd64
which will emulate amd64 on arm64. We strongly discourage this and this will also break Chromium support, since it does not like to get emulated via Docker. Will be also faster if you remove it and it automatically picks the right architecture.
Thanks, I was able to get farther with yours once I added the missing apt-get deps, but then, as you say, I ran into an error when it actually tried to run the test in Chromium (something about the page closing).
Your example does work when I remove the emulation.
Unfortunately, I have to keep the emulation for now in order to support the Azure Developer CLI (https://github.com/Azure/azure-dev/issues/1314). For now, I will run the tests outside of the Dev Container and get them running on CI as well.
Feel free to close this issue, thanks for the response!
Not sure if there is a difference between Azure Developer CLI and Azure CLI, but we at Playwright are using Azure CLI inside linux-arm64 since a while and it works like charm. We install it like that:
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash
Closing then for now.
Thanks to your help, I'm successfully running Playwright inside dev containers. However, I'd now like to get headed mode working. I added xvfb to my container and ran:
xvfb-run python3 -m pytest --headed
The tests run and pass, but no browser pops up, like it does outside of a dev container. Is there a way to get the browser to pop up?
This is my repo:
There is no way of accessing the desktop environment of your GitHub Codespace without running a VNC server and accessing it by that. This will work but the user experience will be slow, since there is a lot of delay etc. and the machines are not made for that. We usually recommend to develop locally.
See e.g. https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/desktop-lite.md
I'm trying to run in local VS Code Dev Container, not Codespaces - would that also require VNC? I always use a Dev Container for my web apps as it sets up the app database as well, very convenient.
I'm trying to run in local VS Code Dev Container, not Codespaces - would that also require VNC? I always use a Dev Container for my web apps as it sets up the app database as well, very convenient.
This is about the same limitations in the end. Yes, developing web apps and writing playwright tests are significant different. One involves a GUI and one does not.
You can expose your web app port tho to your host system, what you most likely already doing, and run the pwtests against them from your host.
Okay, I was hoping to be able to do it all inside a VS Code Dev Container for a VS Code live stream today, but sounds like headed won't be possible. I'll start off by showing playwright headed in a non-DevContainer environment, then I'll show headless tests running on a more complex web app in a Dev Container environment.
I see what you mean that I could run my tests (and codegen) outside the Dev Container by making sure the tests navigate to the page at the exposed host port instead of the randomly generated internal port that my tests currently use, so will keep that in mind if anyone asks.
Thanks!
Context:
Describe the bug
When I run
playwright install
in the Dev Container, I get an error:This is the Dockerfile that I'm using for the Dev Container: