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

Side by Side Diff: chrome/test/data/webui/settings/languages_page_browsertest.js

Issue 2095993003: MD Settings: find language buttons more specifically in tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 /** @fileoverview Suite of tests for settings-languages-page. */ 5 /** @fileoverview Suite of tests for settings-languages-page. */
6 6
7 /** @const {string} Path to root from chrome/test/data/webui/settings/. */ 7 /** @const {string} Path to root from chrome/test/data/webui/settings/. */
8 var ROOT_PATH = '../../../../../'; 8 var ROOT_PATH = '../../../../../';
9 9
10 // Polymer BrowserTest fixture. 10 // Polymer BrowserTest fixture.
11 GEN_INCLUDE( 11 GEN_INCLUDE(
12 [ROOT_PATH + 'chrome/test/data/webui/polymer_browser_test_base.js']); 12 [ROOT_PATH + 'chrome/test/data/webui/polymer_browser_test_base.js']);
13 // SettingsPageBrowserTest fixture. 13 // SettingsPageBrowserTest fixture.
14 GEN_INCLUDE([ROOT_PATH + 14 GEN_INCLUDE([ROOT_PATH +
15 'chrome/test/data/webui/settings/settings_page_browsertest.js']); 15 'chrome/test/data/webui/settings/settings_page_browsertest.js']);
16 16
17 var languageSettings = languageSettings || {}; 17 var languageSettings = languageSettings || {};
18 18
19 /** 19 /**
20 * Test class for settings-languages-page UI. 20 * Test class for settings-languages-page UI.
21 * @constructor 21 * @constructor
22 * @extends {SettingsPageBrowserTest} 22 * @extends {SettingsPageBrowserTest}
23 */ 23 */
24 function SettingsLanguagesPageBrowserTest() { 24 function SettingsLanguagesPageBrowserTest() {}
25 }
26 25
27 SettingsLanguagesPageBrowserTest.prototype = { 26 SettingsLanguagesPageBrowserTest.prototype = {
28 __proto__: SettingsPageBrowserTest.prototype, 27 __proto__: SettingsPageBrowserTest.prototype,
29 28
30 /** @override */ 29 /** @override */
31 browsePreload: 'chrome://md-settings/advanced', 30 browsePreload: 'chrome://md-settings/advanced',
32 31
33 /** @override */ 32 /** @override */
34 preLoad: function() { 33 preLoad: function() {
35 SettingsPageBrowserTest.prototype.preLoad.call(this); 34 SettingsPageBrowserTest.prototype.preLoad.call(this);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 68
70 teardown(function(done) { 69 teardown(function(done) {
71 if (this.isAtRoot()) 70 if (this.isAtRoot())
72 return done(); 71 return done();
73 this.backToRoot(); 72 this.backToRoot();
74 setTimeout(done); 73 setTimeout(done);
75 }.bind(this)); 74 }.bind(this));
76 75
77 test('manage languages', function() { 76 test('manage languages', function() {
78 var manageLanguagesButton = 77 var manageLanguagesButton =
79 languagesPage.$.languagesCollapse.querySelector('.list-button'); 78 languagesPage.$.languagesCollapse.querySelector(
79 '.list-button:last-of-type');
80 MockInteractions.tap(manageLanguagesButton); 80 MockInteractions.tap(manageLanguagesButton);
81 assertTrue(!!languagesPage.$$('settings-manage-languages-page')); 81 assertTrue(!!languagesPage.$$('settings-manage-languages-page'));
82 }); 82 });
83 83
84 test('language detail', function() { 84 test('language detail', function() {
85 var languageButton = languagesPage.$.languagesCollapse.querySelector( 85 var languageButton = languagesPage.$.languagesCollapse.querySelector(
86 '.list-item paper-icon-button[icon="cr:settings"]'); 86 '.list-item paper-icon-button[icon="cr:settings"]');
87 assertTrue(!!languageButton); 87 assertTrue(!!languageButton);
88 MockInteractions.tap(languageButton); 88 MockInteractions.tap(languageButton);
89 89
90 var languageDetailPage = languagesPage.$$( 90 var languageDetailPage =
91 'settings-language-detail-page'); 91 languagesPage.$$('settings-language-detail-page');
92 assertTrue(!!languageDetailPage); 92 assertTrue(!!languageDetailPage);
93 assertEquals('en-US', languageDetailPage.detail.language.code); 93 assertEquals('en-US', languageDetailPage.detail.language.code);
94 }); 94 });
95 95
96 test('manage input methods', function() { 96 test('manage input methods', function() {
97 var inputMethodsCollapse = languagesPage.$.inputMethodsCollapse; 97 var inputMethodsCollapse = languagesPage.$.inputMethodsCollapse;
98 var inputMethodSettingsExist = !!inputMethodsCollapse; 98 var inputMethodSettingsExist = !!inputMethodsCollapse;
99 if (cr.isChromeOS) { 99 if (cr.isChromeOS) {
100 assertTrue(inputMethodSettingsExist); 100 assertTrue(inputMethodSettingsExist);
101 var manageInputMethodsButton = 101 var manageInputMethodsButton =
102 inputMethodsCollapse.querySelector('.list-button'); 102 inputMethodsCollapse.querySelector('.list-button:last-of-type');
103 MockInteractions.tap(manageInputMethodsButton); 103 MockInteractions.tap(manageInputMethodsButton);
104 assertTrue(!!languagesPage.$$('settings-manage-input-methods-page')); 104 assertTrue(!!languagesPage.$$('settings-manage-input-methods-page'));
105 } else { 105 } else {
106 assertFalse(inputMethodSettingsExist); 106 assertFalse(inputMethodSettingsExist);
107 } 107 }
108 }); 108 });
109 109
110 test('spellcheck', function() { 110 test('spellcheck', function() {
111 var spellCheckCollapse = languagesPage.$.spellCheckCollapse; 111 var spellCheckCollapse = languagesPage.$.spellCheckCollapse;
112 var spellCheckSettingsExist = !!spellCheckCollapse; 112 var spellCheckSettingsExist = !!spellCheckCollapse;
113 if (cr.isMac) { 113 if (cr.isMac) {
114 assertFalse(spellCheckSettingsExist); 114 assertFalse(spellCheckSettingsExist);
115 } else { 115 } else {
116 assertTrue(spellCheckSettingsExist); 116 assertTrue(spellCheckSettingsExist);
117 MockInteractions.tap(spellCheckCollapse.querySelector('.list-button')); 117 MockInteractions.tap(
118 spellCheckCollapse.querySelector('.list-button:last-of-type'));
118 assertTrue(!!languagesPage.$$('settings-edit-dictionary-page')); 119 assertTrue(!!languagesPage.$$('settings-edit-dictionary-page'));
119 } 120 }
120 }); 121 });
121 }.bind(this)); 122 }.bind(this));
122 123
123 // TODO(michaelpg): Test more aspects of the languages UI. 124 // TODO(michaelpg): Test more aspects of the languages UI.
124 125
125 // Run all registered tests. 126 // Run all registered tests.
126 mocha.run(); 127 mocha.run();
127 }); 128 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698