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

Unified Diff: appengine/config_service/ui/test/config-ui/config-set_test.html

Issue 2959833002: config_service: add last import validation and tests (Closed)
Patch Set: Add tests to front-page and config-set page. Created 3 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 side-by-side diff with in-line comments
Download patch
Index: appengine/config_service/ui/test/config-ui/config-set_test.html
diff --git a/appengine/config_service/ui/test/config-ui/config-set_test.html b/appengine/config_service/ui/test/config-ui/config-set_test.html
new file mode 100644
index 0000000000000000000000000000000000000000..0cd9ffbe3b8d95d51b733f7f63965243d8407ef0
--- /dev/null
+++ b/appengine/config_service/ui/test/config-ui/config-set_test.html
@@ -0,0 +1,101 @@
+<!--
+ Copyright 2017 The LUCI Authors. All rights reserved.
+ Use of this source code is governed under the Apache License, Version 2.0
+ that can be found in the LICENSE file.
+-->
+
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
+
+ <title>config-set test</title>
+
+ <script src="../../bower_components/webcomponentsjs/webcomponents-lite.js"></script>
+ <script src="../../bower_components/web-component-tester/browser.js"></script>
+
+ <link rel="import" href="../../src/config-ui/config-set.html">
+ </head>
+ <body>
+
+ <test-fixture id="projects/infra-experimental">
Sergey Berezin 2017/06/28 19:11:35 nit: we usually try to avoid having actual product
ayanaadylova 2017/07/05 18:02:45 Done.
ayanaadylova 2017/07/06 22:51:43 Done.
+ <template>
+ <config-set category="projects"
+ name="infra-experimental"></config-set>
+ </template>
+ </test-fixture>
+
+ <test-fixture id="projects/infra-experimental/refs/heads/master">
+ <template>
+ <config-set category="projects"
+ name="infra-experimental/refs/heads/master"></config-set>
+ </template>
+ </test-fixture>
+
+ <script>
+ suite('<config-set>', function() {
+ var config_set;
+ setup(function() {
+ config_set = fixture('projects/infra-experimental');
+ });
+
+ test('checks the category of config set', function() {
Sergey Berezin 2017/06/28 19:11:35 nit: it's a good practice to name suites and tests
ayanaadylova 2017/07/06 22:51:43 Done.
+ assert.equal(config_set.category, 'projects');
+ });
+
+ test('checks the name of config set', function() {
+ assert.equal(config_set.name, 'infra-experimental');
+ });
+
+ test('checks that isLoading property is true by default', function() {
+ assert.equal(config_set.isLoading, true);
+ });
+
+ test('gets iron-ajax response', function () {
+ var ajax = config_set.shadowRoot.querySelector('iron-ajax');
+ ajax.generateRequest();
+ ajax.addEventListener('response', function() {
+ assert.equal(config_set.isLoading, false);
+ assert.equal(config_set.files.length, 11);
+ assert.equal(config_set.lastImportAttempt.success, true);
+ assert.notEqual(config_set.location, "");
+ });
+ });
+
+ });
+
+ suite('<config-set>', function() {
Sergey Berezin 2017/06/28 19:11:35 Should the suite names be different? The two test
ayanaadylova 2017/07/06 22:51:43 Done.
+ var config_set;
+ setup(function() {
+ config_set = fixture('projects/infra-experimental/refs/heads/master');
+ });
+
+ test('checks the category of config set', function() {
+ assert.equal(config_set.category, 'projects');
+ });
+
+ test('checks the name of config set', function() {
+ assert.equal(config_set.name, 'infra-experimental/refs/heads/master');
+ });
+
+ test('checks that isLoading property is true by default', function() {
+ assert.equal(config_set.isLoading, true);
+ });
+
+ test('gets iron-ajax response', function () {
+ var ajax = config_set.shadowRoot.querySelector('iron-ajax');
+ ajax.generateRequest();
+ ajax.addEventListener('response', function() {
+ assert.equal(config_set.isLoading, false);
+ assert.equal(config_set.files.length, 0);
Sergey Berezin 2017/06/28 19:11:35 nit: it would be interesting to generate a few fil
ayanaadylova 2017/07/06 22:51:43 Done.
+ assert.equal(config_set.lastImportAttempt.success, true);
+ assert.notEqual(config_set.location, "");
+ });
+ });
+
+ });
+
+ </script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698