Skip to content

Commit

Permalink
Merge pull request #227 from Exabyte-io/update/SOF-7332
Browse files Browse the repository at this point in the history
update/SOF 7332
  • Loading branch information
VsevolodX authored Aug 13, 2024
2 parents a03fd5d + dabfaa9 commit 8017458
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 0 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
IMAGE_TAG=latest
PORT=3001
VNC_PORT=5920
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,21 @@ sleep 30 # let the app actually start
docker-compose run materials-designer-test
```

To run tests in the container use default profile by not specifying it:

```bash
docker-compose up -d --build
```

For debugging purposes, Materials Designer and test container can be run interactively with access via VNC:

```bash
docker-compose --profile use-vnc up -d --build
```

Then connect to `vnc://localhost:5920` with a VNC client. The password is `123`. (Port set in `.env` file.)
Make sure to have VNC client installed on the system, when address is typed in the Chrome browser, the VNC prompt will appear.

### 3.5. Using Cove.js for local development

If need to link Cove.js into the app for local development, you need
Expand Down
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ services:
volumes:
- ./src/:/opt/app/src/
- ./entrypoint.sh:/opt/app/entrypoint.sh
profiles:
- ""
- use-vnc

# Meant to be used for CI/CD testing
materials-designer-test:
image: materials-designer-test:${IMAGE_TAG}
Expand All @@ -30,3 +34,19 @@ services:
volumes:
- ./tests/cypress:/opt/test/cypress
- ./entrypoint.sh:/opt/test/entrypoint.sh
profiles:
- ""

# For local testing with access via VNC
materials-designer-test-vnc:
image: materials-designer-test-vnc:${IMAGE_TAG}
build:
context: .
dockerfile: ./dockerfiles/app/test/Dockerfile-vnc
ports:
- ${VNC_PORT}:${VNC_PORT}
volumes:
- ./tests/cypress:/opt/test/cypress
- ./entrypoint-vnc.sh:/opt/test/entrypoint-vnc.sh
profiles:
- use-vnc
27 changes: 27 additions & 0 deletions dockerfiles/app/test/Dockerfile-vnc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# From https://hub.docker.com/r/cypress/browsers/tags
FROM materials-designer-test:latest

# Followed instructions from https://spin.atomicobject.com/cypress-running-docker-container/
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
curl \
libgtk2.0-0 \
libgtk-3-0 \
libgbm-dev \
libnotify-dev \
libgconf-2-4 \
libnss3 \
libxss1 \
libasound2 \
libxtst6 \
xauth \
xvfb \
x11vnc \
fluxbox

# Install Chrome
RUN curl https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -o /tmp/google-chrome.deb
RUN apt-get install -y /tmp/google-chrome.deb

ENV CYPRESS_BASE_URL=${CYPRESS_BASE_URL:-'http://host.docker.internal:3001'}

ENTRYPOINT ["/opt/test/entrypoint-vnc.sh"]
7 changes: 7 additions & 0 deletions entrypoint-vnc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
# Run Xvfb, x11vnc and fluxbox and Cypress in a single CMD to ensure they're properly synchronized
export DISPLAY=":20"
Xvfb $DISPLAY -screen 0 1920x1080x16 &
x11vnc --passwd "123" -display $DISPLAY -N -forever -bg -o "/tmp/x11vnc.log" &
DISPLAY=$DISPLAY fluxbox -log /tmp/fluxbox.log &
DISPLAY=$DISPLAY cypress open /opt/tests/ --browser chrome

0 comments on commit 8017458

Please sign in to comment.