Skip to content

Commit

Permalink
ci: Isolate end-to-end-test
Browse files Browse the repository at this point in the history
  • Loading branch information
j3soon committed Aug 4, 2024
1 parent 0ef5739 commit 0ee67dd
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 18 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ The automated tests currently include the following:
- **Default tests**: Test the default title name of arXiv abstract/PDF pages.
- **Navigation tests**: Test the arxiv-utils button can switch between arXiv abstract/PDF pages, and the title is modified.

The testcases along with their description is stored in [tests/testcases.yaml](tests/testcases.yaml).
The testcases along with their description is stored in [tests/testcases/testcases.yaml](tests/testcases/testcases.yaml).

Other functions should still be tested manually:

Expand Down Expand Up @@ -195,11 +195,11 @@ docker compose up -d
Then run the tests:

```sh
docker exec -t tests-selenium-tests-1 \
python "/app/tests/test_navigation.py"
docker exec -t end-to-end-test-selenium-tests-1 \
python "/app/tests/end-to-end-test/test_navigation.py"
```

When adding new test cases, it is often convenient to comment out existing test cases in [tests/testcases.yaml](tests/testcases.yaml); When testing specific browsers, you can modify the `for browser in [...]` part in [tests/test_navigation.py](tests/test_navigation.py) to only run tests for the desired browser.
When adding new test cases, it is often convenient to comment out existing test cases in [tests/testcases/testcases.yaml](tests/testcases/testcases.yaml); When testing specific browsers, you can modify the `for browser in [...]` part in [tests/test_navigation.py](tests/test_navigation.py) to only run tests for the desired browser.

> If the test logs stuck at launching the webdriver, you may need to restart the containers.
Expand Down
File renamed without changes.
9 changes: 4 additions & 5 deletions tests/compose.yml → tests/end-to-end-test/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3.yml up`
# Add the `-d` flag at the end for detached execution
# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3.yml down`
version: "3"
services:
chrome-node:
image: selenium/node-chrome:4.8.3-20230404
Expand All @@ -15,7 +14,7 @@ services:
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
# - VNC_NO_PASSWORD=1
volumes:
- "..:/app:ro" # Source code
- "../..:/app:ro" # Source code
- "data:/data" # For testing downloads
ports:
- "6900:5900" # VNC port, default password: secret
Expand All @@ -32,7 +31,7 @@ services:
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
# - VNC_NO_PASSWORD=1
volumes:
- "..:/app:ro" # Source code
- "../..:/app:ro" # Source code
- "data:/data" # For testing downloads
ports:
- "6901:5900" # VNC port, default password: secret
Expand All @@ -49,7 +48,7 @@ services:
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
# - VNC_NO_PASSWORD=1
volumes:
- "..:/app:ro" # Source code
- "../..:/app:ro" # Source code
- "data:/data" # For testing downloads
ports:
- "6902:5900" # VNC port, default password: secret
Expand All @@ -66,7 +65,7 @@ services:
selenium-tests:
build: .
volumes:
- "..:/app:ro" # Source code
- "../..:/app:ro" # Source code
- "data:/data" # For testing downloads
# Attach to the container with:
# docker exec -it tests_selenium-tests_1 bash
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait

testcases_path = "/app/tests/testcases.yaml"
testcases_path = "/app/tests/testcases/testcases.yaml"
with open(testcases_path, "r") as f:
testcases = yaml.safe_load(f)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait

testcases_path = "/app/tests/testcases.yaml"
testcases_path = "/app/tests/testcases/testcases.yaml"
with open(testcases_path, "r") as f:
testcases = yaml.safe_load(f)

Expand Down
8 changes: 4 additions & 4 deletions tests/scripts/docker-compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

if [[ "$1" == "up" ]]; then
docker compose -f $DIR/../compose.yml up --build "${@:2}"
docker compose -f $DIR/../end-to-end-test/compose.yml up --build "${@:2}"
elif [[ "$1" == "pull" ]]; then
docker compose -f $DIR/../compose.yml pull
docker compose -f $DIR/../end-to-end-test/compose.yml pull
elif [[ "$1" == "down" ]]; then
docker compose -f $DIR/../compose.yml down
docker compose -f $DIR/../end-to-end-test/compose.yml down
elif [[ "$1" == "shutdown" ]]; then
docker compose -f $DIR/../compose.yml down -v --remove-orphans
docker compose -f $DIR/../end-to-end-test/compose.yml down -v --remove-orphans
fi
4 changes: 2 additions & 2 deletions tests/scripts/docker-utils/exec-selenium.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -e

docker exec -t tests-selenium-tests-1 \
python "/app/tests/$@"
docker exec -t end-to-end-test-selenium-tests-1 \
python "/app/tests/end-to-end-test/$@"
2 changes: 1 addition & 1 deletion tests/scripts/docker-utils/test-connection.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash -e

docker run --rm --network tests_default curlimages/curl:latest -s --retry 20 --retry-delay 1 --retry-connrefused $1
docker run --rm --network end-to-end-test_default curlimages/curl:latest -s --retry 20 --retry-delay 1 --retry-connrefused $1
File renamed without changes.

0 comments on commit 0ee67dd

Please sign in to comment.