Skip to content

Commit d2abd95

Browse files
committed
Unreviewed. Update W3C WebDriver imported tests.
Tools: Show full pytest failure logs. pytest truncates long lists when printing a failed assertion. This is not great for debugging and arguably it should be the default to show the full diff when comparing lists. * Scripts/webkitpy/webdriver_tests/pytest_runner.py: (run): WebDriverTests: * imported/w3c/importer.json: * imported/w3c/tools/wptrunner/requirements_sauce.txt: * imported/w3c/tools/wptrunner/tox.ini: * imported/w3c/tools/wptrunner/wptrunner/browsers/sauce.py: * imported/w3c/tools/wptrunner/wptrunner/executors/executormarionette.py: * imported/w3c/tools/wptrunner/wptrunner/executors/pytestrunner/runner.py: * imported/w3c/tools/wptrunner/wptrunner/metadata.py: * imported/w3c/webdriver/OWNERS: * imported/w3c/webdriver/tests/__init__.py: * imported/w3c/webdriver/tests/actions/mouse.py: * imported/w3c/webdriver/tests/actions/mouse_dblclick.py: * imported/w3c/webdriver/tests/actions/support/mouse.py: * imported/w3c/webdriver/tests/cookies/add_cookie.py: * imported/w3c/webdriver/tests/cookies/delete_cookie.py: * imported/w3c/webdriver/tests/cookies/get_named_cookie.py: * imported/w3c/webdriver/tests/element_send_keys/form_controls.py: Added. * imported/w3c/webdriver/tests/element_send_keys/interactability.py: * imported/w3c/webdriver/tests/interaction/element_clear.py: * imported/w3c/webdriver/tests/support/asserts.py: Canonical link: https://commits.webkit.org/198128@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227880 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 3204ffa commit d2abd95

22 files changed

Lines changed: 258 additions & 91 deletions

File tree

Tools/ChangeLog

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
2018-01-31 Carlos Garcia Campos <cgarcia@igalia.com>
2+
3+
Unreviewed. Update W3C WebDriver imported tests.
4+
5+
Show full pytest failure logs.
6+
7+
pytest truncates long lists when printing a failed assertion.
8+
This is not great for debugging and arguably it should be the
9+
default to show the full diff when comparing lists.
10+
11+
* Scripts/webkitpy/webdriver_tests/pytest_runner.py:
12+
(run):
13+
114
2018-01-30 John Wilander <wilander@apple.com>
215

316
Add callbacks to testRunner.statisticsSetShouldPartitionCookiesForHost() and testRunner.statisticsUpdateCookiePartitioning()

Tools/Scripts/webkitpy/webdriver_tests/pytest_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def run(path, args, timeout, env, expectations, ignore_param=None):
190190

191191
with TemporaryDirectory() as cache_directory:
192192
try:
193-
cmd = ['--verbose',
193+
cmd = ['-vv',
194194
'--capture=no',
195195
'--basetemp=%s' % cache_directory,
196196
'--showlocals',

WebDriverTests/ChangeLog

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
2018-01-31 Carlos Garcia Campos <cgarcia@igalia.com>
2+
3+
Unreviewed. Update W3C WebDriver imported tests.
4+
5+
* imported/w3c/importer.json:
6+
* imported/w3c/tools/wptrunner/requirements_sauce.txt:
7+
* imported/w3c/tools/wptrunner/tox.ini:
8+
* imported/w3c/tools/wptrunner/wptrunner/browsers/sauce.py:
9+
* imported/w3c/tools/wptrunner/wptrunner/executors/executormarionette.py:
10+
* imported/w3c/tools/wptrunner/wptrunner/executors/pytestrunner/runner.py:
11+
* imported/w3c/tools/wptrunner/wptrunner/metadata.py:
12+
* imported/w3c/webdriver/OWNERS:
13+
* imported/w3c/webdriver/tests/__init__.py:
14+
* imported/w3c/webdriver/tests/actions/mouse.py:
15+
* imported/w3c/webdriver/tests/actions/mouse_dblclick.py:
16+
* imported/w3c/webdriver/tests/actions/support/mouse.py:
17+
* imported/w3c/webdriver/tests/cookies/add_cookie.py:
18+
* imported/w3c/webdriver/tests/cookies/delete_cookie.py:
19+
* imported/w3c/webdriver/tests/cookies/get_named_cookie.py:
20+
* imported/w3c/webdriver/tests/element_send_keys/form_controls.py: Added.
21+
* imported/w3c/webdriver/tests/element_send_keys/interactability.py:
22+
* imported/w3c/webdriver/tests/interaction/element_clear.py:
23+
* imported/w3c/webdriver/tests/support/asserts.py:
24+
125
2018-01-26 Carlos Garcia Campos <cgarcia@igalia.com>
226

327
Unreviewed. Update W3C WebDriver imported tests.

WebDriverTests/imported/w3c/importer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"repository": "https://github.com/w3c/web-platform-tests.git",
3-
"revision": "c83b6394196c00c260f021ffd3fb7d294cc50dd4",
3+
"revision": "d848423ebc60882f98b6712d03ffe23af1ff7741",
44
"paths_to_import": [
55
"tools/webdriver",
66
"tools/wptrunner",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
mozprocess >= 0.19
22
selenium >= 3.3.0
3+
requests

WebDriverTests/imported/w3c/tools/wptrunner/tox.ini

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,21 @@
22
xfail_strict=true
33

44
[tox]
5-
envlist = {py27,pypy}-{base,chrome,firefox,servo},py27-flake8
5+
envlist = {py27,pypy}-{base,chrome,firefox,sauce,servo},py27-flake8
66

77
[testenv]
88
deps =
99
pytest>=2.9
1010
pytest-cov
1111
pytest-xdist
12+
mock
1213
-r{toxinidir}/requirements.txt
1314
chrome: -r{toxinidir}/requirements_chrome.txt
1415
firefox: -r{toxinidir}/requirements_firefox.txt
16+
sauce: -r{toxinidir}/requirements_sauce.txt
1517
servo: -r{toxinidir}/requirements_servo.txt
1618

17-
commands = pytest --cov
19+
commands = pytest {posargs:--cov}
1820

1921
[testenv:py27-flake8]
2022
# flake8 versions should be kept in sync across tools/tox.ini, tools/wpt/tox.ini, and tools/wptrunner/tox.ini

WebDriverTests/imported/w3c/tools/wptrunner/wptrunner/browsers/sauce.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,28 @@ def __enter__(self, options):
156156
"web-platform.test",
157157
"*.web-platform.test"
158158
])
159-
while not os.path.exists('./sauce_is_ready') and not self.sc_process.poll():
160-
time.sleep(5)
161159

162-
if self.sc_process.returncode is not None and self.sc_process.returncode > 0:
160+
# Timeout config vars
161+
each_sleep_secs = 1
162+
max_wait = 30
163+
kill_wait = 5
164+
165+
tot_wait = 0
166+
while not os.path.exists('./sauce_is_ready') and self.sc_process.poll() is None:
167+
if tot_wait >= max_wait:
168+
self.sc_process.terminate()
169+
while self.sc_process.poll() is None:
170+
time.sleep(each_sleep_secs)
171+
tot_wait += each_sleep_secs
172+
if tot_wait >= (max_wait + kill_wait):
173+
self.sc_process.kill()
174+
break
175+
raise SauceException("Sauce Connect Proxy was not ready after %d seconds" % tot_wait)
176+
177+
time.sleep(each_sleep_secs)
178+
tot_wait += each_sleep_secs
179+
180+
if self.sc_process.returncode is not None:
163181
raise SauceException("Unable to start Sauce Connect Proxy. Process exited with code %s", self.sc_process.returncode)
164182

165183
def __exit__(self, exc_type, exc_val, exc_tb):

WebDriverTests/imported/w3c/tools/wptrunner/wptrunner/executors/executormarionette.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,14 @@ def load_runner(self, protocol):
131131
self.logger.debug("Loading %s" % url)
132132
self.runner_handle = self.marionette.current_window_handle
133133
try:
134-
self.marionette.navigate(url)
134+
self.dismiss_alert(lambda: self.marionette.navigate(url))
135135
except Exception as e:
136136
self.logger.critical(
137137
"Loading initial page %s failed. Ensure that the "
138138
"there are no other programs bound to this port and "
139139
"that your firewall rules or network setup does not "
140140
"prevent access.\e%s" % (url, traceback.format_exc(e)))
141+
raise
141142
self.marionette.execute_script(
142143
"document.title = '%s'" % threading.current_thread().name.replace("'", '"'))
143144

@@ -157,6 +158,7 @@ def close_old_windows(self, protocol):
157158

158159
for handle in handles:
159160
try:
161+
self.dismiss_alert(lambda: self.marionette.switch_to_window(handle))
160162
self.marionette.switch_to_window(handle)
161163
self.marionette.close()
162164
except errors.NoSuchWindowException:
@@ -168,6 +170,19 @@ def close_old_windows(self, protocol):
168170
if runner_handle != self.runner_handle:
169171
self.load_runner(protocol)
170172

173+
def dismiss_alert(self, f):
174+
while True:
175+
try:
176+
f()
177+
except errors.UnexpectedAlertOpen:
178+
alert = self.marionette.switch_to_alert()
179+
try:
180+
alert.dismiss()
181+
except errors.NoAlertPresentException:
182+
pass
183+
else:
184+
break
185+
171186
def wait(self):
172187
try:
173188
socket_timeout = self.marionette.client.socket_timeout

WebDriverTests/imported/w3c/tools/wptrunner/wptrunner/executors/pytestrunner/runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def run(path, server_config, session_config, timeout=0):
5252
with TemporaryDirectory() as cache:
5353
try:
5454
pytest.main(["--strict", # turn warnings into errors
55-
"--verbose", # show each individual subtest
55+
"-vv", # show each individual subtest and full failure logs
5656
"--capture", "no", # enable stdout/stderr from tests
5757
"--basetemp", cache, # temporary directory
5858
"--showlocals", # display contents of variables in local scope

WebDriverTests/imported/w3c/tools/wptrunner/wptrunner/metadata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ def update_expected(test_paths, serve_root, log_file_names,
6565
for test in tree.iterchildren():
6666
for subtest in test.iterchildren():
6767
if subtest.new_disabled:
68-
print os.path.dirname(subtest.root.test_path) + "/" + subtest.name
68+
print "disabled: %s" % os.path.dirname(subtest.root.test_path) + "/" + subtest.name
6969
if test.new_disabled:
70-
print test.root.test_path
70+
print "disabled: %s" % test.root.test_path
7171

7272
results_changed = [item.test_path for item in expected_map.itervalues() if item.modified]
7373

0 commit comments

Comments
 (0)