Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Research: run Playwright tests based on marker and base-url #2560

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tests/playwright/pytest.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
[pytest]
addopts = --tracing on -v --template=html1/index.html --report=test-results/report.html --video on
markers =
dev
test
prod
23 changes: 21 additions & 2 deletions tests/playwright/run.sh
Original file line number Diff line number Diff line change
@@ -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"
8 changes: 6 additions & 2 deletions tests/playwright/test_healthcheck.py
Original file line number Diff line number Diff line change
@@ -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()
Loading