Commit ab87fca5 authored by ojan@chromium.org's avatar ojan@chromium.org

Fix partytime.

My last change to it made it not work if there were no failures
for a tree because failures[tree] would be undefined. Make it
less brittle, add tests for this code and while here add an
explanatory message that this page means there are no failures.

BUG=407496
NOTRY=true
R=jyasskin@chromium.org

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

git-svn-id: svn://svn.chromium.org/blink/trunk@181599 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 59ec2fcc
......@@ -18,7 +18,7 @@ function CTFailures(commitLog) {
this.commitLog = commitLog;
this.builderLatestRevisions = null;
// Maps a tree id to an array of CTFailureGroups within that tree.
this.failures = {};
this.failures = null;
this.lastUpdateDate = null;
// FIXME: Get this from
......
......@@ -349,6 +349,7 @@ describe('ct-failures', function() {
describe('processTrooperFailures', function() {
it('should filter out updates that are not alerts', function() {
var analyzer = new CTFailures(new CTCommitList(undefined, []));
analyzer.failures = {};
analyzer._processTrooperFailures(
{'key_1': {'tree_1': {should_alert: true, should_appear: true},
'tree_2': {should_alert: false, should_appear: false}},
......
......@@ -32,6 +32,7 @@ found in the LICENSE file.
<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-unexpected-failures-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-select-tests.html">
......
......@@ -4,18 +4,18 @@ Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<polymer-element name="ct-party-time" attributes="partytime" noscript>
<polymer-element name="ct-party-time" noscript>
<template>
<template if="{{ partytime }}">
<style>
:host {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
</style>
<img src="../images/partytime.gif">
</template>
<style>
:host {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
</style>
<div>No failures!</div>
<img src="../images/partytime.gif">
</template>
</polymer-element>
......@@ -45,10 +45,12 @@ found in the LICENSE file.
</div>
<ct-tree-status status="{{ treeStatuses['chromium'] }}" state="{{ treeStatuses['chromium'].status }}"></ct-tree-status>
<ct-tree-status status="{{ treeStatuses['blink'] }}" state="{{ treeStatuses['blink'].status }}"></ct-tree-status>
<ct-party-time failures="{{ failures.failures[tree].length == 0 }}"></ct-party-time>
<ct-failure-stream title="Reliable failures" category="default" groups="{{ failures.failures[tree] }}" commitLog="{{ commitLog }}" tree="{{ tree }}"></ct-failure-stream>
<ct-failure-stream title="Failures that have only happened once (on one bot)" category="failedOnce" groups="{{ failures.failures[tree] }}" commitLog="{{ commitLog }}" tree="{{ tree }}"></ct-failure-stream>
<ct-failure-stream title="Snoozed failures" category="snoozed" groups="{{ failures.failures[tree] }}" commitLog="{{ commitLog }}" tree="{{ tree }}"></ct-failure-stream>
<template if="{{ failures && failures.failures && (!failures.failures[tree] || !failures.failures[tree].length) }}">
<ct-party-time></ct-party-time>
</template>
<ct-failure-stream title="Reliable failures" category="default" groups="{{ failures && failures.failures[tree] }}" commitLog="{{ commitLog }}" tree="{{ tree }}"></ct-failure-stream>
<ct-failure-stream title="Failures that have only happened once (on one bot)" category="failedOnce" groups="{{ failures && failures.failures[tree] }}" commitLog="{{ commitLog }}" tree="{{ tree }}"></ct-failure-stream>
<ct-failure-stream title="Snoozed failures" category="snoozed" groups="{{ failures && failures.failures[tree] }}" commitLog="{{ commitLog }}" tree="{{ tree }}"></ct-failure-stream>
</template>
<script>
(function() {
......
......@@ -16,7 +16,6 @@ describe('ct-party-time', function() {
var partyTime;
before(function(done) {
partyTime = document.createElement('ct-party-time');
partyTime.partytime = true;
setTimeout(done);
});
......@@ -24,19 +23,6 @@ describe('ct-party-time', function() {
assert(partyTime.shadowRoot.querySelector('img'));
});
});
describe('party time: no party', function() {
var partyTime;
before(function(done) {
partyTime = document.createElement('ct-party-time');
partyTime.partytime = false;
setTimeout(done);
});
it('should not have a party', function() {
assert(!partyTime.shadowRoot.querySelector('img'));
});
});
});
})()
......
......@@ -97,6 +97,10 @@ describe('ct-results-panel', function() {
beforeEach(function(done) {
panel = document.createElement('ct-results-panel');
// FIXME: The results-panel needs to be appended to the DOM so that the flakiness
// dashboard's iframe has a window when we grab location off of it, but that
// also means that we actually do fetches for the iframes of the foo_step stdio.
// This results in some console spam from the 404'ed request.
panel.hidden = true;
document.body.appendChild(panel);
......
<!--
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-unexpected-failures.html'>
<link rel="import" href="../../model/ct-commit-list.html">
<link rel="import" href="../../model/ct-failures.html">
<script>
(function () {
var assert = chai.assert;
describe('ct-unexpected-failures', function() {
it('test showing partytime with no CTFailures', function(done) {
var noFailures = document.createElement('ct-unexpected-failures');
setTimeout(function() {
assert.notOk(noFailures.shadowRoot.querySelector('ct-party-time'));
done();
});
});
it('test showing partytime with no failures for the selected tree', function(done) {
var noFailuresForTree = document.createElement('ct-unexpected-failures');
noFailuresForTree.failures = new CTFailures(new CTCommitList(undefined, []));
noFailuresForTree.failures.failures = {
othertree: [new CTFailure('step', 'reason', [])]
};
noFailuresForTree.tree = 'mocktree';
setTimeout(function() {
assert.ok(noFailuresForTree.shadowRoot.querySelector('ct-party-time'));
done();
});
});
it('test showing partytime with no failures in this tree\'s list', function(done) {
var noFailuresByLength = document.createElement('ct-unexpected-failures');
noFailuresByLength.failures = new CTFailures(new CTCommitList(undefined, []));
noFailuresByLength.failures.failures = {
mocktree: []
};
noFailuresByLength.tree = 'mocktree';
setTimeout(function() {
assert.ok(noFailuresByLength.shadowRoot.querySelector('ct-party-time'));
done();
});
});
it('test showing partytime with failures for this tree', function(done) {
var hasFailures = document.createElement('ct-unexpected-failures');
hasFailures.failures = new CTFailures(new CTCommitList(undefined, []));
hasFailures.failures.failures = {
mocktree: [new CTFailure('step', 'reason', [])]
};
hasFailures.tree = 'mocktree';
setTimeout(function() {
assert.notOk(hasFailures.shadowRoot.querySelector('ct-party-time'));
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