Sheriff-o-matic: Display snoozed failure groups in a separate stream

Adds a category to ct-failure-group and enables ct-failure-stream to filter
to a single category.

Ports the previously broken ct-failure-stream-tests to mocha in order to
add new tests.

NOTRY=true
BUG=400397,399967, 400387

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

git-svn-id: svn://svn.chromium.org/blink/trunk@180314 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent bf761207
...@@ -26,6 +26,12 @@ CTFailureGroup.prototype.unsnooze = function() { ...@@ -26,6 +26,12 @@ CTFailureGroup.prototype.unsnooze = function() {
CTFailureGroup.prototype._computeProperties = function() { CTFailureGroup.prototype._computeProperties = function() {
this.isSnoozed = Date.now() < this.annotation.snoozeTime; this.isSnoozed = Date.now() < this.annotation.snoozeTime;
if (this.isSnoozed) {
this.category = 'snoozed';
} else {
// FIXME: crbug.com/400397 Split into: Whole step failure, Tree closer, Test failure, Flaky tests
this.category = 'default';
}
}; };
CTFailureGroup.prototype._annotate = function(newAnnotation) { CTFailureGroup.prototype._annotate = function(newAnnotation) {
......
...@@ -17,6 +17,18 @@ describe('ct-failure-group', function() { ...@@ -17,6 +17,18 @@ describe('ct-failure-group', function() {
localStorage.removeItem('CTFailureGroupAnnotations'); localStorage.removeItem('CTFailureGroupAnnotations');
}); });
describe('category', function() {
it('should be "default" by default', function() {
var group = new CTFailureGroup('key', []);
assert.equal(group.category, 'default');
});
it('should be "snoozed" when snoozed', function() {
var group = new CTFailureGroup('key', [], {snoozeTime: Date.now() + 1000 * 1000});
assert.equal(group.category, 'snoozed');
});
});
describe('snooze', function() { describe('snooze', function() {
it('should set isSnoozed', function(done) { it('should set isSnoozed', function(done) {
var group = new CTFailureGroup('key', []); var group = new CTFailureGroup('key', []);
......
...@@ -56,6 +56,5 @@ THE POSSIBILITY OF SUCH DAMAGE. ...@@ -56,6 +56,5 @@ THE POSSIBILITY OF SUCH DAMAGE.
<link rel="import" href="model/ct-failure-tests.html"> <link rel="import" href="model/ct-failure-tests.html">
<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">
</body> </body>
...@@ -12,6 +12,7 @@ found in the LICENSE file. ...@@ -12,6 +12,7 @@ found in the LICENSE file.
<link rel="import" href="../ui/test/ct-commit-tests.html"> <link rel="import" href="../ui/test/ct-commit-tests.html">
<link rel="import" href="../ui/test/ct-embedded-flakiness-dashboard-tests.html"> <link rel="import" href="../ui/test/ct-embedded-flakiness-dashboard-tests.html">
<link rel="import" href="../ui/test/ct-failure-analyzer-tests.html"> <link rel="import" href="../ui/test/ct-failure-analyzer-tests.html">
<link rel="import" href="../ui/test/ct-failure-stream-tests.html">
<link rel="import" href="../ui/test/ct-last-updated-tests.html"> <link rel="import" href="../ui/test/ct-last-updated-tests.html">
<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">
......
<!--
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-failure-stream.html">
<script>
(function () {
module("ct-failure-stream");
asyncTest("basic", 3, function() {
var stream = document.createElement('ct-failure-stream');
// FIXME: We should use some more interesting test data, but
// ct-failure-stream will give these values to ct-commit-data,
// which will hit the network unless we figure out how to mock
// out ct-commit-data in a better way.
stream.groups = [[], []];
Platform.endOfMicrotask(function() {
var cards = stream.shadowRoot.querySelectorAll('ct-failure-card');
equal(cards.length, 2);
deepEqual(cards[0].failures, []);
deepEqual(cards[1].failures, []);
start();
});
});
})()
</script>
...@@ -6,7 +6,7 @@ found in the LICENSE file. ...@@ -6,7 +6,7 @@ found in the LICENSE file.
<link rel="import" href="ct-failure-card.html"> <link rel="import" href="ct-failure-card.html">
<polymer-element name="ct-failure-stream" attributes="groups commits tree" noscript> <polymer-element name="ct-failure-stream" attributes="groups commits tree category" noscript>
<template> <template>
<style> <style>
:host { :host {
...@@ -19,8 +19,11 @@ found in the LICENSE file. ...@@ -19,8 +19,11 @@ found in the LICENSE file.
border-top: 1px solid lightgrey; border-top: 1px solid lightgrey;
} }
</style> </style>
<!-- FIXME: Show a label based on the category when the filtered stream isn't empty -->
<template repeat="{{ group in groups }}"> <template repeat="{{ group in groups }}">
<ct-failure-card group="{{ group }}" commits="{{ commits }}" tree="{{ tree }}"></ct-failure-card> <template if="{{ group.category == category }}">
<ct-failure-card group="{{ group }}" commits="{{ commits }}" tree="{{ tree }}"></ct-failure-card>
</template>
</template> </template>
</template> </template>
</polymer-element> </polymer-element>
...@@ -45,7 +45,8 @@ found in the LICENSE file. ...@@ -45,7 +45,8 @@ found in the LICENSE file.
<ct-tree-status status="{{ treeStatuses['chromium'] }}" state="{{ treeStatuses['chromium'].status }}"></ct-tree-status> <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-tree-status status="{{ treeStatuses['blink'] }}" state="{{ treeStatuses['blink'].status }}"></ct-tree-status>
<ct-party-time failures="{{ failures }}" tree="{{ tree }}"></ct-party-time> <ct-party-time failures="{{ failures }}" tree="{{ tree }}"></ct-party-time>
<ct-failure-stream groups="{{ failures[tree] }}" commits="{{ revisionLog }}" tree="{{ tree }}"></ct-failure-stream> <ct-failure-stream category="default" groups="{{ failures[tree] }}" commits="{{ revisionLog }}" tree="{{ tree }}"></ct-failure-stream>
<ct-failure-stream category="snoozed" groups="{{ failures[tree] }}" commits="{{ revisionLog }}" tree="{{ tree }}"></ct-failure-stream>
</template> </template>
<script> <script>
(function() { (function() {
......
<!--
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-failure-stream.html">
<script>
(function () {
var assert = chai.assert;
describe('ct-failure-stream', function() {
var stream;
beforeEach(function(done) {
stream = document.createElement('ct-failure-stream');
setTimeout(done);
});
describe('default ui', function() {
it('should show failure groups', function(done) {
// FIXME: We should use some more interesting test data, but
// ct-failure-stream will give these values to ct-commit-data,
// which will hit the network unless we figure out how to mock
// out ct-commit-data in a better way.
stream.groups = [new CTFailureGroup('a', []), new CTFailureGroup('b', [])];
stream.category = 'default';
setTimeout(function() {
var cards = stream.shadowRoot.querySelectorAll('ct-failure-card');
assert.equal(cards.length, 2);
assert.equal(cards[0].group.key, 'a');
assert.equal(cards[1].group.key, 'b');
done();
});
});
});
describe('category', function() {
it('should only show failure groups for the specified category', function(done) {
stream.groups = [new CTFailureGroup('a', []), new CTFailureGroup('b', [], {snoozeTime: Date.now() + 1000 * 1000})];
stream.category = 'snoozed';
setTimeout(function() {
var cards = stream.shadowRoot.querySelectorAll('ct-failure-card');
assert.equal(cards.length, 1);
assert.equal(cards[0].group.key, 'b');
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