diff --git a/test/javascripts/acceptance/dashboard-next-test.js.es6 b/test/javascripts/acceptance/dashboard-next-test.js.es6 index 56aef0402b..34d69d77ba 100644 --- a/test/javascripts/acceptance/dashboard-next-test.js.es6 +++ b/test/javascripts/acceptance/dashboard-next-test.js.es6 @@ -4,37 +4,35 @@ acceptance("Dashboard Next", { loggedIn: true }); -QUnit.test("Visit dashboard next page", assert => { - visit("/admin"); +QUnit.test("Visit dashboard next page", async assert => { + await visit("/admin"); - andThen(() => { - assert.ok($(".dashboard-next").length, "has dashboard-next class"); + assert.ok($(".dashboard-next").length, "has dashboard-next class"); - assert.ok($(".dashboard-mini-chart.signups").length, "has a signups chart"); + assert.ok($(".dashboard-mini-chart.signups").length, "has a signups chart"); - assert.ok($(".dashboard-mini-chart.posts").length, "has a posts chart"); + assert.ok($(".dashboard-mini-chart.posts").length, "has a posts chart"); - assert.ok( - $(".dashboard-mini-chart.dau_by_mau").length, - "has a dau_by_mau chart" - ); + assert.ok( + $(".dashboard-mini-chart.dau_by_mau").length, + "has a dau_by_mau chart" + ); - assert.ok( - $(".dashboard-mini-chart.daily_engaged_users").length, - "has a daily_engaged_users chart" - ); + assert.ok( + $(".dashboard-mini-chart.daily_engaged_users").length, + "has a daily_engaged_users chart" + ); - assert.ok( - $(".dashboard-mini-chart.new_contributors").length, - "has a new_contributors chart" - ); + assert.ok( + $(".dashboard-mini-chart.new_contributors").length, + "has a new_contributors chart" + ); - assert.equal( - $(".section.dashboard-problems .problem-messages ul li:first-child") - .html() - .trim(), - "Houston...", - "displays problems" - ); - }); + assert.equal( + $(".section.dashboard-problems .problem-messages ul li:first-child") + .html() + .trim(), + "Houston...", + "displays problems" + ); }); diff --git a/test/javascripts/acceptance/emoji-picker-test.js.es6 b/test/javascripts/acceptance/emoji-picker-test.js.es6 index 2933e55381..3c2ebe7be4 100644 --- a/test/javascripts/acceptance/emoji-picker-test.js.es6 +++ b/test/javascripts/acceptance/emoji-picker-test.js.es6 @@ -9,179 +9,156 @@ acceptance("EmojiPicker", { } }); -QUnit.test("emoji picker can be opened/closed", assert => { - visit("/t/internationalization-localization/280"); - click("#topic-footer-buttons .btn.create"); +QUnit.test("emoji picker can be opened/closed", async assert => { + await visit("/t/internationalization-localization/280"); + await click("#topic-footer-buttons .btn.create"); - click("button.emoji.btn"); - andThen(() => { - assert.notEqual( - find(".emoji-picker") - .html() - .trim(), - "", - "it opens the picker" - ); - }); + await click("button.emoji.btn"); + assert.notEqual( + find(".emoji-picker") + .html() + .trim(), + "", + "it opens the picker" + ); - click("button.emoji.btn"); - andThen(() => { - assert.equal( - find(".emoji-picker") - .html() - .trim(), - "", - "it closes the picker" - ); - }); + await click("button.emoji.btn"); + assert.equal( + find(".emoji-picker") + .html() + .trim(), + "", + "it closes the picker" + ); }); -QUnit.test("emojis can be hovered to display info", assert => { - visit("/t/internationalization-localization/280"); - click("#topic-footer-buttons .btn.create"); +QUnit.test("emojis can be hovered to display info", async assert => { + await visit("/t/internationalization-localization/280"); + await click("#topic-footer-buttons .btn.create"); - click("button.emoji.btn"); - andThen(() => { - $(".emoji-picker button[title='grinning']").trigger("mouseover"); - andThen(() => { - assert.equal( - find(".emoji-picker .info") - .html() - .trim(), - ` :grinning:`, - "it displays emoji info when hovering emoji" - ); - }); - }); + await click("button.emoji.btn"); + $(".emoji-picker button[title='grinning']").trigger("mouseover"); + assert.equal( + find(".emoji-picker .info") + .html() + .trim(), + ` :grinning:`, + "it displays emoji info when hovering emoji" + ); }); -QUnit.test("emoji picker triggers event when picking emoji", assert => { - visit("/t/internationalization-localization/280"); - click("#topic-footer-buttons .btn.create"); - click("button.emoji.btn"); +QUnit.test("emoji picker triggers event when picking emoji", async assert => { + await visit("/t/internationalization-localization/280"); + await click("#topic-footer-buttons .btn.create"); + await click("button.emoji.btn"); - click(".emoji-picker button[title='grinning']"); - andThen(() => { - assert.equal( - find(".d-editor-input").val(), - ":grinning:", - "it adds the emoji code in the editor when selected" - ); - }); + await click(".emoji-picker button[title='grinning']"); + assert.equal( + find(".d-editor-input").val(), + ":grinning:", + "it adds the emoji code in the editor when selected" + ); }); -QUnit.test("emoji picker has a list of recently used emojis", assert => { - visit("/t/internationalization-localization/280"); - click("#topic-footer-buttons .btn.create"); - click("button.emoji.btn"); +QUnit.test("emoji picker has a list of recently used emojis", async assert => { + await visit("/t/internationalization-localization/280"); + await click("#topic-footer-buttons .btn.create"); + await click("button.emoji.btn"); - click( + await click( ".emoji-picker .section[data-section='people'] button.emoji[title='grinning']" ); - andThen(() => { - assert.equal( - find('.emoji-picker .section[data-section="recent"]').css("display"), - "block", - "it shows recent section" - ); + assert.equal( + find('.emoji-picker .section[data-section="recent"]').css("display"), + "block", + "it shows recent section" + ); - assert.equal( - find( - '.emoji-picker .section[data-section="recent"] .section-group button.emoji' - ).length, - 1, - "it adds the emoji code to the recently used emojis list" - ); - }); + assert.equal( + find( + '.emoji-picker .section[data-section="recent"] .section-group button.emoji' + ).length, + 1, + "it adds the emoji code to the recently used emojis list" + ); - click(".emoji-picker .clear-recent"); - andThen(() => { - assert.equal( - find( - '.emoji-picker .section[data-section="recent"] .section-group button.emoji' - ).length, - 0, - "it has cleared recent emojis" - ); + await click(".emoji-picker .clear-recent"); + assert.equal( + find( + '.emoji-picker .section[data-section="recent"] .section-group button.emoji' + ).length, + 0, + "it has cleared recent emojis" + ); - assert.equal( - find('.emoji-picker .section[data-section="recent"]').css("display"), - "none", - "it hides recent section" - ); + assert.equal( + find('.emoji-picker .section[data-section="recent"]').css("display"), + "none", + "it hides recent section" + ); - assert.equal( - find('.emoji-picker .category-icon button.emoji[data-section="recent"]') - .parent() - .css("display"), - "none", - "it hides recent category icon" - ); - }); + assert.equal( + find('.emoji-picker .category-icon button.emoji[data-section="recent"]') + .parent() + .css("display"), + "none", + "it hides recent category icon" + ); }); -QUnit.test("emoji picker correctly orders recently used emojis", assert => { - visit("/t/internationalization-localization/280"); - click("#topic-footer-buttons .btn.create"); +QUnit.test( + "emoji picker correctly orders recently used emojis", + async assert => { + await visit("/t/internationalization-localization/280"); + await click("#topic-footer-buttons .btn.create"); - click("button.emoji.btn"); - andThen(() => { - click(".emoji-picker button[title='sunglasses']"); - click(".emoji-picker button[title='grinning']"); - andThen(() => { - assert.equal( + await click("button.emoji.btn"); + await click(".emoji-picker button[title='sunglasses']"); + await click(".emoji-picker button[title='grinning']"); + assert.equal( + find('.section[data-section="recent"] .section-group button.emoji') + .length, + 2, + "it has multiple recent emojis" + ); + + assert.equal( + /grinning/.test( find('.section[data-section="recent"] .section-group button.emoji') - .length, - 2, - "it has multiple recent emojis" - ); - - assert.equal( - /grinning/.test( - find('.section[data-section="recent"] .section-group button.emoji') - .first() - .css("background-image") - ), - true, - "it puts the last used emoji in first" - ); - }); - }); -}); - -QUnit.test("emoji picker lazy loads emojis", assert => { - visit("/t/internationalization-localization/280"); - click("#topic-footer-buttons .btn.create"); - - click("button.emoji.btn"); - - andThen(() => { - assert.equal( - find('.emoji-picker button[title="massage_woman"]').css( - "background-image" + .first() + .css("background-image") ), - "none", - "it doesn't load invisible emojis" - ); - }); -}); - -QUnit.test("emoji picker persists state", assert => { - visit("/t/internationalization-localization/280"); - click("#topic-footer-buttons .btn.create"); - - click("button.emoji.btn"); - andThen(() => { - click(".emoji-picker a.diversity-scale.medium-dark"); - }); - click("button.emoji.btn"); - - click("button.emoji.btn"); - andThen(() => { - assert.equal( - find(".emoji-picker .diversity-scale.medium-dark").hasClass("selected"), true, - "it stores diversity scale" + "it puts the last used emoji in first" ); - }); + } +); + +QUnit.test("emoji picker lazy loads emojis", async assert => { + await visit("/t/internationalization-localization/280"); + await click("#topic-footer-buttons .btn.create"); + + await click("button.emoji.btn"); + + assert.equal( + find('.emoji-picker button[title="massage_woman"]').css("background-image"), + "none", + "it doesn't load invisible emojis" + ); +}); + +QUnit.test("emoji picker persists state", async assert => { + await visit("/t/internationalization-localization/280"); + await click("#topic-footer-buttons .btn.create"); + + await click("button.emoji.btn"); + await click(".emoji-picker a.diversity-scale.medium-dark"); + await click("button.emoji.btn"); + + await click("button.emoji.btn"); + assert.equal( + find(".emoji-picker .diversity-scale.medium-dark").hasClass("selected"), + true, + "it stores diversity scale" + ); }); diff --git a/test/javascripts/acceptance/emoji-test.js.es6 b/test/javascripts/acceptance/emoji-test.js.es6 index b6d46df09b..a01b623d1a 100644 --- a/test/javascripts/acceptance/emoji-test.js.es6 +++ b/test/javascripts/acceptance/emoji-test.js.es6 @@ -2,52 +2,44 @@ import { acceptance } from "helpers/qunit-helpers"; acceptance("Emoji", { loggedIn: true }); -QUnit.test("emoji is cooked properly", assert => { - visit("/t/internationalization-localization/280"); - click("#topic-footer-buttons .btn.create"); +QUnit.test("emoji is cooked properly", async assert => { + await visit("/t/internationalization-localization/280"); + await click("#topic-footer-buttons .btn.create"); - fillIn(".d-editor-input", "this is an emoji :blonde_woman:"); - andThen(() => { - assert.equal( - find(".d-editor-preview:visible") - .html() - .trim(), - '

this is an emoji :blonde_woman:

' - ); - }); + await fillIn(".d-editor-input", "this is an emoji :blonde_woman:"); + assert.equal( + find(".d-editor-preview:visible") + .html() + .trim(), + '

this is an emoji :blonde_woman:

' + ); - click("#reply-control .btn.create"); - andThen(() => { - assert.equal( - find(".topic-post:last .cooked p") - .html() - .trim(), - 'this is an emoji :blonde_woman:' - ); - }); + await click("#reply-control .btn.create"); + assert.equal( + find(".topic-post:last .cooked p") + .html() + .trim(), + 'this is an emoji :blonde_woman:' + ); }); -QUnit.test("skin toned emoji is cooked properly", assert => { - visit("/t/internationalization-localization/280"); - click("#topic-footer-buttons .btn.create"); +QUnit.test("skin toned emoji is cooked properly", async assert => { + await visit("/t/internationalization-localization/280"); + await click("#topic-footer-buttons .btn.create"); - fillIn(".d-editor-input", "this is an emoji :blonde_woman:t5:"); - andThen(() => { - assert.equal( - find(".d-editor-preview:visible") - .html() - .trim(), - '

this is an emoji :blonde_woman:t5:

' - ); - }); + await fillIn(".d-editor-input", "this is an emoji :blonde_woman:t5:"); + assert.equal( + find(".d-editor-preview:visible") + .html() + .trim(), + '

this is an emoji :blonde_woman:t5:

' + ); - click("#reply-control .btn.create"); - andThen(() => { - assert.equal( - find(".topic-post:last .cooked p") - .html() - .trim(), - 'this is an emoji :blonde_woman:t5:' - ); - }); + await click("#reply-control .btn.create"); + assert.equal( + find(".topic-post:last .cooked p") + .html() + .trim(), + 'this is an emoji :blonde_woman:t5:' + ); }); diff --git a/test/javascripts/acceptance/group-card-mobile-test.js.es6 b/test/javascripts/acceptance/group-card-mobile-test.js.es6 index d3b6fcc9b0..f4734e8621 100644 --- a/test/javascripts/acceptance/group-card-mobile-test.js.es6 +++ b/test/javascripts/acceptance/group-card-mobile-test.js.es6 @@ -2,13 +2,10 @@ import { acceptance } from "helpers/qunit-helpers"; acceptance("Group Card - Mobile", { mobileView: true }); -QUnit.test("group card", assert => { - visit("/t/301/1"); - +QUnit.test("group card", async assert => { + await visit("/t/301/1"); assert.ok(invisible("#group-card"), "user card is invisible by default"); - click("a.mention-group:first"); - andThen(() => { - assert.ok(visible(".group-details-container"), "group page show be shown"); - }); + await click("a.mention-group:first"); + assert.ok(visible(".group-details-container"), "group page show be shown"); }); diff --git a/test/javascripts/acceptance/group-card-test.js.es6 b/test/javascripts/acceptance/group-card-test.js.es6 index 5ca3f4ad77..2b8496936c 100644 --- a/test/javascripts/acceptance/group-card-test.js.es6 +++ b/test/javascripts/acceptance/group-card-test.js.es6 @@ -2,13 +2,10 @@ import { acceptance } from "helpers/qunit-helpers"; acceptance("Group Card"); -QUnit.test("group card", assert => { - visit("/t/301/1"); - +QUnit.test("group card", async assert => { + await visit("/t/301/1"); assert.ok(invisible("#group-card"), "user card is invisible by default"); - click("a.mention-group:first"); - andThen(() => { - assert.ok(visible("#group-card"), "card should appear"); - }); + await click("a.mention-group:first"); + assert.ok(visible("#group-card"), "card should appear"); }); diff --git a/test/javascripts/acceptance/group-index-test.js.es6 b/test/javascripts/acceptance/group-index-test.js.es6 index bd6dc23e3e..1ad8fee562 100644 --- a/test/javascripts/acceptance/group-index-test.js.es6 +++ b/test/javascripts/acceptance/group-index-test.js.es6 @@ -2,62 +2,56 @@ import { acceptance, logIn, replaceCurrentUser } from "helpers/qunit-helpers"; acceptance("Group Members"); -QUnit.test("Viewing Members as anon user", assert => { - visit("/groups/discourse"); +QUnit.test("Viewing Members as anon user", async assert => { + await visit("/groups/discourse"); - andThen(() => { - assert.ok( - count(".avatar-flair .fa-adjust") === 1, - "it displays the group's avatar flair" - ); - assert.ok(count(".group-members tr") > 0, "it lists group members"); + assert.ok( + count(".avatar-flair .fa-adjust") === 1, + "it displays the group's avatar flair" + ); + assert.ok(count(".group-members tr") > 0, "it lists group members"); - assert.ok( - count(".group-member-dropdown") === 0, - "it does not allow anon user to manage group members" - ); + assert.ok( + count(".group-member-dropdown") === 0, + "it does not allow anon user to manage group members" + ); - assert.equal( - find(".group-username-filter").attr("placeholder"), - I18n.t("groups.members.filter_placeholder"), - "it should display the right filter placehodler" - ); - }); + assert.equal( + find(".group-username-filter").attr("placeholder"), + I18n.t("groups.members.filter_placeholder"), + "it should display the right filter placehodler" + ); }); -QUnit.test("Viewing Members as a group owner", assert => { +QUnit.test("Viewing Members as a group owner", async assert => { logIn(); Discourse.reset(); replaceCurrentUser({ admin: false, staff: false }); - visit("/groups/discourse"); - click(".group-members-add"); + await visit("/groups/discourse"); + await click(".group-members-add"); - andThen(() => { - assert.equal( - find("#group-add-members-user-selector").length, - 1, - "it should display the add members modal" - ); - }); + assert.equal( + find("#group-add-members-user-selector").length, + 1, + "it should display the add members modal" + ); }); -QUnit.test("Viewing Members as an admin user", assert => { +QUnit.test("Viewing Members as an admin user", async assert => { logIn(); Discourse.reset(); - visit("/groups/discourse"); + await visit("/groups/discourse"); - andThen(() => { - assert.ok( - count(".group-member-dropdown") > 0, - "it allows admin user to manage group members" - ); + assert.ok( + count(".group-member-dropdown") > 0, + "it allows admin user to manage group members" + ); - assert.equal( - find(".group-username-filter").attr("placeholder"), - I18n.t("groups.members.filter_placeholder_admin"), - "it should display the right filter placehodler" - ); - }); + assert.equal( + find(".group-username-filter").attr("placeholder"), + I18n.t("groups.members.filter_placeholder_admin"), + "it should display the right filter placehodler" + ); }); diff --git a/test/javascripts/acceptance/group-manage-interaction-test.js.es6 b/test/javascripts/acceptance/group-manage-interaction-test.js.es6 index 06a1c913cb..5884eca593 100644 --- a/test/javascripts/acceptance/group-manage-interaction-test.js.es6 +++ b/test/javascripts/acceptance/group-manage-interaction-test.js.es6 @@ -7,75 +7,71 @@ acceptance("Managing Group Interaction Settings", { } }); -QUnit.test("As an admin", assert => { - visit("/groups/discourse/manage/interaction"); +QUnit.test("As an admin", async assert => { + await visit("/groups/discourse/manage/interaction"); - andThen(() => { - assert.equal( - find(".groups-form-visibility-level").length, - 1, - "it should display visibility level selector" - ); + assert.equal( + find(".groups-form-visibility-level").length, + 1, + "it should display visibility level selector" + ); - assert.equal( - find(".groups-form-mentionable-level").length, - 1, - "it should display mentionable level selector" - ); + assert.equal( + find(".groups-form-mentionable-level").length, + 1, + "it should display mentionable level selector" + ); - assert.equal( - find(".groups-form-messageable-level").length, - 1, - "it should display messageable level selector" - ); + assert.equal( + find(".groups-form-messageable-level").length, + 1, + "it should display messageable level selector" + ); - assert.equal( - find(".groups-form-incoming-email").length, - 1, - "it should display incoming email input" - ); + assert.equal( + find(".groups-form-incoming-email").length, + 1, + "it should display incoming email input" + ); - assert.equal( - find(".groups-form-default-notification-level").length, - 1, - "it should display default notification level input" - ); - }); + assert.equal( + find(".groups-form-default-notification-level").length, + 1, + "it should display default notification level input" + ); }); -QUnit.test("As a group owner", assert => { +QUnit.test("As a group owner", async assert => { replaceCurrentUser({ admin: false, staff: false }); - visit("/groups/discourse/manage/interaction"); + await visit("/groups/discourse/manage/interaction"); - andThen(() => { - assert.equal( - find(".groups-form-visibility-level").length, - 0, - "it should display visibility level selector" - ); + assert.equal( + find(".groups-form-visibility-level").length, + 0, + "it should display visibility level selector" + ); - assert.equal( - find(".groups-form-mentionable-level").length, - 1, - "it should display mentionable level selector" - ); + assert.equal( + find(".groups-form-mentionable-level").length, + 1, + "it should display mentionable level selector" + ); - assert.equal( - find(".groups-form-messageable-level").length, - 1, - "it should display messageable level selector" - ); + assert.equal( + find(".groups-form-messageable-level").length, + 1, + "it should display messageable level selector" + ); - assert.equal( - find(".groups-form-incoming-email").length, - 0, - "it should not display incoming email input" - ); + assert.equal( + find(".groups-form-incoming-email").length, + 0, + "it should not display incoming email input" + ); - assert.equal( - find(".groups-form-default-notification-level").length, - 1, - "it should display default notification level input" - ); - }); + assert.equal( + find(".groups-form-default-notification-level").length, + 1, + "it should display default notification level input" + ); }); diff --git a/test/javascripts/acceptance/group-manage-membership-test.js.es6 b/test/javascripts/acceptance/group-manage-membership-test.js.es6 index d22aa56bed..1b57b393b6 100644 --- a/test/javascripts/acceptance/group-manage-membership-test.js.es6 +++ b/test/javascripts/acceptance/group-manage-membership-test.js.es6 @@ -4,117 +4,111 @@ acceptance("Managing Group Membership", { loggedIn: true }); -QUnit.test("As an admin", assert => { - visit("/groups/discourse/manage/membership"); +QUnit.test("As an admin", async assert => { + await visit("/groups/discourse/manage/membership"); - andThen(() => { - assert.ok( - find('label[for="automatic_membership"]').length === 1, - "it should display automatic membership label" - ); + assert.ok( + find('label[for="automatic_membership"]').length === 1, + "it should display automatic membership label" + ); - assert.ok( - find(".groups-form-automatic-membership-retroactive").length === 1, - "it should display automatic membership retroactive checkbox" - ); + assert.ok( + find(".groups-form-automatic-membership-retroactive").length === 1, + "it should display automatic membership retroactive checkbox" + ); - assert.ok( - find(".groups-form-primary-group").length === 1, - "it should display set as primary group checkbox" - ); + assert.ok( + find(".groups-form-primary-group").length === 1, + "it should display set as primary group checkbox" + ); - assert.ok( - find(".groups-form-grant-trust-level").length === 1, - "it should display grant trust level selector" - ); + assert.ok( + find(".groups-form-grant-trust-level").length === 1, + "it should display grant trust level selector" + ); - assert.ok( - find(".group-form-public-admission").length === 1, - "it should display group public admission input" - ); + assert.ok( + find(".group-form-public-admission").length === 1, + "it should display group public admission input" + ); - assert.ok( - find(".group-form-public-exit").length === 1, - "it should display group public exit input" - ); + assert.ok( + find(".group-form-public-exit").length === 1, + "it should display group public exit input" + ); - assert.ok( - find(".group-form-allow-membership-requests").length === 1, - "it should display group allow_membership_request input" - ); + assert.ok( + find(".group-form-allow-membership-requests").length === 1, + "it should display group allow_membership_request input" + ); - assert.ok( - find(".group-form-allow-membership-requests[disabled]").length === 1, - "it should disable group allow_membership_request input" - ); - }); + assert.ok( + find(".group-form-allow-membership-requests[disabled]").length === 1, + "it should disable group allow_membership_request input" + ); - click(".group-form-public-admission"); - click(".group-form-allow-membership-requests"); + await click(".group-form-public-admission"); + await click(".group-form-allow-membership-requests"); - andThen(() => { - assert.ok( - find(".group-form-public-admission[disabled]").length === 1, - "it should disable group public admission input" - ); + assert.ok( + find(".group-form-public-admission[disabled]").length === 1, + "it should disable group public admission input" + ); - assert.ok( - find(".group-form-public-exit[disabled]").length === 0, - "it should not disable group public exit input" - ); + assert.ok( + find(".group-form-public-exit[disabled]").length === 0, + "it should not disable group public exit input" + ); - assert.equal( - find(".group-form-membership-request-template").length, - 1, - "it should display the membership request template field" - ); - }); + assert.equal( + find(".group-form-membership-request-template").length, + 1, + "it should display the membership request template field" + ); }); -QUnit.test("As a group owner", assert => { +QUnit.test("As a group owner", async assert => { replaceCurrentUser({ staff: false, admin: false }); - visit("/groups/discourse/manage/membership"); + await visit("/groups/discourse/manage/membership"); - andThen(() => { - assert.ok( - find('label[for="automatic_membership"]').length === 0, - "it should not display automatic membership label" - ); + assert.ok( + find('label[for="automatic_membership"]').length === 0, + "it should not display automatic membership label" + ); - assert.ok( - find(".groups-form-automatic-membership-retroactive").length === 0, - "it should not display automatic membership retroactive checkbox" - ); + assert.ok( + find(".groups-form-automatic-membership-retroactive").length === 0, + "it should not display automatic membership retroactive checkbox" + ); - assert.ok( - find(".groups-form-primary-group").length === 0, - "it should not display set as primary group checkbox" - ); + assert.ok( + find(".groups-form-primary-group").length === 0, + "it should not display set as primary group checkbox" + ); - assert.ok( - find(".groups-form-grant-trust-level").length === 0, - "it should not display grant trust level selector" - ); + assert.ok( + find(".groups-form-grant-trust-level").length === 0, + "it should not display grant trust level selector" + ); - assert.ok( - find(".group-form-public-admission").length === 1, - "it should display group public admission input" - ); + assert.ok( + find(".group-form-public-admission").length === 1, + "it should display group public admission input" + ); - assert.ok( - find(".group-form-public-exit").length === 1, - "it should display group public exit input" - ); + assert.ok( + find(".group-form-public-exit").length === 1, + "it should display group public exit input" + ); - assert.ok( - find(".group-form-allow-membership-requests").length === 1, - "it should display group allow_membership_request input" - ); + assert.ok( + find(".group-form-allow-membership-requests").length === 1, + "it should display group allow_membership_request input" + ); - assert.ok( - find(".group-form-allow-membership-requests[disabled]").length === 1, - "it should disable group allow_membership_request input" - ); - }); + assert.ok( + find(".group-form-allow-membership-requests[disabled]").length === 1, + "it should disable group allow_membership_request input" + ); }); diff --git a/test/javascripts/acceptance/group-manage-profile-test.js.es6 b/test/javascripts/acceptance/group-manage-profile-test.js.es6 index 351ebd084d..a219797a61 100644 --- a/test/javascripts/acceptance/group-manage-profile-test.js.es6 +++ b/test/javascripts/acceptance/group-manage-profile-test.js.es6 @@ -2,55 +2,49 @@ import { acceptance, logIn, replaceCurrentUser } from "helpers/qunit-helpers"; acceptance("Managing Group Profile"); -QUnit.test("As an admin", assert => { +QUnit.test("As an admin", async assert => { logIn(); Discourse.reset(); - visit("/groups/discourse/manage/profile"); + await visit("/groups/discourse/manage/profile"); - andThen(() => { - assert.ok( - find(".group-flair-inputs").length === 1, - "it should display avatar flair inputs" - ); - assert.ok( - find(".group-form-bio").length === 1, - "it should display group bio input" - ); - assert.ok( - find(".group-form-name").length === 1, - "it should display group name input" - ); - assert.ok( - find(".group-form-full-name").length === 1, - "it should display group full name input" - ); - }); + assert.ok( + find(".group-flair-inputs").length === 1, + "it should display avatar flair inputs" + ); + assert.ok( + find(".group-form-bio").length === 1, + "it should display group bio input" + ); + assert.ok( + find(".group-form-name").length === 1, + "it should display group name input" + ); + assert.ok( + find(".group-form-full-name").length === 1, + "it should display group full name input" + ); }); -QUnit.test("As a group owner", assert => { +QUnit.test("As a group owner", async assert => { logIn(); Discourse.reset(); replaceCurrentUser({ staff: false, admin: false }); - visit("/groups/discourse/manage/profile"); + await visit("/groups/discourse/manage/profile"); - andThen(() => { - assert.equal( - find(".group-form-name").length, - 0, - "it should not display group name input" - ); - }); + assert.equal( + find(".group-form-name").length, + 0, + "it should not display group name input" + ); }); -QUnit.test("As an anonymous user", assert => { - visit("/groups/discourse/manage/profile"); +QUnit.test("As an anonymous user", async assert => { + await visit("/groups/discourse/manage/profile"); - andThen(() => { - assert.ok( - count(".group-members tr") > 0, - "it should redirect to members page for an anonymous user" - ); - }); + assert.ok( + count(".group-members tr") > 0, + "it should redirect to members page for an anonymous user" + ); }); diff --git a/test/javascripts/acceptance/groups-index-test.js.es6 b/test/javascripts/acceptance/groups-index-test.js.es6 index 5429434ba6..75c26df3b9 100644 --- a/test/javascripts/acceptance/groups-index-test.js.es6 +++ b/test/javascripts/acceptance/groups-index-test.js.es6 @@ -2,56 +2,44 @@ import { acceptance } from "helpers/qunit-helpers"; acceptance("Groups"); -QUnit.test("Browsing Groups", assert => { - visit("/groups"); +QUnit.test("Browsing Groups", async assert => { + await visit("/groups"); - andThen(() => { - assert.equal(count(".groups-table-row"), 2, "it displays visible groups"); - assert.equal( - find(".group-index-join").length, - 1, - "it shows button to join group" - ); - assert.equal( - find(".group-index-request").length, - 1, - "it shows button to request for group membership" - ); - }); + assert.equal(count(".groups-table-row"), 2, "it displays visible groups"); + assert.equal( + find(".group-index-join").length, + 1, + "it shows button to join group" + ); + assert.equal( + find(".group-index-request").length, + 1, + "it shows button to request for group membership" + ); - click(".group-index-join"); + await click(".group-index-join"); - andThen(() => { - assert.ok(exists(".modal.login-modal"), "it shows the login modal"); - }); + assert.ok(exists(".modal.login-modal"), "it shows the login modal"); - click(".login-modal .close"); + await click(".login-modal .close"); - andThen(() => { - assert.ok(invisible(".modal.login-modal"), "it closes the login modal"); - }); + assert.ok(invisible(".modal.login-modal"), "it closes the login modal"); - click(".group-index-request"); + await click(".group-index-request"); - andThen(() => { - assert.ok(exists(".modal.login-modal"), "it shows the login modal"); - }); + assert.ok(exists(".modal.login-modal"), "it shows the login modal"); - click("a[href='/groups/discourse/members']"); + await click("a[href='/groups/discourse/members']"); - andThen(() => { - assert.equal( - find(".group-info-name") - .text() - .trim(), - "Awesome Team", - "it displays the group page" - ); - }); + assert.equal( + find(".group-info-name") + .text() + .trim(), + "Awesome Team", + "it displays the group page" + ); - click(".group-index-join"); + await click(".group-index-join"); - andThen(() => { - assert.ok(exists(".modal.login-modal"), "it shows the login modal"); - }); + assert.ok(exists(".modal.login-modal"), "it shows the login modal"); }); diff --git a/test/javascripts/acceptance/groups-new-test.js.es6 b/test/javascripts/acceptance/groups-new-test.js.es6 index 96e02e4129..4aaea091e9 100644 --- a/test/javascripts/acceptance/groups-new-test.js.es6 +++ b/test/javascripts/acceptance/groups-new-test.js.es6 @@ -2,97 +2,83 @@ import { acceptance, logIn } from "helpers/qunit-helpers"; acceptance("New Group"); -QUnit.test("As an anon user", assert => { - visit("/groups"); +QUnit.test("As an anon user", async assert => { + await visit("/groups"); - andThen(() => { - assert.equal( - find(".groups-header-new").length, - 0, - "it should not display the button to create a group" - ); - }); + assert.equal( + find(".groups-header-new").length, + 0, + "it should not display the button to create a group" + ); }); -QUnit.test("Creating a new group", assert => { +QUnit.test("Creating a new group", async assert => { logIn(); Discourse.reset(); - visit("/groups"); + await visit("/groups"); - click(".groups-header-new"); + await click(".groups-header-new"); - andThen(() => { - assert.equal( - find(".group-form-save[disabled]").length, - 1, - "save button should be disabled" - ); - }); + assert.equal( + find(".group-form-save[disabled]").length, + 1, + "save button should be disabled" + ); - fillIn("input[name='name']", "1"); + await fillIn("input[name='name']", "1"); - andThen(() => { - assert.equal( - find(".tip.bad") - .text() - .trim(), - I18n.t("admin.groups.new.name.too_short"), - "it should show the right validation tooltip" - ); + assert.equal( + find(".tip.bad") + .text() + .trim(), + I18n.t("admin.groups.new.name.too_short"), + "it should show the right validation tooltip" + ); - assert.ok( - find(".group-form-save:disabled").length === 1, - "it should disable the save button" - ); - }); + assert.ok( + find(".group-form-save:disabled").length === 1, + "it should disable the save button" + ); - fillIn( + await fillIn( "input[name='name']", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ); - andThen(() => { - assert.equal( - find(".tip.bad") - .text() - .trim(), - I18n.t("admin.groups.new.name.too_long"), - "it should show the right validation tooltip" - ); - }); + assert.equal( + find(".tip.bad") + .text() + .trim(), + I18n.t("admin.groups.new.name.too_long"), + "it should show the right validation tooltip" + ); - fillIn("input[name='name']", ""); + await fillIn("input[name='name']", ""); - andThen(() => { - assert.equal( - find(".tip.bad") - .text() - .trim(), - I18n.t("admin.groups.new.name.blank"), - "it should show the right validation tooltip" - ); - }); + assert.equal( + find(".tip.bad") + .text() + .trim(), + I18n.t("admin.groups.new.name.blank"), + "it should show the right validation tooltip" + ); - fillIn("input[name='name']", "goodusername"); + await fillIn("input[name='name']", "goodusername"); - andThen(() => { - assert.equal( - find(".tip.good") - .text() - .trim(), - I18n.t("admin.groups.new.name.available"), - "it should show the right validation tooltip" - ); - }); + assert.equal( + find(".tip.good") + .text() + .trim(), + I18n.t("admin.groups.new.name.available"), + "it should show the right validation tooltip" + ); - click(".group-form-public-admission"); + await click(".group-form-public-admission"); - andThen(() => { - assert.equal( - find("groups-new-allow-membership-requests").length, - 0, - "it should disable the membership requests checkbox" - ); - }); + assert.equal( + find("groups-new-allow-membership-requests").length, + 0, + "it should disable the membership requests checkbox" + ); });