Skip to content

Commit 8467750

Browse files
authored
Merge branch 'trunk' into relay-node-match
2 parents a3f3d49 + 8f40a8f commit 8467750

File tree

15 files changed

+90
-69
lines changed

15 files changed

+90
-69
lines changed

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@ body:
3535
label: Debugging Logs
3636
placeholder: |
3737
Note: the stack trace should be in the explanation section above
38-
Instructions for enabling logging can be found in the link below
38+
Instructions for enabling and referencing logs can be found in the links below
3939
render: logs
4040
- type: markdown
4141
id: link
4242
attributes:
4343
value: |
4444
**Read our [logging documentation](https://www.selenium.dev/documentation/webdriver/troubleshooting/logging/)**
45+
**Link to a [gist](https://gist.github.com/) if logs are too long**
4546
 
4647
4748
## Help us Address Your Issue Faster!

.github/workflows/ci-ruby.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,6 @@ jobs:
2222
cache-key: rb-docs
2323
run: bazel run //rb:docs
2424

25-
lint:
26-
name: Lint
27-
needs: build
28-
uses: ./.github/workflows/bazel.yml
29-
with:
30-
name: Lint
31-
cache-key: rb-lint
32-
run: bazel test //rb:lint
33-
3425
unit-tests:
3526
name: Unit Tests
3627
needs: build

.skipped-tests

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,4 @@
5757
-//rb/spec/integration/selenium/webdriver:element-chrome-bidi
5858
-//rb/spec/integration/selenium/webdriver:element-chrome-remote
5959
-//rb/spec/integration/selenium/webdriver:action_builder-firefox-beta-remote
60+
-//rb:lint

py/selenium/webdriver/remote/webdriver.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
17+
1718
"""The WebDriver implementation."""
19+
1820
import base64
1921
import contextlib
2022
import copy
@@ -343,9 +345,14 @@ def start_session(self, capabilities: dict) -> None:
343345
"""
344346

345347
caps = _create_caps(capabilities)
346-
response = self.execute(Command.NEW_SESSION, caps)["value"]
347-
self.session_id = response.get("sessionId")
348-
self.caps = response.get("capabilities")
348+
try:
349+
response = self.execute(Command.NEW_SESSION, caps)["value"]
350+
self.session_id = response.get("sessionId")
351+
self.caps = response.get("capabilities")
352+
except Exception:
353+
if self.service is not None:
354+
self.service.stop()
355+
raise
349356

350357
def _wrap_value(self, value):
351358
if isinstance(value, dict):

py/test/selenium/webdriver/chrome/chrome_service_tests.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,19 @@
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 os
1819
import subprocess
1920
import time
2021
from unittest.mock import patch
2122

2223
import pytest
2324

24-
from selenium.common.exceptions import WebDriverException
25+
from selenium.common.exceptions import SessionNotCreatedException
26+
from selenium.webdriver.chrome.options import Options
2527
from selenium.webdriver.chrome.service import Service
2628

2729

28-
@pytest.mark.xfail_chrome(raises=WebDriverException)
2930
@pytest.mark.no_driver_after_test
3031
def test_uses_chromedriver_logging(clean_driver, driver_executable) -> None:
3132
log_file = "chromedriver.log"
@@ -107,6 +108,17 @@ def test_log_output_null_default(driver, capfd) -> None:
107108
driver.quit()
108109

109110

111+
@pytest.mark.no_driver_after_test
112+
def test_driver_is_stopped_if_browser_cant_start(clean_driver) -> None:
113+
options = Options()
114+
options.add_argument("--user-data-dir=/no/such/location")
115+
service = Service()
116+
with pytest.raises(SessionNotCreatedException):
117+
clean_driver(options=options, service=service)
118+
assert not service.is_connectable()
119+
assert service.process.poll() is not None
120+
121+
110122
@pytest.fixture
111123
def service():
112124
return Service()

py/test/selenium/webdriver/common/api_example_tests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ def test_is_element_displayed(driver, pages):
239239
assert not not_visible
240240

241241

242-
@pytest.mark.xfail_chrome
242+
@pytest.mark.xfail_edge
243+
@pytest.mark.xfail_firefox(reason="https://github.com/mozilla/geckodriver/issues/2224")
243244
@pytest.mark.xfail_safari
244245
def test_move_window_position(driver, pages):
245246
pages.load("blank.html")

py/test/selenium/webdriver/common/window_tests.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def test_should_get_the_size_of_the_current_window(driver):
4545
assert size.get("height") > 0
4646

4747

48+
@pytest.mark.xfail_edge
4849
def test_should_set_the_size_of_the_current_window(driver):
4950
size = driver.get_window_size()
5051

@@ -57,13 +58,15 @@ def test_should_set_the_size_of_the_current_window(driver):
5758
assert new_size.get("height") == target_height
5859

5960

60-
@pytest.mark.xfail_chrome
6161
def test_should_get_the_position_of_the_current_window(driver):
6262
position = driver.get_window_position()
6363
assert position.get("x") >= 0
6464
assert position.get("y") >= 0
6565

6666

67+
@pytest.mark.xfail_chrome
68+
@pytest.mark.xfail_edge
69+
@pytest.mark.xfail_firefox(reason="https://github.com/mozilla/geckodriver/issues/2224")
6770
def test_should_set_the_position_of_the_current_window(driver):
6871
position = driver.get_window_position()
6972

@@ -81,7 +84,6 @@ def test_should_set_the_position_of_the_current_window(driver):
8184

8285

8386
@pytest.mark.xfail_safari(raises=WebDriverException, reason="Get Window Rect command not implemented")
84-
@pytest.mark.xfail_chrome
8587
def test_should_get_the_rect_of_the_current_window(driver):
8688
rect = driver.get_window_rect()
8789
assert rect.get("x") >= 0
@@ -90,6 +92,8 @@ def test_should_get_the_rect_of_the_current_window(driver):
9092
assert rect.get("height") >= 0
9193

9294

95+
@pytest.mark.xfail_edge
96+
@pytest.mark.xfail_firefox(reason="https://github.com/mozilla/geckodriver/issues/2224")
9397
@pytest.mark.xfail_safari(raises=WebDriverException, reason="Get Window Rect command not implemented")
9498
def test_should_set_the_rect_of_the_current_window(driver):
9599
rect = driver.get_window_rect()

py/test/selenium/webdriver/edge/edge_service_tests.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,19 @@
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 os
1819
import subprocess
1920
import time
2021
from unittest.mock import patch
2122

2223
import pytest
2324

24-
from selenium.common.exceptions import WebDriverException
25+
from selenium.common.exceptions import SessionNotCreatedException
26+
from selenium.webdriver.edge.options import Options
2527
from selenium.webdriver.edge.service import Service
2628

2729

28-
@pytest.mark.xfail_edge(raises=WebDriverException)
2930
@pytest.mark.no_driver_after_test
3031
def test_uses_edgedriver_logging(clean_driver, driver_executable) -> None:
3132
log_file = "msedgedriver.log"
@@ -107,6 +108,17 @@ def test_log_output_null_default(driver, capfd) -> None:
107108
driver.quit()
108109

109110

111+
@pytest.mark.no_driver_after_test
112+
def test_driver_is_stopped_if_browser_cant_start(clean_driver) -> None:
113+
options = Options()
114+
options.add_argument("--user-data-dir=/no/such/location")
115+
service = Service()
116+
with pytest.raises(SessionNotCreatedException):
117+
clean_driver(options=options, service=service)
118+
assert not service.is_connectable()
119+
assert service.process.poll() is not None
120+
121+
110122
@pytest.fixture
111123
def service():
112124
return Service()

py/test/selenium/webdriver/firefox/firefox_service_tests.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@
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 os
1819
import subprocess
1920
from unittest.mock import patch
2021

2122
import pytest
2223

24+
from selenium.common.exceptions import SessionNotCreatedException
2325
from selenium.webdriver import Firefox
26+
from selenium.webdriver.firefox.options import Options
2427
from selenium.webdriver.firefox.service import Service
2528

2629

@@ -61,6 +64,16 @@ def test_log_output_as_stdout(capfd) -> None:
6164
driver.quit()
6265

6366

67+
def test_driver_is_stopped_if_browser_cant_start(clean_driver) -> None:
68+
options = Options()
69+
options.add_argument("-profile=/no/such/location")
70+
service = Service()
71+
with pytest.raises(SessionNotCreatedException):
72+
clean_driver(options=options, service=service)
73+
assert not service.is_connectable()
74+
assert service.process.poll() is not None
75+
76+
6477
@pytest.fixture
6578
def service():
6679
return Service()

rb/.rubocop.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
1-
require:
2-
- rubocop-rake
3-
- rubocop-rspec
4-
51
plugins:
62
- rubocop-performance
3+
- rubocop-rake
4+
- rubocop-rspec
75

86
AllCops:
97
TargetRubyVersion: 3.1
108
NewCops: enable
119
Exclude:
1210
- !ruby/regexp /lib\/selenium\/devtools\/v\d+/
1311

14-
Capybara/RSpec/PredicateMatcher:
15-
Enabled: false
16-
17-
FactoryBot/CreateList:
18-
Enabled: false
19-
2012
Gemspec/DevelopmentDependencies:
2113
EnforcedStyle: gemspec
2214

@@ -155,10 +147,8 @@ Style/OptionalBooleanParameter:
155147
Enabled: false
156148

157149
Lint/Debugger:
158-
Enabled: true
159-
DebuggerMethods:
160-
Capybara:
161-
- save_screenshot: ~
150+
Exclude:
151+
- 'lib/selenium/webdriver/common/driver_extensions/full_page_screenshot.rb'
162152

163153
Lint/UselessConstantScoping:
164154
Enabled: false

0 commit comments

Comments
 (0)