OLD | NEW |
| (Empty) |
1 <!-- | |
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 | |
4 found in the LICENSE file. | |
5 --> | |
6 | |
7 <link rel="import" href="../ct-failure-card-buttons.html"> | |
8 <link rel="import" href="../ct-step-failure-card.html"> | |
9 | |
10 <link rel="import" href="../../model/ct-commit-list-mock.html"> | |
11 <link rel="import" href="../../model/ct-commit-log-mock.html"> | |
12 <link rel="import" href="../../model/ct-failure-group.html"> | |
13 | |
14 <script> | |
15 (function () { | |
16 | |
17 var assert = chai.assert; | |
18 | |
19 describe('ct-failure-card-buttons', function() { | |
20 var group; | |
21 var card; | |
22 var failures; | |
23 | |
24 beforeEach(function(done) { | |
25 card = document.createElement('ct-failure-card-buttons'); | |
26 var cl = new CTCommitListMock(); | |
27 group = new CTFailureGroup('blink', new CTStepFailureGroupData([ | |
28 new CTStepFailure('autobot', 'unknown', {someBuilder: {key: 'a'}}, {'bli
nk':158547}, | |
29 {'blink':158544})], cl)); | |
30 card.group = group; | |
31 setTimeout(done); | |
32 }); | |
33 | |
34 describe('failure card buttons', function() { | |
35 | |
36 it('examine should link to failure', function() { | |
37 assert(card.shadowRoot.getElementById('examine').parentNode.href.endsWith( | |
38 '/blink/failure/autobot%3A%3Aunknown')); | |
39 }); | |
40 | |
41 it('clicking link bug should show dialog', function(done) { | |
42 card.shadowRoot.getElementById('link-bug').dispatchEvent(new CustomEvent('
tap')); | |
43 setTimeout(function() { | |
44 var dialog = card.shadowRoot.getElementById('bugDialog'); | |
45 assert.isTrue(dialog.opened); | |
46 var bugField = card.shadowRoot.getElementById('bug'); | |
47 bugField.value = '999'; | |
48 card.shadowRoot.getElementById('dialogOk').dispatchEvent(new CustomEvent
('tap')); | |
49 setTimeout(function() { | |
50 assert.equal(group.bug, 'https://crbug.com/999'); | |
51 assert.equal(group.bugLabel, 'Bug 999'); | |
52 assert.equal(group._annotation.bug, 'https://crbug.com/999'); | |
53 done(); | |
54 }); | |
55 }); | |
56 }); | |
57 | |
58 it('entering URLs should work for bugs', function(done) { | |
59 card.shadowRoot.getElementById('link-bug').dispatchEvent(new CustomEvent('
tap')); | |
60 setTimeout(function() { | |
61 var dialog = card.shadowRoot.getElementById('bugDialog'); | |
62 assert.isTrue(dialog.opened); | |
63 var bugField = card.shadowRoot.getElementById('bug'); | |
64 bugField.value = 'https://foo.com/?id=888'; | |
65 card.shadowRoot.getElementById('dialogOk').dispatchEvent(new CustomEvent
('tap')); | |
66 setTimeout(function() { | |
67 assert.equal(group.bug, 'https://foo.com/?id=888'); | |
68 assert.equal(group.bugLabel, 'Bug 888'); | |
69 assert.equal(group._annotation.bug, 'https://foo.com/?id=888'); | |
70 done(); | |
71 }); | |
72 }); | |
73 }); | |
74 | |
75 it('file bug link should have the right URL', function(done) { | |
76 card.shadowRoot.getElementById('link-bug').dispatchEvent(new CustomEvent('
tap')); | |
77 setTimeout(function() { | |
78 var dialog = card.shadowRoot.getElementById('bugDialog'); | |
79 assert.isTrue(dialog.opened); | |
80 var fileBugLink = card.shadowRoot.getElementById('fileBugLink'); | |
81 assert.equal(fileBugLink.href, 'https://code.google.com/p/chromium/issue
s/entry?status=Available&labels=Pri-2,gardening-blink&summary=Build%20failure&co
mment=Build%20is%20broken:%0aautobot%20unknown%0Ahttp%3A%2F%2Ftest-results.appsp
ot.com%2Fdashboards%2Fflakiness_dashboard.html%23tests%3Dunknown%26testType%3Dau
tobot%0A%0ARevision%20range%3A%0Ablink%20158544%20%3A%20158545%0A%0AFailing%20bu
ilders%3A%0AsomeBuilder%3A%20undefined%2Fbuilders%2FsomeBuilder%0A'); | |
82 done(); | |
83 }); | |
84 }); | |
85 | |
86 it('remove bug link should work', function(done) { | |
87 group.setBug(123); | |
88 card.shadowRoot.getElementById('link-bug').dispatchEvent(new CustomEvent('
tap')); | |
89 setTimeout(function() { | |
90 var dialog = card.shadowRoot.getElementById('bugDialog'); | |
91 assert.isTrue(dialog.opened); | |
92 card.shadowRoot.getElementById('dialogRemoveBug').dispatchEvent(new Cust
omEvent('tap')); | |
93 setTimeout(function() { | |
94 assert.isUndefined(group.bug); | |
95 assert.isUndefined(group.bugLabel); | |
96 done(); | |
97 }); | |
98 }); | |
99 }); | |
100 }); | |
101 | |
102 }); | |
103 | |
104 })() | |
105 </script> | |
OLD | NEW |