Sheriff-o-Matic: Convert some more ui tests to mocha

This converts the remaining ui test suites, besides the two that are currently failing (ct-failure-card, ct-failure-stream).

BUG=400387
R=ojan@chromium.org
NOTRY=true

Review URL: https://codereview.chromium.org/464163002

git-svn-id: svn://svn.chromium.org/blink/trunk@180125 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent e216dd63
...@@ -15,6 +15,7 @@ module.exports = function(config) { ...@@ -15,6 +15,7 @@ module.exports = function(config) {
client: { client: {
mocha: { mocha: {
ui: 'bdd', ui: 'bdd',
checkLeaks: true,
globals: ['net'] globals: ['net']
} }
}, },
...@@ -28,8 +29,9 @@ module.exports = function(config) { ...@@ -28,8 +29,9 @@ module.exports = function(config) {
{pattern: 'bower_components/**/*.{js,html,css,map}', included: false}, {pattern: 'bower_components/**/*.{js,html,css,map}', included: false},
'node_modules/mocha/mocha.js', 'node_modules/mocha/mocha.js',
'polymer-load-warning.html', 'polymer-load-warning.html',
{pattern: 'model/*.html', included: false}, {pattern: 'base/*.html', included: false},
{pattern: 'lib/*.html', included: false}, {pattern: 'lib/*.html', included: false},
{pattern: 'model/*.html', included: false},
'lib/test/*.html', 'lib/test/*.html',
'model/test/*.html', 'model/test/*.html',
'scripts/*.js', 'scripts/*.js',
......
...@@ -57,11 +57,5 @@ THE POSSIBILITY OF SUCH DAMAGE. ...@@ -57,11 +57,5 @@ THE POSSIBILITY OF SUCH DAMAGE.
<link rel="import" href="model/tree-status-tests.html"> <link rel="import" href="model/tree-status-tests.html">
<link rel="import" href="ui/ct-failure-card-tests.html"> <link rel="import" href="ui/ct-failure-card-tests.html">
<link rel="import" href="ui/ct-failure-stream-tests.html"> <link rel="import" href="ui/ct-failure-stream-tests.html">
<link rel="import" href="ui/ct-results-comparison-zoomer-tests.html">
<link rel="import" href="ui/ct-results-panel-tests.html">
<link rel="import" href="ui/ct-revision-details-tests.html">
<link rel="import" href="ui/ct-test-list-tests.html">
<link rel="import" href="ui/ct-test-output-tests.html">
<link rel="import" href="ui/ct-tree-status-tests.html">
</body> </body>
...@@ -16,4 +16,10 @@ found in the LICENSE file. ...@@ -16,4 +16,10 @@ found in the LICENSE file.
<link rel="import" href="../ui/test/ct-party-time-tests.html"> <link rel="import" href="../ui/test/ct-party-time-tests.html">
<link rel="import" href="../ui/test/ct-results-by-builder-tests.html"> <link rel="import" href="../ui/test/ct-results-by-builder-tests.html">
<link rel="import" href="../ui/test/ct-results-comparison-tests.html"> <link rel="import" href="../ui/test/ct-results-comparison-tests.html">
<link rel="import" href="../ui/test/ct-results-comparison-zoomer-tests.html">
<link rel="import" href="../ui/test/ct-results-detail-tests.html"> <link rel="import" href="../ui/test/ct-results-detail-tests.html">
<link rel="import" href="../ui/test/ct-results-panel-tests.html">
<link rel="import" href="../ui/test/ct-revision-details-tests.html">
<link rel="import" href="../ui/test/ct-test-list-tests.html">
<link rel="import" href="../ui/test/ct-test-output-tests.html">
<link rel="import" href="../ui/test/ct-tree-status-tests.html">
<!--
Copyright 2014 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="ct-embedded-flakiness-dashboard.html">
<script>
(function() {
module("ct-embedded-flakiness-dashboard");
asyncTest("url", 1, function() {
var failure = new CTFailure('foo_tests', 'foo/bar.html');
var tree = "blink";
var embeddedFlakinessDashboard = document.createElement('ct-embedded-flakiness-dashboard');
embeddedFlakinessDashboard.test = failure;
embeddedFlakinessDashboard.tree = tree;
requestAnimationFrame(function() {
var iframe = embeddedFlakinessDashboard.shadowRoot.querySelector('#iframe');
equal(iframe.src, failure.embeddedFlakinessDashboardURL(tree));
start();
});
});
asyncTest("heightChanged", 1, function() {
var embeddedFlakinessDashboard = document.createElement('ct-embedded-flakiness-dashboard');
function finishTest() {
window.removeEventListener('message', finishTest);
var iframe = embeddedFlakinessDashboard.shadowRoot.querySelector('#iframe');
equal(iframe.style.height, "100px");
start();
}
window.addEventListener('message', finishTest);
requestAnimationFrame(function() {
window.postMessage({command: 'heightChanged', height: "100"}, '*');
});
});
})()
</script>
<!--
Copyright 2014 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="ct-results-comparison-zoomer.html">
<link rel="import" href="../base/ct-canvas-2d-context-mock.html">
<script>
(function () {
module("ct-results-comparison-zoomer");
asyncTest("no-position", 2, function() {
var zoomer = document.createElement('ct-results-comparison-zoomer');
// FIXME: This should set zoomer.position instead, but there's no way
// to get between the microtask and requestAnimationFrame to verify the
// behavior.
zoomer.positionChanged();
ok(zoomer._drawScheduled);
requestAnimationFrame(function() {
ok(!zoomer._drawScheduled);
start();
});
});
test("draw", 3, function() {
// Hard to verify correct behavior here, but at least make sure the
// code executes without throwing errors.
var zoomer = document.createElement('ct-results-comparison-zoomer');
try {
zoomer._drawAll();
ok(true);
} catch(e) {
ok(false);
}
// FIXME: Use a proper model class instead of a dumb object.
zoomer.position = {x: 0, y: 0};
try {
zoomer._drawAll();
ok(true);
} catch(e) {
ok(false);
}
try {
zoomer._draw(zoomer.$.diffZoomer);
ok(true);
} catch(e) {
ok(false);
}
});
asyncTest("drawCanvas", 1, function() {
var zoomer = document.createElement('ct-results-comparison-zoomer');
zoomer.position = {x: 0.2, y: 0.5};
requestAnimationFrame(function() {
var canvasContext = new CTCanvas2dContextMock();
zoomer._drawCanvas(canvasContext, zoomer.$.diffZoomer);
var expectedContext = new CTCanvas2dContextMock();
expectedContext.imageSmoothingEnabled = false;
expectedContext.translate(-960, -1800);
expectedContext.strokeRect(-1.5, -1.5, 4802, 3602);
expectedContext.scale(6, 6);
expectedContext.drawImage(zoomer.shadowRoot.querySelector('img'), 0, 0);
deepEqual(canvasContext, expectedContext);
start();
});
});
})()
</script>
<!--
Copyright 2014 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="ct-revision-details.html">
<link rel="import" href="../model/ct-builder-revisions-mock.html">
<link rel="import" href="../model/ct-commit-log-mock.html">
<script>
(function() {
module("ct-revision-details");
asyncTest("empty", 2, function() {
var revisionDetails = document.createElement('ct-revision-details');
requestAnimationFrame(function() {
equal(revisionDetails.shadowRoot.querySelector('#fullyProcessedRevision'), null);
equal(revisionDetails.shadowRoot.querySelector('#trunkRevision'), null);
start();
});
});
asyncTest("basic", 2, function() {
var revisionDetails = document.createElement('ct-revision-details');
var builderRevisions = CTBuilderRevisionsMock();
var commitLog = CTCommitLogMock();
commitLog._findFirstAndLastRevisions('blink');
revisionDetails.builderLatestRevisions = builderRevisions;
revisionDetails.tree = 'blink';
revisionDetails.revisionLog = commitLog;
requestAnimationFrame(function() {
equal(revisionDetails.shadowRoot.querySelector('#fullyProcessedRevision').innerText, '158543');
equal(revisionDetails.shadowRoot.querySelector('#trunkRevision').innerText, '158545');
start();
});
});
})()
</script>
<!--
Copyright 2014 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="ct-test-output.html">
<script>
(function () {
module("ct-test-output");
asyncTest("image", 4, function() {
var output = document.createElement('ct-test-output');
output.type = results.kImageType;
var url = "http://domain.com/dummy-expected";
output.url = url;
Platform.endOfMicrotask(function() {
equal(output.shadowRoot.querySelectorAll('iframe').length, 0);
equal(output.shadowRoot.querySelectorAll('audio').length, 0);
var images = output.shadowRoot.querySelectorAll('img');
equal(images.length, 1);
equal(images[0].src, url);
start();
});
});
asyncTest("text", 4, function() {
var output = document.createElement('ct-test-output');
output.type = results.kTextType;
var url = "http://domain.com/dummy-expected";
output.url = url;
Platform.endOfMicrotask(function() {
equal(output.shadowRoot.querySelectorAll('img').length, 0);
equal(output.shadowRoot.querySelectorAll('audio').length, 0);
var images = output.shadowRoot.querySelectorAll('iframe');
equal(images.length, 1);
equal(images[0].src, url);
start();
});
});
asyncTest("audio", 4, function() {
var output = document.createElement('ct-test-output');
output.type = results.kAudioType;
var url = "http://domain.com/dummy-expected";
output.url = url;
Platform.endOfMicrotask(function() {
equal(output.shadowRoot.querySelectorAll('iframe').length, 0);
equal(output.shadowRoot.querySelectorAll('img').length, 0);
var images = output.shadowRoot.querySelectorAll('audio');
equal(images.length, 1);
equal(images[0].src, url);
start();
});
});
asyncTest("unknown-type", 3, function() {
var output = document.createElement('ct-test-output');
output.type = 'garbage';
var url = "http://domain.com/dummy-expected";
output.url = url;
Platform.endOfMicrotask(function() {
equal(output.shadowRoot.querySelectorAll('iframe').length, 0);
equal(output.shadowRoot.querySelectorAll('audio').length, 0);
equal(output.shadowRoot.querySelectorAll('img').length, 0);
start();
});
});
asyncTest("no-url", 3, function() {
var output = document.createElement('ct-test-output');
output.type = results.kImageType;
Platform.endOfMicrotask(function() {
equal(output.shadowRoot.querySelectorAll('iframe').length, 0);
equal(output.shadowRoot.querySelectorAll('audio').length, 0);
equal(output.shadowRoot.querySelectorAll('img').length, 0);
start();
});
});
})()
</script>
<!--
Copyright 2014 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="ct-tree-status.html">
<script>
(function () {
module("ct-tree-status");
asyncTest('basic', 5, function() {
var openTree = document.createElement("ct-tree-status");
var openTreeStatus = new TreeStatus('open-tree-project');
openTreeStatus.status = 'open';
openTree.status = openTreeStatus;
var throttledTree = document.createElement("ct-tree-status");
var throttledTreeStatus = new TreeStatus('throttled-tree-project');
throttledTreeStatus.status = 'throttled';
throttledTreeStatus.message = 'Tree is throttled just for fun';
throttledTree.status = throttledTreeStatus;
var closedTree = document.createElement("ct-tree-status");
var closedTreeStatus = new TreeStatus('closed-tree-project');
closedTreeStatus.status = 'closed';
closedTreeStatus.message = 'Tree is closed';
closedTree.status = closedTreeStatus;
var simulator = new NetworkSimulator(ok, start);
simulator.runTest(function() {
requestAnimationFrame(function() {
ok(!openTree.shadowRoot.textContent.has("open-tree-project"));
ok(throttledTree.shadowRoot.textContent.has("throttled-tree-project"));
ok(closedTree.shadowRoot.textContent.has("closed-tree-project"));
equal(closedTree.shadowRoot.querySelector('a').href, closedTreeStatus.url);
start();
});
});
});
})();
</script>
<!--
Copyright 2014 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="../ct-results-comparison-zoomer.html">
<link rel="import" href="../../base/ct-canvas-2d-context-mock.html">
<script>
(function () {
var assert = chai.assert;
describe('ct-results-comparison-zoomer', function() {
var zoomer;
beforeEach(function(done) {
zoomer = document.createElement('ct-results-comparison-zoomer');
setTimeout(done);
});
it('should draw after position is changed', function(done) {
// FIXME: This should set zoomer.position instead, but there's no way
// to get between the microtask and requestAnimationFrame to verify the
// behavior.
zoomer.positionChanged();
assert(zoomer._drawScheduled);
requestAnimationFrame(function() {
assert(!zoomer._drawScheduled);
done();
});
});
it('draw', function() {
zoomer._drawAll();
// FIXME: Use a proper model class instead of a dumb object.
zoomer.position = {x: 0, y: 0};
zoomer._drawAll();
zoomer._draw(zoomer.$.diffZoomer);
});
it('drawCanvas', function(done) {
zoomer.position = {x: 0.2, y: 0.5};
setTimeout(function() {
var canvasContext = new CTCanvas2dContextMock();
zoomer._drawCanvas(canvasContext, zoomer.$.diffZoomer);
var expectedContext = new CTCanvas2dContextMock();
expectedContext.imageSmoothingEnabled = false;
expectedContext.translate(-960, -1800);
expectedContext.strokeRect(-1.5, -1.5, 4802, 3602);
expectedContext.scale(6, 6);
expectedContext.drawImage(zoomer.shadowRoot.querySelector('img'), 0, 0);
assert.deepEqual(canvasContext, expectedContext);
done();
});
});
});
})();
</script>
...@@ -4,13 +4,15 @@ Use of this source code is governed by a BSD-style license that can be ...@@ -4,13 +4,15 @@ Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. found in the LICENSE file.
--> -->
<link rel="import" href="ct-results-panel.html"> <link rel="import" href="../ct-results-panel.html">
<link rel="import" href="../model/ct-failure.html"> <link rel="import" href="../../model/ct-failure.html">
<script> <script>
(function () { (function () {
var assert = chai.assert;
var kExampleFailures = [ var kExampleFailures = [
new CTFailure("testName", "plugins/gesture-events-scrolled.html", new CTFailure("testName", "plugins/gesture-events-scrolled.html",
{ {
...@@ -89,77 +91,85 @@ var kExampleFailures = [ ...@@ -89,77 +91,85 @@ var kExampleFailures = [
), ),
]; ];
module("ct-results-panel"); describe('ct-results-panel', function() {
var panel;
asyncTest("empty", 1, function() { var failures;
var panel = document.createElement('ct-results-panel');
requestAnimationFrame(function() { beforeEach(function(done) {
var message = panel.shadowRoot.querySelector('.message'); panel = document.createElement('ct-results-panel');
equal(message.textContent, 'No results to display.'); if (failures)
panel.failures = failures;
start(); setTimeout(done);
}); });
});
asyncTest("basic", 8, function() { describe('empty', function() {
var panel = document.createElement('ct-results-panel'); before(function() {
failures = undefined;
panel.failures = kExampleFailures; });
requestAnimationFrame(function() { it('should show no results', function() {
var items = panel.shadowRoot.querySelectorAll('paper-item'); var message = panel.shadowRoot.querySelector('.message');
equal(items.length, 3); assert.equal(message.textContent, 'No results to display.');
equal(items[0].label, 'plugins/gesture-events-scrolled.html'); });
equal(items[1].label, 'plugins/transformed-events.html'); });
equal(items[2].label, 'plugins/gesture-events.html');
var results = panel.shadowRoot.querySelectorAll('ct-results-by-builder'); describe('failing tests', function() {
equal(results.length, 1); before(function() {
equal(results[0].failure, kExampleFailures[0]); failures = kExampleFailures;
});
panel.shadowRoot.querySelector('core-menu').selected = 2; it('should show tests and results for selected test', function(done) {
var items = panel.shadowRoot.querySelectorAll('paper-item');
assert.lengthOf(items, 3);
assert.equal(items[0].label, 'plugins/gesture-events-scrolled.html');
assert.equal(items[1].label, 'plugins/transformed-events.html');
assert.equal(items[2].label, 'plugins/gesture-events.html');
requestAnimationFrame(function() {
var results = panel.shadowRoot.querySelectorAll('ct-results-by-builder'); var results = panel.shadowRoot.querySelectorAll('ct-results-by-builder');
equal(results.length, 1); assert.lengthOf(results, 1);
equal(results[0].failure, kExampleFailures[2]); assert.equal(results[0].failure, kExampleFailures[0]);
start(); panel.shadowRoot.querySelector('core-menu').selected = 2;
});
});
});
asyncTest("whole step failed", 4, function() { setTimeout(function() {
var panel = document.createElement('ct-results-panel'); var results = panel.shadowRoot.querySelectorAll('ct-results-by-builder');
assert.lengthOf(results, 1);
assert.equal(results[0].failure, kExampleFailures[2]);
var failure = { done();
testName: null, });
step: 'foo-step', });
resultNodesByBuilder: { });
'WebKit Win7 (dbg)': {
actual: 'UNKNOWN',
},
},
oldestFailingRevision: 123,
newestPassingRevision: 124,
};
panel.failures = [failure];
requestAnimationFrame(function() { describe('whole step failed', function() {
var items = panel.shadowRoot.querySelectorAll('paper-item'); before(function() {
equal(items.length, 0); var failure = {
testName: null,
step: 'foo-step',
resultNodesByBuilder: {
'WebKit Win7 (dbg)': {
actual: 'UNKNOWN',
},
},
oldestFailingRevision: 123,
newestPassingRevision: 124,
};
failures = [failure];
});
var results = panel.shadowRoot.querySelectorAll('ct-results-by-builder'); it('should show step failure', function() {
equal(results.length, 1); var items = panel.shadowRoot.querySelectorAll('paper-item');
equal(results[0].failure, failure); assert.lengthOf(items, 0);
equal(panel.shadowRoot.querySelectorAll('ct-embedded-flakiness-dashboard').length, 0); var results = panel.shadowRoot.querySelectorAll('ct-results-by-builder');
assert.lengthOf(results, 1);
assert.equal(results[0].failure, failures[0]);
start(); assert.lengthOf(panel.shadowRoot.querySelectorAll('ct-embedded-flakiness-dashboard'), 0);
});
}); });
}); });
})() })();
</script> </script>
<!--
Copyright 2014 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="../ct-revision-details.html">
<link rel="import" href="../../model/ct-builder-revisions-mock.html">
<link rel="import" href="../../model/ct-commit-log-mock.html">
<script>
(function () {
var assert = chai.assert;
describe('ct-revision-details', function() {
var revisionDetails;
describe('empty', function() {
before(function(done) {
revisionDetails = document.createElement('ct-revision-details');
setTimeout(done);
});
it('should not show revision', function() {
assert.isNull(revisionDetails.shadowRoot.querySelector('#fullyProcessedRevision'));
assert.isNull(revisionDetails.shadowRoot.querySelector('#trunkRevision'));
});
});
describe('blink revision', function() {
before(function(done) {
revisionDetails = document.createElement('ct-revision-details');
var builderRevisions = CTBuilderRevisionsMock();
var commitLog = CTCommitLogMock();
commitLog._findFirstAndLastRevisions('blink');
revisionDetails.builderLatestRevisions = builderRevisions;
revisionDetails.tree = 'blink';
revisionDetails.revisionLog = commitLog;
setTimeout(done);
});
it('should show the revision', function() {
assert.equal(revisionDetails.shadowRoot.querySelector('#fullyProcessedRevision').innerText, '158543');
assert.equal(revisionDetails.shadowRoot.querySelector('#trunkRevision').innerText, '158545');
});
});
});
})();
</script>
...@@ -4,80 +4,75 @@ Use of this source code is governed by a BSD-style license that can be ...@@ -4,80 +4,75 @@ Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. found in the LICENSE file.
--> -->
<link rel="import" href="../model/ct-failure.html"> <link rel="import" href="../ct-test-list.html">
<link rel="import" href="ct-test-list.html">
<link rel="import" href="../model/ct-failure.html"> <link rel="import" href="../../model/ct-failure.html">
<script> <script>
(function () { (function () {
var assert = chai.assert;
var kExampleTests = [ var kExampleTests = [
new CTFailure("foo_step", "plugins/gesture-events-scrolled.html", {}, 177164, 177165); new CTFailure("foo_step", "plugins/gesture-events-scrolled.html", {}, 177164, 177165),
new CTFailure("foo_step", "plugins/transformed-events.html", {}, 177164, 177165); new CTFailure("foo_step", "plugins/transformed-events.html", {}, 177164, 177165),
new CTFailure("foo_step", "plugins/gesture-events.html", {}, 177164, 177165); new CTFailure("foo_step", "plugins/gesture-events.html", {}, 177164, 177165),
]; ];
var kExampleTestsChromium = [ var kExampleTestsChromium = [
new CTFailure("browser_tests", "SomeTest.SubTest1", {}, 177164, 177165); new CTFailure("browser_tests", "SomeTest.SubTest1", {}, 177164, 177165),
new CTFailure("browser_tests", "SomeTest.SubTest2", {}, 177164, 177165); new CTFailure("browser_tests", "SomeTest.SubTest2", {}, 177164, 177165),
]; ];
var kExampleTestsBlink = [ var kExampleTestsBlink = [
new CTFailure("webkit_tests", "fast/events/foo.html", {}, 177164, 177165); new CTFailure("webkit_tests", "fast/events/foo.html", {}, 177164, 177165),
new CTFailure("webkit_tests", "fast/events/bar.html", {}, 177164, 177165); new CTFailure("webkit_tests", "fast/events/bar.html", {}, 177164, 177165),
]; ];
module("ct-test-list"); function createTestList(tests, tree) {
asyncTest("basic", 4, function() {
var list = document.createElement('ct-test-list'); var list = document.createElement('ct-test-list');
list.tests = tests;
list.tests = kExampleFailures;
list.tree = 'blink'; list.tree = 'blink';
return list;
setTimeout(function() { }
var tests = list.shadowRoot.querySelectorAll('a');
equal(tests.length, 3); describe('ct-test-list', function() {
equal(tests[0].href, 'http://test-results.appspot.com/dashboards/flakiness_dashboard.html#group=@ToT%20Blink&tests=plugins%2Fgesture-events-scrolled.html&testType=foo_step'); var list;
equal(tests[1].href, 'http://test-results.appspot.com/dashboards/flakiness_dashboard.html#group=@ToT%20Blink&tests=plugins%2Ftransformed-events.html&testType=foo_step');
equal(tests[2].href, 'http://test-results.appspot.com/dashboards/flakiness_dashboard.html#group=@ToT%20Blink&tests=plugins%2Fgesture-events.html&testType=foo_step'); describe('tests failed', function() {
before(function(done) {
start(); list = createTestList(kExampleTests, 'blink');
}); setTimeout(done);
}); });
asyncTest("groupingChromium", 2, function() { it('should show all tests', function() {
var list = document.createElement('ct-test-list'); var tests = list.shadowRoot.querySelectorAll('a');
assert.equal(tests.length, 3);
list.tests = kExampleTestsChromium; assert.equal(tests[0].href, 'http://test-results.appspot.com/dashboards/flakiness_dashboard.html#group=@ToT%20Blink&tests=plugins%2Fgesture-events-scrolled.html&testType=foo_step');
list.tree = 'chromium'; assert.equal(tests[1].href, 'http://test-results.appspot.com/dashboards/flakiness_dashboard.html#group=@ToT%20Blink&tests=plugins%2Ftransformed-events.html&testType=foo_step');
assert.equal(tests[2].href, 'http://test-results.appspot.com/dashboards/flakiness_dashboard.html#group=@ToT%20Blink&tests=plugins%2Fgesture-events.html&testType=foo_step');
setTimeout(function() { });
var tests = list.shadowRoot.querySelectorAll('a');
equal(tests.length, 0);
var icons = list.shadowRoot.querySelectorAll('paper-icon-button');
equal(icons.length, 1);
start();
}); });
});
asyncTest("groupingBlink", 2, function() {
var list = document.createElement('ct-test-list');
list.tests = kExampleTestsBlink;
list.tree = 'blink';
setTimeout(function() {
var tests = list.shadowRoot.querySelectorAll('a');
equal(tests.length, 0);
var icons = list.shadowRoot.querySelectorAll('paper-icon-button');
equal(icons.length, 1);
start(); describe('group of tests failed', function() {
afterEach(function() {
var tests = list.shadowRoot.querySelectorAll('a');
assert.lengthOf(tests, 0);
var icons = list.shadowRoot.querySelectorAll('paper-icon-button');
assert.lengthOf(icons, 1);
});
it('should group chromium tests', function(done) {
list = createTestList(kExampleTestsChromium, 'chromium');
setTimeout(done);
});
it('should group blink tests', function(done) {
list = createTestList(kExampleTestsBlink, 'blink');
setTimeout(done);
});
}); });
}); });
})() })();
</script> </script>
<!--
Copyright 2014 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="../ct-test-output.html">
<script>
(function () {
var assert = chai.assert;
describe('ct-test-output', function() {
var output;
var resultType;
var url;
beforeEach(function(done) {
output = document.createElement('ct-test-output');
output.type = resultType;
output.url = url;
setTimeout(done);
});
describe('image', function() {
before(function() {
resultType = results.kImageType;
url = 'http://domain.com/dummy-expected';
});
it('image', function() {
assert.lengthOf(output.shadowRoot.querySelectorAll('iframe'), 0);
assert.lengthOf(output.shadowRoot.querySelectorAll('audio'), 0);
var images = output.shadowRoot.querySelectorAll('img');
assert.lengthOf(images, 1);
assert.equal(images[0].src, url);
});
});
describe('text', function() {
before(function() {
resultType = results.kTextType;
url = 'http://domain.com/dummy-expected';
});
it('text', function() {
assert.lengthOf(output.shadowRoot.querySelectorAll('img'), 0);
assert.lengthOf(output.shadowRoot.querySelectorAll('audio'), 0);
var iframes = output.shadowRoot.querySelectorAll('iframe');
assert.lengthOf(iframes, 1);
assert.equal(iframes[0].src, url);
});
});
describe('audio', function() {
before(function() {
resultType = results.kAudioType;
url = 'http://domain.com/dummy-expected';
});
it('audio', function() {
assert.lengthOf(output.shadowRoot.querySelectorAll('iframe'), 0);
assert.lengthOf(output.shadowRoot.querySelectorAll('img'), 0);
var audios = output.shadowRoot.querySelectorAll('audio');
assert.lengthOf(audios, 1);
assert.equal(audios[0].src, url);
});
});
describe('unknown type', function() {
before(function() {
resultType = 'lambeosaurus';
url = 'http://domain.com/dummy-expected';
});
it('no output', function() {
assert.lengthOf(output.shadowRoot.querySelectorAll('iframe'), 0);
assert.lengthOf(output.shadowRoot.querySelectorAll('audio'), 0);
assert.lengthOf(output.shadowRoot.querySelectorAll('img'), 0);
});
});
describe('no url', function() {
before(function() {
resultType = results.kImageType;
url = undefined;
});
it('no output', function() {
assert.lengthOf(output.shadowRoot.querySelectorAll('iframe'), 0);
assert.lengthOf(output.shadowRoot.querySelectorAll('audio'), 0);
assert.lengthOf(output.shadowRoot.querySelectorAll('img'), 0);
});
});
});
})();
</script>
<!--
Copyright 2014 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="../ct-tree-status.html">
<script>
(function () {
var assert = chai.assert;
describe('ct-tree-status', function() {
it('should show statuses', function(done) {
var openTree = document.createElement("ct-tree-status");
var openTreeStatus = new TreeStatus('open-tree-project');
openTreeStatus.status = 'open';
openTree.status = openTreeStatus;
var throttledTree = document.createElement("ct-tree-status");
var throttledTreeStatus = new TreeStatus('throttled-tree-project');
throttledTreeStatus.status = 'throttled';
throttledTreeStatus.message = 'Tree is throttled just for fun';
throttledTree.status = throttledTreeStatus;
var closedTree = document.createElement("ct-tree-status");
var closedTreeStatus = new TreeStatus('closed-tree-project');
closedTreeStatus.status = 'closed';
closedTreeStatus.message = 'Tree is closed';
closedTree.status = closedTreeStatus;
setTimeout(function() {
assert.notInclude(!openTree.shadowRoot.textContent, "open-tree-project");
assert.include(throttledTree.shadowRoot.textContent, "throttled-tree-project");
assert.include(closedTree.shadowRoot.textContent, "closed-tree-project");
assert.equal(closedTree.shadowRoot.querySelector('a').href, closedTreeStatus.url);
done();
});
});
});
})();
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment