From 2f6dd51509f03d98d99315e59d5a62e8305b1b4e Mon Sep 17 00:00:00 2001 From: Angela Tran Date: Wed, 4 Dec 2024 01:20:48 +0000 Subject: [PATCH] chore: proof of concept where both marker and base-url are needed --- tests/playwright/pytest.ini | 4 ++++ tests/playwright/run.sh | 23 +++++++++++++++++++++-- tests/playwright/test_healthcheck.py | 8 ++++++-- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/tests/playwright/pytest.ini b/tests/playwright/pytest.ini index 03d2265ad..b4f78e4ea 100644 --- a/tests/playwright/pytest.ini +++ b/tests/playwright/pytest.ini @@ -1,2 +1,6 @@ [pytest] addopts = --tracing on -v --template=html1/index.html --report=test-results/report.html --video on +markers = + dev + test + prod diff --git a/tests/playwright/run.sh b/tests/playwright/run.sh index d390fc1e2..8c3d129d6 100755 --- a/tests/playwright/run.sh +++ b/tests/playwright/run.sh @@ -1,5 +1,24 @@ #!/bin/bash -set -e +set -eux -pytest +ENV=$1 + +if [ $# -ne 1 ]; then + echo "No environment given... running against local environment" +else + MARK="-m ${ENV}" +fi + +if [ "$ENV" = "dev" ]; then + BASE_URL="https://dev-benefits.calitp.org" +elif [ "$ENV" = "test" ]; then + BASE_URL="https://test-benefits.calitp.org" +elif [ "$ENV" = "prod" ]; then + BASE_URL="https://benefits.calitp.org" +else + BASE_URL="http://localhost:11369" + MARK="" +fi + +pytest --base-url "$BASE_URL" "$MARK" diff --git a/tests/playwright/test_healthcheck.py b/tests/playwright/test_healthcheck.py index 51b6ce967..a85772162 100644 --- a/tests/playwright/test_healthcheck.py +++ b/tests/playwright/test_healthcheck.py @@ -1,7 +1,11 @@ from playwright.sync_api import Page, expect +import pytest -def test_dev_healthcheck(page: Page): - page.goto("https://dev-benefits.calitp.org/healthcheck") +@pytest.mark.dev +@pytest.mark.test +@pytest.mark.prod +def test_healthcheck(page: Page): + page.goto("/healthcheck") expect(page.get_by_text("Healthy")).to_be_visible()