Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: microsoft/playwright-python
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.22.0
Choose a base ref
...
head repository: microsoft/playwright-python
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.30.0
Choose a head ref

Commits on May 26, 2022

  1. Copy the full SHA
    50fbc75 View commit details

Commits on May 27, 2022

  1. Copy the full SHA
    4ccde4a View commit details
  2. Copy the full SHA
    be4892e View commit details

Commits on May 31, 2022

  1. Copy the full SHA
    f25b954 View commit details
  2. Copy the full SHA
    be9b5f7 View commit details
  3. Copy the full SHA
    869e5f5 View commit details

Commits on Jun 1, 2022

  1. Copy the full SHA
    7db9d6b View commit details
  2. Copy the full SHA
    d280b93 View commit details
  3. Copy the full SHA
    b116502 View commit details

Commits on Jun 2, 2022

  1. build(deps): bump pillow from 9.1.0 to 9.1.1 (#1343)

    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Jun 2, 2022
    Copy the full SHA
    a02f10b View commit details

Commits on Jun 8, 2022

  1. Copy the full SHA
    b23a29c View commit details

Commits on Jun 14, 2022

  1. Copy the full SHA
    e586c66 View commit details

Commits on Jun 15, 2022

  1. Copy the full SHA
    f4c8019 View commit details

Commits on Jun 17, 2022

  1. Copy the full SHA
    724f4e0 View commit details

Commits on Jun 22, 2022

  1. Copy the full SHA
    5d33195 View commit details

Commits on Jun 24, 2022

  1. Copy the full SHA
    034511f View commit details
  2. chore(roll): roll Playwright to 1.23.0-beta-1656026605000 (1/n) (#1374)

    This is part 1/n of the 1.23 port.
    
    Relates #1308.
    
    Ports:
    
      - [x] microsoft/playwright@fe0afd6 (fix(toHaveProperty): serialize falsy arguments as well (#14232))
      - [x] microsoft/playwright@4c2fc6b (feat(browser): add Browser.BrowserType() method (#14468))
      - [x] microsoft/playwright@fccee89 (feat: add Response.fromServiceWorker flag (#14715))
      - [x] microsoft/playwright@85d0371 (feat: add allow/block serviceWorkers option (#14714))
      - [x] microsoft/playwright@c7a28ac (fix(test runner): collect artifacts when calling `browser.close()` (#14797))
      - [x] microsoft/playwright@cdb8627 (fix(page): "load" event should fire before "waitForLoadState" resolves (#14897))
      - [x] microsoft/playwright@7f026dd Language override behavior changed upstream in WebKit/WebKit@039ebd9
    rwoll authored Jun 24, 2022
    Copy the full SHA
    f742da9 View commit details
  3. Copy the full SHA
    0e3a502 View commit details

Commits on Jun 27, 2022

  1. chore: expose local_utils (#1383)

    This is part 4/n of the 1.23 port.
    
    Relates #1308, #1374, #1376, #1382
    
    Ports:
    
    - [x] microsoft/playwright@176ab7e (chore: make LocalUtils easily available on the client (#14717))
    rwoll authored Jun 27, 2022
    Copy the full SHA
    7b9ac37 View commit details
  2. chore: port record_har_* options (content, mode, url_filter) (#1382)

    This is part 3/n of the 1.23 port.
    
    Relates #1308, #1374, #1376.
    
    Ports:
    
    - [x] microsoft/playwright@fdcdd58 (feat(har): introduce urlFilter (#14693))
    - [x] microsoft/playwright@c349c1d (feat: newContext.har (#14892))
    - [x] microsoft/playwright@245c33a (feat(har): allow storing content as separate files (#14934))
    - [x] microsoft/playwright@be64e9c (chore(har): attach resources for .zip hars (#14938))
    - [x] microsoft/playwright@7bd7271 (feat(har): introduce the slim mode (#15053))
    rwoll authored Jun 27, 2022
    Copy the full SHA
    84d94a3 View commit details
  3. chore: port route chaining, fallback, async, times (#1376)

    This is part 2/n of the 1.23 port.
    
    Relates #1308, #1374
    
    Ports:
    
      - [x] microsoft/playwright@a1324bd (fix(route): support route w/ async handler & times (#14317))
      - [x] microsoft/playwright@7a568a2 (feat(route): chain routes (#14771))
      - [x] microsoft/playwright@dcdd3c3 (feat(route): explicitly fall back to the next handler (#14834))
      - [x] microsoft/playwright@9cf068a (feat(fallback): allow falling back w/ overrides (#14849))
      - [x] microsoft/playwright@48f9867 (chore: remove stray fallback overrides check)
      - [x] microsoft/playwright@ae6f48c (fix(route): match against updated url while chaining (#15112))
    rwoll authored Jun 27, 2022
    Copy the full SHA
    7b424eb View commit details

Commits on Jun 28, 2022

  1. chore: port routeFromHar, roll to 1.23.0 driver (#1384)

    This is part 5/n of the 1.23 port.
    
    Relates #1308, #1374, #1376, #1382, #1383
    
    Ports:
    
      - [x] microsoft/playwright@259c8d6 (feat: Page.routeFromHar (#14870))
      - [x] microsoft/playwright@79378dd (fix: add pw:api logging to har router (#14903))
      - [x] microsoft/playwright@030e7d2 (chore(har): allow replaying from zip har (#14962))
      - [x] microsoft/playwright@ed6b14f (fix(har): restart redirected navigation (#14939))
      - [x] microsoft/playwright@e5372c3 (chore: move har router into local utils (#14967))
      - [x] microsoft/playwright@920f1d5 (chore: allow routing by uncompressed har (#14987))
      - [x] microsoft/playwright@eb87966 (feat(har): disambiguate requests by post data (#14993))
      - [x] microsoft/playwright@6af6fab (fix(har): internal redirect in renderer-initiated navigations (#15000))
      - [x] microsoft/playwright@9525bed (feat(har): re-add routeFromHAR (#15024))
    rwoll authored Jun 28, 2022
    Copy the full SHA
    b2e3b93 View commit details

Commits on Jun 30, 2022

  1. chore: port update option for routeFromHar (#1392)

    Fixes #1389.
    
    Ports:
    
      - [x] microsoft/playwright@6a8d835 (chore: allow updating har while routing (#15197))
    rwoll authored Jun 30, 2022
    Copy the full SHA
    36ff52e View commit details
  2. Copy the full SHA
    0f0c735 View commit details

Commits on Jul 4, 2022

  1. fix: emit Page on load/DOMContentLoaded (#1400)

    Fixes #1399.
    
    Ports in #1374 of microsoft/playwright@cdb8627
    was incorrect.
    rwoll authored Jul 4, 2022
    Copy the full SHA
    eb239a8 View commit details

Commits on Jul 5, 2022

  1. Copy the full SHA
    5f9d5dd View commit details
  2. Copy the full SHA
    5b3cb55 View commit details

Commits on Jul 6, 2022

  1. fix(tracing): apiName calculation for route handlers (#1409)

    test: clean up tracing tests
    mxschmitt authored Jul 6, 2022
    Copy the full SHA
    8820f30 View commit details

Commits on Jul 7, 2022

  1. Copy the full SHA
    c8d8f4a View commit details

Commits on Jul 8, 2022

  1. Copy the full SHA
    35b63a8 View commit details

Commits on Jul 13, 2022

  1. Copy the full SHA
    390940a View commit details
  2. Copy the full SHA
    1c69b53 View commit details

Commits on Jul 18, 2022

  1. Copy the full SHA
    393a060 View commit details

Commits on Jul 19, 2022

  1. chore: constrain Pattern type (#1440)

    Fixes #1415.
    
    NB: Using bytes in patterns with our code will currently explode, so
    this type constrains to hint to users to use str patterns:
    
    ```py
    await expect(page).to_have_url(re.compile(r".*/grid\.html"))
    await expect(page).to_have_url(re.compile(rb".*/grid\.html"))
    ```
    
    This change opts to constrain the type rather than allow for bytes, too.
    rwoll authored Jul 19, 2022
    Copy the full SHA
    c123ce0 View commit details

Commits on Jul 21, 2022

  1. Copy the full SHA
    67ea47b View commit details

Commits on Jul 25, 2022

  1. Copy the full SHA
    7d7e4ff View commit details

Commits on Jul 26, 2022

  1. Copy the full SHA
    6145aff View commit details

Commits on Jul 27, 2022

  1. Copy the full SHA
    5f95476 View commit details

Commits on Jul 28, 2022

  1. chore: roll Playwright to 1.25.0-alpha-jul-26-2022 (#1456)

    - Roll to fix MSEdge downloads
    
    Ports:
    
    - [chore: reparent context objects into the object (#15689)](microsoft/playwright@a198b6d)
    
    Resolves #1398.
    rwoll authored Jul 28, 2022
    Copy the full SHA
    b5273b8 View commit details

Commits on Aug 1, 2022

  1. Copy the full SHA
    bf5f0c2 View commit details

Commits on Aug 2, 2022

  1. chore: fix implicit optional (#1475)

    Resolves #1460.
    rwoll authored Aug 2, 2022
    Copy the full SHA
    2fa0b93 View commit details

Commits on Aug 4, 2022

  1. Copy the full SHA
    eecef85 View commit details
  2. 1
    Copy the full SHA
    ab6bea1 View commit details

Commits on Aug 10, 2022

  1. Copy the full SHA
    4c4e13c View commit details

Commits on Aug 11, 2022

  1. Copy the full SHA
    e1dcfff View commit details
  2. chore: roll Playwright to 1.25.0-alpha-1660067092000 (#1485)

    Co-authored-by: Max Schmitt <max@schmitt.mx>
    rwoll and mxschmitt authored Aug 11, 2022
    Copy the full SHA
    2f91de5 View commit details

Commits on Aug 12, 2022

  1. chore: fix typos (#1482)

    kianmeng authored Aug 12, 2022
    Copy the full SHA
    921f7d8 View commit details
  2. Copy the full SHA
    1afb553 View commit details

Commits on Aug 15, 2022

  1. chore: roll Playwright to 1.25.0 (#1494)

    Resolves #1465.
    rwoll authored Aug 15, 2022
    Copy the full SHA
    d27c485 View commit details
  2. Copy the full SHA
    dbba174 View commit details
Showing with 31,091 additions and 13,322 deletions.
  1. +1 −6 .gitattributes
  2. +49 −12 .github/workflows/ci.yml
  3. +3 −3 .github/workflows/publish.yml
  4. +3 −3 .github/workflows/publish_canary_docker.yml
  5. +3 −3 .github/workflows/publish_release_docker.yml
  6. +12 −6 .github/workflows/test_docker.yml
  7. +21 −0 .github/workflows/trigger_internal_tests.yml
  8. +7 −6 .pre-commit-config.yaml
  9. +3 −3 README.md
  10. +1 −0 conda_build_config.yaml
  11. 0 examples/todomvc/mvctests/__init__.py
  12. +38 −0 examples/todomvc/mvctests/test_clear_completed_button.py
  13. +28 −0 examples/todomvc/mvctests/test_counter.py
  14. +84 −0 examples/todomvc/mvctests/test_editing.py
  15. +76 −0 examples/todomvc/mvctests/test_item.py
  16. +71 −0 examples/todomvc/mvctests/test_mark_all_as_completed.py
  17. +76 −0 examples/todomvc/mvctests/test_new_todo.py
  18. +35 −0 examples/todomvc/mvctests/test_persistence.py
  19. +81 −0 examples/todomvc/mvctests/test_routing.py
  20. +28 −0 examples/todomvc/mvctests/utils.py
  21. +1 −0 examples/todomvc/requirements.txt
  22. +18 −18 local-requirements.txt
  23. +2 −4 meta.yaml
  24. +1 −1 playwright/_impl/__pyinstaller/hook-playwright.async_api.py
  25. +1 −1 playwright/_impl/__pyinstaller/hook-playwright.sync_api.py
  26. +87 −0 playwright/_impl/_api_structures.py
  27. +2 −1 playwright/_impl/_artifact.py
  28. +142 −39 playwright/_impl/_assertions.py
  29. +1 −8 playwright/_impl/_async_base.py
  30. +32 −11 playwright/_impl/_browser.py
  31. +119 −28 playwright/_impl/_browser_context.py
  32. +31 −13 playwright/_impl/_browser_type.py
  33. +163 −33 playwright/_impl/_connection.py
  34. +2 −1 playwright/_impl/_element_handle.py
  35. +91 −21 playwright/_impl/_fetch.py
  36. +106 −13 playwright/_impl/_frame.py
  37. +104 −0 playwright/_impl/_har_router.py
  38. +91 −21 playwright/_impl/_helper.py
  39. +10 −2 playwright/_impl/_impl_to_api_mapping.py
  40. +20 −8 playwright/_impl/_js_handle.py
  41. +80 −0 playwright/_impl/_json_pipe.py
  42. +33 −2 playwright/_impl/_local_utils.py
  43. +250 −15 playwright/_impl/_locator.py
  44. +190 −36 playwright/_impl/_network.py
  45. +4 −1 playwright/_impl/_object_factory.py
  46. +127 −37 playwright/_impl/_page.py
  47. +3 −2 playwright/_impl/_playwright.py
  48. +14 −1 playwright/_impl/_selectors.py
  49. +18 −13 playwright/_impl/_str_utils.py
  50. +21 −5 playwright/_impl/_sync_base.py
  51. +3 −3 playwright/_impl/_tracing.py
  52. +0 −82 playwright/_impl/_transport.py
  53. +4 −0 playwright/_impl/_video.py
  54. +21 −20 playwright/_impl/_wait_helper.py
  55. +2 −0 playwright/async_api/__init__.py
  56. +9,998 −5,915 playwright/async_api/_generated.py
  57. +2 −0 playwright/sync_api/__init__.py
  58. +14 −4 playwright/sync_api/_context_manager.py
  59. +10,898 −6,341 playwright/sync_api/_generated.py
  60. +1 −1 playwright/sync_api/_py37ThreadedChildWatcher.py
  61. +6 −2 pyproject.toml
  62. +13 −10 scripts/documentation_provider.py
  63. +5 −5 scripts/expected_api_mismatch.txt
  64. +43 −12 scripts/generate_api.py
  65. +3 −7 scripts/generate_async_api.py
  66. +4 −8 scripts/generate_sync_api.py
  67. +11 −7 setup.py
  68. +11 −10 tests/assets/client.py
  69. +1 −1 tests/assets/download-blob.html
  70. +3 −0 tests/assets/global-var.html
  71. +366 −0 tests/assets/har-fulfill.har
  72. +620 −0 tests/assets/har-redirect.har
  73. +1 −0 tests/assets/har-sha1-main-response.txt
  74. +95 −0 tests/assets/har-sha1.har
  75. +0 −69 tests/async/test_accessibility.py
  76. +356 −12 tests/async/test_assertions.py
  77. +4 −0 tests/async/test_browser.py
  78. +1 −1 tests/async/test_browsercontext.py
  79. +12 −2 tests/async/test_browsercontext_cookies.py
  80. +384 −0 tests/async/test_browsercontext_request_fallback.py
  81. +176 −0 tests/async/test_browsercontext_request_intercept.py
  82. +24 −0 tests/async/test_browsercontext_service_worker_policy.py
  83. +2 −2 tests/async/test_browsertype_connect.py
  84. +3 −3 tests/async/test_browsertype_connect_cdp.py
  85. +1 −1 tests/async/test_click.py
  86. +1 −1 tests/async/test_console.py
  87. +12 −48 tests/async/test_defaultbrowsercontext.py
  88. +37 −0 tests/async/test_device_descriptors.py
  89. +0 −5 tests/async/test_element_handle.py
  90. +35 −0 tests/async/test_evaluate.py
  91. +50 −2 tests/async/test_fetch_global.py
  92. +1 −1 tests/async/test_focus.py
  93. +3 −3 tests/async/test_geolocation.py
  94. +606 −5 tests/async/test_har.py
  95. +3 −3 tests/async/test_interception.py
  96. +4 −1 tests/async/test_launcher.py
  97. +96 −3 tests/async/test_locators.py
  98. +24 −11 tests/async/test_navigation.py
  99. +14 −1 tests/async/test_network.py
  100. +37 −181 tests/async/test_page.py
  101. +378 −0 tests/async/test_page_request_fallback.py
  102. +42 −0 tests/async/test_page_request_intercept.py
  103. +220 −0 tests/async/test_page_select_option.py
  104. +11 −3 tests/async/test_popup.py
  105. +15 −0 tests/async/test_request_continue.py
  106. +78 −0 tests/async/test_request_fulfill.py
  107. +170 −0 tests/async/test_request_intercept.py
  108. +47 −0 tests/async/test_selector_generator.py
  109. +72 −0 tests/async/test_selectors_get_by.py
  110. +35 −0 tests/async/test_selectors_text.py
  111. +163 −0 tests/async/test_tracing.py
  112. +14 −0 tests/async/test_video.py
  113. +91 −0 tests/async/test_wait_for_function.py
  114. +2 −2 tests/async/test_wait_for_url.py
  115. +4 −4 tests/async/test_websocket.py
  116. +1 −1 tests/async/test_worker.py
  117. +23 −7 tests/server.py
  118. +6 −0 tests/sync/conftest.py
  119. +0 −74 tests/sync/test_accessibility.py
  120. +469 −15 tests/sync/test_assertions.py
  121. +21 −0 tests/sync/test_browser.py
  122. +359 −0 tests/sync/test_browsercontext_request_fallback.py
  123. +123 −0 tests/sync/test_browsercontext_request_intercept.py
  124. +24 −0 tests/sync/test_browsercontext_service_worker_policy.py
  125. +1 −1 tests/sync/test_browsertype_connect.py
  126. +1 −1 tests/sync/test_browsertype_connect_cdp.py
  127. +2 −2 tests/sync/test_console.py
  128. +52 −4 tests/sync/test_fetch_global.py
  129. +28 −0 tests/sync/test_fill.py
  130. +544 −6 tests/sync/test_har.py
  131. +213 −0 tests/sync/test_locator_get_by.py
  132. +69 −3 tests/sync/test_locators.py
  133. +13 −1 tests/sync/test_network.py
  134. +19 −1 tests/sync/test_page.py
  135. +350 −0 tests/sync/test_page_request_fallback.py
  136. +28 −0 tests/sync/test_page_request_intercept.py
  137. +214 −0 tests/sync/test_page_select_option.py
  138. +360 −0 tests/sync/test_queryselector.py
  139. +75 −0 tests/sync/test_request_fulfill.py
  140. +117 −0 tests/sync/test_request_intercept.py
  141. +1 −1 tests/sync/test_sync.py
  142. +163 −0 tests/sync/test_tracing.py
  143. +23 −1 tests/sync/test_video.py
  144. +6 −6 tests/test_installation.py
  145. +20 −3 tests/test_reference_count_async.py
  146. +1 −1 utils/docker/Dockerfile.focal
  147. +5 −5 utils/docker/{Dockerfile.bionic → Dockerfile.jammy}
  148. +1 −1 utils/docker/build.sh
  149. +22 −19 utils/docker/publish_docker.sh
7 changes: 1 addition & 6 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
# text files must be lf for golden file tests to work
*.txt eol=lf
*.json eol=lf
*.py eol=lf
*.yml eol=lf
*.yaml eol=lf
*.md eol=lf
* text=auto eol=lf
61 changes: 49 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -10,14 +10,20 @@ on:
- main
- release-*

concurrency:
# For pull requests, cancel all currently-running jobs for this workflow
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
infra:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies & browsers
@@ -28,7 +34,7 @@ jobs:
python setup.py bdist_wheel
python -m playwright install --with-deps
- name: Lint
uses: pre-commit/action@v2.0.3
run: pre-commit run --show-diff-on-failure --color=always --all-files
- name: Generate APIs
run: bash scripts/update_api.sh
- name: Verify generated API is up to date
@@ -77,11 +83,23 @@ jobs:
- os: macos-11.0
python-version: '3.10'
browser: chromium
- os: windows-latest
python-version: '3.11'
browser: chromium
- os: macos-latest
python-version: '3.11'
browser: chromium
- os: ubuntu-latest
python-version: '3.11'
browser: chromium
- os: windows-latest
python-version: '3.11'
browser: chromium
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies & browsers
@@ -90,7 +108,7 @@ jobs:
pip install -r local-requirements.txt
pip install -e .
python setup.py bdist_wheel
python -m playwright install --with-deps
python -m playwright install --with-deps ${{ matrix.browser }}
- name: Common Tests
run: pytest tests/common --browser=${{ matrix.browser }} --timeout 90
- name: Test Reference count
@@ -111,7 +129,7 @@ jobs:
- name: Test Async API
if: matrix.os == 'ubuntu-latest'
run: xvfb-run pytest tests/async --browser=${{ matrix.browser }} --timeout 90
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ matrix.browser }}-${{ matrix.os }}-${{ matrix.python-version }}
@@ -135,9 +153,9 @@ jobs:
browser-channel: msedge
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies & browsers
@@ -161,7 +179,7 @@ jobs:
- name: Test Async API
if: matrix.os == 'ubuntu-latest'
run: xvfb-run pytest tests/async --browser=chromium --browser-channel=${{ matrix.browser-channel }} --timeout 90
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ matrix.browser-channel }}-${{ matrix.os }}
@@ -172,10 +190,10 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-10.15, windows-2019]
os: [ubuntu-20.04, macos-11, windows-2019]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get conda
@@ -187,3 +205,22 @@ jobs:
run: conda install conda-build conda-verify
- name: Build
run: conda build .

test_examples:
name: Examples
runs-on: ubuntu-22.04
defaults:
run:
working-directory: examples/todomvc/
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies & browsers
run: |
pip install -r requirements.txt
python -m playwright install --with-deps chromium
- name: Common Tests
run: pytest
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@ jobs:
deploy-pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
@@ -30,7 +30,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get conda
6 changes: 3 additions & 3 deletions .github/workflows/publish_canary_docker.yml
Original file line number Diff line number Diff line change
@@ -11,9 +11,9 @@ jobs:
runs-on: ubuntu-20.04
if: github.repository == 'microsoft/playwright-python'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies & browsers
@@ -27,7 +27,7 @@ jobs:
username: playwright
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker QEMU for arm64 docker builds
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
with:
platforms: arm64
- name: publish docker canary
6 changes: 3 additions & 3 deletions .github/workflows/publish_release_docker.yml
Original file line number Diff line number Diff line change
@@ -17,9 +17,9 @@ jobs:
runs-on: ubuntu-20.04
if: github.repository == 'microsoft/playwright-python'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.10"
- uses: azure/docker-login@v1
@@ -28,7 +28,7 @@ jobs:
username: playwright
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker QEMU for arm64 docker builds
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
with:
platforms: arm64
- name: Install dependencies & browsers
18 changes: 12 additions & 6 deletions .github/workflows/test_docker.yml
Original file line number Diff line number Diff line change
@@ -18,12 +18,18 @@ on:
- release-*
jobs:
build:
timeout-minutes: 60
runs-on: ubuntu-20.04
timeout-minutes: 120
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
docker-image-variant:
- focal
- jammy
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
@@ -32,10 +38,10 @@ jobs:
pip install -r local-requirements.txt
pip install -e .
- name: Build Docker image
run: bash utils/docker/build.sh --amd64 focal playwright-python:localbuild-focal
run: bash utils/docker/build.sh --amd64 ${{ matrix.docker-image-variant }} playwright-python:localbuild-${{ matrix.docker-image-variant }}
- name: Test
run: |
CONTAINER_ID="$(docker run --rm -v $(pwd):/root/playwright --name playwright-docker-test --workdir /root/playwright/ -d -t playwright-python:localbuild-focal /bin/bash)"
CONTAINER_ID="$(docker run --rm -v $(pwd):/root/playwright --name playwright-docker-test --workdir /root/playwright/ -d -t playwright-python:localbuild-${{ matrix.docker-image-variant }} /bin/bash)"
# Fix permissions for Git inside the container
docker exec "${CONTAINER_ID}" chown -R root:root /root/playwright
docker exec "${CONTAINER_ID}" pip install -r local-requirements.txt
21 changes: 21 additions & 0 deletions .github/workflows/trigger_internal_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Internal Tests"

on:
push:
branches:
- main
- release-*

jobs:
trigger:
name: "trigger"
runs-on: ubuntu-20.04
steps:
- run: |
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GH_TOKEN}" \
--data "{\"event_type\": \"playwright_tests_python\", \"client_payload\": {\"ref\": \"${GITHUB_SHA}\"}}" \
https://github.com/api/repos/microsoft/playwright-browsers/dispatches
env:
GH_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
13 changes: 7 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -2,10 +2,11 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
exclude: tests/assets/har-sha1-main-response.txt
- id: check-yaml
- id: check-toml
- id: requirements-txt-fixer
@@ -14,16 +15,16 @@ repos:
- id: check-executables-have-shebangs
- id: check-merge-conflict
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.942
rev: v0.982
hooks:
- id: mypy
additional_dependencies: [types-pyOpenSSL==21.0.3]
additional_dependencies: [types-pyOpenSSL==22.1.0.1]
- repo: https://github.com/pycqa/flake8
rev: 4.0.1
rev: 5.0.4
hooks:
- id: flake8
- repo: https://github.com/pycqa/isort
@@ -38,4 +39,4 @@ repos:
language: node
pass_filenames: false
types: [python]
additional_dependencies: ["pyright@1.1.210"]
additional_dependencies: ["pyright@1.1.278"]
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -4,9 +4,9 @@ Playwright is a Python library to automate [Chromium](https://www.chromium.org/H

| | Linux | macOS | Windows |
| :--- | :---: | :---: | :---: |
| Chromium <!-- GEN:chromium-version -->102.0.5005.40<!-- GEN:stop --> ||||
| WebKit <!-- GEN:webkit-version -->15.4<!-- GEN:stop --> ||||
| Firefox <!-- GEN:firefox-version -->99.0.1<!-- GEN:stop --> ||||
| Chromium <!-- GEN:chromium-version -->110.0.5481.38<!-- GEN:stop --> ||||
| WebKit <!-- GEN:webkit-version -->16.4<!-- GEN:stop --> ||||
| Firefox <!-- GEN:firefox-version -->108.0.2<!-- GEN:stop --> ||||

## Documentation

1 change: 1 addition & 0 deletions conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -3,3 +3,4 @@ python:
- 3.8
- 3.9
- "3.10"
- "3.11"
Empty file.
38 changes: 38 additions & 0 deletions examples/todomvc/mvctests/test_clear_completed_button.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from typing import Generator

import pytest

from playwright.sync_api import Page, expect

from .utils import TODO_ITEMS, create_default_todos


@pytest.fixture(autouse=True)
def run_around_tests(page: Page) -> Generator[None, None, None]:
# setup before a test
page.goto("https://demo.playwright.dev/todomvc")
create_default_todos(page)
# run the actual test
yield
# run any cleanup code


def test_should_display_the_correct_text(page: Page) -> None:
page.locator(".todo-list li .toggle").first.check()
expect(page.locator(".clear-completed")).to_have_text("Clear completed")


def test_should_clear_completed_items_when_clicked(page: Page) -> None:
todo_items = page.locator(".todo-list li")
todo_items.nth(1).locator(".toggle").check()
page.locator(".clear-completed").click()
expect(todo_items).to_have_count(2)
expect(todo_items).to_have_text([TODO_ITEMS[0], TODO_ITEMS[2]])


def test_should_be_hidden_when_there_are_no_items_that_are_completed(
page: Page,
) -> None:
page.locator(".todo-list li .toggle").first.check()
page.locator(".clear-completed").click()
expect(page.locator(".clear-completed")).to_be_hidden()
28 changes: 28 additions & 0 deletions examples/todomvc/mvctests/test_counter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from typing import Generator

import pytest

from playwright.sync_api import Page, expect

from .utils import TODO_ITEMS, assert_number_of_todos_in_local_storage


@pytest.fixture(autouse=True)
def run_around_tests(page: Page) -> Generator[None, None, None]:
# setup before a test
page.goto("https://demo.playwright.dev/todomvc")
# run the actual test
yield
# run any cleanup code


def test_should_display_the_current_number_of_todo_items(page: Page) -> None:
page.locator(".new-todo").fill(TODO_ITEMS[0])
page.locator(".new-todo").press("Enter")
expect(page.locator(".todo-count")).to_contain_text("1")

page.locator(".new-todo").fill(TODO_ITEMS[1])
page.locator(".new-todo").press("Enter")
expect(page.locator(".todo-count")).to_contain_text("2")

assert_number_of_todos_in_local_storage(page, 2)
Loading