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

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

Issue 565523002: [Sheriff-o-matic] Refactor cards and get rid of ct-failure-cards (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ToT-ed 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 | Annotate | Revision Log
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-bot-failure-card.html">
8 <link rel="import" href="../ct-failure-card-buttons.html">
8 9
9 <link rel="import" href="../../model/ct-commit-list-mock.html"> 10 <link rel="import" href="../../model/ct-commit-list-mock.html">
10 <link rel="import" href="../../model/ct-commit-log-mock.html"> 11 <link rel="import" href="../../model/ct-commit-log-mock.html">
11 <link rel="import" href="../../model/ct-failure-group.html"> 12 <link rel="import" href="../../model/ct-failure-group.html">
12 13
13 <script> 14 <script>
14 (function () { 15 (function () {
15 16
16 var assert = chai.assert; 17 var assert = chai.assert;
17 18
18 describe('ct-failure-card', function() { 19 describe('ct-failure-card-buttons', function() {
19 var group; 20 var group;
20 var card; 21 var card;
21 var failures; 22 var failures;
22 23
23 beforeEach(function(done) { 24 beforeEach(function(done) {
24 card = document.createElement('ct-failure-card'); 25 card = document.createElement('ct-failure-card-buttons');
25 var cl = new CTCommitListMock(); 26 var cl = new CTCommitListMock();
26 group = new CTFailureGroup('', new CTSheriffFailureGroupData([ 27 group = new CTFailureGroup('', new CTSheriffFailureGroupData([
27 new CTFailure('autobot', 'unknown', {someBuilder: {key: 'a'}}, {'blink': 158547}, 28 new CTFailure('autobot', 'unknown', {someBuilder: {key: 'a'}}, {'blink': 158547},
28 {'blink':158544})], cl)); 29 {'blink':158544})], cl));
29 card.group = group; 30 card.group = group;
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 buttons', function() {
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 done();
54 });
55 });
56 });
57 });
58
59 it('should have commit summaries', function(done) {
60 // Expand the first repository so that the <ct-commit>'s are generated.
61 card.group.data.commitList.repositories[0].expanded = true;
62
63 setTimeout(function() {
64 var list = card.shadowRoot.querySelector('::shadow ct-commit-list');
65 var commits = list.shadowRoot.querySelectorAll('ct-commit');
66 assert(commits[1].data);
67 assert(commits[1].data.summary);
68 done();
69 });
70 });
71
72 it('removing a commit summary', function(done) {
73 card.commitLog.commits['blink']['158545'].summary = undefined;
74 card.group.data.commitList.repositories[0].expanded = true;
75
76 setTimeout(function() {
77 var list = card.shadowRoot.querySelector('::shadow ct-commit-list');
78 var commits = list.shadowRoot.querySelectorAll('ct-commit');
79 assert.notOk(commits[0].data.summary);
80 done();
81 });
82 });
83 35
84 it('examine should dispatch event', function(done) { 36 it('examine should dispatch event', function(done) {
85 card.addEventListener('ct-examine-failures', function(event) { 37 card.addEventListener('ct-examine-failures', function(event) {
86 assert.deepEqual(event.detail.failures, card.group.failures); 38 assert.deepEqual(event.detail.failures, card.group.failures);
87 done(); 39 done();
88 }); 40 });
89 41
90 card.shadowRoot.getElementById('examine').dispatchEvent(new CustomEvent('t ap')); 42 card.shadowRoot.getElementById('examine').dispatchEvent(new CustomEvent('t ap'));
91 }); 43 });
92 44
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 done(); 105 done();
154 }); 106 });
155 }); 107 });
156 }); 108 });
157 }); 109 });
158 110
159 }); 111 });
160 112
161 })() 113 })()
162 </script> 114 </script>
OLDNEW
« no previous file with comments | « Tools/GardeningServer/ui/test/ct-bot-failure-card-tests.html ('k') | Tools/GardeningServer/ui/test/ct-failure-card-tests.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698