From 3383cb948c516eeb7d21e106ddd3254437834c8a Mon Sep 17 00:00:00 2001 From: Shrish Adhikari Date: Tue, 14 Jan 2025 15:48:31 +0545 Subject: [PATCH 1/4] Added fix for running cypress interactive UI from docker This includes changes that are necessary to run cypress from mac --- CONTRIBUTING.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 49dfc34350..da823dbe22 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -106,12 +106,12 @@ If you need to test that the image works with Cypress, you can follow these inst 1. Install XQuartz: https://www.xquartz.org/ 2. Launch XQuartz. Under the XQuartz menu, select Settings 3. Go to the security tab and ensure "Allow connections from network clients" is checked. -4. From the XQuarts terminal, run `xhost + ${hostname}` to allow connections to the macOS host -5. From the XQuarts terminal, set up a `HOSTNAME` env var `export HOSTNAME="host.docker.internal:0"` -6. From the XQuarts terminal, run your Docker image like such: - +4. `xhost +$(ipconfig getifaddr en0)` to allow connections to the macOS host, this adds IP related to our en0 network interface to the access control list + - This step is vital for us to see the interactive UI for cypress +5. Set up a `DISPLAY` env var `export DISPLAY="$IP:0"` +6. Run your Docker image like such: ```bash -docker run --rm -it -e DISPLAY="host.docker.internal:0" -v /tmp/.X11-unix:/tmp/.X11-unix --entrypoint bash +docker run --rm -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --entrypoint bash ``` When executing `npx cypress open` from the Docker container, the display should now be visible! From dc12770c516413c3d278c802b1e6926c198320bd Mon Sep 17 00:00:00 2001 From: Shrish Adhikari Date: Tue, 14 Jan 2025 16:13:36 +0545 Subject: [PATCH 2/4] Removed redundant line --- CONTRIBUTING.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index da823dbe22..0966e88cf1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -107,7 +107,6 @@ If you need to test that the image works with Cypress, you can follow these inst 2. Launch XQuartz. Under the XQuartz menu, select Settings 3. Go to the security tab and ensure "Allow connections from network clients" is checked. 4. `xhost +$(ipconfig getifaddr en0)` to allow connections to the macOS host, this adds IP related to our en0 network interface to the access control list - - This step is vital for us to see the interactive UI for cypress 5. Set up a `DISPLAY` env var `export DISPLAY="$IP:0"` 6. Run your Docker image like such: ```bash From c5b0467100bc61d5c8328d1197c8a4f1f48bc0b6 Mon Sep 17 00:00:00 2001 From: Shrish Adhikari Date: Wed, 15 Jan 2025 10:23:53 +0545 Subject: [PATCH 3/4] Added case when xhost command isn't found This happens when xhost is not set properly in the path --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0966e88cf1..408b192f4e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -107,6 +107,7 @@ If you need to test that the image works with Cypress, you can follow these inst 2. Launch XQuartz. Under the XQuartz menu, select Settings 3. Go to the security tab and ensure "Allow connections from network clients" is checked. 4. `xhost +$(ipconfig getifaddr en0)` to allow connections to the macOS host, this adds IP related to our en0 network interface to the access control list + - If we get `xhost` command not found error, try running this instead `/usr/X11/bin/xhost + $(ipconfig getifaddr en0)` 5. Set up a `DISPLAY` env var `export DISPLAY="$IP:0"` 6. Run your Docker image like such: ```bash From 1b3c2be2ed15ece5cd69626bf44384187d75a986 Mon Sep 17 00:00:00 2001 From: Shrish Adhikari Date: Wed, 15 Jan 2025 16:23:34 +0545 Subject: [PATCH 4/4] Added explicit definition of IP variable --- CONTRIBUTING.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 408b192f4e..28b8793968 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -106,10 +106,11 @@ If you need to test that the image works with Cypress, you can follow these inst 1. Install XQuartz: https://www.xquartz.org/ 2. Launch XQuartz. Under the XQuartz menu, select Settings 3. Go to the security tab and ensure "Allow connections from network clients" is checked. -4. `xhost +$(ipconfig getifaddr en0)` to allow connections to the macOS host, this adds IP related to our en0 network interface to the access control list +4. `export IP=$(ipconfig getifaddr en0)` +5. `xhost + $IP` to allow connections to the macOS host, this adds IP related to our en0 network interface to the access control list - If we get `xhost` command not found error, try running this instead `/usr/X11/bin/xhost + $(ipconfig getifaddr en0)` -5. Set up a `DISPLAY` env var `export DISPLAY="$IP:0"` -6. Run your Docker image like such: +6. Set up a `DISPLAY` env var `export DISPLAY="$IP:0"` +7. Run your Docker image like such: ```bash docker run --rm -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --entrypoint bash ```