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

Side by Side Diff: dashboard/dashboard/elements/test-picker-test.html

Issue 2767433002: Start using /list_tests to populate subtest menus in test-picker (Closed)
Patch Set: fix typo Created 3 years, 8 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
« no previous file with comments | « dashboard/dashboard/elements/test-picker.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright 2015 The Chromium Authors. All rights reserved. 3 Copyright 2015 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 7
8 <link rel="import" href="/dashboard/elements/test-picker.html"> 8 <link rel="import" href="/dashboard/elements/test-picker.html">
9 <link rel="import" href="/dashboard/static/testing_common.html"> 9 <link rel="import" href="/dashboard/static/testing_common.html">
10 10
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // Test suites should be in the order of monitored, unmonitored, 102 // Test suites should be in the order of monitored, unmonitored,
103 // and deprecated. 103 // and deprecated.
104 var expectedSuites = ['blink_perf', 'dromaeo', 'endure']; 104 var expectedSuites = ['blink_perf', 'dromaeo', 'endure'];
105 var actualSuites = []; 105 var actualSuites = [];
106 for (var i = 0; i < suiteItems.length; i++) { 106 for (var i = 0; i < suiteItems.length; i++) {
107 actualSuites.push(suiteItems[i].name); 107 actualSuites.push(suiteItems[i].name);
108 } 108 }
109 assert.deepEqual(actualSuites, expectedSuites); 109 assert.deepEqual(actualSuites, expectedSuites);
110 }, testOptions); 110 }, testOptions);
111 111
112 test('fullPathRetained', function() { 112 test('fullPathRetained', async function() {
113 testing_common.addXhrMock('*', JSON.stringify(MOCK_RESPONSE)); 113 const testPicker = document.createElement('test-picker');
114 let testPicker = document.createElement('test-picker');
115 testPicker.testSuites = { 114 testPicker.testSuites = {
116 'endure': { 115 'endure': {
117 'mas': {'Chromium': {'mac': false, 'win7': true}}, 116 'mas': {'Chromium': {'mac': false, 'win7': true}},
118 'dep': true 117 'dep': true
119 }, 118 },
120 'dromaeo': { 119 'dromaeo': {
121 'mas': {'Chromium': {'mac': false, 'win7': false}} 120 'mas': {'Chromium': {'mac': false, 'win7': false}}
122 }, 121 },
123 'blink_perf': { 122 'blink_perf': {
124 'mas': {'Chromium': {'mac': false, 'win7': false}}, 123 'mas': {'Chromium': {'mac': false, 'win7': false}},
125 'mon': ['select-multiple-add/select-multiple-add.html'] 124 'mon': ['select-multiple-add/select-multiple-add.html']
126 } 125 }
127 }; 126 };
127 testPicker.subtests.prepopulate({
128 'Chromium/mac/blink_perf': [{name: 'textarea-edit'}],
129 'Chromium/mac/blink_perf/textarea-edit': [
130 {name: 'textarea_edit.html'}]
131 });
128 132
129 let suiteMenu = testPicker.getSelectionMenu(0); 133 const suiteMenu = testPicker.getSelectionMenu(0);
130 suiteMenu.selectedItem = suiteMenu.items[0]; 134 suiteMenu.selectedItem = suiteMenu.items[0];
131 135
132 let botMenu = testPicker.getSelectionMenu(1); 136 const botMenu = testPicker.getSelectionMenu(1);
133 botMenu.selectedItem = botMenu.items[0]; 137 // Pick the second bot menu item because the first is the master.
138 botMenu.selectedItem = botMenu.items[1];
134 139
135 let benchmarkMenu = testPicker.getSelectionMenu(2); 140 // We need to do this manuallyto make sure the next menu is populated.
136 let expectedBenchmark = benchmarkMenu.items[0].name; 141 await testPicker.updateSubtestMenus(2);
142
143 const benchmarkMenu = testPicker.getSelectionMenu(2);
144 const expectedBenchmark = benchmarkMenu.items[0].name;
137 benchmarkMenu.selectedItem = benchmarkMenu.items[0]; 145 benchmarkMenu.selectedItem = benchmarkMenu.items[0];
138 146
139 let metricMenu = testPicker.getSelectionMenu(3); 147 await testPicker.updateSubtestMenus(3);
140 let expectedMetric = metricMenu.items[0].name; 148
149 const metricMenu = testPicker.getSelectionMenu(3);
150 const expectedMetric = metricMenu.items[0].name;
141 metricMenu.selectedItem = metricMenu.items[0]; 151 metricMenu.selectedItem = metricMenu.items[0];
142 152
143 // Now pick a new bot 153 // Now pick a new bot
144 botMenu.selectedItem = botMenu.items[1]; 154 botMenu.selectedItem = botMenu.items[1];
145 155
146 assert.deepEqual(benchmarkMenu.selectedItem.name, expectedBenchmark); 156 assert.deepEqual(benchmarkMenu.selectedItem.name, expectedBenchmark);
147 assert.deepEqual(metricMenu.selectedItem.name, expectedMetric); 157 assert.deepEqual(metricMenu.selectedItem.name, expectedMetric);
148 }, testOptions); 158 }, testOptions);
149 159
150 test('getCurrentSelectionReturnsNullIfInvalid', async function() { 160 test('getCurrentSelectionReturnsUndefinedIfInvalid', async function() {
151 testing_common.addXhrMock('*', JSON.stringify(MOCK_RESPONSE)); 161 const testPicker = document.createElement('test-picker');
152 let testPicker = document.createElement('test-picker');
153 testPicker.testSuites = { 162 testPicker.testSuites = {
154 'endure': { 163 'endure': {
155 'mas': {'Chromium': {'mac': false, 'win7': true}}, 164 'mas': {'Chromium': {'mac': false, 'win7': true}},
156 'dep': true 165 'dep': true
157 }, 166 },
158 'dromaeo': { 167 'dromaeo': {
159 'mas': {'Chromium': {'mac': false, 'win7': false}} 168 'mas': {'Chromium': {'mac': false, 'win7': false}}
160 }, 169 },
161 'blink_perf': { 170 'blink_perf': {
162 'mas': {'Chromium': {'mac': false, 'win7': false}}, 171 'mas': {'Chromium': {'mac': false, 'win7': false}},
163 'mon': ['select-multiple-add/select-multiple-add.html'] 172 'mon': ['select-multiple-add/select-multiple-add.html']
164 } 173 }
165 }; 174 };
166 175
167 let suiteMenu = testPicker.getSelectionMenu(0); 176 const suiteMenu = testPicker.getSelectionMenu(0);
168 suiteMenu.selectedItem = suiteMenu.items[0]; 177 suiteMenu.selectedItem = suiteMenu.items[0];
169 178
170 let botMenu = testPicker.getSelectionMenu(1); 179 const botMenu = testPicker.getSelectionMenu(1);
171 botMenu.selectedItem = botMenu.items[0]; 180 botMenu.selectedItem = botMenu.items[0];
172 181
173 assert.isNull(await testPicker.getCurrentSelection()); 182 assert.isUndefined(await testPicker.getCurrentSelection());
183 });
184
185 test('prepopulateSubtests', async function() {
186 const testPicker = document.createElement('test-picker');
187 testPicker.subtests.prepopulate({foo: 'bar'});
188 assert.strictEqual(
189 await testPicker.subtests.getSubtestsForPath('foo'), 'bar');
190 });
191
192 test('getSubtestsForPath', async function() {
193 testing_common.addXhrMock('*', JSON.stringify(['foo/bar']));
194 const testPicker = document.createElement('test-picker');
195 assert.deepEqual(
196 await testPicker.subtests.getSubtestsForPath('foo'), [{name: 'bar'}]);
197 testing_common.clearXhrMock();
198 });
199
200 test('subtestsStoresPromises', async function() {
201 testing_common.addXhrMock('*', JSON.stringify(['foo/bar']));
202 const testPicker = document.createElement('test-picker');
203 assert.instanceOf(
204 testPicker.subtests.getSubtestsForPath('foo'), Promise);
174 testing_common.clearXhrMock(); 205 testing_common.clearXhrMock();
175 }); 206 });
176 }); 207 });
177 </script> 208 </script>
OLDNEW
« no previous file with comments | « dashboard/dashboard/elements/test-picker.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698