Skip to content
Permalink
Browse files
Unreviewed. Update Selenium WebDriver imported tests.
Tools:

New version of selenium uses command line options to pass driver and browser binaries to pytest instead of
environment variables.

* Scripts/webkitpy/webdriver_tests/pytest_runner.py:
(collect): Reorder the arguments to make pytest happy.
(run): Ditto.
* Scripts/webkitpy/webdriver_tests/webdriver_selenium_executor.py:
(WebDriverSeleniumExecutor.__init__): Add driver binary, browser binary and browser args as arguments.

WebDriverTests:

* imported/selenium/importer.json:
* imported/selenium/py/conftest.py:
* imported/selenium/py/selenium/__init__.py:
* imported/selenium/py/selenium/webdriver/__init__.py:
* imported/selenium/py/selenium/webdriver/common/action_chains.py:
* imported/selenium/py/selenium/webdriver/common/service.py:
* imported/selenium/py/selenium/webdriver/remote/remote_connection.py:
* imported/selenium/py/selenium/webdriver/remote/switch_to.py:
* imported/selenium/py/selenium/webdriver/remote/webdriver.py:
* imported/selenium/py/selenium/webdriver/remote/webelement.py:
* imported/selenium/py/selenium/webdriver/support/expected_conditions.py:
* imported/selenium/py/selenium/webdriver/webkitgtk/options.py:
* imported/selenium/py/test/selenium/webdriver/common/alerts_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/api_example_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/appcache_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/driver_element_finding_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/executing_async_javascript_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/frame_switching_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/interactions_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/page_load_timeout_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/position_and_size_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/rendered_webelement_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/select_class_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/visibility_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/w3c_interaction_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/webdriverwait_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/window_tests.py:

Canonical link: https://commits.webkit.org/197388@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226773 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
carlosgcampos committed Jan 11, 2018
1 parent b80779b commit 86a6e4599bdb48002dd45ff9878eec30e5d488a3
Showing with 406 additions and 259 deletions.
  1. +13 −0 Tools/ChangeLog
  2. +15 −13 Tools/Scripts/webkitpy/webdriver_tests/pytest_runner.py
  3. +7 −9 Tools/Scripts/webkitpy/webdriver_tests/webdriver_selenium_executor.py
  4. +32 −0 WebDriverTests/ChangeLog
  5. +1 −1 WebDriverTests/imported/selenium/importer.json
  6. +36 −23 WebDriverTests/imported/selenium/py/conftest.py
  7. +1 −1 WebDriverTests/imported/selenium/py/selenium/__init__.py
  8. +1 −1 WebDriverTests/imported/selenium/py/selenium/webdriver/__init__.py
  9. +2 −2 WebDriverTests/imported/selenium/py/selenium/webdriver/common/action_chains.py
  10. +3 −1 WebDriverTests/imported/selenium/py/selenium/webdriver/common/service.py
  11. +8 −2 WebDriverTests/imported/selenium/py/selenium/webdriver/remote/remote_connection.py
  12. +3 −1 WebDriverTests/imported/selenium/py/selenium/webdriver/remote/switch_to.py
  13. +121 −24 WebDriverTests/imported/selenium/py/selenium/webdriver/remote/webdriver.py
  14. +146 −19 WebDriverTests/imported/selenium/py/selenium/webdriver/remote/webelement.py
  15. +0 −1 WebDriverTests/imported/selenium/py/selenium/webdriver/support/expected_conditions.py
  16. +15 −15 WebDriverTests/imported/selenium/py/selenium/webdriver/webkitgtk/options.py
  17. +1 −68 WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/alerts_tests.py
  18. +0 −2 WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/api_example_tests.py
  19. +0 −1 WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/appcache_tests.py
  20. +0 −16 WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/driver_element_finding_tests.py
  21. +0 −2 ...iverTests/imported/selenium/py/test/selenium/webdriver/common/executing_async_javascript_tests.py
  22. +0 −15 WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/frame_switching_tests.py
  23. +0 −3 WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/interactions_tests.py
  24. +0 −4 WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/page_load_timeout_tests.py
  25. +0 −2 WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/position_and_size_tests.py
  26. +0 −3 WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/rendered_webelement_tests.py
  27. +0 −4 WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/select_class_tests.py
  28. +1 −5 WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/visibility_tests.py
  29. +0 −10 WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/w3c_interaction_tests.py
  30. +0 −3 WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/webdriverwait_tests.py
  31. +0 −8 WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/window_tests.py
@@ -1,3 +1,16 @@
2018-01-11 Carlos Garcia Campos <cgarcia@igalia.com>

Unreviewed. Update Selenium WebDriver imported tests.

New version of selenium uses command line options to pass driver and browser binaries to pytest instead of
environment variables.

* Scripts/webkitpy/webdriver_tests/pytest_runner.py:
(collect): Reorder the arguments to make pytest happy.
(run): Ditto.
* Scripts/webkitpy/webdriver_tests/webdriver_selenium_executor.py:
(WebDriverSeleniumExecutor.__init__): Add driver binary, browser binary and browser args as arguments.

2018-01-11 Ling Ho <lingcherd_ho@apple.com>

Move Commit Queue and EWS Queues to Sierra on Bot Watcher's Dasboard
@@ -132,10 +132,11 @@ def collect(directory, args):
with open(os.devnull, 'wb') as devnull:
sys.stdout = devnull
with TemporaryDirectory() as cache_directory:
pytest.main(args + ['--collect-only',
'--basetemp', cache_directory,
directory],
plugins=[collect_recorder])
cmd = ['--collect-only',
'--basetemp=%s' % cache_directory]
cmd.extend(args)
cmd.append(directory)
pytest.main(cmd, plugins=[collect_recorder])
sys.stdout = stdout
return collect_recorder.tests

@@ -149,15 +150,16 @@ def run(path, args, timeout, env={}):

with TemporaryDirectory() as cache_directory:
try:
result = pytest.main(args + ['--verbose',
'--capture=no',
'--basetemp', cache_directory,
'--showlocals',
'--timeout=%s' % timeout,
'-p', 'no:cacheprovider',
'-p', 'pytest_timeout',
path],
plugins=[harness_recorder, subtests_recorder])
cmd = ['--verbose',
'--capture=no',
'--basetemp=%s' % cache_directory,
'--showlocals',
'--timeout=%s' % timeout,
'-p', 'no:cacheprovider',
'-p', 'pytest_timeout']
cmd.extend(args)
cmd.append(path)
result = pytest.main(cmd, plugins=[harness_recorder, subtests_recorder])
if result == EXIT_INTERNALERROR:
harness_recorder.outcome = ('ERROR', None)
except Exception as e:
@@ -41,18 +41,16 @@ def do_delayed_imports():
class WebDriverSeleniumExecutor(object):

def __init__(self, driver, display_driver):
self._env = {}
self._env['WD_DRIVER_PATH'] = driver.binary_path()
browser_path = driver.browser_path()
self._env = display_driver._setup_environ_for_test()
self._env.update(driver.browser_env())

self._args = ['--driver=%s' % driver.selenium_name(), '--driver-binary=%s' % driver.binary_path().encode()]
browser_path = driver.browser_path().encode()
if browser_path:
self._env['WD_BROWSER_PATH'] = browser_path
self._args.extend(['--browser-binary=%s' % browser_path])
browser_args = driver.browser_args()
if browser_args:
self._env['WD_BROWSER_ARGS'] = ' '.join(browser_args)
self._env.update(display_driver._setup_environ_for_test())
self._env.update(driver.browser_env())

self._args = ['--driver=%s' % driver.selenium_name()]
self._args.extend(['--browser-args=%s' % ' '.join(browser_args)])

if pytest_runner is None:
do_delayed_imports()
@@ -1,3 +1,35 @@
2018-01-11 Carlos Garcia Campos <cgarcia@igalia.com>

Unreviewed. Update Selenium WebDriver imported tests.

* imported/selenium/importer.json:
* imported/selenium/py/conftest.py:
* imported/selenium/py/selenium/__init__.py:
* imported/selenium/py/selenium/webdriver/__init__.py:
* imported/selenium/py/selenium/webdriver/common/action_chains.py:
* imported/selenium/py/selenium/webdriver/common/service.py:
* imported/selenium/py/selenium/webdriver/remote/remote_connection.py:
* imported/selenium/py/selenium/webdriver/remote/switch_to.py:
* imported/selenium/py/selenium/webdriver/remote/webdriver.py:
* imported/selenium/py/selenium/webdriver/remote/webelement.py:
* imported/selenium/py/selenium/webdriver/support/expected_conditions.py:
* imported/selenium/py/selenium/webdriver/webkitgtk/options.py:
* imported/selenium/py/test/selenium/webdriver/common/alerts_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/api_example_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/appcache_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/driver_element_finding_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/executing_async_javascript_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/frame_switching_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/interactions_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/page_load_timeout_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/position_and_size_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/rendered_webelement_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/select_class_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/visibility_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/w3c_interaction_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/webdriverwait_tests.py:
* imported/selenium/py/test/selenium/webdriver/common/window_tests.py:

2018-01-10 Carlos Garcia Campos <cgarcia@igalia.com>

Unreviewed. Update W3C WebDriver imported tests.
@@ -1,6 +1,6 @@
{
"repository": "https://github.com/SeleniumHQ/selenium.git",
"revision": "57fe00346d1c4d6d3f8e33ae4d7426940e795a30",
"revision": "c5e4a585f1e3c4b3468ec93ab50d3668d47aef1b",
"paths_to_import": [
"common",
"py/conftest.py",
@@ -41,21 +41,22 @@
'Firefox',
'Ie',
'Marionette',
'PhantomJS',
'Remote',
'Safari',
'WebKitGTK',
)


def pytest_addoption(parser):
parser.addoption(
'--driver',
action='append',
choices=drivers,
dest='drivers',
metavar='DRIVER',
help='driver to run tests against ({0})'.format(', '.join(drivers)))
parser.addoption('--driver', action='append', choices=drivers, dest='drivers',
metavar='DRIVER',
help='driver to run tests against ({})'.format(', '.join(drivers)))
parser.addoption('--browser-binary', action='store', dest='binary',
help='location of the browser binary')
parser.addoption('--driver-binary', action='store', dest='executable',
help='location of the service executable binary')
parser.addoption('--browser-args', action='store', dest='args',
help='arguments to start the browser with')


def pytest_ignore_collect(path, config):
@@ -94,40 +95,52 @@ def fin():
yield
return

driver_path = request.config.option.executable
options = None

global driver_instance
if driver_instance is None:
if driver_class == 'BlackBerry':
kwargs.update({'device_password': 'password'})
if driver_class == 'Firefox':
kwargs.update({'capabilities': {'marionette': False}})
options = get_options(driver_class, request.config)
if driver_class == 'Marionette':
driver_class = 'Firefox'
options = get_options(driver_class, request.config)
if driver_class == 'Remote':
capabilities = DesiredCapabilities.FIREFOX.copy()
capabilities['marionette'] = False
kwargs.update({'desired_capabilities': capabilities})
options = get_options('Firefox', request.config)
if driver_class == 'WebKitGTK':
additional_args = {}
options = webdriver.WebKitGTKOptions()
options.overlay_scrollbars_enabled = False
browser_path = os.environ.get('WD_BROWSER_PATH')
if browser_path is not None:
options.browser_executable_path = browser_path
browser_args = os.environ.get('WD_BROWSER_ARGS')
if browser_args is not None:
for arg in browser_args.split():
options.add_browser_argument(arg)
additional_args['options'] = options
driver_path = os.environ.get('WD_DRIVER_PATH')
if driver_path is not None:
additional_args['executable_path'] = driver_path
kwargs.update(additional_args)
options = get_options(driver_class, request.config)
if driver_path is not None:
kwargs['executable_path'] = driver_path
if options is not None:
kwargs['options'] = options
driver_instance = getattr(webdriver, driver_class)(**kwargs)
yield driver_instance
if MarkEvaluator(request.node, 'no_driver_after_test').istrue():
driver_instance = None


def get_options(driver_class, config):
browser_path = config.option.binary
browser_args = config.option.args
options = None
if browser_path or browser_args:
options = getattr(webdriver, '{}Options'.format(driver_class))()
if driver_class == 'WebKitGTK':
options.overlay_scrollbars_enabled = False
if browser_path is not None:
options.binary_location = browser_path
if browser_args is not None:
for arg in browser_args.split():
options.add_argument(arg)
return options


@pytest.fixture(scope='session', autouse=True)
def stop_driver(request):
def fin():
@@ -16,4 +16,4 @@
# under the License.


__version__ = "3.8.0"
__version__ = "3.8.1"
@@ -24,4 +24,4 @@
from .common.touch_actions import TouchActions # noqa
from .common.proxy import Proxy # noqa

__version__ = '3.8.0'
__version__ = '3.8.1'
@@ -331,12 +331,12 @@ def release(self, on_element=None):
- on_element: The element to mouse up.
If None, releases on current mouse position.
"""
if on_element:
self.move_to_element(on_element)
if self._driver.w3c:
self.w3c_actions.pointer_action.release()
self.w3c_actions.key_action.pause()
else:
if on_element:
self.move_to_element(on_element)
self._actions.append(lambda: self._driver.execute(Command.MOUSE_UP, {}))
return self

@@ -71,7 +71,9 @@ def start(self):
cmd.extend(self.command_line_args())
self.process = subprocess.Popen(cmd, env=self.env,
close_fds=platform.system() != 'Windows',
stdout=self.log_file, stderr=self.log_file)
stdout=self.log_file,
stderr=self.log_file,
stdin=PIPE)
except TypeError:
raise
except OSError as err:
@@ -200,6 +200,10 @@ def __init__(self, remote_server_addr, keep_alive=False, resolve_ip=True):
port = parsed_url.port or None
if parsed_url.scheme == "https":
ip = parsed_url.hostname
elif port and not common_utils.is_connectable(port, parsed_url.hostname):
ip = None
LOGGER.info('Could not connect to port {} on host '
'{}'.format(port, parsed_url.hostname))
else:
ip = common_utils.find_connectable_ip(parsed_url.hostname,
port=port)
@@ -454,8 +458,10 @@ def execute(self, command, params):
"""
command_info = self._commands[command]
assert command_info is not None, 'Unrecognised command %s' % command
data = utils.dump_json(params)
path = string.Template(command_info[1]).substitute(params)
if hasattr(self, 'w3c') and self.w3c and isinstance(params, dict) and 'sessionId' in params:
del params['sessionId']
data = utils.dump_json(params)
url = '%s%s' % (self._url, path)
return self._request(command_info[0], url, body=data)

@@ -558,5 +564,5 @@ def _request(self, method, url, body=None):
data = {'status': 0, 'value': body.strip()}
return data
finally:
LOGGER.debug("Finished Request")
LOGGER.debug(u"Finished Request {}".format(data))
resp.close()
@@ -51,7 +51,9 @@ def alert(self):
:Usage:
alert = driver.switch_to.alert
"""
return Alert(self._driver)
alert = Alert(self._driver)
alert.text
return alert

def default_content(self):
"""

0 comments on commit 86a6e45

Please sign in to comment.