Skip to content

Commit

Permalink
Update WAVE test runner (web-platform-tests#30357)
Browse files Browse the repository at this point in the history
  • Loading branch information
FritzHeiden authored Nov 16, 2021
1 parent 7a6c0b1 commit e5c7faa
Show file tree
Hide file tree
Showing 73 changed files with 16,517 additions and 2,806 deletions.
3 changes: 3 additions & 0 deletions tools/wave/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
!www/lib
!export/lib
!export/css
8 changes: 6 additions & 2 deletions tools/wave/config.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@
"automatic": 60000,
"manual": 300000
},
"enable_results_import": false,
"enable_import_results": false,
"web_root": "/_wave",
"persisting_interval": 20,
"api_titles": []
"api_titles": [],
"enable_read_sessions": false,
"event_cache_duration": 60000,
"enable_test_type_selection": false,
"enable_test_file_selection": false
}
}
24 changes: 21 additions & 3 deletions tools/wave/configuration_loader.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import os
from io import open

from tools.wpt import wpt

Expand Down Expand Up @@ -46,15 +47,24 @@ def load(configuration_file_path):
configuration["hostname"] = configuration.get(
"browser_host", default_configuration["browser_host"])

configuration["import_enabled"] = configuration.get(
configuration["import_results_enabled"] = configuration.get(
"wave", default_configuration["wave"]).get(
"enable_results_import",
default_configuration["wave"]["enable_results_import"])
"enable_import_results",
default_configuration["wave"]["enable_import_results"])

configuration["read_sessions_enabled"] = configuration.get(
"wave", default_configuration["wave"]).get(
"enable_read_sessions",
default_configuration["wave"]["enable_read_sessions"])

configuration["persisting_interval"] = configuration.get(
"wave", default_configuration["wave"]).get(
"persisting_interval", default_configuration["wave"]["persisting_interval"])

configuration["event_cache_duration"] = configuration.get(
"wave", default_configuration["wave"]).get(
"event_cache_duration", default_configuration["wave"]["event_cache_duration"])

configuration["tests_directory_path"] = os.getcwd()

configuration["manifest_file_path"] = os.path.join(
Expand All @@ -64,6 +74,14 @@ def load(configuration_file_path):
"wave", default_configuration["wave"]).get(
"api_titles", default_configuration["wave"]["api_titles"])

configuration["enable_test_type_selection"] = configuration.get(
"wave", default_configuration["wave"]).get(
"enable_test_type_selection", default_configuration["wave"]["enable_test_type_selection"])

configuration["enable_test_file_selection"] = configuration.get(
"wave", default_configuration["wave"]).get(
"enable_test_file_selection", default_configuration["wave"]["enable_test_file_selection"])

return configuration


Expand Down
6 changes: 6 additions & 0 deletions tools/wave/data/device.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class Device(object):
def __init__(self, token, user_agent, name, last_active):
self.token = token
self.user_agent = user_agent
self.name = name
self.last_active = last_active
8 changes: 8 additions & 0 deletions tools/wave/data/event_listener.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class EventListener(object):
def __init__(self, dispatcher_token):
super(EventListener, self).__init__()
self.dispatcher_token = dispatcher_token
self.token = None

def send_message(self, message):
raise Exception("Client.send_message(message) not implemented!")
11 changes: 11 additions & 0 deletions tools/wave/data/http_polling_event_listener.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from .event_listener import EventListener

class HttpPollingEventListener(EventListener):
def __init__(self, dispatcher_token, event):
super(HttpPollingEventListener, self).__init__(dispatcher_token)
self.event = event
self.message = None

def send_message(self, message):
self.message = message
self.event.set()
24 changes: 8 additions & 16 deletions tools/wave/data/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Session(object):
def __init__(
self,
token=None,
types=None,
test_types=None,
user_agent=None,
labels=None,
tests=None,
Expand All @@ -23,49 +23,43 @@ def __init__(
test_state=None,
last_completed_test=None,
recent_completed_count=None,
date_created=None,
date_started=None,
date_finished=None,
is_public=None,
reference_tokens=None,
browser=None,
webhook_urls=None,
expiration_date=None,
type=None,
malfunctioning_tests=None
):
if token is None:
token = ""
self.token = token
if types is None:
types = [AUTOMATIC, MANUAL]
self.types = types
if test_types is None:
test_types = [AUTOMATIC, MANUAL]
self.test_types = test_types
if user_agent is None:
user_agent = ""
self.user_agent = user_agent
if labels is None:
labels = []
self.labels = labels
if tests is None:
tests = {}
self.tests = tests
if pending_tests is None:
pending_tests = {}
self.pending_tests = pending_tests
if running_tests is None:
running_tests = {}
self.running_tests = running_tests
if timeouts is None:
timeouts = {}
self.timeouts = timeouts
if status is None:
status = UNKNOWN
self.status = status
if test_state is None:
test_state = {}
self.test_state = test_state
self.last_completed_test = last_completed_test
if recent_completed_count is None:
recent_completed_count = 0
self.recent_completed_count = recent_completed_count
self.date_created = date_created
self.date_started = date_started
self.date_finished = date_finished
if is_public is None:
Expand All @@ -75,10 +69,8 @@ def __init__(
reference_tokens = []
self.reference_tokens = reference_tokens
self.browser = browser
if webhook_urls is None:
webhook_urls = []
self.webhook_urls = webhook_urls
self.expiration_date = expiration_date
self.type = type
if malfunctioning_tests is None:
malfunctioning_tests = []
self.malfunctioning_tests = malfunctioning_tests
16 changes: 13 additions & 3 deletions tools/wave/docs/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# WAVE Test Suite Documentation
# WAVE Test Runner Documentation

- [REST API](./rest-api/README.md)
- [Usage Guide](./usage/usage.md)
As part of the [WAVE project](https://cta.tech/Resources/Standards/WAVE-Project)
the WAVE Test Runner was implemented to run tests that confirm proper implementation
of specified features. The code base is used in different subprojects, each of which
may have different requirements and scopes, so some features and screenshots in
this documentation may use specific contexts.

## Contents

- [Configuration](./config.md): How to configure the test runner
- [REST API](./rest-api/README.md): Documentation of endpoints, parameters and payloads
- [Guides](./rest-api/guides/README.md): How to use certain API mechanisms
- [Usage Guide](./usage/usage.md): General usage guide
Loading

0 comments on commit e5c7faa

Please sign in to comment.