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
77 changes: 39 additions & 38 deletions .github/workflows/ci-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,23 @@ name: CI - Python
on:
workflow_call:
inputs:
smoke:
description: Smoke tests always run; callers pass false to add the full matrix
required: false
type: boolean
default: true
compile-manager:
description: Build Selenium Manager from source instead of downloading the pinned binary
required: false
type: boolean
default: false
workflow_dispatch:
inputs:
smoke:
description: Smoke tests only (default also runs the full matrix)
required: false
type: boolean
default: false
compile-manager:
description: Build Selenium Manager from source instead of downloading the pinned binary
required: false
Expand All @@ -19,10 +29,14 @@ on:
permissions:
contents: read

# Two tiers, mutually exclusive by content. `smoke` runs on every event, including
# schedule, so the schedule-only flaky parser sees it. The full jobs run on schedule
# or dispatch and exclude the smoke tags, so they are the nightly complement of
# smoke rather than the whole tree.
jobs:
build:
name: Build
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
if: github.event_name == 'schedule' || !inputs.smoke
uses: ./.github/workflows/bazel.yml
with:
name: Build
Expand Down Expand Up @@ -55,7 +69,7 @@ jobs:

unit-tests:
name: Unit Tests
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
if: github.event_name == 'schedule' || !inputs.smoke
uses: ./.github/workflows/bazel.yml
strategy:
fail-fast: false
Expand All @@ -68,26 +82,40 @@ jobs:
python-version: ${{ matrix.python-version }}
run: bazel test --local_test_jobs 1 //py:unit

remote-tests:
name: Remote Tests
smoke:
name: ${{ matrix.os }}-smoke
uses: ./.github/workflows/bazel.yml
strategy:
fail-fast: false
matrix:
os: [windows, macos]
tag_filters: ["os-sensitive,se-manager,skip-rbe"]
include:
# RBE already runs the os-sensitive targets on Linux; ubuntu is here for what needs network.
- os: ubuntu
tag_filters: se-manager,skip-rbe
with:
name: Integration Tests Remote
name: ${{ matrix.os }}
needs-display: true
os: ${{ matrix.os }}
rerun-with-debug: true
download-artifact-name: targets
run: >
[ -s bazel-targets-py.txt ] || echo //py/... > bazel-targets-py.txt;
{ echo "tests(//py:test-remote) intersect set("; cat bazel-targets-py.txt; echo ")"; } > query.txt;
bazel query --query_file=query.txt --output=label > remote-targets.txt;
./scripts/github-actions/bazel-test-if-targets.sh
--keep_going
--flaky_test_attempts 3
--local_test_jobs 1
--target_pattern_file=remote-targets.txt
--build_tests_only
--skip_incompatible_explicit_targets
--pin_browsers=false
${{ inputs.compile-manager && '--manager=host' || '' }}
--test_tag_filters=${{ matrix.tag_filters }}
--target_pattern_file=bazel-targets-py.txt

browser-tests:
name: Browser Tests
if: github.event_name == 'schedule' || !inputs.smoke
uses: ./.github/workflows/bazel.yml
strategy:
fail-fast: false
Expand All @@ -102,39 +130,12 @@ jobs:
needs-display: true
os: ${{ matrix.os }}
rerun-with-debug: true
download-artifact-name: targets
run: >
[ -s bazel-targets-py.txt ] || echo //py/... > bazel-targets-py.txt;
{ echo "tests(//py:test-${{ matrix.browser }}) intersect set("; cat bazel-targets-py.txt; echo ")"; } > query.txt;
bazel query --query_file=query.txt --output=label > browser-targets.txt;
./scripts/github-actions/bazel-test-if-targets.sh
bazel test
--keep_going
--flaky_test_attempts 3
--local_test_jobs 1
--skip_incompatible_explicit_targets
--target_pattern_file=browser-targets.txt

selenium-manager-tests:
name: Selenium Manager Tests
uses: ./.github/workflows/bazel.yml
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
with:
name: Integration Tests Selenium Manager (${{ matrix.os }})
needs-display: true
os: ${{ matrix.os }}
rerun-with-debug: true
download-artifact-name: targets
run: >
[ -s bazel-targets-py.txt ] || echo //py/... > bazel-targets-py.txt;
./scripts/github-actions/bazel-test-if-targets.sh
--local_test_jobs 1
--flaky_test_attempts 3
--pin_browsers=false
${{ inputs.compile-manager && '--manager=host' || '' }}
--build_tests_only
--skip_incompatible_explicit_targets
--test_tag_filters=se-manager
--target_pattern_file=bazel-targets-py.txt
--test_tag_filters=-os-sensitive,-se-manager,-skip-rbe
//py:test-${{ matrix.browser }}
13 changes: 12 additions & 1 deletion py/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,13 @@ ACTIONS_TESTS = [

DRIVER_FINDER_TESTS = ["test/selenium/webdriver/common/driver_finder_tests.py"]

# Behavior that differs by host OS (window geometry, screenshots); tagged so CI
# runs these on every OS rather than only on the Linux RBE pass.
OS_SENSITIVE_TESTS = [
"test/selenium/webdriver/common/takes_screenshots_tests.py",
"test/selenium/webdriver/common/window_tests.py",
]

# Browser-specific test configuration
BROWSER_TESTS = {
"chrome": {
Expand Down Expand Up @@ -1015,6 +1022,7 @@ DEFAULT_BROWSER_TESTS = [b for b in BROWSER_TESTS if b != "ie"]
] + BROWSERS[browser]["args"],
data = BROWSERS[browser]["data"],
env_inherit = ["DISPLAY"],
extra_tags = {src: ["os-sensitive"] for src in OS_SENSITIVE_TESTS},
tags = ["no-sandbox"] + BROWSERS[browser]["tags"],
target_compatible_with = BROWSERS[browser]["target_compatible_with"],
test_suffix = browser,
Expand All @@ -1037,7 +1045,10 @@ DEFAULT_BROWSER_TESTS = [b for b in BROWSER_TESTS if b != "ie"]
] + BROWSERS[browser]["args"],
data = BROWSERS[browser]["data"],
env_inherit = ["DISPLAY"],
tags = ["no-sandbox"] + BROWSERS[browser]["tags"],
tags = [
"no-sandbox",
"os-sensitive",
] + BROWSERS[browser]["tags"],
target_compatible_with = BROWSERS[browser]["target_compatible_with"],
test_suffix = "%s-actions" % browser,
deps = [
Expand Down
12 changes: 10 additions & 2 deletions py/private/suite.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ def _strip_test_prefixes(path):
path = path[:-len(filename)] + filename[len("test_"):]
return path

def py_test_suite(name, srcs, size = None, deps = None, python_version = None, imports = None, visibility = None, test_suffix = None, **kwargs):
def py_test_suite(name, srcs, size = None, deps = None, python_version = None, imports = None, visibility = None, test_suffix = None, extra_tags = None, **kwargs):
extra_tags = extra_tags or {}
unknown = [src for src in extra_tags if src not in srcs]
if unknown:
fail("extra_tags keys not in srcs of %s: %s" % (name, unknown))
support_srcs = [src for src in srcs if not _is_test(src)]

if support_srcs:
Expand All @@ -41,14 +45,18 @@ def py_test_suite(name, srcs, size = None, deps = None, python_version = None, i

tests.append(test_name)

remaining_kwargs = dict(kwargs)
test_tags = remaining_kwargs.pop("tags", []) + extra_tags.get(src, [])

pytest_test(
name = test_name,
size = size,
srcs = [src],
deps = test_deps,
python_version = python_version,
precompile = "disabled",
**kwargs
tags = test_tags,
**remaining_kwargs
)
native.test_suite(
name = name,
Expand Down
1 change: 1 addition & 0 deletions py/test/selenium/webdriver/common/interactions_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ def test_sending_keys_to_active_element_with_modifier(driver, pages):
def test_sending_keys_to_element(driver, pages):
pages.load("formPage.html")
e = driver.find_element(By.ID, "working")
driver.execute_script('arguments[0].scrollIntoView({block: "center", inline: "nearest"});', e)

ActionChains(driver).send_keys_to_element(e, "abc").perform()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def test_sending_keys_to_active_element_with_modifier_with_keyboard(driver, page
def test_sending_keys_to_element_with_keyboard(driver, pages):
pages.load("formPage.html")
e = driver.find_element(By.ID, "working")
driver.execute_script('arguments[0].scrollIntoView({block: "center", inline: "nearest"});', e)

key_board = KeyInput("test keyboard")

Expand Down