mirror of
https://github.com/discourse/discourse.git
synced 2025-04-19 20:59:05 +08:00
DEV: migrate acceptance tests to async await - dashboard, emoji, group
This commit is contained in:
parent
e36d1c72f1
commit
7f7944bc3a
@ -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"
|
||||
);
|
||||
});
|
||||
|
@ -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(),
|
||||
`<img src=\"/images/emoji/emoji_one/grinning.png?v=${v}\" class=\"emoji\"> <span>:grinning:<span></span></span>`,
|
||||
"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(),
|
||||
`<img src=\"/images/emoji/emoji_one/grinning.png?v=${v}\" class=\"emoji\"> <span>:grinning:<span></span></span>`,
|
||||
"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"
|
||||
);
|
||||
});
|
||||
|
@ -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(),
|
||||
'<p>this is an emoji <img src="/images/emoji/emoji_one/blonde_woman.png?v=5" title=":blonde_woman:" class="emoji" alt=":blonde_woman:"></p>'
|
||||
);
|
||||
});
|
||||
await fillIn(".d-editor-input", "this is an emoji :blonde_woman:");
|
||||
assert.equal(
|
||||
find(".d-editor-preview:visible")
|
||||
.html()
|
||||
.trim(),
|
||||
'<p>this is an emoji <img src="/images/emoji/emoji_one/blonde_woman.png?v=5" title=":blonde_woman:" class="emoji" alt=":blonde_woman:"></p>'
|
||||
);
|
||||
|
||||
click("#reply-control .btn.create");
|
||||
andThen(() => {
|
||||
assert.equal(
|
||||
find(".topic-post:last .cooked p")
|
||||
.html()
|
||||
.trim(),
|
||||
'this is an emoji <img src="/images/emoji/emoji_one/blonde_woman.png?v=5" title=":blonde_woman:" class="emoji" alt=":blonde_woman:">'
|
||||
);
|
||||
});
|
||||
await click("#reply-control .btn.create");
|
||||
assert.equal(
|
||||
find(".topic-post:last .cooked p")
|
||||
.html()
|
||||
.trim(),
|
||||
'this is an emoji <img src="/images/emoji/emoji_one/blonde_woman.png?v=5" title=":blonde_woman:" class="emoji" alt=":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(),
|
||||
'<p>this is an emoji <img src="/images/emoji/emoji_one/blonde_woman/5.png?v=5" title=":blonde_woman:t5:" class="emoji" alt=":blonde_woman:t5:"></p>'
|
||||
);
|
||||
});
|
||||
await fillIn(".d-editor-input", "this is an emoji :blonde_woman:t5:");
|
||||
assert.equal(
|
||||
find(".d-editor-preview:visible")
|
||||
.html()
|
||||
.trim(),
|
||||
'<p>this is an emoji <img src="/images/emoji/emoji_one/blonde_woman/5.png?v=5" title=":blonde_woman:t5:" class="emoji" alt=":blonde_woman:t5:"></p>'
|
||||
);
|
||||
|
||||
click("#reply-control .btn.create");
|
||||
andThen(() => {
|
||||
assert.equal(
|
||||
find(".topic-post:last .cooked p")
|
||||
.html()
|
||||
.trim(),
|
||||
'this is an emoji <img src="/images/emoji/emoji_one/blonde_woman/5.png?v=5" title=":blonde_woman:t5:" class="emoji" alt=":blonde_woman:t5:">'
|
||||
);
|
||||
});
|
||||
await click("#reply-control .btn.create");
|
||||
assert.equal(
|
||||
find(".topic-post:last .cooked p")
|
||||
.html()
|
||||
.trim(),
|
||||
'this is an emoji <img src="/images/emoji/emoji_one/blonde_woman/5.png?v=5" title=":blonde_woman:t5:" class="emoji" alt=":blonde_woman:t5:">'
|
||||
);
|
||||
});
|
||||
|
@ -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");
|
||||
});
|
||||
|
@ -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");
|
||||
});
|
||||
|
@ -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"
|
||||
);
|
||||
});
|
||||
|
@ -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"
|
||||
);
|
||||
});
|
||||
|
@ -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"
|
||||
);
|
||||
});
|
||||
|
@ -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"
|
||||
);
|
||||
});
|
||||
|
@ -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");
|
||||
});
|
||||
|
@ -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"
|
||||
);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user