]> source.dussan.org Git - sonarqube.git/commitdiff
refactor web tests to simplify asynchronous actions
authorStas Vilchik <vilchiks@gmail.com>
Thu, 2 Jul 2015 15:19:09 +0000 (17:19 +0200)
committerStas Vilchik <vilchiks@gmail.com>
Thu, 2 Jul 2015 15:19:20 +0000 (17:19 +0200)
server/sonar-web/test/helpers/test-page.js
server/sonar-web/test/medium/issues.spec.js
server/sonar-web/test/medium/users.spec.js

index 4b6df7a987522b93bfe13bb77ba224ccaf4dacc5..cab78072a2a6a55d3f4bef8f73a6d56e7f4f2914 100644 (file)
@@ -5,72 +5,86 @@ define(function (require) {
   var Command = require('intern/dojo/node!leadfoot/Command');
   var pollUntil = require('intern/dojo/node!leadfoot/helpers/pollUntil');
 
-  Command.prototype.assertElementCount = function (selector, count) {
+  Command.prototype.checkElementCount = function (selector, count) {
     return new this.constructor(this, function () {
       return this.parent
-          .findAllByCssSelector(selector)
-          .then(function (elements) {
-            assert.equal(count, elements.length, count + ' elements were found by ' + selector);
-          })
-          .end();
-    });
-  };
+          .then(pollUntil(function (selector, count) {
+            var elements = document.querySelectorAll(selector);
+            return elements.length === count ? true : null;
+          }, [selector, count]))
+          .then(function () {
 
-  Command.prototype.assertElementExist = function (selector) {
-    return new this.constructor(this, function () {
-      return this.parent
-          .findAllByCssSelector(selector)
-          .then(function (elements) {
-            assert.ok(elements.length, selector + ' exists');
-          })
-          .end();
+          }, function () {
+            assert.fail(null, null, 'failed to find ' + count + ' elements by selector "' + selector + '"');
+          });
     });
   };
 
-  Command.prototype.assertElementNotExist = function (selector) {
+  Command.prototype.checkElementExist = function (selector) {
     return new this.constructor(this, function () {
       return this.parent
-          .findAllByCssSelector(selector)
-          .then(function (elements) {
-            assert.equal(elements.length, 0, selector + ' does not exist');
-          })
-          .end();
+          .then(pollUntil(function (selector) {
+            var elements = document.querySelectorAll(selector);
+            return elements.length > 0 ? true : null;
+          }, [selector]))
+          .then(function () {
+
+          }, function () {
+            assert.fail(null, null, 'failed to find elements by selector "' + selector + '"');
+          });
     });
   };
 
-  Command.prototype.assertElementInclude = function (selector, text) {
+  Command.prototype.checkElementNotExist = function (selector) {
     return new this.constructor(this, function () {
       return this.parent
-          .findAllByCssSelector(selector)
-          .getVisibleText()
-          .then(function (texts) {
-            assert.include(texts.join(''), text, selector + ' contains "' + text + '"');
-          })
-          .end();
+          .then(pollUntil(function (selector) {
+            var elements = document.querySelectorAll(selector);
+            return elements.length === 0 ? true : null;
+          }, [selector]))
+          .then(function () {
+
+          }, function () {
+            assert.fail(null, null, 'failed to fail to find elements by selector "' + selector + '"');
+          });
     });
   };
 
-  Command.prototype.assertElementNotInclude = function (selector, text) {
+  Command.prototype.checkElementInclude = function (selector, text) {
     return new this.constructor(this, function () {
       return this.parent
-          .findAllByCssSelector(selector)
-          .getVisibleText()
-          .then(function (texts) {
-            assert.notInclude(texts.join(''), text, selector + ' does not contain "' + text + '"');
-          })
-          .end();
+          .then(pollUntil(function (selector, text) {
+            var elements = Array.prototype.slice.call(document.querySelectorAll(selector));
+            var result = elements.some(function (element) {
+              return element.textContent.indexOf(text) !== -1;
+            });
+            return result ? true : null;
+          }, [selector, text]))
+          .then(function () {
+
+          }, function () {
+            assert.fail(null, null, 'failed to find elements by selector "' + selector +
+                '" that include "' + text + '"');
+          });
     });
   };
 
-  Command.prototype.assertElementVisible = function (selector) {
+  Command.prototype.checkElementNotInclude = function (selector, text) {
     return new this.constructor(this, function () {
       return this.parent
-          .findAllByCssSelector(selector)
-          .isDisplayed()
-          .then(function (displayed) {
-            assert.ok(displayed, selector + ' is visible');
-          })
-          .end();
+          .then(pollUntil(function (selector, text) {
+            var elements = Array.prototype.slice.call(document.querySelectorAll(selector));
+            var result = elements.every(function (element) {
+              return element.textContent.indexOf(text) === -1;
+            });
+            return result ? true : null;
+          }, [selector, text]))
+          .then(function () {
+
+          }, function () {
+            assert.fail(null, null, 'failed to fail to find elements by selector "' + selector +
+                '" that include "' + text + '"');
+          });
     });
   };
 
@@ -93,16 +107,6 @@ define(function (require) {
     });
   };
 
-  Command.prototype.waitForElementCount = function (selector, count) {
-    return new this.constructor(this, function () {
-      return this.parent
-          .then(pollUntil(function (selector, count) {
-            var elements = document.querySelectorAll(selector);
-            return elements.length === count ? true : null;
-          }, [selector, count]));
-    });
-  };
-
   Command.prototype.mockFromFile = function (url, file, options) {
     var response = fs.readFileSync('src/test/json/' + file, 'utf-8');
     return new this.constructor(this, function () {
@@ -139,7 +143,7 @@ define(function (require) {
               App.start({ el: '#content' });
             });
           }, [app])
-          .sleep(2000);
+          .sleep(1000);
     });
   };
 
index eb990de1c8ae315db769a296605e163183ed19ff..c03852901fc7039737385abe9e0b4e3aeadf1dfc 100644 (file)
@@ -11,9 +11,9 @@ define(function (require) {
             .mockFromFile('/api/issue_filters/app', 'issues-spec/app.json')
             .mockFromFile('/api/issues/search', 'issues-spec/search.json')
             .startApp('issues')
-            .waitForElementCount('.js-filter', 2)
-            .waitForElementCount('.js-filter[data-id="31"]', 1)
-            .waitForElementCount('.js-filter[data-id="32"]', 1);
+            .checkElementCount('.js-filter', 2)
+            .checkElementCount('.js-filter[data-id="31"]', 1)
+            .checkElementCount('.js-filter[data-id="32"]', 1);
       });
 
       bdd.it('should load a saved search', function () {
@@ -26,12 +26,12 @@ define(function (require) {
             .startApp('issues')
             .clickElement('.search-navigator-filters-show-list')
             .clickElement('.js-filter[data-id="31"]')
-            .assertElementCount('.js-filter-copy', 1)
-            .assertElementCount('.js-filter-edit', 1)
-            .assertElementInclude('.issues-filters-name', 'Critical and Blocker Issues')
-            .assertElementCount('.js-facet.active[data-value="BLOCKER"]', 1)
-            .assertElementCount('.js-facet.active[data-value="CRITICAL"]', 1)
-            .assertElementCount('.js-facet.active[data-unresolved]', 1);
+            .checkElementCount('.js-filter-copy', 1)
+            .checkElementCount('.js-filter-edit', 1)
+            .checkElementInclude('.issues-filters-name', 'Critical and Blocker Issues')
+            .checkElementCount('.js-facet.active[data-value="BLOCKER"]', 1)
+            .checkElementCount('.js-facet.active[data-value="CRITICAL"]', 1)
+            .checkElementCount('.js-facet.active[data-unresolved]', 1);
       });
 
       bdd.it('should load a saved search and then resets it by new search', function () {
@@ -44,17 +44,17 @@ define(function (require) {
             .startApp('issues')
             .clickElement('.search-navigator-filters-show-list')
             .clickElement('.js-filter[data-id="31"]')
-            .assertElementCount('.js-filter-copy', 1)
-            .assertElementCount('.js-filter-edit', 1)
-            .assertElementInclude('.issues-filters-name', 'Critical and Blocker Issues')
-            .assertElementCount('.js-facet.active[data-value="BLOCKER"]', 1)
-            .assertElementCount('.js-facet.active[data-value="CRITICAL"]', 1)
-            .assertElementCount('.js-facet.active[data-unresolved]', 1)
+            .checkElementCount('.js-filter-copy', 1)
+            .checkElementCount('.js-filter-edit', 1)
+            .checkElementInclude('.issues-filters-name', 'Critical and Blocker Issues')
+            .checkElementCount('.js-facet.active[data-value="BLOCKER"]', 1)
+            .checkElementCount('.js-facet.active[data-value="CRITICAL"]', 1)
+            .checkElementCount('.js-facet.active[data-unresolved]', 1)
             .clickElement('.js-new-search')
-            .assertElementCount('.js-facet[data-value="BLOCKER"]:not(.active)', 1)
-            .assertElementCount('.js-facet[data-value="CRITICAL"]:not(.active)', 1)
-            .assertElementCount('.js-facet.active[data-unresolved]', 1)
-            .assertElementNotInclude('.issues-filters-name', 'Critical and Blocker Issues');
+            .checkElementCount('.js-facet[data-value="BLOCKER"]:not(.active)', 1)
+            .checkElementCount('.js-facet[data-value="CRITICAL"]:not(.active)', 1)
+            .checkElementCount('.js-facet.active[data-unresolved]', 1)
+            .checkElementNotInclude('.issues-filters-name', 'Critical and Blocker Issues');
       });
     });
 
@@ -66,35 +66,35 @@ define(function (require) {
           .mockFromFile('/api/issues/search', 'issues-spec/search.json')
           .startApp('issues')
           .clickElement('.js-new-search')
-          .assertElementExist('.facet[data-value=BLOCKER]')
-          .assertElementExist('.facet[data-value=CRITICAL]')
-          .assertElementExist('.facet[data-value=MAJOR]')
-          .assertElementExist('.facet[data-value=MINOR]')
-          .assertElementExist('.facet[data-value=INFO]')
-
-          .assertElementExist('.facet[data-value=OPEN]')
-          .assertElementExist('.facet[data-value=REOPENED]')
-          .assertElementExist('.facet[data-value=CONFIRMED]')
-          .assertElementExist('.facet[data-value=RESOLVED]')
-          .assertElementExist('.facet[data-value=CLOSED]')
-
-          .assertElementExist('.facet[data-unresolved]')
-          .assertElementExist('.facet[data-value=REMOVED]')
-          .assertElementExist('.facet[data-value=FIXED]')
-          .assertElementExist('.facet[data-value=FALSE-POSITIVE]')
-
-          .assertElementCount('.issue', 50)
-          .assertElementCount('.issue.selected', 1)
-        //.assertElementInclude('.issue', '1 more branches need to be covered by unit tests to reach')
-
-          .assertElementExist('.js-new-search')
-          .assertElementExist('.js-filter-save-as')
-
-          .assertElementInclude('#issues-total', '4623')
-          .assertElementExist('.js-prev')
-          .assertElementExist('.js-next')
-          .assertElementExist('.js-reload')
-          .assertElementExist('.js-bulk-change');
+          .checkElementExist('.facet[data-value=BLOCKER]')
+          .checkElementExist('.facet[data-value=CRITICAL]')
+          .checkElementExist('.facet[data-value=MAJOR]')
+          .checkElementExist('.facet[data-value=MINOR]')
+          .checkElementExist('.facet[data-value=INFO]')
+
+          .checkElementExist('.facet[data-value=OPEN]')
+          .checkElementExist('.facet[data-value=REOPENED]')
+          .checkElementExist('.facet[data-value=CONFIRMED]')
+          .checkElementExist('.facet[data-value=RESOLVED]')
+          .checkElementExist('.facet[data-value=CLOSED]')
+
+          .checkElementExist('.facet[data-unresolved]')
+          .checkElementExist('.facet[data-value=REMOVED]')
+          .checkElementExist('.facet[data-value=FIXED]')
+          .checkElementExist('.facet[data-value=FALSE-POSITIVE]')
+
+          .checkElementCount('.issue', 50)
+          .checkElementCount('.issue.selected', 1)
+        //.checkElementInclude('.issue', '1 more branches need to be covered by unit tests to reach')
+
+          .checkElementExist('.js-new-search')
+          .checkElementExist('.js-filter-save-as')
+
+          .checkElementInclude('#issues-total', '4623')
+          .checkElementExist('.js-prev')
+          .checkElementExist('.js-next')
+          .checkElementExist('.js-reload')
+          .checkElementExist('.js-bulk-change');
     });
 
     bdd.it('should show severity facet', function () {
@@ -105,11 +105,11 @@ define(function (require) {
           .mockFromFile('/api/issues/search', 'issues-spec/search.json')
           .startApp('issues')
           .clickElement('.js-new-search')
-          .waitForElementCount('.issue', 50)
+          .checkElementCount('.issue', 50)
           .clearMocks()
           .mockFromFile('/api/issues/search', 'issues-spec/search-reopened.json', { data: { severities: 'BLOCKER' } })
           .clickElement('.facet[data-value=BLOCKER]')
-          .waitForElementCount('.issue', 4);
+          .checkElementCount('.issue', 4);
     });
 
     bdd.it('should select issues', function () {
@@ -123,20 +123,20 @@ define(function (require) {
           .mockFromFile('/api/issues/search', 'issues-spec/search.json')
           .startApp('issues')
           .clickElement('.js-new-search')
-          .assertElementExist('.js-selection')
-          .assertElementNotExist('.js-selection.icon-checkbox-checked')
-          .assertElementExist('.issue .js-toggle')
-          .assertElementCount('.js-toggle', 50)
-          .assertElementNotExist(issueSelector + ' .js-toggle .icon-checkbox-checked')
+          .checkElementExist('.js-selection')
+          .checkElementNotExist('.js-selection.icon-checkbox-checked')
+          .checkElementExist('.issue .js-toggle')
+          .checkElementCount('.js-toggle', 50)
+          .checkElementNotExist(issueSelector + ' .js-toggle .icon-checkbox-checked')
           .clickElement(issueSelector + ' .js-toggle')
-          .assertElementExist(issueSelector + ' .js-toggle .icon-checkbox-checked')
-          .assertElementExist('.js-selection.icon-checkbox-single.icon-checkbox-checked')
+          .checkElementExist(issueSelector + ' .js-toggle .icon-checkbox-checked')
+          .checkElementExist('.js-selection.icon-checkbox-single.icon-checkbox-checked')
           .clickElement('.js-selection')
-          .assertElementNotExist('.js-selection.icon-checkbox-checked')
-          .assertElementNotExist('.js-toggle .icon-checkbox-checked')
+          .checkElementNotExist('.js-selection.icon-checkbox-checked')
+          .checkElementNotExist('.js-toggle .icon-checkbox-checked')
           .clickElement('.js-selection')
-          .assertElementExist('.js-selection.icon-checkbox-checked')
-          .assertElementCount('.js-toggle .icon-checkbox-checked', 50);
+          .checkElementExist('.js-selection.icon-checkbox-checked')
+          .checkElementCount('.js-toggle .icon-checkbox-checked', 50);
     });
 
     bdd.it('should bulk change issues', function () {
@@ -151,8 +151,8 @@ define(function (require) {
           .clickElement('.js-new-search')
           .clickElement('#issues-bulk-change')
           .clickElement('.js-bulk-change')
-          .assertElementExist('#bulk-change-form')
-          .assertElementInclude('#bulk-change-form', 'bulk change form');
+          .checkElementExist('#bulk-change-form')
+          .checkElementInclude('#bulk-change-form', 'bulk change form');
     });
 
     bdd.it('should bulk change selected issues', function () {
@@ -168,24 +168,24 @@ define(function (require) {
           '<div id="bulk-change-form">bulk change form</div>', { contentType: 'text/plain' })
           .startApp('issues')
           .clickElement('.js-new-search')
-          .assertElementExist('.js-selection')
-          .assertElementNotExist('.js-selection.icon-checkbox-checked')
-          .assertElementExist('.issue .js-toggle')
-          .assertElementNotExist(issueSelector + ' .js-toggle .icon-checkbox-checked')
+          .checkElementExist('.js-selection')
+          .checkElementNotExist('.js-selection.icon-checkbox-checked')
+          .checkElementExist('.issue .js-toggle')
+          .checkElementNotExist(issueSelector + ' .js-toggle .icon-checkbox-checked')
           .clickElement(issueSelector + ' .js-toggle')
-          .assertElementExist(issueSelector + ' .js-toggle .icon-checkbox-checked')
-          .assertElementExist('.js-selection.icon-checkbox-single.icon-checkbox-checked')
+          .checkElementExist(issueSelector + ' .js-toggle .icon-checkbox-checked')
+          .checkElementExist('.js-selection.icon-checkbox-single.icon-checkbox-checked')
           .clickElement('#issues-bulk-change')
           .clickElement('.js-bulk-change-selected')
-          .assertElementExist('#bulk-change-form')
-          .assertElementInclude('#bulk-change-form', 'bulk change form')
+          .checkElementExist('#bulk-change-form')
+          .checkElementInclude('#bulk-change-form', 'bulk change form')
           .clearMocks()
           .mockFromFile('/api/issues/search', 'issues-spec/search-changed.json')
           .execute(function () {
             window.onBulkIssues();
           })
-          .assertElementExist(issueSelector + ' .js-issue-set-severity .icon-severity-blocker')
-          .assertElementExist(issueSelector + ' .js-toggle .icon-checkbox-checked');
+          .checkElementExist(issueSelector + ' .js-issue-set-severity .icon-severity-blocker')
+          .checkElementExist(issueSelector + ' .js-toggle .icon-checkbox-checked');
     });
 
     bdd.it('should filter similar issues', function () {
@@ -199,20 +199,20 @@ define(function (require) {
           .startApp('issues')
           .clickElement('.js-new-search')
           .clickElement('.issue.selected .js-issue-filter')
-          .assertElementExist('.bubble-popup')
-          .assertElementExist('.bubble-popup [data-property="severities"][data-value="MAJOR"]')
-          .assertElementExist('.bubble-popup [data-property="statuses"][data-value="CONFIRMED"]')
-          .assertElementExist('.bubble-popup [data-property="resolved"][data-value="false"]')
-          .assertElementExist('.bubble-popup [data-property="rules"][data-value="squid:S1214"]')
-          .assertElementExist('.bubble-popup [data-property="assigned"][data-value="false"]')
-          .assertElementExist('.bubble-popup [data-property="planned"][data-value="false"]')
-          .assertElementExist('.bubble-popup [data-property="tags"][data-value="bad-practice"]')
-          .assertElementExist('.bubble-popup [data-property="tags"][data-value="brain-overload"]')
-          .assertElementExist('.bubble-popup [data-property="projectUuids"][data-value="69e57151-be0d-4157-adff-c06741d88879"]')
-          .assertElementExist('.bubble-popup [data-property="moduleUuids"][data-value="7feef7c3-11b9-4175-b5a7-527ca3c75cb7"]')
-          .assertElementExist('.bubble-popup [data-property="fileUuids"][data-value="b0517331-0aaf-4091-b5cf-8e305dd0337a"]')
+          .checkElementExist('.bubble-popup')
+          .checkElementExist('.bubble-popup [data-property="severities"][data-value="MAJOR"]')
+          .checkElementExist('.bubble-popup [data-property="statuses"][data-value="CONFIRMED"]')
+          .checkElementExist('.bubble-popup [data-property="resolved"][data-value="false"]')
+          .checkElementExist('.bubble-popup [data-property="rules"][data-value="squid:S1214"]')
+          .checkElementExist('.bubble-popup [data-property="assigned"][data-value="false"]')
+          .checkElementExist('.bubble-popup [data-property="planned"][data-value="false"]')
+          .checkElementExist('.bubble-popup [data-property="tags"][data-value="bad-practice"]')
+          .checkElementExist('.bubble-popup [data-property="tags"][data-value="brain-overload"]')
+          .checkElementExist('.bubble-popup [data-property="projectUuids"][data-value="69e57151-be0d-4157-adff-c06741d88879"]')
+          .checkElementExist('.bubble-popup [data-property="moduleUuids"][data-value="7feef7c3-11b9-4175-b5a7-527ca3c75cb7"]')
+          .checkElementExist('.bubble-popup [data-property="fileUuids"][data-value="b0517331-0aaf-4091-b5cf-8e305dd0337a"]')
           .clickElement('.bubble-popup [data-property="severities"]')
-          .waitForElementCount('.issue', 17);
+          .checkElementCount('.issue', 17);
     });
   });
 
index 22a6757a47d60a48acfff8b29c1ce1525f7942bb..d7d57572a6d2b55e0ab7257ecc2faf08e5c9e105 100644 (file)
@@ -10,21 +10,21 @@ define(function (require) {
           .mockFromString('/api/l10n/index', '{}')
           .mockFromFile('/api/users/search', 'users-spec/search.json')
           .startApp('users')
-          .assertElementCount('#users-list ul', 1)
-          .assertElementCount('#users-list li[data-login]', 3)
-          .assertElementInclude('#users-list .js-user-login', 'smith')
-          .assertElementInclude('#users-list .js-user-name', 'Bob')
-          .assertElementInclude('#users-list .js-user-email', 'bob@example.com')
-          .assertElementCount('#users-list .js-user-update', 3)
-          .assertElementCount('#users-list .js-user-change-password', 3)
-          .assertElementCount('#users-list .js-user-deactivate', 3)
-        //.assertElementInclude('#users-list-footer', '3/3')
-          .assertElementNotInclude('[data-login="ryan"]', 'another@example.com')
+          .checkElementCount('#users-list ul', 1)
+          .checkElementCount('#users-list li[data-login]', 3)
+          .checkElementInclude('#users-list .js-user-login', 'smith')
+          .checkElementInclude('#users-list .js-user-name', 'Bob')
+          .checkElementInclude('#users-list .js-user-email', 'bob@example.com')
+          .checkElementCount('#users-list .js-user-update', 3)
+          .checkElementCount('#users-list .js-user-change-password', 3)
+          .checkElementCount('#users-list .js-user-deactivate', 3)
+        //.checkElementInclude('#users-list-footer', '3/3')
+          .checkElementNotInclude('[data-login="ryan"]', 'another@example.com')
           .clickElement('[data-login="ryan"] .js-user-more-scm')
-          .assertElementInclude('[data-login="ryan"]', 'another@example.com')
-          .assertElementNotInclude('[data-login="ryan"]', 'four')
+          .checkElementInclude('[data-login="ryan"]', 'another@example.com')
+          .checkElementNotInclude('[data-login="ryan"]', 'four')
           .clickElement('[data-login="ryan"] .js-user-more-groups')
-          .assertElementInclude('[data-login="ryan"]', 'four');
+          .checkElementInclude('[data-login="ryan"]', 'four');
     });
 
     bdd.it('should search users', function () {
@@ -34,20 +34,20 @@ define(function (require) {
           .mockFromString('/api/l10n/index', '{}')
           .mockFromFile('/api/users/search', 'users-spec/search.json')
           .startApp('users')
-          .assertElementCount('#users-list ul', 1)
-          .assertElementCount('#users-list li[data-login]', 3)
+          .checkElementCount('#users-list ul', 1)
+          .checkElementCount('#users-list li[data-login]', 3)
           .clearMocks()
           .mockFromFile('/api/users/search', 'users-spec/search-filtered.json')
           .fillElement('#users-search-query', 'ryan')
           .clickElement('#users-search-submit')
           .waitForDeletedByCssSelector('[data-login="admin"]')
-          .assertElementCount('#users-list li[data-login]', 1)
+          .checkElementCount('#users-list li[data-login]', 1)
           .clearMocks()
           .mockFromFile('/api/users/search', 'users-spec/search.json')
           .fillElement('#users-search-query', '')
           .clickElement('#users-search-submit')
-          .assertElementCount('[data-login="admin"]', 1)
-          .assertElementCount('#users-list li[data-login]', 3);
+          .checkElementCount('[data-login="admin"]', 1)
+          .checkElementCount('#users-list li[data-login]', 3);
     });
 
     bdd.it('should show more', function () {
@@ -57,13 +57,13 @@ define(function (require) {
           .mockFromString('/api/l10n/index', '{}')
           .mockFromFile('/api/users/search', 'users-spec/search-big-1.json')
           .startApp('users')
-          .assertElementCount('#users-list ul', 1)
-          .assertElementCount('#users-list li[data-login]', 2)
+          .checkElementCount('#users-list ul', 1)
+          .checkElementCount('#users-list li[data-login]', 2)
           .clearMocks()
           .mockFromFile('/api/users/search', 'users-spec/search-big-2.json')
           .clickElement('#users-fetch-more')
-          .assertElementCount('[data-login="ryan"]', 1)
-          .assertElementCount('#users-list li[data-login]', 3);
+          .checkElementCount('[data-login="ryan"]', 1)
+          .checkElementCount('#users-list li[data-login]', 3);
     });
 
     bdd.it('should create a new user', function () {
@@ -73,10 +73,10 @@ define(function (require) {
           .mockFromString('/api/l10n/index', '{}')
           .mockFromFile('/api/users/search', 'users-spec/search.json')
           .startApp('users')
-          .assertElementCount('#users-list ul', 1)
-          .assertElementCount('#users-list li[data-login]', 3)
+          .checkElementCount('#users-list ul', 1)
+          .checkElementCount('#users-list li[data-login]', 3)
           .clickElement('#users-create')
-          .assertElementCount('#create-user-form', 1)
+          .checkElementCount('#create-user-form', 1)
           .clearMocks()
           .mockFromFile('/api/users/search', 'users-spec/search-created.json')
           .mockFromString('/api/users/create', '{}')
@@ -91,11 +91,11 @@ define(function (require) {
             jQuery('[name="scmAccounts"]').last().val('scm2');
           })
           .clickElement('#create-user-submit')
-          .assertElementCount('[data-login="login"]', 1)
-          .assertElementCount('#users-list li[data-login]', 4)
-          .assertElementInclude('#users-list .js-user-login', 'login')
-          .assertElementInclude('#users-list .js-user-name', 'name')
-          .assertElementInclude('#users-list .js-user-email', 'email@example.com');
+          .checkElementCount('[data-login="login"]', 1)
+          .checkElementCount('#users-list li[data-login]', 4)
+          .checkElementInclude('#users-list .js-user-login', 'login')
+          .checkElementInclude('#users-list .js-user-name', 'name')
+          .checkElementInclude('#users-list .js-user-email', 'email@example.com');
     });
 
     bdd.it('should update a user', function () {
@@ -105,9 +105,9 @@ define(function (require) {
           .mockFromString('/api/l10n/index', '{}')
           .mockFromFile('/api/users/search', 'users-spec/search.json')
           .startApp('users')
-          .assertElementCount('#users-list ul', 1)
+          .checkElementCount('#users-list ul', 1)
           .clickElement('[data-login="smith"] .js-user-update')
-          .assertElementCount('#create-user-form', 1)
+          .checkElementCount('#create-user-form', 1)
           .clearMocks()
           .mockFromFile('/api/users/search', 'users-spec/search-updated.json')
           .mockFromString('/api/users/update', '{}')
@@ -120,9 +120,9 @@ define(function (require) {
           })
           .clickElement('#create-user-submit')
           .waitForDeletedByCssSelector('#create-user-form')
-          .assertElementInclude('[data-login="smith"] .js-user-login', 'smith')
-          .assertElementInclude('[data-login="smith"] .js-user-name', 'Mike')
-          .assertElementInclude('[data-login="smith"] .js-user-email', 'mike@example.com');
+          .checkElementInclude('[data-login="smith"] .js-user-login', 'smith')
+          .checkElementInclude('[data-login="smith"] .js-user-name', 'Mike')
+          .checkElementInclude('[data-login="smith"] .js-user-email', 'mike@example.com');
     });
 
     bdd.it('should change user\'s password', function () {
@@ -132,9 +132,9 @@ define(function (require) {
           .mockFromString('/api/l10n/index', '{}')
           .mockFromFile('/api/users/search', 'users-spec/search.json')
           .startApp('users')
-          .assertElementCount('#users-list ul', 1)
+          .checkElementCount('#users-list ul', 1)
           .clickElement('[data-login="smith"] .js-user-change-password')
-          .assertElementCount('#change-user-password-form', 1)
+          .checkElementCount('#change-user-password-form', 1)
           .clearMocks()
           .mockFromString('/api/users/change_password', '{}')
           .execute(function () {
@@ -142,7 +142,7 @@ define(function (require) {
             jQuery('#change-user-password-password-confirmation').val('another');
           })
           .clickElement('#change-user-password-submit')
-          .assertElementCount('.alert.alert-danger', 1)
+          .checkElementCount('.alert.alert-danger', 1)
           .execute(function () {
             jQuery('#change-user-password-password').val('secret');
             jQuery('#change-user-password-password-confirmation').val('secret');
@@ -158,9 +158,9 @@ define(function (require) {
           .mockFromString('/api/l10n/index', '{}')
           .mockFromFile('/api/users/search', 'users-spec/search.json')
           .startApp('users')
-          .assertElementCount('#users-list ul', 1)
+          .checkElementCount('#users-list ul', 1)
           .clickElement('[data-login="smith"] .js-user-deactivate')
-          .assertElementCount('#deactivate-user-form', 1)
+          .checkElementCount('#deactivate-user-form', 1)
           .clearMocks()
           .mockFromString('/api/users/deactivate', '{}')
           .clickElement('#deactivate-user-submit')