Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions runner/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<html lang=en>
<meta charset=UTF-8>
<title>Web tests</title>
<meta name="viewport" content="width=device-width"></meta>
<link rel='stylesheet' href='css/bootstrap.min.css'>
<link rel='stylesheet' href='css/bootstrap-theme.min.css'>
<link rel=stylesheet href=runner.css>
Expand Down Expand Up @@ -71,6 +72,10 @@
<input type=checkbox id='dumpit'>
Dump JSON
</label>
<label>
<input type=checkbox id='iframe'>
Run tests in iframe
</label>
</div>
</div>

Expand Down Expand Up @@ -168,7 +173,9 @@ <h4>Progress
</table>
<a class="jsonResults btn btn-primary pull-right">Download JSON results</a>
</div>

<div id="runMode">
<iframe id="testFrame" allowFullScreen="true" mozAllowFullScreen="true" webkitAllowFullScreen="true"></iframe>
</div>
<div class="results">
<div id="manualUI">
<div class='panel panel-primary'>
Expand Down Expand Up @@ -209,4 +216,4 @@ <h4>Details</h4>
</div>
</div>

</div>
</div>
8 changes: 8 additions & 0 deletions runner/runner.css
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,11 @@ td.ERROR {
animation-iteration-count: infinite;
animation-direction: alternate;
}

#testFrame{
display: none;
border: 1px solid #ddd;
border-radius: 3px;
width: 100%;
height: 400px;
}
53 changes: 43 additions & 10 deletions runner/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ VisualOutput.prototype = {
var json = this.runner.results.to_json();

if (document.getElementById("dumpit").checked) {
this.json_results_area = Array.prototype.slice.call(this.elem.querySelectorAll("textarea"));
for(var i = 0,t = this.json_results_area.length; i < t; i++){
this.elem.removeChild(this.json_results_area[i]);
}
this.json_results_area = document.createElement("textarea");
this.json_results_area.style.width = "100%";
this.json_results_area.setAttribute("rows", "50");
Expand Down Expand Up @@ -355,12 +359,12 @@ function ManualUI(elem, runner) {

this.pass_button.onclick = function() {
this.disable_buttons();
this.runner.on_result("PASS", "", []);
this.runner.on_result("PASS", "", "unjs");
}.bind(this);

this.fail_button.onclick = function() {
this.disable_buttons();
this.runner.on_result("FAIL", "", []);
this.runner.on_result("FAIL", "", "unjs");
}.bind(this);
}

Expand Down Expand Up @@ -431,6 +435,7 @@ function TestControl(elem, runner) {
}.bind(this),
false);
}.bind(this));
this.iframe_checkbox = this.elem.querySelector("#iframe");
this.timeout_input = this.elem.querySelector(".timeout_multiplier");
this.render_checkbox = this.elem.querySelector(".render");
this.runner = runner;
Expand All @@ -444,6 +449,7 @@ TestControl.prototype = {
this.pause_button.disabled = true;
this.start_button.textContent = "Start";
this.path_input.disabled = false;
this.iframe_checkbox.disabled = false;
this.type_checkboxes.forEach(function(elem) {
elem.disabled = false;
});
Expand All @@ -452,7 +458,11 @@ TestControl.prototype = {
var test_types = this.get_test_types();
var settings = this.get_testharness_settings();
var use_regex = this.get_use_regex();
this.runner.start(path, test_types, settings, use_regex);
var run_mode = "window";
if (this.iframe_checkbox.checked) {
run_mode = "iframe";
}
this.runner.start(path, test_types, settings, use_regex, run_mode);
this.set_stop();
this.set_pause();
}.bind(this);
Expand Down Expand Up @@ -563,7 +573,9 @@ function Runner(manifest_path) {
this.manifest_iterator = null;

this.test_window = null;
this.test_frame = document.getElementById('testFrame');
this.test_div = document.getElementById('test_url');
this.run_mode = null;
this.current_test = null;
this.timeout = null;
this.num_tests = null;
Expand Down Expand Up @@ -601,14 +613,15 @@ Runner.prototype = {
}
},

start: function(path, test_types, testharness_settings, use_regex) {
start: function(path, test_types, testharness_settings, use_regex, run_mode) {
this.pause_flag = false;
this.stop_flag = false;
this.done_flag = false;
this.path = path;
this.use_regex = use_regex;
this.test_types = test_types;
window.testharness_properties = testharness_settings;
this.run_mode = run_mode;
this.manifest_iterator = new ManifestIterator(this.manifest, this.path, this.test_types, this.use_regex);
this.num_tests = null;

Expand All @@ -628,7 +641,11 @@ Runner.prototype = {

do_start: function() {
if (this.manifest_iterator.count() > 0) {
this.open_test_window();
if (this.run_mode ==="window") {
this.open_test_window();
}else if (this.run_mode === "iframe") {
this.test_frame.style.display = "block";
}
this.start_callbacks.forEach(function(callback) {
callback();
});
Expand Down Expand Up @@ -657,6 +674,13 @@ Runner.prototype = {
},

on_result: function(status, message, subtests) {
if (this.current_test.type == "manual" || this.current_test.type == "reftest"){
if (subtests != "unjs"){
return;
}else{
subtests = [];
}
}
clearTimeout(this.timeout);
this.results.set(this.current_test, status, message, subtests);
this.result_callbacks.forEach(function(callback) {
Expand All @@ -671,8 +695,13 @@ Runner.prototype = {

done: function() {
this.done_flag = true;
if (this.test_window) {
this.test_window.close();
if (this.run_mode === "window") {
if (this.test_window) {
this.test_window.close();
}
} else {
this.test_frame.src = "";
this.test_frame.style.display = "none";
}
this.done_callbacks.forEach(function(callback) {
callback();
Expand Down Expand Up @@ -704,10 +733,14 @@ Runner.prototype = {
},

load: function(path) {
if (this.test_window.location === null) {
this.open_test_window();
if (this.run_mode === "window") {
if (this.test_window.location === null) {
this.open_test_window();
}
this.test_window.location.href = this.server + path;
} else {
this.test_frame.src = this.server + path;
}
this.test_window.location.href = this.server + path;
},

progress: function() {
Expand Down