Skip to content

Commit

Permalink
Merge r227291 - Unreviewed. Update W3C WebDriver imported tests.
Browse files Browse the repository at this point in the history
* imported/w3c/importer.json:
* imported/w3c/tools/webdriver/webdriver/client.py:
* imported/w3c/tools/webdriver/webdriver/protocol.py:
* imported/w3c/tools/webdriver/webdriver/servo.py: Removed.
* imported/w3c/tools/webdriver/webdriver/transport.py:
* imported/w3c/tools/wptrunner/MANIFEST.in:
* imported/w3c/tools/wptrunner/README.rst:
* imported/w3c/tools/wptrunner/docs/conf.py:
* imported/w3c/tools/wptrunner/docs/usage.rst:
* imported/w3c/tools/wptrunner/setup.py:
* imported/w3c/tools/wptrunner/tox.ini:
* imported/w3c/tools/wptrunner/wptrunner/browsers/__init__.py:
* imported/w3c/tools/wptrunner/wptrunner/browsers/b2g_setup/certtest_app.zip: Removed.
* imported/w3c/tools/wptrunner/wptrunner/browsers/chrome_android.py: Copied from WebDriverTests/imported/w3c/tools/wptrunner/wptrunner/browsers/ie.py.
* imported/w3c/tools/wptrunner/wptrunner/browsers/firefox.py:
* imported/w3c/tools/wptrunner/wptrunner/browsers/ie.py:
* imported/w3c/tools/wptrunner/wptrunner/browsers/servo.py:
* imported/w3c/tools/wptrunner/wptrunner/environment.py:
* imported/w3c/tools/wptrunner/wptrunner/executors/base.py:
* imported/w3c/tools/wptrunner/wptrunner/executors/executormarionette.py:
* imported/w3c/tools/wptrunner/wptrunner/executors/executorselenium.py:
* imported/w3c/tools/wptrunner/wptrunner/executors/executorservo.py:
* imported/w3c/tools/wptrunner/wptrunner/executors/executorservodriver.py:
* imported/w3c/tools/wptrunner/wptrunner/manifestupdate.py:
* imported/w3c/tools/wptrunner/wptrunner/metadata.py:
* imported/w3c/tools/wptrunner/wptrunner/stability.py:
* imported/w3c/tools/wptrunner/wptrunner/testloader.py:
* imported/w3c/tools/wptrunner/wptrunner/testrunner.py:
* imported/w3c/tools/wptrunner/wptrunner/tests/test_hosts.py:
* imported/w3c/tools/wptrunner/wptrunner/update/__init__.py:
* imported/w3c/tools/wptrunner/wptrunner/update/sync.py:
* imported/w3c/tools/wptrunner/wptrunner/update/tree.py:
* imported/w3c/tools/wptrunner/wptrunner/vcs.py:
* imported/w3c/tools/wptrunner/wptrunner/webdriver_server.py:
* imported/w3c/tools/wptrunner/wptrunner/wptcommandline.py:
* imported/w3c/tools/wptrunner/wptrunner/wptmanifest/tests/test_serializer.py:
* imported/w3c/tools/wptrunner/wptrunner/wptmanifest/tests/test_tokenizer.py:
* imported/w3c/tools/wptrunner/wptrunner/wptrunner.py:
* imported/w3c/tools/wptrunner/wptrunner/wpttest.py:
* imported/w3c/webdriver/tests/execute_async_script/__init__.py: Added.
* imported/w3c/webdriver/tests/execute_script/__init__.py: Added.
* imported/w3c/webdriver/tests/sessions/new_session/response.py:
  • Loading branch information
carlosgcampos committed Jan 24, 2018
1 parent f07be2b commit 0653114
Show file tree
Hide file tree
Showing 43 changed files with 287 additions and 149 deletions.
47 changes: 47 additions & 0 deletions WebDriverTests/ChangeLog
@@ -1,3 +1,50 @@
2018-01-22 Carlos Garcia Campos <cgarcia@igalia.com>

Unreviewed. Update W3C WebDriver imported tests.

* imported/w3c/importer.json:
* imported/w3c/tools/webdriver/webdriver/client.py:
* imported/w3c/tools/webdriver/webdriver/protocol.py:
* imported/w3c/tools/webdriver/webdriver/servo.py: Removed.
* imported/w3c/tools/webdriver/webdriver/transport.py:
* imported/w3c/tools/wptrunner/MANIFEST.in:
* imported/w3c/tools/wptrunner/README.rst:
* imported/w3c/tools/wptrunner/docs/conf.py:
* imported/w3c/tools/wptrunner/docs/usage.rst:
* imported/w3c/tools/wptrunner/setup.py:
* imported/w3c/tools/wptrunner/tox.ini:
* imported/w3c/tools/wptrunner/wptrunner/browsers/__init__.py:
* imported/w3c/tools/wptrunner/wptrunner/browsers/b2g_setup/certtest_app.zip: Removed.
* imported/w3c/tools/wptrunner/wptrunner/browsers/chrome_android.py: Copied from WebDriverTests/imported/w3c/tools/wptrunner/wptrunner/browsers/ie.py.
* imported/w3c/tools/wptrunner/wptrunner/browsers/firefox.py:
* imported/w3c/tools/wptrunner/wptrunner/browsers/ie.py:
* imported/w3c/tools/wptrunner/wptrunner/browsers/servo.py:
* imported/w3c/tools/wptrunner/wptrunner/environment.py:
* imported/w3c/tools/wptrunner/wptrunner/executors/base.py:
* imported/w3c/tools/wptrunner/wptrunner/executors/executormarionette.py:
* imported/w3c/tools/wptrunner/wptrunner/executors/executorselenium.py:
* imported/w3c/tools/wptrunner/wptrunner/executors/executorservo.py:
* imported/w3c/tools/wptrunner/wptrunner/executors/executorservodriver.py:
* imported/w3c/tools/wptrunner/wptrunner/manifestupdate.py:
* imported/w3c/tools/wptrunner/wptrunner/metadata.py:
* imported/w3c/tools/wptrunner/wptrunner/stability.py:
* imported/w3c/tools/wptrunner/wptrunner/testloader.py:
* imported/w3c/tools/wptrunner/wptrunner/testrunner.py:
* imported/w3c/tools/wptrunner/wptrunner/tests/test_hosts.py:
* imported/w3c/tools/wptrunner/wptrunner/update/__init__.py:
* imported/w3c/tools/wptrunner/wptrunner/update/sync.py:
* imported/w3c/tools/wptrunner/wptrunner/update/tree.py:
* imported/w3c/tools/wptrunner/wptrunner/vcs.py:
* imported/w3c/tools/wptrunner/wptrunner/webdriver_server.py:
* imported/w3c/tools/wptrunner/wptrunner/wptcommandline.py:
* imported/w3c/tools/wptrunner/wptrunner/wptmanifest/tests/test_serializer.py:
* imported/w3c/tools/wptrunner/wptrunner/wptmanifest/tests/test_tokenizer.py:
* imported/w3c/tools/wptrunner/wptrunner/wptrunner.py:
* imported/w3c/tools/wptrunner/wptrunner/wpttest.py:
* imported/w3c/webdriver/tests/execute_async_script/__init__.py: Added.
* imported/w3c/webdriver/tests/execute_script/__init__.py: Added.
* imported/w3c/webdriver/tests/sessions/new_session/response.py:

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

[GTK] WebDriver: test imported/w3c/webdriver/tests/sessions/new_session/response.py is crashing in the bots
Expand Down
2 changes: 1 addition & 1 deletion WebDriverTests/imported/w3c/importer.json
@@ -1,6 +1,6 @@
{
"repository": "https://github.com/w3c/web-platform-tests.git",
"revision": "d44e0531e8ca9b0e44a794a013b5cc42f22f5528",
"revision": "a9c9f5fd5e6567d42cc85cf8b8571e3d69785b9b",
"paths_to_import": [
"tools/webdriver",
"tools/wptrunner",
Expand Down
Expand Up @@ -4,6 +4,8 @@
import protocol
import transport

from six import string_types

from mozlog import get_default_logger

logger = get_default_logger()
Expand Down Expand Up @@ -313,7 +315,7 @@ def __setitem__(self, name, value):
cookie = {"name": name,
"value": None}

if isinstance(name, (str, unicode)):
if isinstance(name, string_types):
cookie["value"] = value
elif hasattr(value, "value"):
cookie["value"] = value.value
Expand Down
Expand Up @@ -16,7 +16,7 @@ def default(self, obj):
return [self.default(x) for x in obj]
elif isinstance(obj, webdriver.Element):
return {webdriver.Element.identifier: obj.id}
return super(ProtocolEncoder, self).default(obj)
return super(Encoder, self).default(obj)


class Decoder(json.JSONDecoder):
Expand Down
18 changes: 0 additions & 18 deletions WebDriverTests/imported/w3c/tools/webdriver/webdriver/servo.py

This file was deleted.

Expand Up @@ -4,6 +4,7 @@

import error

from six import text_type

"""Implements HTTP transport for the WebDriver wire protocol."""

Expand Down Expand Up @@ -135,7 +136,7 @@ def send(self,
except ValueError:
raise ValueError("Failed to encode request body as JSON:\n"
"%s" % json.dumps(body, indent=2))
if isinstance(payload, unicode):
if isinstance(payload, text_type):
payload = body.encode("utf-8")

if headers is None:
Expand Down
1 change: 0 additions & 1 deletion WebDriverTests/imported/w3c/tools/wptrunner/MANIFEST.in
@@ -1,6 +1,5 @@
exclude MANIFEST.in
include requirements.txt
include wptrunner/browsers/b2g_setup/*
include wptrunner.default.ini
include wptrunner/testharness_runner.html
include wptrunner/*.js
Expand Down
2 changes: 1 addition & 1 deletion WebDriverTests/imported/w3c/tools/wptrunner/README.rst
Expand Up @@ -23,7 +23,7 @@ The ``wptrunner`` command takes multiple options, of which the
following are most significant:

``--product`` (defaults to `firefox`)
The product to test against: `b2g`, `chrome`, `firefox`, or `servo`.
The product to test against: `chrome`, `firefox`, or `servo`.

``--binary`` (required if product is `firefox` or `servo`)
The path to a binary file for the product (browser) to test against.
Expand Down
22 changes: 11 additions & 11 deletions WebDriverTests/imported/w3c/tools/wptrunner/docs/conf.py
Expand Up @@ -186,22 +186,22 @@
# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'wptrunner.tex', u'wptrunner Documentation',
u'James Graham', 'manual'),
('index', 'wptrunner.tex', u'wptrunner Documentation',
u'James Graham', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -244,9 +244,9 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'wptrunner', u'wptrunner Documentation',
u'James Graham', 'wptrunner', 'One line description of project.',
'Miscellaneous'),
('index', 'wptrunner', u'wptrunner Documentation',
u'James Graham', 'wptrunner', 'One line description of project.',
'Miscellaneous'),
]

# Documents to append as an appendix to all manuals.
Expand Down
2 changes: 1 addition & 1 deletion WebDriverTests/imported/w3c/tools/wptrunner/docs/usage.rst
Expand Up @@ -54,7 +54,7 @@ A test run is started using the ``wptrunner`` command. The command
takes multiple options, of which the following are most significant:

``--product`` (defaults to `firefox`)
The product to test against: `b2g`, `chrome`, `firefox`, or `servo`.
The product to test against: `chrome`, `firefox`, or `servo`.

``--binary`` (required if product is `firefox` or `servo`)
The path to a binary file for the product (browser) to test against.
Expand Down
3 changes: 1 addition & 2 deletions WebDriverTests/imported/w3c/tools/wptrunner/setup.py
Expand Up @@ -53,13 +53,12 @@
"config.json",
"wptrunner.default.ini",
"browsers/server-locations.txt",
"browsers/b2g_setup/*",
"browsers/sauce_setup/*",
"prefs/*"]},
include_package_data=True,
data_files=[("requirements", requirements_files)],
install_requires=deps
)
)

if "install" in sys.argv:
path = os.path.relpath(os.path.join(sys.prefix, "requirements"), os.curdir)
Expand Down
39 changes: 38 additions & 1 deletion WebDriverTests/imported/w3c/tools/wptrunner/tox.ini
Expand Up @@ -2,7 +2,7 @@
xfail_strict=true

[tox]
envlist = {py27,pypy}-{base,b2g,chrome,firefox,servo}
envlist = {py27,pypy}-{base,chrome,firefox,servo},py27-flake8

[testenv]
deps =
Expand All @@ -15,3 +15,40 @@ deps =
servo: -r{toxinidir}/requirements_servo.txt

commands = pytest --cov

[testenv:py27-flake8]
# flake8 versions should be kept in sync across tools/tox.ini, tools/wpt/tox.ini, and tools/wptrunner/tox.ini
deps =
flake8==3.5.0
pycodestyle==2.3.1
pyflakes==1.6.0
pep8-naming==0.4.1

commands =
flake8

[flake8]
# flake8 config should be kept in sync across tools/tox.ini, tools/wpt/tox.ini, and tools/wptrunner/tox.ini
select = E,W,F,N
# E128: continuation line under-indented for visual indent
# E129: visually indented line with same indent as next logical line
# E221: multiple spaces before operator
# E226: missing whitespace around arithmetic operator
# E231: missing whitespace after ‘,’, ‘;’, or ‘:’
# E251: unexpected spaces around keyword / parameter equals
# E265: block comment should start with ‘# ‘
# E302: expected 2 blank lines, found 0
# E303: too many blank lines (3)
# E305: expected 2 blank lines after end of function or class
# E402: module level import not at top of file
# E731: do not assign a lambda expression, use a def
# E901: SyntaxError or IndentationError
# W601: .has_key() is deprecated, use ‘in’
# F401: module imported but unused
# F403: ‘from module import *’ used; unable to detect undefined names
# F405: name may be undefined, or defined from star imports: module
# F841: local variable name is assigned to but never used
# N801: class names should use CapWords convention
# N802: function name should be lowercase
ignore = E128,E129,E221,E226,E231,E251,E265,E302,E303,E305,E402,E731,E901,W601,F401,F403,F405,F841,N801,N802
max-line-length = 141
Expand Up @@ -23,6 +23,7 @@
"""

product_list = ["chrome",
"chrome_android",
"edge",
"firefox",
"ie",
Expand Down
Binary file not shown.
@@ -0,0 +1,98 @@
from .base import Browser, ExecutorBrowser, require_arg
from ..webdriver_server import ChromeDriverServer
from ..executors import executor_kwargs as base_executor_kwargs
from ..executors.executorselenium import (SeleniumTestharnessExecutor,
SeleniumRefTestExecutor)
from ..executors.executorchrome import ChromeDriverWdspecExecutor


__wptrunner__ = {"product": "chrome_android",
"check_args": "check_args",
"browser": "ChromeAndroidBrowser",
"executor": {"testharness": "SeleniumTestharnessExecutor",
"reftest": "SeleniumRefTestExecutor",
"wdspec": "ChromeDriverWdspecExecutor"},
"browser_kwargs": "browser_kwargs",
"executor_kwargs": "executor_kwargs",
"env_extras": "env_extras",
"env_options": "env_options"}


def check_args(**kwargs):
require_arg(kwargs, "webdriver_binary")


def browser_kwargs(test_type, run_info_data, **kwargs):
return {"binary": kwargs["binary"],
"webdriver_binary": kwargs["webdriver_binary"],
"webdriver_args": kwargs.get("webdriver_args")}


def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
**kwargs):
from selenium.webdriver import DesiredCapabilities

executor_kwargs = base_executor_kwargs(test_type, server_config,
cache_manager, **kwargs)
executor_kwargs["close_after_done"] = True
capabilities = dict(DesiredCapabilities.CHROME.items())
capabilities["chromeOptions"] = {}
# required to start on mobile
capabilities["chromeOptions"]["androidPackage"] = "com.android.chrome"

for (kwarg, capability) in [("binary", "binary"), ("binary_args", "args")]:
if kwargs[kwarg] is not None:
capabilities["chromeOptions"][capability] = kwargs[kwarg]
if test_type == "testharness":
capabilities["useAutomationExtension"] = False
capabilities["excludeSwitches"] = ["enable-automation"]
if test_type == "wdspec":
capabilities["chromeOptions"]["w3c"] = True
executor_kwargs["capabilities"] = capabilities
return executor_kwargs


def env_extras(**kwargs):
return []


def env_options():
return {"host": "web-platform.test",
"bind_hostname": "true"}


class ChromeAndroidBrowser(Browser):
"""Chrome is backed by chromedriver, which is supplied through
``wptrunner.webdriver.ChromeDriverServer``.
"""

def __init__(self, logger, binary, webdriver_binary="chromedriver",
webdriver_args=None):
"""Creates a new representation of Chrome. The `binary` argument gives
the browser binary to use for testing."""
Browser.__init__(self, logger)
self.binary = binary
self.server = ChromeDriverServer(self.logger,
binary=webdriver_binary,
args=webdriver_args)

def start(self, **kwargs):
self.server.start(block=False)

def stop(self, force=False):
self.server.stop(force=force)

def pid(self):
return self.server.pid

def is_alive(self):
# TODO(ato): This only indicates the driver is alive,
# and doesn't say anything about whether a browser session
# is active.
return self.server.is_alive()

def cleanup(self):
self.stop()

def executor_browser(self):
return ExecutorBrowser, {"webdriver_url": self.server.url}
Expand Up @@ -96,15 +96,15 @@ def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
executor_kwargs["reftest_internal"] = kwargs["reftest_internal"]
executor_kwargs["reftest_screenshot"] = kwargs["reftest_screenshot"]
if test_type == "wdspec":
fxOptions = {}
options = {}
if kwargs["binary"]:
fxOptions["binary"] = kwargs["binary"]
options["binary"] = kwargs["binary"]
if kwargs["binary_args"]:
fxOptions["args"] = kwargs["binary_args"]
fxOptions["prefs"] = {
options["args"] = kwargs["binary_args"]
options["prefs"] = {
"network.dns.localDomains": ",".join(hostnames)
}
capabilities["moz:firefoxOptions"] = fxOptions
capabilities["moz:firefoxOptions"] = options
if kwargs["certutil_binary"] is None:
capabilities["acceptInsecureCerts"] = True
if capabilities:
Expand Down Expand Up @@ -364,7 +364,7 @@ def setup_ssl(self):

env[env_var] = (os.path.pathsep.join([certutil_dir, env[env_var]])
if env_var in env else certutil_dir).encode(
sys.getfilesystemencoding() or 'utf-8', 'replace')
sys.getfilesystemencoding() or 'utf-8', 'replace')

def certutil(*args):
cmd = [self.certutil_binary] + list(args)
Expand Down

0 comments on commit 0653114

Please sign in to comment.