Skip to content

Commit

Permalink
Skip screenshot tests by default
Browse files Browse the repository at this point in the history
They can be run by setting an enviroment variable.
Run the screenshot tests in CI; they will generate new screenshots,
but we only care (in CI) about checking that they don't fail.
  • Loading branch information
rebkwok committed Aug 21, 2024
1 parent 3a07c8c commit fb4d690
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

- name: Run tests
run: |
just test-all
RUN_SCREENSHOT_TESTS=True just test-all
# not actually needed for tests, but we want to make sure the dev tooling
# is still working
Expand Down
3 changes: 3 additions & 0 deletions dotenv-sample
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ OTEL_EXPORTER_CONSOLE=False

# To send to honecomb in dev, create a token for the development and set it here.
# OTEL_EXPORTER_OTLP_HEADERS="x-honeycomb-team=TOKEN34"

# Uncomment to run the tests that take docs screenshots
# RUN_SCREENSHOT_TESTS=True
10 changes: 10 additions & 0 deletions tests/functional/test_docs_screenshots.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import os
import re

import pytest
from django.conf import settings
from playwright.sync_api import expect

Expand All @@ -19,6 +21,10 @@
}


@pytest.mark.skipif(
os.getenv("RUN_SCREENSHOT_TESTS") is None,
reason="screenshot tests skipped; set RUN_SCREENSHOT_TESTS env variable",
)
def test_screenshot_from_creation_to_release(
page, live_server, context, release_files_stubber
):
Expand Down Expand Up @@ -266,6 +272,10 @@ def do_review_and_approve(username):
page.screenshot(path=settings.SCREENSHOT_DIR / "files_released.png")


@pytest.mark.skipif(
os.getenv("RUN_SCREENSHOT_TESTS") is None,
reason="screenshot tests skipped; set RUN_SCREENSHOT_TESTS env variable",
)
def test_screenshot_withdraw_request(page, context, live_server):
user = factories.create_user(**USER_DATA["author"])
release_request = factories.create_request_at_status(
Expand Down

0 comments on commit fb4d690

Please sign in to comment.