Skip to content

Commit

Permalink
Fix github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Archmonger committed Oct 5, 2024
1 parent 5ffc34f commit 8b057b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 2 additions & 4 deletions docs/src/about/code.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,10 @@ By running the command below you can run the full test suite:
nox -t test
```

Or, if you want to run the tests in the foreground with a visible browser window, run:

<!-- TODO: Change `headed` to `headless` -->
Or, if you want to run the tests in the background run:

```bash linenums="0"
nox -t test -- --headed
nox -t test -- --headless
```

## Creating a pull request
Expand Down
7 changes: 5 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import asyncio
import os
import sys

import pytest
from playwright.async_api import async_playwright
from reactpy.testing import BackendFixture, DisplayFixture

GITHUB_ACTIONS = os.getenv("GITHUB_ACTIONS", "").lower() == "true"


def pytest_addoption(parser) -> None:
parser.addoption(
"--headless",
dest="headless",
action="store_false",
action="store_true",
help="Hide the browser window when running web-based tests",
)

Expand All @@ -33,4 +36,4 @@ async def backend():
@pytest.fixture
async def browser(pytestconfig):
async with async_playwright() as pw:
yield await pw.chromium.launch(headless=False)
yield await pw.chromium.launch(headless=True if GITHUB_ACTIONS else pytestconfig.getoption("headless"))

0 comments on commit 8b057b2

Please sign in to comment.