Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Side by Side Diff: Tools/GardeningServer/ui/test/ct-failure-card-tests.html

Issue 476903004: [sheriff-o-matic]: Basic trooper display for sheriff-o-matic. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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-card.html"> 7 <link rel="import" href="../ct-failure-card.html">
8 8
9 <link rel="import" href="../../model/ct-commit-list-mock.html"> 9 <link rel="import" href="../../model/ct-commit-list-mock.html">
10 <link rel="import" href="../../model/ct-commit-log-mock.html"> 10 <link rel="import" href="../../model/ct-commit-log-mock.html">
11 <link rel="import" href="../../model/ct-failure-group.html"> 11 <link rel="import" href="../../model/ct-failure-group.html">
12 12
13 <script> 13 <script>
14 (function () { 14 (function () {
15 15
16 var assert = chai.assert; 16 var assert = chai.assert;
17 17
18 describe('ct-failure-card', function() { 18 describe('ct-failure-card', function() {
19 var group; 19 var group;
20 var card; 20 var card;
21 var failures; 21 var failures;
22 22
23 beforeEach(function(done) { 23 beforeEach(function(done) {
24 card = document.createElement('ct-failure-card'); 24 card = document.createElement('ct-failure-card');
25 var cl = new CTCommitListMock(); 25 var cl = new CTCommitListMock();
26 group = new CTFailureGroup([ 26 group = new CTFailureGroup(new CTSheriffFailureGroupData([
27 new CTFailure('autobot', 'unknown', {someBuilder: {key: 'a'}}, {'blink': 158547}, 27 new CTFailure('autobot', 'unknown', {someBuilder: {key: 'a'}}, {'blink': 158547},
28 {'blink':158544})], cl); 28 {'blink':158544})], cl));
29 card.group = group; 29 card.group = group;
30 card.commitLog = new CTCommitLogMock(); 30 card.commitLog = new CTCommitLogMock();
31 setTimeout(done); 31 setTimeout(done);
32 }); 32 });
33 33
34 describe('failure card UI', function() { 34 describe('failure card UI', function() {
35 35
36 it('should select the correct card type', function(done) {
37 assert(card.shadowRoot.querySelector('ct-bot-failure-card') != null,
38 'missing sheriff card');
39 card.group = new CTFailureGroup(new CTTrooperFailureGroupData(
40 'details', 'url', {percent_over_median_slo: '6%',
41 percent_over_max_slo: '7%'}, 'cq_latency', ''));
42 setTimeout(function() {
43 assert(card.shadowRoot.querySelector('ct-trooper-card') != null,
44 'missing cq-latency card');
45 card.group.data.type = 'tree_status';
46 setTimeout(function() {
47 assert(card.shadowRoot.querySelector('ct-trooper-card') !=
48 null, 'missing tree-status card');
49 card.group.data.type = 'cycle_time';
50 setTimeout(function() {
51 assert(card.shadowRoot.querySelector('ct-trooper-card') !=
52 null, 'missing cycle-time card');
53 // Suppress leaked global warning from third-party library.
54 delete __googleVisualizationAbstractRendererElementsCount__;
55 done();
56 });
57 });
58 });
59 });
60
36 it('should have commit summaries', function(done) { 61 it('should have commit summaries', function(done) {
37 // Expand the first repository so that the <ct-commit>'s are generated. 62 // Expand the first repository so that the <ct-commit>'s are generated.
38 card.group.commitList.repositories[0].expanded = true; 63 card.group.data.commitList.repositories[0].expanded = true;
39 64
40 setTimeout(function() { 65 setTimeout(function() {
41 var list = card.shadowRoot.querySelector('ct-commit-list'); 66 var list = card.shadowRoot.querySelector('::shadow ct-commit-list');
42 var commits = list.shadowRoot.querySelectorAll('ct-commit'); 67 var commits = list.shadowRoot.querySelectorAll('ct-commit');
43 assert(commits[1].data); 68 assert(commits[1].data);
44 assert(commits[1].data.summary); 69 assert(commits[1].data.summary);
45 done(); 70 done();
46 }); 71 });
47 }); 72 });
48 73
49 it('removing a commit summary', function(done) { 74 it('removing a commit summary', function(done) {
50 card.commitLog.commits['blink']['158545'].summary = undefined; 75 card.commitLog.commits['blink']['158545'].summary = undefined;
51 card.group.commitList.repositories[0].expanded = true; 76 card.group.data.commitList.repositories[0].expanded = true;
52 77
53 setTimeout(function() { 78 setTimeout(function() {
54 var list = card.shadowRoot.querySelector('ct-commit-list'); 79 var list = card.shadowRoot.querySelector('::shadow ct-commit-list');
55 var commits = list.shadowRoot.querySelectorAll('ct-commit'); 80 var commits = list.shadowRoot.querySelectorAll('ct-commit');
56 assert.notOk(commits[0].data.summary); 81 assert.notOk(commits[0].data.summary);
57 done(); 82 done();
58 }); 83 });
59 }); 84 });
60 85
61 it('examine should dispatch event', function(done) { 86 it('examine should dispatch event', function(done) {
62 card.addEventListener('ct-examine-failures', function(event) { 87 card.addEventListener('ct-examine-failures', function(event) {
63 assert.deepEqual(event.detail.failures, card.group.failures); 88 assert.deepEqual(event.detail.failures, card.group.failures);
64 done(); 89 done();
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 done(); 155 done();
131 }); 156 });
132 }); 157 });
133 }); 158 });
134 }); 159 });
135 160
136 }); 161 });
137 162
138 })() 163 })()
139 </script> 164 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698