| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview Test suite for the Site Engagement WebUI. | 6 * @fileoverview Test suite for the Site Engagement WebUI. |
| 7 */ | 7 */ |
| 8 var ROOT_PATH = '../../../../../'; | 8 var ROOT_PATH = '../../../../../'; |
| 9 var EXAMPLE_URL_1 = 'http://example.com/'; | 9 var EXAMPLE_URL_1 = 'http://example.com/'; |
| 10 var EXAMPLE_URL_2 = 'http://shmlexample.com/'; | 10 var EXAMPLE_URL_2 = 'http://shmlexample.com/'; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 /** @override */ | 40 /** @override */ |
| 41 setUp: function() { | 41 setUp: function() { |
| 42 testing.Test.prototype.setUp.call(this); | 42 testing.Test.prototype.setUp.call(this); |
| 43 suiteSetup(function() { | 43 suiteSetup(function() { |
| 44 return whenPageIsPopulatedForTest(); | 44 return whenPageIsPopulatedForTest(); |
| 45 }); | 45 }); |
| 46 }, | 46 }, |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 // TODO(crbug.com/734716): This test is flaky. | 49 // This test is flaky on Windows. See https://crbug.com/734716. |
| 50 TEST_F('SiteEngagementBrowserTest', 'DISABLED_All', function() { | 50 GEN('#if defined(OS_WIN)'); |
| 51 GEN('#define MAYBE_All DISABLED_All'); |
| 52 GEN('#else'); |
| 53 GEN('#define MAYBE_All All'); |
| 54 GEN('#endif'); |
| 55 TEST_F('SiteEngagementBrowserTest', 'MAYBE_All', function() { |
| 51 test('check engagement values are loaded', function() { | 56 test('check engagement values are loaded', function() { |
| 52 var originCells = | 57 var originCells = |
| 53 Array.from(document.getElementsByClassName('origin-cell')); | 58 Array.from(document.getElementsByClassName('origin-cell')); |
| 54 assertDeepEquals( | 59 assertDeepEquals( |
| 55 [EXAMPLE_URL_1, EXAMPLE_URL_2], originCells.map(x => x.textContent)); | 60 [EXAMPLE_URL_1, EXAMPLE_URL_2], originCells.map(x => x.textContent)); |
| 56 }); | 61 }); |
| 57 | 62 |
| 58 test('scores rounded to 2 decimal places', function() { | 63 test('scores rounded to 2 decimal places', function() { |
| 59 var scoreInputs = | 64 var scoreInputs = |
| 60 Array.from(document.getElementsByClassName('base-score-input')); | 65 Array.from(document.getElementsByClassName('base-score-input')); |
| 61 assertDeepEquals(['10', '3.14'], scoreInputs.map(x => x.value)); | 66 assertDeepEquals(['10', '3.14'], scoreInputs.map(x => x.value)); |
| 62 var bonusScoreCells = | 67 var bonusScoreCells = |
| 63 Array.from(document.getElementsByClassName('bonus-score-cell')); | 68 Array.from(document.getElementsByClassName('bonus-score-cell')); |
| 64 assertDeepEquals(['0', '0'], bonusScoreCells.map(x => x.textContent)); | 69 assertDeepEquals(['0', '0'], bonusScoreCells.map(x => x.textContent)); |
| 65 var totalScoreCells = | 70 var totalScoreCells = |
| 66 Array.from(document.getElementsByClassName('total-score-cell')); | 71 Array.from(document.getElementsByClassName('total-score-cell')); |
| 67 assertDeepEquals(['10', '3.14'], totalScoreCells.map(x => x.textContent)); | 72 assertDeepEquals(['10', '3.14'], totalScoreCells.map(x => x.textContent)); |
| 68 }); | 73 }); |
| 69 mocha.run(); | 74 mocha.run(); |
| 70 }); | 75 }); |
| OLD | NEW |