Skip to content

Commit 6477870

Browse files
authored
[py][build] Python CI - add unit test job and windows integration tests to GH runners (#16362)
1 parent 6c76af1 commit 6477870

File tree

6 files changed

+32
-1
lines changed

6 files changed

+32
-1
lines changed

.github/workflows/ci-python.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,22 @@ jobs:
5454
env:
5555
TOXENV: mypy
5656

57+
unit-tests:
58+
name: Unit Tests
59+
needs: build
60+
uses: ./.github/workflows/bazel.yml
61+
strategy:
62+
fail-fast: false
63+
matrix:
64+
include:
65+
- os: ubuntu
66+
- os: macos
67+
with:
68+
name: Unit Tests (${{ matrix.os }})
69+
os: ${{ matrix.os }}
70+
cache-key: python-unit-test-${{ matrix.os }}
71+
run: bazel test //py:unit
72+
5773
remote-tests:
5874
name: Remote Tests
5975
needs: build
@@ -83,6 +99,10 @@ jobs:
8399
os: ubuntu
84100
- browser: firefox
85101
os: ubuntu
102+
- browser: chrome
103+
os: windows
104+
- browser: edge
105+
os: windows
86106
with:
87107
name: Integration Tests (${{ matrix.browser }}, ${{ matrix.os }})
88108
browser: ${{ matrix.browser }}
@@ -108,4 +128,5 @@ jobs:
108128
os: ${{ matrix.os }}
109129
cache-key: py-browser-${{ matrix.browser }}
110130
run: |
131+
bazel test --local_test_jobs 1 --flaky_test_attempts 3 --pin_browsers=true //py:common-${{ matrix.browser }}
111132
bazel test --local_test_jobs 1 --flaky_test_attempts 3 --pin_browsers=true //py:test-${{ matrix.browser }}

py/selenium/types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
17+
1718
"""Selenium type definitions."""
1819

1920
from collections.abc import Iterable

py/test/selenium/webdriver/chrome/chrome_service_tests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import os
1919
import subprocess
20+
import sys
2021
import time
2122
from unittest.mock import patch
2223

@@ -107,6 +108,9 @@ def test_log_output_null_default(driver, capfd) -> None:
107108
driver.quit()
108109

109110

111+
@pytest.mark.xfail(
112+
sys.platform == "win32", reason="chromedriver doesn't return an error on windows if you use an invalid profile path"
113+
)
110114
@pytest.mark.no_driver_after_test
111115
def test_driver_is_stopped_if_browser_cant_start(clean_driver, clean_options, driver_executable) -> None:
112116
clean_options.add_argument("--user-data-dir=/no/such/location")

py/test/selenium/webdriver/edge/edge_service_tests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import os
1919
import subprocess
20+
import sys
2021
import time
2122
from unittest.mock import patch
2223

@@ -107,6 +108,9 @@ def test_log_output_null_default(driver, capfd) -> None:
107108
driver.quit()
108109

109110

111+
@pytest.mark.xfail(
112+
sys.platform == "win32", reason="edgedriver doesn't return an error on windows if you use an invalid profile path"
113+
)
110114
@pytest.mark.no_driver_after_test
111115
def test_driver_is_stopped_if_browser_cant_start(clean_driver, clean_options, clean_service, driver_executable) -> None:
112116
clean_options.add_argument("--user-data-dir=/no/such/location")

py/test/unit/selenium/webdriver/remote/remote_connection_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def test_get_remote_connection_headers_defaults():
6565
assert headers.get("Accept") == "application/json"
6666
assert headers.get("Content-Type") == "application/json;charset=UTF-8"
6767
assert headers.get("User-Agent").startswith(f"selenium/{__version__} (python ")
68-
assert headers.get("User-Agent").split(" ")[-1] in {"windows)", "mac)", "linux)", "mac", "windows", "linux"}
68+
assert headers.get("User-Agent").split(" ")[-1].rstrip(")") in ("win32", "windows", "mac", "linux")
6969

7070

7171
def test_get_remote_connection_headers_adds_auth_header_if_pass(recwarn):

py/test/unit/selenium/webdriver/virtual_authenticator/virtual_authenticator_options_tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18+
1819
import pytest
1920

2021
from selenium.webdriver.common.virtual_authenticator import VirtualAuthenticatorOptions

0 commit comments

Comments
 (0)