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-test-list.html"> | |
8 | |
9 <link rel="import" href="../../model/ct-step-failure.html"> | |
10 | |
11 <script> | |
12 (function () { | |
13 | |
14 var assert = chai.assert; | |
15 | |
16 var kExampleTests = [ | |
17 new CTStepFailure("foo_step", "plugins/gesture-events-scrolled.html", {}, 1771
64, 177165), | |
18 new CTStepFailure("foo_step", "plugins/transformed-events.html", {}, 177164, 1
77165), | |
19 new CTStepFailure("foo_step", "plugins/gesture-events.html", {}, 177164, 17716
5), | |
20 ]; | |
21 | |
22 var kExampleTestsChromium = [ | |
23 new CTStepFailure("browser_tests", "SomeTest.SubTest1", {}, 177164, 177165), | |
24 new CTStepFailure("browser_tests", "SomeTest.SubTest2", {}, 177164, 177165), | |
25 ]; | |
26 | |
27 var kExampleTestsBlink = [ | |
28 new CTStepFailure("webkit_tests", "fast/events/foo.html", {}, 177164, 177165), | |
29 new CTStepFailure("webkit_tests", "fast/events/bar.html", {}, 177164, 177165), | |
30 ]; | |
31 | |
32 function createTestList(tests) { | |
33 var list = document.createElement('ct-test-list'); | |
34 list.tests = tests; | |
35 return list; | |
36 } | |
37 | |
38 describe('ct-test-list', function() { | |
39 var list; | |
40 | |
41 describe('tests failed', function() { | |
42 before(function(done) { | |
43 list = createTestList(kExampleTests); | |
44 setTimeout(done); | |
45 }); | |
46 | |
47 it('should show all tests', function() { | |
48 var tests = list.shadowRoot.querySelectorAll('a'); | |
49 assert.equal(tests.length, 3); | |
50 assert.equal(tests[0].href, 'http://test-results.appspot.com/dashboards/fl
akiness_dashboard.html#tests=plugins%2Fgesture-events-scrolled.html&testType=foo
_step'); | |
51 assert.equal(tests[1].href, 'http://test-results.appspot.com/dashboards/fl
akiness_dashboard.html#tests=plugins%2Ftransformed-events.html&testType=foo_step
'); | |
52 assert.equal(tests[2].href, 'http://test-results.appspot.com/dashboards/fl
akiness_dashboard.html#tests=plugins%2Fgesture-events.html&testType=foo_step'); | |
53 }); | |
54 }); | |
55 | |
56 describe('group of tests failed', function() { | |
57 afterEach(function() { | |
58 var tests = list.shadowRoot.querySelectorAll('a'); | |
59 assert.lengthOf(tests, 0); | |
60 var icons = list.shadowRoot.querySelectorAll('paper-icon-button'); | |
61 assert.lengthOf(icons, 1); | |
62 }); | |
63 | |
64 it('should group chromium tests', function(done) { | |
65 list = createTestList(kExampleTestsChromium); | |
66 setTimeout(done); | |
67 }); | |
68 | |
69 it('should group blink tests', function(done) { | |
70 list = createTestList(kExampleTestsBlink); | |
71 setTimeout(done); | |
72 }); | |
73 }); | |
74 | |
75 describe('many tests failed', function() { | |
76 var manyTests = []; | |
77 before(function() { | |
78 for (var i = 0; i < 12; i++) { | |
79 manyTests.push(new CTStepFailure("base_unittests", "SomeTest{1}.SubTest"
.assign(i), {})); | |
80 } | |
81 }); | |
82 it('should clamp tests to 10 when there are 12 or more', function(done) { | |
83 list = createTestList(manyTests); | |
84 setTimeout(function() { | |
85 var links = list.shadowRoot.querySelectorAll('a'); | |
86 assert.lengthOf(links, 10); | |
87 done(); | |
88 }); | |
89 }); | |
90 it('should show all tests when clicked', function(done) { | |
91 list = createTestList(manyTests); | |
92 setTimeout(function() { | |
93 var buttons = list.shadowRoot.querySelectorAll('#outerExpand'); | |
94 assert.lengthOf(buttons, 1); | |
95 buttons[0].dispatchEvent(new CustomEvent('click')); | |
96 setTimeout(function() { | |
97 var links = list.shadowRoot.querySelectorAll('a'); | |
98 assert.lengthOf(links, 12); | |
99 var buttons = list.shadowRoot.querySelectorAll('#outerExpand'); | |
100 assert.lengthOf(buttons, 0); | |
101 done(); | |
102 }); | |
103 }); | |
104 }); | |
105 it('should show all tests when no steps have >10 tests each', function(done)
{ | |
106 var sixTestsEach = []; | |
107 for (var step of ["step1", "step2"]) { | |
108 for (var i = 0; i < 6; i++) { | |
109 sixTestsEach.push(new CTStepFailure(step, "SomeTest{1}.SubTest".assign
(i), {})); | |
110 } | |
111 } | |
112 list = createTestList(sixTestsEach); | |
113 setTimeout(function() { | |
114 var links = list.shadowRoot.querySelectorAll('a'); | |
115 assert.lengthOf(links, 12); | |
116 done(); | |
117 }); | |
118 }); | |
119 }); | |
120 }); | |
121 | |
122 })(); | |
123 </script> | |
OLD | NEW |