Skip to content
Merged
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
22 changes: 11 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ jobs:
run: python build_package.py
- name: Install
run: python -m playwright install
- name: Test
- name: Test Sync API
if: matrix.os != 'ubuntu-latest'
run: pytest -vv --browser=${{ matrix.browser }} --junitxml=junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.browser }}.xml --timeout 90
- name: Test
run: pytest -vv tests/sync --browser=${{ matrix.browser }} --timeout 90
- name: Test Sync API
if: matrix.os == 'ubuntu-latest'
run: xvfb-run pytest -vv --browser=${{ matrix.browser }} --junitxml=junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.browser }}.xml --timeout 90
- name: Upload pytest test results
uses: actions/upload-artifact@v1
with:
name: pytest-results-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.browser }}.xml
path: junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.browser }}.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
run: xvfb-run pytest -vv tests/sync --browser=${{ matrix.browser }} --timeout 90
- name: Test Async API
if: matrix.os != 'ubuntu-latest'
run: pytest -vv tests/async --browser=${{ matrix.browser }} --timeout 90
- name: Test Async API
if: matrix.os == 'ubuntu-latest'
run: xvfb-run pytest -vv tests/async --browser=${{ matrix.browser }} --timeout 90

test-package-installations:
name: Test package installations
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions tests/sync/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
from playwright import sync_playwright


@pytest.fixture
@pytest.fixture(scope="session")
def playwright():
with sync_playwright() as p:
yield p


@pytest.fixture
@pytest.fixture(scope="session")
def browser(playwright, browser_name, launch_arguments):
browser_type = None
if browser_name == "chromium":
Expand Down
10 changes: 4 additions & 6 deletions tests/sync/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,10 @@ def test_sync_workers_page_workers(page: Page, server):


def test_sync_playwright_multiple_times():
with sync_playwright() as pw1:
assert pw1.chromium
with pytest.raises(Error) as exc:
with sync_playwright() as pw2:
assert pw1.chromium == pw2.chromium
assert "Can only run one Playwright at a time." in exc.value.message
with pytest.raises(Error) as exc:
with sync_playwright() as pw:
assert pw.chromium
assert "Can only run one Playwright at a time." in exc.value.message


def test_sync_set_default_timeout(page):
Expand Down