Adds network UI test framework

This adds a test framework to drive UI tests from the client
instead of injecting events from the websocket.  Tests consist
of a pair of snapshots (before and after the test) and
a list of UI events to process.  Tests are run using a FSM
in the client that controls the resetting of state to the snapshot,
injecting the events into the UI, recording test coverage,
and reporting tests to the server.

* Adds design for event trace table
* Adds design for a coverage tracking table
* Adds models for EventTrace and Coverage
* Adds trace_id to recording messages
* Adds design for TopologySnapshot table
* Adds order to TopologySnapshot table
* Adds TopologySnapshot table
* Adds Snapshot message when recordings are started and stoppped
* Adds models for tracking test cases and test results
* Adds designs for a test runner FSM
* Updates test management commands with new schema
* Adds download recording button
* Adds models to track tests
* Adds ui test runner
* Adds id and client to TestResult design
* Adds id and client to TestResult
* Update message types
* Stores test results and code coverage from the test runner
* Adds tool to generate a test coverage report
* Adds APIs for tests and code coverage
* Adds per-test-case coverage reports
* Breaks out coverage for loading the modules from the tests
* Re-raises server-side errors
* Captures errors during tests
* Adds defaults for host name and host type
* Disables test FSM trace storage
* Adds support for sending server error message to the client
* Resets the UI flags, history, and toolbox contents between tests
* Adds istanbul instrumentation to network-ui
This commit is contained in:
Ben Thomasson
2018-01-08 11:34:23 -05:00
parent eeaf7c257c
commit bf7f4ee1e1
38 changed files with 1534 additions and 97 deletions

View File

@@ -176,23 +176,18 @@ function MultipleMessage(sender, messages) {
}
exports.MultipleMessage = MultipleMessage;
function Coverage(sender, coverage) {
this.msg_type = "Coverage";
this.sender = sender;
this.coverage = coverage;
}
exports.Coverage = Coverage;
function MouseEvent(sender, x, y, type) {
function MouseEvent(sender, x, y, type, trace_id) {
this.msg_type = "MouseEvent";
this.sender = sender;
this.x = x;
this.y = y;
this.type = type;
this.trace_id = trace_id;
}
exports.MouseEvent = MouseEvent;
function MouseWheelEvent(sender, delta, deltaX, deltaY, type, metaKey) {
function MouseWheelEvent(sender, delta, deltaX, deltaY, type, metaKey, trace_id) {
this.msg_type = "MouseWheelEvent";
this.sender = sender;
this.delta = delta;
@@ -200,10 +195,11 @@ function MouseWheelEvent(sender, delta, deltaX, deltaY, type, metaKey) {
this.deltaY = deltaY;
this.type = type;
this.originalEvent = {metaKey: metaKey};
this.trace_id = trace_id;
}
exports.MouseWheelEvent = MouseWheelEvent;
function KeyEvent(sender, key, keyCode, type, altKey, shiftKey, ctrlKey, metaKey) {
function KeyEvent(sender, key, keyCode, type, altKey, shiftKey, ctrlKey, metaKey, trace_id) {
this.msg_type = "KeyEvent";
this.sender = sender;
this.key = key;
@@ -213,6 +209,7 @@ function KeyEvent(sender, key, keyCode, type, altKey, shiftKey, ctrlKey, metaKey
this.shiftKey = shiftKey;
this.ctrlKey = ctrlKey;
this.metaKey = metaKey;
this.trace_id = trace_id;
}
exports.KeyEvent = KeyEvent;
@@ -224,24 +221,27 @@ function TouchEvent(sender, type, touches) {
}
exports.TouchEvent = TouchEvent;
function StartRecording(sender) {
function StartRecording(sender, trace_id) {
this.msg_type = "StartRecording";
this.sender = sender;
this.trace_id = trace_id;
}
exports.StartRecording = StartRecording;
function StopRecording(sender) {
function StopRecording(sender, trace_id) {
this.msg_type = "StopRecording";
this.sender = sender;
this.trace_id = trace_id;
}
exports.StopRecording = StopRecording;
function ViewPort(sender, scale, panX, panY) {
function ViewPort(sender, scale, panX, panY, trace_id) {
this.msg_type = "ViewPort";
this.sender = sender;
this.scale = scale;
this.panX = panX;
this.panY = panY;
this.trace_id = trace_id;
}
exports.ViewPort = ViewPort;
@@ -446,3 +446,54 @@ function ChannelTrace(from_fsm, to_fsm, sent_message_type) {
this.sent_message_type = sent_message_type;
}
exports.ChannelTrace = ChannelTrace;
function Snapshot(sender, devices, links, groups, streams, order, trace_id) {
this.msg_type = 'Snapshot';
this.sender = 0;
this.devices = devices;
this.links = links;
this.groups = groups;
this.streams = streams;
this.order = order;
this.trace_id = trace_id;
}
exports.Snapshot = Snapshot;
function EnableTest() {
this.msg_type = "EnableTest";
}
exports.EnableTest = EnableTest;
function DisableTest() {
this.msg_type = "DisableTest";
}
exports.DisableTest = DisableTest;
function StartTest() {
this.msg_type = "StartTest";
}
exports.StartTest = StartTest;
function TestCompleted() {
this.msg_type = "TestCompleted";
}
exports.TestCompleted = TestCompleted;
function TestResult(sender, id, name, result, date, code_under_test) {
this.msg_type = "TestResult";
this.sender = sender;
this.id = id;
this.name = name;
this.result = result;
this.date = date;
this.code_under_test = code_under_test;
}
exports.TestResult = TestResult;
function Coverage(sender, coverage, result_id) {
this.msg_type = "Coverage";
this.sender = sender;
this.coverage = coverage;
this.result_id = result_id;
}
exports.Coverage = Coverage;