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

Unified Diff: chrome/test/data/webui/settings/main_page_browsertest.js

Issue 1457543004: Add Mocha based tests for Settings pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/webui/settings/main_page_browsertest.js
diff --git a/chrome/test/data/webui/settings/main_page_browsertest.js b/chrome/test/data/webui/settings/main_page_browsertest.js
new file mode 100644
index 0000000000000000000000000000000000000000..c30a3660df0f7c175ea78d7951fb7fffa22b68dd
--- /dev/null
+++ b/chrome/test/data/webui/settings/main_page_browsertest.js
@@ -0,0 +1,63 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/** @fileoverview Suite of tests for the Settings main page. */
+
+// Polymer BrowserTest fixture.
michaelpg 2015/11/18 02:00:32 // SettingsPageBrowserTest. (or no comment)
stevenjb 2015/11/18 20:02:33 Done.
+GEN_INCLUDE(['settings_page_browsertest.js']);
+
+/**
+ * @constructor
+ * @extends {PolymerTest}
michaelpg 2015/11/18 02:00:32 {SettingsPageBrowserTest}
stevenjb 2015/11/18 20:02:33 Done.
+*/
+function SettingsMainPageBrowserTest() {}
+
+SettingsMainPageBrowserTest.prototype = {
+ __proto__: SettingsPageBrowserTest.prototype,
+
+ registerTests: function() {
+ var self = this;
+ suite('SettingsPage', function() {
+ test('load page', function() {});
+
+ test('basic pages', function() {
+ var page = self.getPage('basic');
+ expectTrue(!!self.getSection(page, 'appearance'));
+ expectTrue(!!self.getSection(page, 'on-startup'));
+ expectTrue(!!self.getSection(page, 'search'));
+ if (!cr.isChromeOS) {
+ expectTrue(!!self.getSection(page, 'people'));
+ expectTrue(!!self.getSection(page, 'defaultBrowser'));
+ } else {
+ expectTrue(!!self.getSection(page, 'internet'));
+ expectTrue(!!self.getSection(page, 'users'));
+ }
+ });
dpapad 2015/11/18 01:44:54 Nit: How about avoiding "var self = this" by just
michaelpg 2015/11/18 02:00:32 Not binding was my suggestion. First of all it's a
stevenjb 2015/11/18 20:02:33 Added a comment.
dpapad 2015/11/18 21:09:53 Thanks for the information. Did not know that "thi
+
+ test('advanced pages', function() {
+ var page = self.getPage('advanced');
+ expectTrue(!!self.getSection(page, 'location'));
+ expectTrue(!!self.getSection(page, 'privacy'));
+ expectTrue(!!self.getSection(page, 'passwordsAndForms'));
+ expectTrue(!!self.getSection(page, 'languages'));
+ expectTrue(!!self.getSection(page, 'downloads'));
+ expectTrue(!!self.getSection(page, 'reset'));
+
+ if (cr.isChromeOS) {
+ expectTrue(!!self.getSection(page, 'dateTime'));
+ expectTrue(!!self.getSection(page, 'bluetooth'));
+ expectTrue(!!self.getSection(page, 'a11y'));
+ }
+ });
+ });
+ }
+};
+
+TEST_F('SettingsMainPageBrowserTest', 'Main', function() {
+ // Register mocha tests.
+ this.registerTests();
michaelpg 2015/11/18 02:00:32 I don't see much of a reason to register these tes
stevenjb 2015/11/18 20:02:33 Done.
+
+ // Run all registered tests.
+ mocha.run();
+});

Powered by Google App Engine
This is Rietveld 408576698