Skip to content

Commit 78172a8

Browse files
committed
[py] Skip BiDi tests on browsers that don't support BiDi
1 parent 0dc57cb commit 78172a8

File tree

5 files changed

+6
-93
lines changed

5 files changed

+6
-93
lines changed

py/conftest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ def driver(request):
126126
if "WebKit" in driver_class and _platform == "Windows":
127127
pytest.skip("WebKit tests cannot be run on Windows")
128128

129+
# skip tests for drivers that don't support BiDi when --bidi is enabled
130+
if request.config.option.bidi:
131+
if driver_class in ("Ie", "Safari", "WebKitGTK", "WPEWebKit"):
132+
pytest.skip(f"{driver_class} does not support BiDi")
133+
129134
# conditionally mark tests as expected to fail based on driver
130135
marker = request.node.get_closest_marker(f"xfail_{driver_class.lower()}")
131136

py/test/selenium/webdriver/common/bidi_browser_tests.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,11 @@
2121
from selenium.webdriver.common.bidi.browser import ClientWindowState
2222

2323

24-
@pytest.mark.xfail_ie
25-
@pytest.mark.xfail_safari
26-
@pytest.mark.xfail_webkitgtk
27-
@pytest.mark.xfail_wpewebkit
2824
def test_browser_initialized(driver):
2925
"""Test that the browser module is initialized properly."""
3026
assert driver.browser is not None
3127

3228

33-
@pytest.mark.xfail_ie
34-
@pytest.mark.xfail_safari
35-
@pytest.mark.xfail_webkitgtk
36-
@pytest.mark.xfail_wpewebkit
3729
def test_create_user_context(driver):
3830
"""Test creating a user context."""
3931
user_context = driver.browser.create_user_context()
@@ -43,10 +35,6 @@ def test_create_user_context(driver):
4335
driver.browser.remove_user_context(user_context)
4436

4537

46-
@pytest.mark.xfail_ie
47-
@pytest.mark.xfail_safari
48-
@pytest.mark.xfail_webkitgtk
49-
@pytest.mark.xfail_wpewebkit
5038
def test_get_user_contexts(driver):
5139
"""Test getting user contexts."""
5240
user_context1 = driver.browser.create_user_context()
@@ -61,10 +49,6 @@ def test_get_user_contexts(driver):
6149
driver.browser.remove_user_context(user_context2)
6250

6351

64-
@pytest.mark.xfail_ie
65-
@pytest.mark.xfail_safari
66-
@pytest.mark.xfail_webkitgtk
67-
@pytest.mark.xfail_wpewebkit
6852
def test_remove_user_context(driver):
6953
"""Test removing a user context."""
7054
user_context1 = driver.browser.create_user_context()
@@ -83,10 +67,6 @@ def test_remove_user_context(driver):
8367
driver.browser.remove_user_context(user_context1)
8468

8569

86-
@pytest.mark.xfail_ie
87-
@pytest.mark.xfail_safari
88-
@pytest.mark.xfail_webkitgtk
89-
@pytest.mark.xfail_wpewebkit
9070
def test_get_client_windows(driver):
9171
"""Test getting client windows."""
9272
client_windows = driver.browser.get_client_windows()
@@ -106,19 +86,11 @@ def test_get_client_windows(driver):
10686
assert window_info.get_y() >= 0
10787

10888

109-
@pytest.mark.xfail_ie
110-
@pytest.mark.xfail_safari
111-
@pytest.mark.xfail_webkitgtk
112-
@pytest.mark.xfail_wpewebkit
11389
def test_raises_exception_when_removing_default_user_context(driver):
11490
with pytest.raises(Exception):
11591
driver.browser.remove_user_context("default")
11692

11793

118-
@pytest.mark.xfail_ie
119-
@pytest.mark.xfail_safari
120-
@pytest.mark.xfail_webkitgtk
121-
@pytest.mark.xfail_wpewebkit
12294
def test_client_window_state_constants(driver):
12395
assert ClientWindowState.FULLSCREEN == "fullscreen"
12496
assert ClientWindowState.MAXIMIZED == "maximized"

py/test/selenium/webdriver/common/bidi_network_tests.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,21 @@
2121
from selenium.webdriver.common.by import By
2222

2323

24-
@pytest.mark.xfail_ie
25-
@pytest.mark.xfail_safari
26-
@pytest.mark.xfail_webkitgtk
27-
@pytest.mark.xfail_wpewebkit
2824
def test_network_initialized(driver):
2925
assert driver.network is not None
3026

3127

32-
@pytest.mark.xfail_ie
33-
@pytest.mark.xfail_safari
34-
@pytest.mark.xfail_webkitgtk
35-
@pytest.mark.xfail_wpewebkit
3628
def test_add_intercept(driver, pages):
3729
result = driver.network._add_intercept()
3830
assert result is not None, "Intercept not added"
3931

4032

41-
@pytest.mark.xfail_ie
42-
@pytest.mark.xfail_safari
43-
@pytest.mark.xfail_webkitgtk
44-
@pytest.mark.xfail_wpewebkit
4533
def test_remove_intercept(driver):
4634
result = driver.network._add_intercept()
4735
driver.network._remove_intercept(result["intercept"])
4836
assert driver.network.intercepts == [], "Intercept not removed"
4937

5038

51-
@pytest.mark.xfail_ie
52-
@pytest.mark.xfail_safari
53-
@pytest.mark.xfail_webkitgtk
54-
@pytest.mark.xfail_wpewebkit
5539
def test_add_and_remove_request_handler(driver, pages):
5640

5741
requests = []
@@ -67,10 +51,6 @@ def callback(request: Request):
6751
assert driver.find_element(By.NAME, "login").is_displayed(), "Request not continued"
6852

6953

70-
@pytest.mark.xfail_ie
71-
@pytest.mark.xfail_safari
72-
@pytest.mark.xfail_webkitgtk
73-
@pytest.mark.xfail_wpewebkit
7454
def test_clear_request_handlers(driver, pages):
7555
requests = []
7656

@@ -91,10 +71,6 @@ def callback(request: Request):
9171

9272
@pytest.mark.xfail_chrome
9373
@pytest.mark.xfail_edge
94-
@pytest.mark.xfail_ie
95-
@pytest.mark.xfail_safari
96-
@pytest.mark.xfail_webkitgtk
97-
@pytest.mark.xfail_wpewebkit
9874
def test_continue_request(driver, pages):
9975

10076
def callback(request: Request):
@@ -108,10 +84,6 @@ def callback(request: Request):
10884

10985
@pytest.mark.xfail_chrome
11086
@pytest.mark.xfail_edge
111-
@pytest.mark.xfail_ie
112-
@pytest.mark.xfail_safari
113-
@pytest.mark.xfail_webkitgtk
114-
@pytest.mark.xfail_wpewebkit
11587
def test_continue_with_auth(driver):
11688

11789
callback_id = driver.network.add_auth_handler("user", "passwd")
@@ -122,10 +94,6 @@ def test_continue_with_auth(driver):
12294

12395
@pytest.mark.xfail_chrome
12496
@pytest.mark.xfail_edge
125-
@pytest.mark.xfail_ie
126-
@pytest.mark.xfail_safari
127-
@pytest.mark.xfail_webkitgtk
128-
@pytest.mark.xfail_wpewebkit
12997
def test_remove_auth_handler(driver):
13098
callback_id = driver.network.add_auth_handler("user", "passwd")
13199
assert callback_id is not None, "Request handler not added"

py/test/selenium/webdriver/common/bidi_script_tests.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,11 @@
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
17-
import pytest
1817

1918
from selenium.webdriver.common.by import By
2019
from selenium.webdriver.support.ui import WebDriverWait
2120

2221

23-
@pytest.mark.xfail_ie
24-
@pytest.mark.xfail_safari
25-
@pytest.mark.xfail_webkitgtk
26-
@pytest.mark.xfail_wpewebkit
2722
def test_logs_console_messages(driver, pages):
2823
pages.load("bidi/logEntryAdded.html")
2924

@@ -42,10 +37,6 @@ def test_logs_console_messages(driver, pages):
4237
assert log_entry.type_ == "console"
4338

4439

45-
@pytest.mark.xfail_ie
46-
@pytest.mark.xfail_safari
47-
@pytest.mark.xfail_webkitgtk
48-
@pytest.mark.xfail_wpewebkit
4940
def test_logs_console_errors(driver, pages):
5041
pages.load("bidi/logEntryAdded.html")
5142
log_entries = []
@@ -70,10 +61,6 @@ def log_error(entry):
7061
assert log_entry.type_ == "console"
7162

7263

73-
@pytest.mark.xfail_ie
74-
@pytest.mark.xfail_safari
75-
@pytest.mark.xfail_webkitgtk
76-
@pytest.mark.xfail_wpewebkit
7764
def test_logs_multiple_console_messages(driver, pages):
7865
pages.load("bidi/logEntryAdded.html")
7966

@@ -88,10 +75,6 @@ def test_logs_multiple_console_messages(driver, pages):
8875
assert len(log_entries) == 2
8976

9077

91-
@pytest.mark.xfail_ie
92-
@pytest.mark.xfail_safari
93-
@pytest.mark.xfail_webkitgtk
94-
@pytest.mark.xfail_wpewebkit
9578
def test_removes_console_message_handler(driver, pages):
9679
pages.load("bidi/logEntryAdded.html")
9780

py/test/selenium/webdriver/common/bidi_tests.py

Lines changed: 1 addition & 16 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
import pytest
1819

1920
from selenium.webdriver.common.by import By
@@ -23,10 +24,6 @@
2324

2425
@pytest.mark.xfail_firefox(reason="https://bugzilla.mozilla.org/show_bug.cgi?id=1819965")
2526
@pytest.mark.xfail_remote(reason="https://bugzilla.mozilla.org/show_bug.cgi?id=1819965")
26-
@pytest.mark.xfail_ie
27-
@pytest.mark.xfail_safari
28-
@pytest.mark.xfail_webkitgtk
29-
@pytest.mark.xfail_wpewebkit
3027
async def test_check_console_messages(driver, pages):
3128
async with driver.bidi_connection() as session:
3229
log = Log(driver, session)
@@ -40,10 +37,6 @@ async def test_check_console_messages(driver, pages):
4037

4138
@pytest.mark.xfail_firefox(reason="https://bugzilla.mozilla.org/show_bug.cgi?id=1819965")
4239
@pytest.mark.xfail_remote(reason="https://bugzilla.mozilla.org/show_bug.cgi?id=1819965")
43-
@pytest.mark.xfail_ie
44-
@pytest.mark.xfail_safari
45-
@pytest.mark.xfail_webkitgtk
46-
@pytest.mark.xfail_wpewebkit
4740
async def test_check_error_console_messages(driver, pages):
4841
async with driver.bidi_connection() as session:
4942
log = Log(driver, session)
@@ -57,11 +50,7 @@ async def test_check_error_console_messages(driver, pages):
5750

5851

5952
@pytest.mark.xfail_firefox
60-
@pytest.mark.xfail_ie
6153
@pytest.mark.xfail_remote
62-
@pytest.mark.xfail_safari
63-
@pytest.mark.xfail_webkitgtk
64-
@pytest.mark.xfail_wpewebkit
6554
async def test_collect_js_exceptions(driver, pages):
6655
async with driver.bidi_connection() as session:
6756
log = Log(driver, session)
@@ -73,11 +62,7 @@ async def test_collect_js_exceptions(driver, pages):
7362

7463

7564
@pytest.mark.xfail_firefox
76-
@pytest.mark.xfail_ie
7765
@pytest.mark.xfail_remote
78-
@pytest.mark.xfail_safari
79-
@pytest.mark.xfail_webkitgtk
80-
@pytest.mark.xfail_wpewebkit
8166
async def test_collect_log_mutations(driver, pages):
8267
async with driver.bidi_connection() as session:
8368
log = Log(driver, session)

0 commit comments

Comments
 (0)