Skip to content

Commit 5bf3f62

Browse files
Merge branch 'trunk' into firefox-profile
2 parents d501714 + 0a724b1 commit 5bf3f62

File tree

12 files changed

+272
-15
lines changed

12 files changed

+272
-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 --local_test_jobs 1 --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 }}

.skipped-tests

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
-//py:test-chrome-test/selenium/webdriver/chrome/chrome_launcher_tests.py
3232
-//py:test-chrome-test/selenium/webdriver/chrome/chrome_service_tests.py
3333
-//py:test-chrome-test/selenium/webdriver/chrome/proxy_tests.py
34+
-//py:test-edge-test/selenium/webdriver/edge/edge_launcher_tests.py
35+
-//py:test-edge-test/selenium/webdriver/edge/edge_service_tests.py
3436
-//rb/spec/integration/selenium/webdriver/chrome:service-chrome
3537
-//rb/spec/integration/selenium/webdriver/chrome:service-chrome-bidi
3638
-//rb/spec/integration/selenium/webdriver/chrome:service-chrome-remote

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: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
19+
def pytest_generate_tests(metafunc):
20+
if "driver" in metafunc.fixturenames and metafunc.config.option.drivers:
21+
metafunc.parametrize("driver", metafunc.config.option.drivers, indirect=True)
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()

0 commit comments

Comments
 (0)