Skip to content

Commit

Permalink
[ci] Update python tests
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <[email protected]>
  • Loading branch information
VietND96 committed Nov 13, 2024
1 parent 0338677 commit d18658d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 18 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/ci-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,16 @@ jobs:
fail-fast: false
matrix:
include:
- browser: chrome
os: ubuntu
- browser: edge
os: ubuntu
- browser: firefox
os: ubuntu
with:
name: Integration Tests (remote, ${{ matrix.browser }})
name: Integration Tests (remote, ${{ matrix.browser }}, ${{ matrix.os }})
browser: ${{ matrix.browser }}
os: ${{ matrix.os }}
cache-key: py-remote-${{ matrix.browser }}
run: bazel test --local_test_jobs 1 --flaky_test_attempts 3 //py:test-remote

Expand All @@ -103,10 +109,17 @@ jobs:
- browser: safari
os: macos
- browser: chrome
os: macos
os: ubuntu
- browser: edge
os: ubuntu
- browser: firefox
os: ubuntu
with:
name: Integration Tests (${{ matrix.browser }}, ${{ matrix.os }})
name: Integration Tests (local, ${{ matrix.browser }}, ${{ matrix.os }})
browser: ${{ matrix.browser }}
os: ${{ matrix.os }}
cache-key: py-browser-${{ matrix.browser }}
run: bazel test --flaky_test_attempts 3 //py:test-${{ matrix.browser }}
run: |
bazel test --flaky_test_attempts 3 //py:common-${{ matrix.browser }}
bazel test --flaky_test_attempts 3 //py:common-${{ matrix.browser }}-bidi
bazel test --flaky_test_attempts 5 //py:test-${{ matrix.browser }}
6 changes: 3 additions & 3 deletions py/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
"chrome",
"edge",
"firefox",
"ie",
# "ie",
"remote",
"safari",
"webkitgtk",
"wpewebkit",
# "webkitgtk",
# "wpewebkit",
)


Expand Down
27 changes: 16 additions & 11 deletions py/test/selenium/webdriver/marionette/mn_options_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,20 @@ def test_we_can_pass_options(self, driver, pages):
class TestUnit:
def test_ctor(self):
opts = Options()
assert opts._binary is None
assert not opts._preferences
assert opts.binary_location == ""
assert opts._preferences == {"remote.active-protocols": 3}
assert opts._profile is None
assert not opts._arguments
assert isinstance(opts.log, Log)

def test_binary(self):
opts = Options()
assert opts.binary is None
assert opts.binary_location == ""

other_binary = FirefoxBinary()
assert other_binary != opts.binary
assert other_binary != opts.binary_location
opts.binary = other_binary
assert other_binary == opts.binary
assert other_binary._start_cmd == opts.binary_location

path = "/path/to/binary"
opts.binary = path
Expand All @@ -63,16 +63,16 @@ def test_binary(self):

def test_prefs(self):
opts = Options()
assert len(opts.preferences) == 0
assert len(opts.preferences) == 1
assert isinstance(opts.preferences, dict)

opts.set_preference("spam", "ham")
assert len(opts.preferences) == 1
opts.set_preference("eggs", True)
assert len(opts.preferences) == 2
opts.set_preference("eggs", True)
assert len(opts.preferences) == 3
opts.set_preference("spam", "spam")
assert len(opts.preferences) == 2
assert opts.preferences == {"spam": "spam", "eggs": True}
assert len(opts.preferences) == 3
assert opts.preferences == {"eggs": True, "remote.active-protocols": 3, "spam": "spam"}

def test_profile(self, tmpdir_factory):
opts = Options()
Expand All @@ -99,7 +99,12 @@ def test_arguments(self):
def test_to_capabilities(self):
opts = Options()
firefox_caps = DesiredCapabilities.FIREFOX.copy()
firefox_caps.update({"pageLoadStrategy": PageLoadStrategy.normal})
firefox_caps.update(
{
"pageLoadStrategy": PageLoadStrategy.normal,
"moz:firefoxOptions": {"prefs": {"remote.active-protocols": 3}},
}
)
assert opts.to_capabilities() == firefox_caps

profile = FirefoxProfile()
Expand Down

0 comments on commit d18658d

Please sign in to comment.