Skip to content

Commit 441b1e7

Browse files
authored
Merge branch 'trunk' into pinned-browser-updates
2 parents ecbc5ca + 19fc217 commit 441b1e7

File tree

9 files changed

+126
-15
lines changed

9 files changed

+126
-15
lines changed

.github/workflows/ci-python.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,35 @@ jobs:
100100
fail-fast: false
101101
matrix:
102102
include:
103-
- browser: safari
104-
os: macos
105103
- browser: chrome
104+
os: ubuntu
105+
- browser: edge
106+
os: ubuntu
107+
- browser: firefox
108+
os: ubuntu
109+
with:
110+
name: Integration Tests (${{ matrix.browser }}, ${{ matrix.os }})
111+
browser: ${{ matrix.browser }}
112+
os: ${{ matrix.os }}
113+
cache-key: py-browser-${{ matrix.browser }}
114+
run: |
115+
bazel test --flaky_test_attempts 3 //py:common-${{ matrix.browser }}-bidi
116+
bazel test --local_test_jobs 1 --flaky_test_attempts 3 //py:test-${{ matrix.browser }}
117+
118+
safari-tests:
119+
name: Browser Tests
120+
needs: build
121+
uses: ./.github/workflows/bazel.yml
122+
strategy:
123+
fail-fast: false
124+
matrix:
125+
include:
126+
- browser: safari
106127
os: macos
107128
with:
108129
name: Integration Tests (${{ matrix.browser }}, ${{ matrix.os }})
109130
browser: ${{ matrix.browser }}
110131
os: ${{ matrix.os }}
111132
cache-key: py-browser-${{ matrix.browser }}
112-
run: bazel test --flaky_test_attempts 3 //py:test-${{ matrix.browser }}
133+
run: |
134+
bazel test --local_test_jobs 1 --flaky_test_attempts 3 //py:test-${{ matrix.browser }}

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,18 @@ Run unit tests with:
317317
bazel test //py:unit
318318
```
319319

320+
To run common tests with a specific browser:
321+
322+
```sh
323+
bazel test //py:common-<browsername>
324+
```
325+
326+
To run common tests with a specific browser (include BiDi tests):
327+
328+
```sh
329+
bazel test //py:common-<browsername>-bidi
330+
```
331+
320332
To run tests with a specific browser:
321333

322334
```sh

java/src/org/openqa/selenium/devtools/CdpEndpointFinder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ public static Optional<URI> getReportedUri(Capabilities caps) {
9191
break;
9292
case "firefox":
9393
key = "moz:debuggerAddress";
94+
LOG.warning(
95+
"CDP support for Firefox is deprecated and will be removed in future versions. "
96+
+ "Please switch to WebDriver BiDi.");
9497
break;
9598
default:
9699
return Optional.empty();

java/src/org/openqa/selenium/firefox/FirefoxDriver.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ private FirefoxDriver(
164164

165165
Optional<URI> reportedUri =
166166
CdpEndpointFinder.getReportedUri("moz:debuggerAddress", capabilities);
167+
168+
if (reportedUri.isPresent()) {
169+
LOG.warning(
170+
"CDP support for Firefox is deprecated and will be removed in future versions. "
171+
+ "Please switch to WebDriver BiDi.");
172+
}
173+
167174
Optional<HttpClient> client =
168175
reportedUri.map(uri -> CdpEndpointFinder.getHttpClient(factory, uri));
169176
Optional<URI> cdpUri;

javascript/node/selenium-webdriver/lib/webdriver.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,12 @@ class WebDriver {
12301230

12311231
const caps = await this.getCapabilities()
12321232

1233+
if (caps['map_'].get('browserName') === 'firefox') {
1234+
console.warn(
1235+
'CDP support for Firefox is deprecated and will be removed in future versions. Please switch to WebDriver BiDi.',
1236+
)
1237+
}
1238+
12331239
if (process.env.SELENIUM_REMOTE_URL) {
12341240
const host = new URL(process.env.SELENIUM_REMOTE_URL).host
12351241
const sessionId = await this.getSession().then((session) => session.getId())

py/test/selenium/webdriver/common/typing_tests.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
from selenium.webdriver.common.by import By
2121
from selenium.webdriver.common.keys import Keys
22+
from selenium.webdriver.support import expected_conditions as EC
23+
from selenium.webdriver.support.wait import WebDriverWait
2224

2325

2426
def test_should_fire_key_press_events(driver, pages):
@@ -49,6 +51,7 @@ def test_should_type_lower_case_letters(driver, pages):
4951
pages.load("javascriptPage.html")
5052
keyReporter = driver.find_element(by=By.ID, value="keyReporter")
5153
keyReporter.send_keys("abc def")
54+
WebDriverWait(driver, 2).until(EC.text_to_be_present_in_element_value((By.ID, "keyReporter"), "abc def"))
5255
assert keyReporter.get_attribute("value") == "abc def"
5356

5457

@@ -98,6 +101,7 @@ def test_should_be_able_to_use_arrow_keys(driver, pages):
98101
pages.load("javascriptPage.html")
99102
keyReporter = driver.find_element(by=By.ID, value="keyReporter")
100103
keyReporter.send_keys("Tet", Keys.ARROW_LEFT, "s")
104+
WebDriverWait(driver, 2).until(EC.text_to_be_present_in_element_value((By.ID, "keyReporter"), "Test"))
101105
assert keyReporter.get_attribute("value") == "Test"
102106

103107

@@ -212,6 +216,7 @@ def test_lower_case_alpha_keys(driver, pages):
212216
element = driver.find_element(by=By.ID, value="keyReporter")
213217
lowerAlphas = "abcdefghijklmnopqrstuvwxyz"
214218
element.send_keys(lowerAlphas)
219+
WebDriverWait(driver, 2).until(EC.text_to_be_present_in_element_value((By.ID, "keyReporter"), lowerAlphas))
215220
assert element.get_attribute("value") == lowerAlphas
216221

217222

@@ -235,7 +240,7 @@ def test_all_printable_keys(driver, pages):
235240
element = driver.find_element(by=By.ID, value="keyReporter")
236241
allPrintable = "!\"#$%&'()*+,-./0123456789:<=>?@ ABCDEFGHIJKLMNOPQRSTUVWXYZ [\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
237242
element.send_keys(allPrintable)
238-
243+
WebDriverWait(driver, 2).until(EC.text_to_be_present_in_element_value((By.ID, "keyReporter"), allPrintable))
239244
assert element.get_attribute("value") == allPrintable
240245
assert "up: 16" in result.text.strip()
241246

@@ -282,6 +287,7 @@ def test_special_space_keys(driver, pages):
282287
pages.load("javascriptPage.html")
283288
element = driver.find_element(by=By.ID, value="keyReporter")
284289
element.send_keys("abcd" + Keys.SPACE + "fgh" + Keys.SPACE + "ij")
290+
WebDriverWait(driver, 2).until(EC.text_to_be_present_in_element_value((By.ID, "keyReporter"), "abcd fgh ij"))
285291
assert element.get_attribute("value") == "abcd fgh ij"
286292

287293

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Licensed to the Software Freedom Conservancy (SFC) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The SFC licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Licensed to the Software Freedom Conservancy (SFC) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The SFC licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
import pytest
19+
20+
21+
@pytest.mark.no_driver_after_test
22+
def test_launch_and_close_browser(clean_driver, clean_service):
23+
driver = clean_driver(service=clean_service)
24+
driver.quit()
25+
26+
27+
@pytest.mark.no_driver_after_test
28+
def test_we_can_launch_multiple_edge_instances(clean_driver, clean_service):
29+
driver1 = clean_driver(service=clean_service)
30+
driver2 = clean_driver(service=clean_service)
31+
driver3 = clean_driver(service=clean_service)
32+
driver1.quit()
33+
driver2.quit()
34+
driver3.quit()

py/test/selenium/webdriver/marionette/mn_options_tests.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,20 @@ def test_we_can_pass_options(self, driver, pages):
4141
class TestUnit:
4242
def test_ctor(self):
4343
opts = Options()
44-
assert opts._binary is None
45-
assert not opts._preferences
44+
assert opts.binary_location == ""
45+
assert opts._preferences == {"remote.active-protocols": 3}
4646
assert opts._profile is None
4747
assert not opts._arguments
4848
assert isinstance(opts.log, Log)
4949

5050
def test_binary(self):
5151
opts = Options()
52-
assert opts.binary is None
52+
assert opts.binary_location == ""
5353

5454
other_binary = FirefoxBinary()
55-
assert other_binary != opts.binary
55+
assert other_binary != opts.binary_location
5656
opts.binary = other_binary
57-
assert other_binary == opts.binary
57+
assert other_binary._start_cmd == opts.binary_location
5858

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

6464
def test_prefs(self):
6565
opts = Options()
66-
assert len(opts.preferences) == 0
66+
assert len(opts.preferences) == 1
6767
assert isinstance(opts.preferences, dict)
6868

6969
opts.set_preference("spam", "ham")
70-
assert len(opts.preferences) == 1
71-
opts.set_preference("eggs", True)
7270
assert len(opts.preferences) == 2
71+
opts.set_preference("eggs", True)
72+
assert len(opts.preferences) == 3
7373
opts.set_preference("spam", "spam")
74-
assert len(opts.preferences) == 2
75-
assert opts.preferences == {"spam": "spam", "eggs": True}
74+
assert len(opts.preferences) == 3
75+
assert opts.preferences == {"eggs": True, "remote.active-protocols": 3, "spam": "spam"}
7676

7777
def test_profile(self, tmpdir_factory):
7878
opts = Options()
@@ -99,7 +99,12 @@ def test_arguments(self):
9999
def test_to_capabilities(self):
100100
opts = Options()
101101
firefox_caps = DesiredCapabilities.FIREFOX.copy()
102-
firefox_caps.update({"pageLoadStrategy": PageLoadStrategy.normal})
102+
firefox_caps.update(
103+
{
104+
"pageLoadStrategy": PageLoadStrategy.normal,
105+
"moz:firefoxOptions": {"prefs": {"remote.active-protocols": 3}},
106+
}
107+
)
103108
assert opts.to_capabilities() == firefox_caps
104109

105110
profile = FirefoxProfile()

0 commit comments

Comments
 (0)