Skip to content

Commit a6b3dc5

Browse files
authored
Merge pull request #6338 from NHSDigital/e2e-doc-updates
Allow e2e to run without args
2 parents 576314a + 0af5aa8 commit a6b3dc5

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

bin/e2e

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,30 @@ RAILS_PORT="4100"
77
HEALTH_CHECK_URL="http://localhost:${RAILS_PORT}/up"
88
MAVIS_TEST_REPO="${MAVIS_TEST_REPO:-"../manage-vaccinations-in-schools-testing"}"
99
E2E_REDIS_URL="redis://localhost:6380/0"
10+
PYTEST_ARGS=("-m" "not accessibility and not reporting and not imms_api")
1011

1112
# Argument handling
1213

1314
function print_help() {
14-
echo "Usage: bin/e2e [--main] [pytest args...] <pytest-target>"
15+
echo "Usage: bin/e2e [--main] [<pytest-args> ...] <pytest-target>"
16+
echo ""
17+
echo "Runs end-to-end tests against a local Rails stack. Only the tests run in CI are"
18+
echo "run by default."
19+
echo ""
20+
echo "The pytest CLI command defaults to:"
21+
echo " uv run pytest ${PYTEST_ARGS[*]} <pytest-target>"
1522
echo ""
1623
echo "Options:"
17-
echo " --main Force sync testing repo to latest main branch. WARNING: this will discard any local changes in the testing repo."
18-
echo " -h, --help Show this help message and exit."
24+
echo " --main Force sync testing repo to latest main branch. WARNING: this"
25+
echo " will discard any local changes in the testing repo."
26+
echo " -h, --help Show this help message and exit."
27+
echo " <pytest-args> Additional arguments to pass to pytest."
1928
echo ""
20-
echo "Example:"
29+
echo "Examples:"
2130
echo " bin/e2e --main --headed tests/test_start.py::test_start_page_elements_visible"
31+
echo " bin/e2e --screenshot=only-on-failure tests/test_import_child_lists.py::test_child_list_file_upload_empty_file"
2232
}
2333

24-
if [ $# -lt 1 ]; then
25-
print_help
26-
exit 1
27-
fi
28-
2934
if ! command -v uv >/dev/null 2>&1; then
3035
echo "[e2e] ERROR: 'uv' is not installed or not on PATH." >&2
3136
echo " Install uv: https://github.com/astral-sh/uv" >&2
@@ -41,7 +46,6 @@ fi
4146

4247
# Consume --main flag if present
4348
USE_MAVIS_BRANCH=false
44-
PYTEST_ARGS=()
4549

4650
for arg in "$@"; do
4751
case "$arg" in
@@ -201,7 +205,7 @@ done
201205
pushd "$MAVIS_TEST_REPO" > /dev/null
202206

203207
echo "[e2e] Running end-to-end tests:"
204-
echo "[e2e] uv run pytest -m "not accessibility and not reporting and not imms_api" ${PYTEST_ARGS[*]}"
208+
echo "[e2e] BASE_URL=\"http://localhost:${RAILS_PORT}\" uv run pytest ${PYTEST_ARGS[*]}"
205209
BASE_URL="http://localhost:${RAILS_PORT}" uv run pytest -m "not accessibility and not reporting and not imms_api" "${PYTEST_ARGS[@]}"
206210
PYTEST_EXIT_CODE=$?
207211

0 commit comments

Comments
 (0)