A platform for community discussion. Free, open, simple.
DEV: migrate acceptance tests to async await - plugin, reports, user, topic
Maja Komel73739060f316
diff --git a/test/javascripts/acceptance/personal-message-test.js.es6 b/test/javascripts/acceptance/personal-message-test.js.es6index c10c3a5d17b..12247dd02a0 100644--- a/test/javascripts/acceptance/personal-message-test.js.es6+++ b/test/javascripts/acceptance/personal-message-test.js.es6@@ -4,15 +4,13 @@ acceptance("Personal Message", {loggedIn: true});-QUnit.test("footer edit button", assert => {- visit("/t/pm-for-testing/12");+QUnit.test("footer edit button", async assert => {+ await visit("/t/pm-for-testing/12");- andThen(() => {- assert.ok(- !exists(".edit-message"),- "does not show edit first post button on footer by default"- );- });+ assert.ok(+ !exists(".edit-message"),+ "does not show edit first post button on footer by default"+ );});acceptance("Personal Message Tagging", {@@ -20,13 +18,11 @@ acceptance("Personal Message Tagging", {site: { can_tag_pms: true }});-QUnit.test("show footer edit button", assert => {- visit("/t/pm-for-testing/12");+QUnit.test("show footer edit button", async assert => {+ await visit("/t/pm-for-testing/12");- andThen(() => {- assert.ok(- exists(".edit-message"),- "shows edit first post button on footer when PM tagging is enabled"- );- });+ assert.ok(+ exists(".edit-message"),+ "shows edit first post button on footer when PM tagging is enabled"+ );});diff --git a/test/javascripts/acceptance/plugin-outlet-connector-class-test.js.es6 b/test/javascripts/acceptance/plugin-outlet-connector-class-test.js.es6index 8f4a18f7302..70071f1d86b 100644--- a/test/javascripts/acceptance/plugin-outlet-connector-class-test.js.es6+++ b/test/javascripts/acceptance/plugin-outlet-connector-class-test.js.es6@@ -36,24 +36,21 @@ acceptance("Plugin Outlet - Connector Class", {}});-QUnit.test("Renders a template into the outlet", assert => {- visit("/u/eviltrout");- andThen(() => {- assert.ok(- find(".user-profile-primary-outlet.hello").length === 1,- "it has class names"- );- assert.ok(- !find(".user-profile-primary-outlet.dont-render").length,- "doesn't render"- );- });- click(".say-hello");- andThen(() => {- assert.equal(- find(".hello-result").text(),- "hello!",- "actions delegate properly"- );- });+QUnit.test("Renders a template into the outlet", async assert => {+ await visit("/u/eviltrout");+ assert.ok(+ find(".user-profile-primary-outlet.hello").length === 1,+ "it has class names"+ );+ assert.ok(+ !find(".user-profile-primary-outlet.dont-render").length,+ "doesn't render"+ );++ await click(".say-hello");+ assert.equal(+ find(".hello-result").text(),+ "hello!",+ "actions delegate properly"+ );});diff --git a/test/javascripts/acceptance/plugin-outlet-multi-template-test.js.es6 b/test/javascripts/acceptance/plugin-outlet-multi-template-test.js.es6index 280cb88dd5e..3dfc8049b4f 100644--- a/test/javascripts/acceptance/plugin-outlet-multi-template-test.js.es6+++ b/test/javascripts/acceptance/plugin-outlet-multi-template-test.js.es6@@ -23,26 +23,24 @@ acceptance("Plugin Outlet - Multi Template", {}});-QUnit.test("Renders a template into the outlet", assert => {- visit("/u/eviltrout");- andThen(() => {- assert.ok(- find(".user-profile-primary-outlet.hello").length === 1,- "it has class names"- );- assert.ok(- find(".user-profile-primary-outlet.goodbye").length === 1,- "it has class names"- );- assert.equal(- find(".hello-span").text(),- "Hello",- "it renders into the outlet"- );- assert.equal(- find(".bye-span").text(),- "Goodbye",- "it renders into the outlet"- );- });+QUnit.test("Renders a template into the outlet", async assert => {+ await visit("/u/eviltrout");+ assert.ok(+ find(".user-profile-primary-outlet.hello").length === 1,+ "it has class names"+ );+ assert.ok(+ find(".user-profile-primary-outlet.goodbye").length === 1,+ "it has class names"+ );+ assert.equal(+ find(".hello-span").text(),+ "Hello",+ "it renders into the outlet"+ );+ assert.equal(+ find(".bye-span").text(),+ "Goodbye",+ "it renders into the outlet"+ );});diff --git a/test/javascripts/acceptance/plugin-outlet-single-template-test.js.es6 b/test/javascripts/acceptance/plugin-outlet-single-template-test.js.es6index 6d74c0a9ff7..4c82e13260e 100644--- a/test/javascripts/acceptance/plugin-outlet-single-template-test.js.es6+++ b/test/javascripts/acceptance/plugin-outlet-single-template-test.js.es6@@ -14,17 +14,15 @@ acceptance("Plugin Outlet - Single Template", {}});-QUnit.test("Renders a template into the outlet", assert => {- visit("/u/eviltrout");- andThen(() => {- assert.ok(- find(".user-profile-primary-outlet.hello").length === 1,- "it has class names"- );- assert.equal(- find(".hello-username").text(),- "eviltrout",- "it renders into the outlet"- );- });+QUnit.test("Renders a template into the outlet", async assert => {+ await visit("/u/eviltrout");+ assert.ok(+ find(".user-profile-primary-outlet.hello").length === 1,+ "it has class names"+ );+ assert.equal(+ find(".hello-username").text(),+ "eviltrout",+ "it renders into the outlet"+ );});diff --git a/test/javascripts/acceptance/raw-plugin-outlet-test.js.es6 b/test/javascripts/acceptance/raw-plugin-outlet-test.js.es6index ceabaf776b6..62ea96028f6 100644--- a/test/javascripts/acceptance/raw-plugin-outlet-test.js.es6+++ b/test/javascripts/acceptance/raw-plugin-outlet-test.js.es6@@ -14,14 +14,12 @@ acceptance("Raw Plugin Outlet", {}});-QUnit.test("Renders the raw plugin outlet", assert => {- visit("/");- andThen(() => {- assert.ok(find(".topic-lala").length > 0, "it renders the outlet");- assert.equal(- find(".topic-lala:eq(0)").text(),- "11557",- "it has the topic id"- );- });+QUnit.test("Renders the raw plugin outlet", async assert => {+ await visit("/");+ assert.ok(find(".topic-lala").length > 0, "it renders the outlet");+ assert.equal(+ find(".topic-lala:eq(0)").text(),+ "11557",+ "it has the topic id"+ );});diff --git a/test/javascripts/acceptance/reports-test.js.es6 b/test/javascripts/acceptance/reports-test.js.es6index 55f4030ae15..76bb6fa746d 100644--- a/test/javascripts/acceptance/reports-test.js.es6+++ b/test/javascripts/acceptance/reports-test.js.es6@@ -4,28 +4,26 @@ acceptance("Reports", {loggedIn: true});-QUnit.test("Visit reports page", assert => {- visit("/admin/reports");+QUnit.test("Visit reports page", async assert => {+ await visit("/admin/reports");- andThen(() => {- assert.equal($(".reports-list .report").length, 1);+ assert.equal($(".reports-list .report").length, 1);- const $report = $(".reports-list .report:first-child");+ const $report = $(".reports-list .report:first-child");- assert.equal(- $report- .find(".report-title")- .html()- .trim(),- "My report"- );+ assert.equal(+ $report+ .find(".report-title")+ .html()+ .trim(),+ "My report"+ );- assert.equal(- $report- .find(".report-description")- .html()- .trim(),- "List of my activities"- );- });+ assert.equal(+ $report+ .find(".report-description")+ .html()+ .trim(),+ "List of my activities"+ );});diff --git a/test/javascripts/acceptance/search-test.js.es6 b/test/javascripts/acceptance/search-test.js.es6index b8d463977d5..cdc882d2ffa 100644--- a/test/javascripts/acceptance/search-test.js.es6+++ b/test/javascripts/acceptance/search-test.js.es6@@ -1,162 +1,135 @@import { acceptance, logIn } from "helpers/qunit-helpers";acceptance("Search");-QUnit.test("search", assert => {- visit("/");-- click("#search-button");-- andThen(() => {- assert.ok(exists("#search-term"), "it shows the search bar");- assert.ok(!exists(".search-menu .results ul li"), "no results by default");- });-- fillIn("#search-term", "dev");- keyEvent("#search-term", "keyup", 16);- andThen(() => {- assert.ok(exists(".search-menu .results ul li"), "it shows results");- });-- click(".show-help");-- andThen(() => {- assert.equal(- find(".full-page-search").val(),- "dev",- "it shows the search term"- );- assert.ok(- exists(".search-advanced-options"),- "advanced search is expanded"- );- });+QUnit.test("search", async assert => {+ await visit("/");++ await click("#search-button");++ assert.ok(exists("#search-term"), "it shows the search bar");+ assert.ok(!exists(".search-menu .results ul li"), "no results by default");++ await fillIn("#search-term", "dev");+ await keyEvent("#search-term", "keyup", 16);+ assert.ok(exists(".search-menu .results ul li"), "it shows results");++ await click(".show-help");++ assert.equal(+ find(".full-page-search").val(),+ "dev",+ "it shows the search term"+ );+ assert.ok(exists(".search-advanced-options"), "advanced search is expanded");});-QUnit.test("search for a tag", assert => {- visit("/");+QUnit.test("search for a tag", async assert => {+ await visit("/");- click("#search-button");+ await click("#search-button");- fillIn("#search-term", "evil");- keyEvent("#search-term", "keyup", 16);- andThen(() => {- assert.ok(exists(".search-menu .results ul li"), "it shows results");- });+ await fillIn("#search-term", "evil");+ await keyEvent("#search-term", "keyup", 16);+ assert.ok(exists(".search-menu .results ul li"), "it shows results");});-QUnit.test("search scope checkbox", assert => {- visit("/c/bug");- click("#search-button");- andThen(() => {- assert.ok(- exists(".search-context input:checked"),- "scope to category checkbox is checked"- );- });- click("#search-button");-- visit("/t/internationalization-localization/280");- click("#search-button");- andThen(() => {- assert.not(- exists(".search-context input:checked"),- "scope to topic checkbox is not checked"- );- });- click("#search-button");-- visit("/u/eviltrout");- click("#search-button");- andThen(() => {- assert.ok(- exists(".search-context input:checked"),- "scope to user checkbox is checked"- );- });+QUnit.test("search scope checkbox", async assert => {+ await visit("/c/bug");+ await click("#search-button");+ assert.ok(+ exists(".search-context input:checked"),+ "scope to category checkbox is checked"+ );+ await click("#search-button");++ await visit("/t/internationalization-localization/280");+ await click("#search-button");+ assert.not(+ exists(".search-context input:checked"),+ "scope to topic checkbox is not checked"+ );+ await click("#search-button");++ await visit("/u/eviltrout");+ await click("#search-button");+ assert.ok(+ exists(".search-context input:checked"),+ "scope to user checkbox is checked"+ );});-QUnit.test("Search with context", assert => {- visit("/t/internationalization-localization/280/1");+QUnit.test("Search with context", async assert => {+ await visit("/t/internationalization-localization/280/1");- click("#search-button");- fillIn("#search-term", "dev");- click(".search-context input[type='checkbox']");- keyEvent("#search-term", "keyup", 16);+ await click("#search-button");+ await fillIn("#search-term", "dev");+ await click(".search-context input[type='checkbox']");+ await keyEvent("#search-term", "keyup", 16);- andThen(() => {- assert.ok(exists(".search-menu .results ul li"), "it shows results");+ assert.ok(exists(".search-menu .results ul li"), "it shows results");- assert.ok(- exists(".cooked span.highlight-strong"),- "it should highlight the search term"- );- });+ assert.ok(+ exists(".cooked span.highlight-strong"),+ "it should highlight the search term"+ );- visit("/");- click("#search-button");+ await visit("/");+ await click("#search-button");- andThen(() => {- assert.ok(!exists(".search-context input[type='checkbox']"));- });+ assert.ok(!exists(".search-context input[type='checkbox']"));- visit("/t/internationalization-localization/280/1");- click("#search-button");+ await visit("/t/internationalization-localization/280/1");+ await click("#search-button");- andThen(() => {- assert.ok(!$(".search-context input[type=checkbox]").is(":checked"));- });+ assert.ok(!$(".search-context input[type=checkbox]").is(":checked"));});-QUnit.test("Right filters are shown to anonymous users", assert => {+QUnit.test("Right filters are shown to anonymous users", async assert => {const inSelector = selectKit(".select-kit#in");- visit("/search?expanded=true");+ await visit("/search?expanded=true");- inSelector.expand();+ await inSelector.expandAwait();- andThen(() => {- assert.ok(inSelector.rowByValue("first").exists());- assert.ok(inSelector.rowByValue("pinned").exists());- assert.ok(inSelector.rowByValue("unpinned").exists());- assert.ok(inSelector.rowByValue("wiki").exists());- assert.ok(inSelector.rowByValue("images").exists());+ assert.ok(inSelector.rowByValue("first").exists());+ assert.ok(inSelector.rowByValue("pinned").exists());+ assert.ok(inSelector.rowByValue("unpinned").exists());+ assert.ok(inSelector.rowByValue("wiki").exists());+ assert.ok(inSelector.rowByValue("images").exists());- assert.notOk(inSelector.rowByValue("unseen").exists());- assert.notOk(inSelector.rowByValue("posted").exists());- assert.notOk(inSelector.rowByValue("watching").exists());- assert.notOk(inSelector.rowByValue("tracking").exists());- assert.notOk(inSelector.rowByValue("bookmarks").exists());+ assert.notOk(inSelector.rowByValue("unseen").exists());+ assert.notOk(inSelector.rowByValue("posted").exists());+ assert.notOk(inSelector.rowByValue("watching").exists());+ assert.notOk(inSelector.rowByValue("tracking").exists());+ assert.notOk(inSelector.rowByValue("bookmarks").exists());- assert.notOk(exists(".search-advanced-options .in-likes"));- assert.notOk(exists(".search-advanced-options .in-private"));- assert.notOk(exists(".search-advanced-options .in-seen"));- });+ assert.notOk(exists(".search-advanced-options .in-likes"));+ assert.notOk(exists(".search-advanced-options .in-private"));+ assert.notOk(exists(".search-advanced-options .in-seen"));});-QUnit.test("Right filters are shown to logged-in users", assert => {+QUnit.test("Right filters are shown to logged-in users", async assert => {const inSelector = selectKit(".select-kit#in");logIn();Discourse.reset();- visit("/search?expanded=true");-- inSelector.expand();-- andThen(() => {- assert.ok(inSelector.rowByValue("first").exists());- assert.ok(inSelector.rowByValue("pinned").exists());- assert.ok(inSelector.rowByValue("unpinned").exists());- assert.ok(inSelector.rowByValue("wiki").exists());- assert.ok(inSelector.rowByValue("images").exists());-- assert.ok(inSelector.rowByValue("unseen").exists());- assert.ok(inSelector.rowByValue("posted").exists());- assert.ok(inSelector.rowByValue("watching").exists());- assert.ok(inSelector.rowByValue("tracking").exists());- assert.ok(inSelector.rowByValue("bookmarks").exists());-- assert.ok(exists(".search-advanced-options .in-likes"));- assert.ok(exists(".search-advanced-options .in-private"));- assert.ok(exists(".search-advanced-options .in-seen"));- });+ await visit("/search?expanded=true");++ await inSelector.expandAwait();++ assert.ok(inSelector.rowByValue("first").exists());+ assert.ok(inSelector.rowByValue("pinned").exists());+ assert.ok(inSelector.rowByValue("unpinned").exists());+ assert.ok(inSelector.rowByValue("wiki").exists());+ assert.ok(inSelector.rowByValue("images").exists());++ assert.ok(inSelector.rowByValue("unseen").exists());+ assert.ok(inSelector.rowByValue("posted").exists());+ assert.ok(inSelector.rowByValue("watching").exists());+ assert.ok(inSelector.rowByValue("tracking").exists());+ assert.ok(inSelector.rowByValue("bookmarks").exists());++ assert.ok(exists(".search-advanced-options .in-likes"));+ assert.ok(exists(".search-advanced-options .in-private"));+ assert.ok(exists(".search-advanced-options .in-seen"));});diff --git a/test/javascripts/acceptance/shared-drafts-test.js.es6 b/test/javascripts/acceptance/shared-drafts-test.js.es6index 28f2ce0ca37..f6433aee22e 100644--- a/test/javascripts/acceptance/shared-drafts-test.js.es6+++ b/test/javascripts/acceptance/shared-drafts-test.js.es6@@ -2,18 +2,14 @@ import { acceptance } from "helpers/qunit-helpers";acceptance("Shared Drafts", { loggedIn: true });-QUnit.test("Viewing", assert => {- visit("/t/some-topic/9");- andThen(() => {- assert.ok(find(".shared-draft-controls").length === 1);- let categoryChooser = selectKit(".shared-draft-controls .category-chooser");- assert.equal(categoryChooser.header().value(), "3");- });+QUnit.test("Viewing", async assert => {+ await visit("/t/some-topic/9");+ assert.ok(find(".shared-draft-controls").length === 1);+ let categoryChooser = selectKit(".shared-draft-controls .category-chooser");+ assert.equal(categoryChooser.header().value(), "3");- click(".publish-shared-draft");- click(".bootbox .btn-primary");+ await click(".publish-shared-draft");+ await click(".bootbox .btn-primary");- andThen(() => {- assert.ok(find(".shared-draft-controls").length === 0);- });+ assert.ok(find(".shared-draft-controls").length === 0);});diff --git a/test/javascripts/acceptance/sign-in-test.js.es6 b/test/javascripts/acceptance/sign-in-test.js.es6index 94867b83b6a..132a8be5b6f 100644--- a/test/javascripts/acceptance/sign-in-test.js.es6+++ b/test/javascripts/acceptance/sign-in-test.js.es6@@ -1,218 +1,176 @@import { acceptance } from "helpers/qunit-helpers";acceptance("Signing In");-QUnit.test("sign in", assert => {- visit("/");- click("header .login-button");- andThen(() => {- assert.ok(exists(".login-modal"), "it shows the login modal");- });+QUnit.test("sign in", async assert => {+ await visit("/");+ await click("header .login-button");+ assert.ok(exists(".login-modal"), "it shows the login modal");// Test invalid password first- fillIn("#login-account-name", "eviltrout");- fillIn("#login-account-password", "incorrect");- click(".modal-footer .btn-primary");- andThen(() => {- assert.ok(exists("#modal-alert:visible"), "it displays the login error");- assert.not(- exists(".modal-footer .btn-primary:disabled"),- "enables the login button"- );- });+ await fillIn("#login-account-name", "eviltrout");+ await fillIn("#login-account-password", "incorrect");+ await click(".modal-footer .btn-primary");+ assert.ok(exists("#modal-alert:visible"), "it displays the login error");+ assert.not(+ exists(".modal-footer .btn-primary:disabled"),+ "enables the login button"+ );// Use the correct password- fillIn("#login-account-password", "correct");- click(".modal-footer .btn-primary");- andThen(() => {- assert.ok(- exists(".modal-footer .btn-primary:disabled"),- "disables the login button"- );- });+ await fillIn("#login-account-password", "correct");+ await click(".modal-footer .btn-primary");+ assert.ok(+ exists(".modal-footer .btn-primary:disabled"),+ "disables the login button"+ );});-QUnit.test("sign in - not activated", assert => {- visit("/");- andThen(() => {- click("header .login-button");- andThen(() => {- assert.ok(exists(".login-modal"), "it shows the login modal");- });-- fillIn("#login-account-name", "eviltrout");- fillIn("#login-account-password", "not-activated");- click(".modal-footer .btn-primary");- andThen(() => {- assert.equal(- find(".modal-body b").text(),- "<small>[email protected]</small>"- );- assert.ok(!exists(".modal-body small"), "it escapes the email address");- });-- click(".modal-footer button.resend");- andThen(() => {- assert.equal(- find(".modal-body b").text(),- "<small>[email protected]</small>"- );- assert.ok(!exists(".modal-body small"), "it escapes the email address");- });- });+QUnit.test("sign in - not activated", async assert => {+ await visit("/");+ await click("header .login-button");+ assert.ok(exists(".login-modal"), "it shows the login modal");++ await fillIn("#login-account-name", "eviltrout");+ await fillIn("#login-account-password", "not-activated");+ await click(".modal-footer .btn-primary");+ assert.equal(+ find(".modal-body b").text(),+ "<small>[email protected]</small>"+ );+ assert.ok(!exists(".modal-body small"), "it escapes the email address");++ await click(".modal-footer button.resend");+ assert.equal(+ find(".modal-body b").text(),+ "<small>[email protected]</small>"+ );+ assert.ok(!exists(".modal-body small"), "it escapes the email address");});-QUnit.test("sign in - not activated - edit email", assert => {- visit("/");- andThen(() => {- click("header .login-button");- andThen(() => {- assert.ok(exists(".login-modal"), "it shows the login modal");- });-- fillIn("#login-account-name", "eviltrout");- fillIn("#login-account-password", "not-activated-edit");- click(".modal-footer .btn-primary");- click(".modal-footer button.edit-email");- andThen(() => {- assert.equal(find(".activate-new-email").val(), "[email protected]");- assert.equal(- find(".modal-footer .btn-primary:disabled").length,- 1,- "must change email"- );- });- fillIn(".activate-new-email", "[email protected]");- andThen(() => {- assert.equal(find(".modal-footer .btn-primary:disabled").length, 0);- });- click(".modal-footer .btn-primary");- andThen(() => {- assert.equal(find(".modal-body b").text(), "[email protected]");- });- });+QUnit.test("sign in - not activated - edit email", async assert => {+ await visit("/");+ await click("header .login-button");+ assert.ok(exists(".login-modal"), "it shows the login modal");++ await fillIn("#login-account-name", "eviltrout");+ await fillIn("#login-account-password", "not-activated-edit");+ await click(".modal-footer .btn-primary");+ await click(".modal-footer button.edit-email");+ assert.equal(find(".activate-new-email").val(), "[email protected]");+ assert.equal(+ find(".modal-footer .btn-primary:disabled").length,+ 1,+ "must change email"+ );+ await fillIn(".activate-new-email", "[email protected]");+ assert.equal(find(".modal-footer .btn-primary:disabled").length, 0);+ await click(".modal-footer .btn-primary");+ assert.equal(find(".modal-body b").text(), "[email protected]");});-QUnit.test("second factor", assert => {- visit("/");- click("header .login-button");-- andThen(() => {- assert.ok(exists(".login-modal"), "it shows the login modal");- });-- fillIn("#login-account-name", "eviltrout");- fillIn("#login-account-password", "need-second-factor");- click(".modal-footer .btn-primary");-- andThen(() => {- assert.not(exists("#modal-alert:visible"), "it hides the login error");- assert.not(- exists("#credentials:visible"),- "it hides the username and password prompt"- );- assert.ok(- exists("#second-factor:visible"),- "it displays the second factor prompt"- );- assert.not(- exists(".modal-footer .btn-primary:disabled"),- "enables the login button"- );- });-- fillIn("#login-second-factor", "123456");- click(".modal-footer .btn-primary");-- andThen(() => {- assert.ok(- exists(".modal-footer .btn-primary:disabled"),- "disables the login button"- );- });+QUnit.test("second factor", async assert => {+ await visit("/");+ await click("header .login-button");++ assert.ok(exists(".login-modal"), "it shows the login modal");++ await fillIn("#login-account-name", "eviltrout");+ await fillIn("#login-account-password", "need-second-factor");+ await click(".modal-footer .btn-primary");++ assert.not(exists("#modal-alert:visible"), "it hides the login error");+ assert.not(+ exists("#credentials:visible"),+ "it hides the username and password prompt"+ );+ assert.ok(+ exists("#second-factor:visible"),+ "it displays the second factor prompt"+ );+ assert.not(+ exists(".modal-footer .btn-primary:disabled"),+ "enables the login button"+ );++ await fillIn("#login-second-factor", "123456");+ await click(".modal-footer .btn-primary");++ assert.ok(+ exists(".modal-footer .btn-primary:disabled"),+ "disables the login button"+ );});-QUnit.test("create account", assert => {- visit("/");- click("header .sign-up-button");+QUnit.test("create account", async assert => {+ await visit("/");+ await click("header .sign-up-button");- andThen(() => {- assert.ok(exists(".create-account"), "it shows the create account modal");- assert.ok(- exists(".modal-footer .btn-primary:disabled"),- "create account is disabled at first"- );- });+ assert.ok(exists(".create-account"), "it shows the create account modal");+ assert.ok(+ exists(".modal-footer .btn-primary:disabled"),+ "create account is disabled at first"+ );- fillIn("#new-account-name", "Dr. Good Tuna");- fillIn("#new-account-password", "cool password bro");+ await fillIn("#new-account-name", "Dr. Good Tuna");+ await fillIn("#new-account-password", "cool password bro");// Check username- fillIn("#new-account-email", "[email protected]");- fillIn("#new-account-username", "taken");- andThen(() => {- assert.ok(- exists("#username-validation.bad"),- "the username validation is bad"- );- assert.ok(- exists(".modal-footer .btn-primary:disabled"),- "create account is still disabled"- );- });-- fillIn("#new-account-username", "goodtuna");- andThen(() => {- assert.ok(- exists("#username-validation.good"),- "the username validation is good"- );- assert.not(- exists(".modal-footer .btn-primary:disabled"),- "create account is enabled"- );- });-- click(".modal-footer .btn-primary");- andThen(() => {- assert.ok(- exists(".modal-footer .btn-primary:disabled"),- "create account is disabled"- );- });+ await fillIn("#new-account-email", "[email protected]");+ await fillIn("#new-account-username", "taken");+ assert.ok(+ exists("#username-validation.bad"),+ "the username validation is bad"+ );+ assert.ok(+ exists(".modal-footer .btn-primary:disabled"),+ "create account is still disabled"+ );++ await fillIn("#new-account-username", "goodtuna");+ assert.ok(+ exists("#username-validation.good"),+ "the username validation is good"+ );+ assert.not(+ exists(".modal-footer .btn-primary:disabled"),+ "create account is enabled"+ );++ await click(".modal-footer .btn-primary");+ assert.ok(+ exists(".modal-footer .btn-primary:disabled"),+ "create account is disabled"+ );});-QUnit.test("second factor backup - valid token", assert => {- visit("/");- click("header .login-button");- fillIn("#login-account-name", "eviltrout");- fillIn("#login-account-password", "need-second-factor");- click(".modal-footer .btn-primary");- click(".login-modal .toggle-second-factor-method");- fillIn("#login-second-factor", "123456");- click(".modal-footer .btn-primary");-- andThen(() => {- assert.ok(- exists(".modal-footer .btn-primary:disabled"),- "it closes the modal when the code is valid"- );- });+QUnit.test("second factor backup - valid token", async assert => {+ await visit("/");+ await click("header .login-button");+ await fillIn("#login-account-name", "eviltrout");+ await fillIn("#login-account-password", "need-second-factor");+ await click(".modal-footer .btn-primary");+ await click(".login-modal .toggle-second-factor-method");+ await fillIn("#login-second-factor", "123456");+ await click(".modal-footer .btn-primary");++ assert.ok(+ exists(".modal-footer .btn-primary:disabled"),+ "it closes the modal when the code is valid"+ );});-QUnit.test("second factor backup - invalid token", assert => {- visit("/");- click("header .login-button");- fillIn("#login-account-name", "eviltrout");- fillIn("#login-account-password", "need-second-factor");- click(".modal-footer .btn-primary");- click(".login-modal .toggle-second-factor-method");- fillIn("#login-second-factor", "something");- click(".modal-footer .btn-primary");-- andThen(() => {- assert.ok(- exists("#modal-alert:visible"),- "it shows an error when the code is invalid"- );- });+QUnit.test("second factor backup - invalid token", async assert => {+ await visit("/");+ await click("header .login-button");+ await fillIn("#login-account-name", "eviltrout");+ await fillIn("#login-account-password", "need-second-factor");+ await click(".modal-footer .btn-primary");+ await click(".login-modal .toggle-second-factor-method");+ await fillIn("#login-second-factor", "something");+ await click(".modal-footer .btn-primary");++ assert.ok(+ exists("#modal-alert:visible"),+ "it shows an error when the code is invalid"+ );});diff --git a/test/javascripts/acceptance/static-test.js.es6 b/test/javascripts/acceptance/static-test.js.es6index 47fa81dd5ec..97ac63c5aa3 100644--- a/test/javascripts/acceptance/static-test.js.es6+++ b/test/javascripts/acceptance/static-test.js.es6@@ -1,37 +1,27 @@import { acceptance } from "helpers/qunit-helpers";acceptance("Static");-QUnit.test("Static Pages", assert => {- visit("/faq");- andThen(() => {- assert.ok($("body.static-faq").length, "has the body class");- assert.ok(exists(".body-page"), "The content is present");- });+QUnit.test("Static Pages", async assert => {+ await visit("/faq");+ assert.ok($("body.static-faq").length, "has the body class");+ assert.ok(exists(".body-page"), "The content is present");- visit("/guidelines");- andThen(() => {- assert.ok($("body.static-guidelines").length, "has the body class");- assert.ok(exists(".body-page"), "The content is present");- });+ await visit("/guidelines");+ assert.ok($("body.static-guidelines").length, "has the body class");+ assert.ok(exists(".body-page"), "The content is present");- visit("/tos");- andThen(() => {- assert.ok($("body.static-tos").length, "has the body class");- assert.ok(exists(".body-page"), "The content is present");- });+ await visit("/tos");+ assert.ok($("body.static-tos").length, "has the body class");+ assert.ok(exists(".body-page"), "The content is present");- visit("/privacy");- andThen(() => {- assert.ok($("body.static-privacy").length, "has the body class");- assert.ok(exists(".body-page"), "The content is present");- });+ await visit("/privacy");+ assert.ok($("body.static-privacy").length, "has the body class");+ assert.ok(exists(".body-page"), "The content is present");- visit("/login");- andThen(() => {- assert.equal(- currentPath(),- "discovery.latest",- "it redirects them to latest unless `login_required`"- );- });+ await visit("/login");+ assert.equal(+ currentPath(),+ "discovery.latest",+ "it redirects them to latest unless `login_required`"+ );});diff --git a/test/javascripts/acceptance/topic-anonymous-test.js.es6 b/test/javascripts/acceptance/topic-anonymous-test.js.es6index 1ec1ed32f57..cd1bade7c75 100644--- a/test/javascripts/acceptance/topic-anonymous-test.js.es6+++ b/test/javascripts/acceptance/topic-anonymous-test.js.es6@@ -1,48 +1,38 @@import { acceptance } from "helpers/qunit-helpers";acceptance("Topic - Anonymous");-QUnit.test("Enter a Topic", assert => {- visit("/t/internationalization-localization/280/1");- andThen(() => {- assert.ok(exists("#topic"), "The topic was rendered");- assert.ok(exists("#topic .cooked"), "The topic has cooked posts");- assert.ok(- find(".shared-draft-notice").length === 0,- "no shared draft unless there's a dest category id"- );- });+QUnit.test("Enter a Topic", async assert => {+ await visit("/t/internationalization-localization/280/1");+ assert.ok(exists("#topic"), "The topic was rendered");+ assert.ok(exists("#topic .cooked"), "The topic has cooked posts");+ assert.ok(+ find(".shared-draft-notice").length === 0,+ "no shared draft unless there's a dest category id"+ );});-QUnit.test("Enter without an id", assert => {- visit("/t/internationalization-localization");- andThen(() => {- assert.ok(exists("#topic"), "The topic was rendered");- });+QUnit.test("Enter without an id", async assert => {+ await visit("/t/internationalization-localization");+ assert.ok(exists("#topic"), "The topic was rendered");});-QUnit.test("Enter a 404 topic", assert => {- visit("/t/not-found/404");- andThen(() => {- assert.ok(!exists("#topic"), "The topic was not rendered");- assert.ok(- find(".not-found").text() === "not found",- "it renders the error message"- );- });+QUnit.test("Enter a 404 topic", async assert => {+ await visit("/t/not-found/404");+ assert.ok(!exists("#topic"), "The topic was not rendered");+ assert.ok(+ find(".not-found").text() === "not found",+ "it renders the error message"+ );});-QUnit.test("Enter without access", assert => {- visit("/t/i-dont-have-access/403");- andThen(() => {- assert.ok(!exists("#topic"), "The topic was not rendered");- assert.ok(exists(".topic-error"), "An error message is displayed");- });+QUnit.test("Enter without access", async assert => {+ await visit("/t/i-dont-have-access/403");+ assert.ok(!exists("#topic"), "The topic was not rendered");+ assert.ok(exists(".topic-error"), "An error message is displayed");});-QUnit.test("Enter with 500 errors", assert => {- visit("/t/throws-error/500");- andThen(() => {- assert.ok(!exists("#topic"), "The topic was not rendered");- assert.ok(exists(".topic-error"), "An error message is displayed");- });+QUnit.test("Enter with 500 errors", async assert => {+ await visit("/t/throws-error/500");+ assert.ok(!exists("#topic"), "The topic was not rendered");+ assert.ok(exists(".topic-error"), "An error message is displayed");});diff --git a/test/javascripts/acceptance/topic-discovery-test.js.es6 b/test/javascripts/acceptance/topic-discovery-test.js.es6index e66382be969..7e105b3bd42 100644--- a/test/javascripts/acceptance/topic-discovery-test.js.es6+++ b/test/javascripts/acceptance/topic-discovery-test.js.es6@@ -1,67 +1,55 @@import { acceptance } from "helpers/qunit-helpers";acceptance("Topic Discovery");-QUnit.test("Visit Discovery Pages", assert => {- visit("/");- andThen(() => {- assert.ok($("body.navigation-topics").length, "has the default navigation");- assert.ok(exists(".topic-list"), "The list of topics was rendered");- assert.ok(exists(".topic-list .topic-list-item"), "has topics");- });+QUnit.test("Visit Discovery Pages", async assert => {+ await visit("/");+ assert.ok($("body.navigation-topics").length, "has the default navigation");+ assert.ok(exists(".topic-list"), "The list of topics was rendered");+ assert.ok(exists(".topic-list .topic-list-item"), "has topics");- visit("/c/bug");- andThen(() => {- assert.ok(exists(".topic-list"), "The list of topics was rendered");- assert.ok(exists(".topic-list .topic-list-item"), "has topics");- assert.ok(!exists(".category-list"), "doesn't render subcategories");- assert.ok(- $("body.category-bug").length,- "has a custom css class for the category id on the body"- );- });+ await visit("/c/bug");+ assert.ok(exists(".topic-list"), "The list of topics was rendered");+ assert.ok(exists(".topic-list .topic-list-item"), "has topics");+ assert.ok(!exists(".category-list"), "doesn't render subcategories");+ assert.ok(+ $("body.category-bug").length,+ "has a custom css class for the category id on the body"+ );- visit("/categories");- andThen(() => {- assert.ok($("body.navigation-categories").length, "has the body class");- assert.ok(- $("body.category-bug").length === 0,- "removes the custom category class"- );- assert.ok(exists(".category"), "has a list of categories");- assert.ok(- $("body.categories-list").length,- "has a custom class to indicate categories"- );- });+ await visit("/categories");+ assert.ok($("body.navigation-categories").length, "has the body class");+ assert.ok(+ $("body.category-bug").length === 0,+ "removes the custom category class"+ );+ assert.ok(exists(".category"), "has a list of categories");+ assert.ok(+ $("body.categories-list").length,+ "has a custom class to indicate categories"+ );- visit("/top");- andThen(() => {- assert.ok(- $("body.categories-list").length === 0,- "removes the `categories-list` class"- );- assert.ok(exists(".topic-list .topic-list-item"), "has topics");- });+ await visit("/top");+ assert.ok(+ $("body.categories-list").length === 0,+ "removes the `categories-list` class"+ );+ assert.ok(exists(".topic-list .topic-list-item"), "has topics");- visit("/c/feature");- andThen(() => {- assert.ok(exists(".topic-list"), "The list of topics was rendered");- assert.ok(- exists(".category-boxes"),- "The list of subcategories were rendered with box style"- );- });+ await visit("/c/feature");+ assert.ok(exists(".topic-list"), "The list of topics was rendered");+ assert.ok(+ exists(".category-boxes"),+ "The list of subcategories were rendered with box style"+ );- visit("/c/dev");- andThen(() => {- assert.ok(exists(".topic-list"), "The list of topics was rendered");- assert.ok(- exists(".category-boxes-with-topics"),- "The list of subcategories were rendered with box-with-featured-topics style"- );- assert.ok(- exists(".category-boxes-with-topics .featured-topics"),- "The featured topics are there too"- );- });+ await visit("/c/dev");+ assert.ok(exists(".topic-list"), "The list of topics was rendered");+ assert.ok(+ exists(".category-boxes-with-topics"),+ "The list of subcategories were rendered with box-with-featured-topics style"+ );+ assert.ok(+ exists(".category-boxes-with-topics .featured-topics"),+ "The featured topics are there too"+ );});diff --git a/test/javascripts/acceptance/unknown-test.js.es6 b/test/javascripts/acceptance/unknown-test.js.es6index 541df10e1f0..3283d362ee1 100644--- a/test/javascripts/acceptance/unknown-test.js.es6+++ b/test/javascripts/acceptance/unknown-test.js.es6@@ -1,10 +1,8 @@import { acceptance } from "helpers/qunit-helpers";acceptance("Unknown");-QUnit.test("Unknown URL", assert => {+QUnit.test("Unknown URL", async assert => {assert.expect(1);- visit("/url-that-doesn't-exist");- andThen(() => {- assert.ok(exists(".page-not-found"), "The not found content is present");- });+ await visit("/url-that-doesn't-exist");+ assert.ok(exists(".page-not-found"), "The not found content is present");});diff --git a/test/javascripts/acceptance/user-anonymous-test.js.es6 b/test/javascripts/acceptance/user-anonymous-test.js.es6index 30d8554811f..f18791484a1 100644--- a/test/javascripts/acceptance/user-anonymous-test.js.es6+++ b/test/javascripts/acceptance/user-anonymous-test.js.es6@@ -2,57 +2,45 @@ import { acceptance } from "helpers/qunit-helpers";acceptance("User Anonymous");function hasStream(assert) {- andThen(() => {- assert.ok(exists(".user-main .about"), "it has the about section");- assert.ok(count(".user-stream .item") > 0, "it has stream items");- });+ assert.ok(exists(".user-main .about"), "it has the about section");+ assert.ok(count(".user-stream .item") > 0, "it has stream items");}function hasTopicList(assert) {- andThen(() => {- assert.equal(count(".user-stream .item"), 0, "has no stream displayed");- assert.ok(count(".topic-list tr") > 0, "it has a topic list");- });+ assert.equal(count(".user-stream .item"), 0, "has no stream displayed");+ assert.ok(count(".topic-list tr") > 0, "it has a topic list");}-QUnit.test("Root URL", assert => {- visit("/u/eviltrout");- andThen(() => {- assert.ok($("body.user-summary-page").length, "has the body class");- assert.equal(currentPath(), "user.summary", "it defaults to summary");- });+QUnit.test("Root URL", async assert => {+ await visit("/u/eviltrout");+ assert.ok($("body.user-summary-page").length, "has the body class");+ assert.equal(currentPath(), "user.summary", "it defaults to summary");});-QUnit.test("Filters", assert => {- visit("/u/eviltrout/activity");- andThen(() => {- assert.ok($("body.user-activity-page").length, "has the body class");- });+QUnit.test("Filters", async assert => {+ await visit("/u/eviltrout/activity");+ assert.ok($("body.user-activity-page").length, "has the body class");hasStream(assert);- visit("/u/eviltrout/activity/topics");- hasTopicList(assert);+ await visit("/u/eviltrout/activity/topics");+ await hasTopicList(assert);- visit("/u/eviltrout/activity/replies");+ await visit("/u/eviltrout/activity/replies");hasStream(assert);});-QUnit.test("Badges", assert => {- visit("/u/eviltrout/badges");- andThen(() => {- assert.ok($("body.user-badges-page").length, "has the body class");- assert.ok(exists(".user-badges-list .badge-card"), "shows a badge");- });+QUnit.test("Badges", async assert => {+ await visit("/u/eviltrout/badges");+ assert.ok($("body.user-badges-page").length, "has the body class");+ assert.ok(exists(".user-badges-list .badge-card"), "shows a badge");});-QUnit.test("Restricted Routes", assert => {- visit("/u/eviltrout/preferences");+QUnit.test("Restricted Routes", async assert => {+ await visit("/u/eviltrout/preferences");- andThen(() => {- assert.equal(- currentURL(),- "/u/eviltrout/activity",- "it redirects from preferences"- );- });+ assert.equal(+ currentURL(),+ "/u/eviltrout/activity",+ "it redirects from preferences"+ );});diff --git a/test/javascripts/acceptance/user-card-test.js.es6 b/test/javascripts/acceptance/user-card-test.js.es6index a502f488cf3..eace2a8c9ac 100644--- a/test/javascripts/acceptance/user-card-test.js.es6+++ b/test/javascripts/acceptance/user-card-test.js.es6@@ -2,13 +2,10 @@ import { acceptance } from "helpers/qunit-helpers";acceptance("User Card");-QUnit.test("user card", assert => {- visit("/");-+QUnit.test("user card", async assert => {+ await visit("/");assert.ok(invisible("#user-card"), "user card is invisible by default");- click("a[data-user-card=eviltrout]:first");- andThen(() => {- assert.ok(visible("#user-card"), "card should appear");- });+ await click("a[data-user-card=eviltrout]:first");+ assert.ok(visible("#user-card"), "card should appear");});diff --git a/test/javascripts/acceptance/user-test.js.es6 b/test/javascripts/acceptance/user-test.js.es6index 2c841513f6f..abd0f933564 100644--- a/test/javascripts/acceptance/user-test.js.es6+++ b/test/javascripts/acceptance/user-test.js.es6@@ -2,53 +2,40 @@ import { acceptance } from "helpers/qunit-helpers";acceptance("User", { loggedIn: true });-QUnit.test("Invites", assert => {- visit("/u/eviltrout/invited/pending");- andThen(() => {- assert.ok($("body.user-invites-page").length, "has the body class");- });+QUnit.test("Invites", async assert => {+ await visit("/u/eviltrout/invited/pending");+ assert.ok($("body.user-invites-page").length, "has the body class");});-QUnit.test("Messages", assert => {- visit("/u/eviltrout/messages");- andThen(() => {- assert.ok($("body.user-messages-page").length, "has the body class");- });+QUnit.test("Messages", async assert => {+ await visit("/u/eviltrout/messages");+ assert.ok($("body.user-messages-page").length, "has the body class");});-QUnit.test("Notifications", assert => {- visit("/u/eviltrout/notifications");- andThen(() => {- assert.ok($("body.user-notifications-page").length, "has the body class");- });+QUnit.test("Notifications", async assert => {+ await visit("/u/eviltrout/notifications");+ assert.ok($("body.user-notifications-page").length, "has the body class");});-QUnit.test("Root URL - Viewing Self", assert => {- visit("/u/eviltrout");- andThen(() => {- assert.ok($("body.user-activity-page").length, "has the body class");- assert.equal(- currentPath(),- "user.userActivity.index",- "it defaults to activity"- );- assert.ok(exists(".container.viewing-self"), "has the viewing-self class");- });+QUnit.test("Root URL - Viewing Self", async assert => {+ await visit("/u/eviltrout");+ assert.ok($("body.user-activity-page").length, "has the body class");+ assert.equal(+ currentPath(),+ "user.userActivity.index",+ "it defaults to activity"+ );+ assert.ok(exists(".container.viewing-self"), "has the viewing-self class");});-QUnit.test("Viewing Summary", assert => {- visit("/u/eviltrout/summary");- andThen(() => {- assert.ok(exists(".replies-section li a"), "replies");- assert.ok(exists(".topics-section li a"), "topics");- assert.ok(exists(".links-section li a"), "links");- assert.ok(exists(".replied-section .user-info"), "liked by");- assert.ok(exists(".liked-by-section .user-info"), "liked by");- assert.ok(exists(".liked-section .user-info"), "liked");- assert.ok(exists(".badges-section .badge-card"), "badges");- assert.ok(- exists(".top-categories-section .category-link"),- "top categories"- );- });+QUnit.test("Viewing Summary", async assert => {+ await visit("/u/eviltrout/summary");+ assert.ok(exists(".replies-section li a"), "replies");+ assert.ok(exists(".topics-section li a"), "topics");+ assert.ok(exists(".links-section li a"), "links");+ assert.ok(exists(".replied-section .user-info"), "liked by");+ assert.ok(exists(".liked-by-section .user-info"), "liked by");+ assert.ok(exists(".liked-section .user-info"), "liked");+ assert.ok(exists(".badges-section .badge-card"), "badges");+ assert.ok(exists(".top-categories-section .category-link"), "top categories");});