OLD | NEW |
1 <!-- | 1 <!-- |
2 Copyright 2014 The Chromium Authors. All rights reserved. | 2 Copyright 2014 The Chromium Authors. All rights reserved. |
3 Use of this source code is governed by a BSD-style license that can be | 3 Use of this source code is governed by a BSD-style license that can be |
4 found in the LICENSE file. | 4 found in the LICENSE file. |
5 --> | 5 --> |
6 | 6 |
7 <link rel="import" href="../ct-failure-stream.html"> | 7 <link rel="import" href="../ct-failure-stream.html"> |
8 | 8 |
9 <script> | 9 <script> |
10 (function () { | 10 (function () { |
(...skipping 12 matching lines...) Expand all Loading... |
23 describe('default ui', function() { | 23 describe('default ui', function() { |
24 it('should show failure groups', function(done) { | 24 it('should show failure groups', function(done) { |
25 // FIXME: We should use some more interesting test data, but | 25 // FIXME: We should use some more interesting test data, but |
26 // ct-failure-stream will give these values to ct-commit-data, | 26 // ct-failure-stream will give these values to ct-commit-data, |
27 // which will hit the network unless we figure out how to mock | 27 // which will hit the network unless we figure out how to mock |
28 // out ct-commit-data in a better way. | 28 // out ct-commit-data in a better way. |
29 stream.groups = [new CTFailureGroup('', new CTSheriffFailureGroupData([]))
, | 29 stream.groups = [new CTFailureGroup('', new CTSheriffFailureGroupData([]))
, |
30 new CTFailureGroup('', new CTSheriffFailureGroupData([]))]; | 30 new CTFailureGroup('', new CTSheriffFailureGroupData([]))]; |
31 stream.category = 'default'; | 31 stream.category = 'default'; |
32 setTimeout(function() { | 32 setTimeout(function() { |
33 var cards = stream.shadowRoot.querySelectorAll('ct-failure-card'); | 33 var cards = stream.shadowRoot.querySelectorAll('ct-bot-failure-card'); |
34 assert.equal(cards.length, 2); | 34 assert.equal(cards.length, 2); |
35 done(); | 35 done(); |
36 }); | 36 }); |
37 }); | 37 }); |
38 }); | 38 }); |
39 | 39 |
40 describe('category', function() { | 40 describe('category', function() { |
| 41 |
41 it('should only show failure groups for the specified category', function(do
ne) { | 42 it('should only show failure groups for the specified category', function(do
ne) { |
42 var failures = [new CTFailure('step', 'reason', [{key: 'a', annotation: {s
noozeTime: Date.now() + 1000 * 1000}}])]; | 43 var failures = [new CTFailure('step', 'reason', [{key: 'a', annotation: {s
noozeTime: Date.now() + 1000 * 1000}}])]; |
43 var snoozed = new CTFailureGroup('', new CTSheriffFailureGroupData(failure
s)); | 44 var snoozed = new CTFailureGroup('', new CTSheriffFailureGroupData(failure
s)); |
44 stream.groups = [new CTFailureGroup('', new CTSheriffFailureGroupData([]))
, snoozed]; | 45 stream.groups = [new CTFailureGroup('', new CTSheriffFailureGroupData([]))
, snoozed]; |
45 stream.category = 'snoozed'; | 46 stream.category = 'snoozed'; |
46 setTimeout(function() { | 47 setTimeout(function() { |
47 var cards = stream.shadowRoot.querySelectorAll('ct-failure-card'); | 48 var cards = stream.shadowRoot.querySelectorAll('ct-bot-failure-card'); |
48 assert.equal(cards.length, 1); | 49 assert.equal(cards.length, 1); |
49 assert.equal(cards[0].group, snoozed); | 50 assert.equal(cards[0].group, snoozed.data); |
50 done(); | 51 done(); |
51 }); | 52 }); |
52 }); | 53 }); |
| 54 |
| 55 it('should select the correct card type', function(done) { |
| 56 var failures = [new CTFailure('step', 'reason', [{key: 'a', annotation: {}
}])]; |
| 57 var failureGroup = new CTFailureGroup('', new CTSheriffFailureGroupData(fa
ilures)); |
| 58 stream.groups = [new CTFailureGroup('', new CTSheriffFailureGroupData([]))
, failureGroup]; |
| 59 stream.category = 'default'; |
| 60 setTimeout(function() { |
| 61 assert(stream.shadowRoot.querySelector('ct-bot-failure-card') != null, |
| 62 'missing sheriff card'); |
| 63 stream.groups = [new CTFailureGroup('', new CTTrooperFailureGroupData( |
| 64 'details', 'url', {percent_over_median_slo: '6%', |
| 65 percent_over_max_slo: '7%'}, 'cq_latency', ''))]; |
| 66 setTimeout(function() { |
| 67 assert(stream.shadowRoot.querySelector('ct-trooper-card') != null, |
| 68 'missing cq-latency card'); |
| 69 stream.groups[0].data.type = 'tree_status'; |
| 70 setTimeout(function() { |
| 71 assert(stream.shadowRoot.querySelector('ct-trooper-card') != |
| 72 null, 'missing tree-status card'); |
| 73 stream.groups[0].data.type = 'cycle_time'; |
| 74 setTimeout(function() { |
| 75 assert(stream.shadowRoot.querySelector('ct-trooper-card') != |
| 76 null, 'missing cycle-time card'); |
| 77 done(); |
| 78 }); |
| 79 }); |
| 80 }); |
| 81 }); |
| 82 }); |
| 83 |
53 }); | 84 }); |
54 }); | 85 }); |
55 | 86 |
56 })(); | 87 })(); |
57 </script> | 88 </script> |
OLD | NEW |