DEV: Update more asserts to qunit-dom (#29326)
regex find&replace + removing now-unused imports + manually fixing incorrect css selectors (that now got flagged 😌) + manually updating selectors that relied on jq
This commit is contained in:
parent
d991378218
commit
b9ec9c7e4f
|
@ -1,10 +1,6 @@
|
|||
import { click, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import I18n from "discourse-i18n";
|
||||
|
||||
acceptance("Admin - Badges - Mass Award", function (needs) {
|
||||
|
@ -24,9 +20,8 @@ acceptance("Admin - Badges - Mass Award", function (needs) {
|
|||
test("when the badge can not be granted multiple times", async function (assert) {
|
||||
await visit("/admin/badges/award/new");
|
||||
await click('.admin-badge-list-item span[data-badge-name="Only icon"]');
|
||||
assert.ok(
|
||||
!exists(".grant-existing-holders"),
|
||||
"checkbox for granting existing holders is not displayed"
|
||||
);
|
||||
assert
|
||||
.dom(".grant-existing-holders")
|
||||
.doesNotExist("checkbox for granting existing holders is not displayed");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -33,69 +33,55 @@ acceptance("Admin Sidebar - Sections", function (needs) {
|
|||
test("default sections are loaded", async function (assert) {
|
||||
await visit("/admin");
|
||||
|
||||
assert.ok(
|
||||
exists(".sidebar-section[data-section-name='admin-root']"),
|
||||
"root section is displayed"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".sidebar-section[data-section-name='admin-account']"),
|
||||
"account section is displayed"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".sidebar-section[data-section-name='admin-reports']"),
|
||||
"reports section is displayed"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".sidebar-section[data-section-name='admin-community']"),
|
||||
"community section is displayed"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".sidebar-section[data-section-name='admin-appearance']"),
|
||||
"appearance section is displayed"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".sidebar-section[data-section-name='admin-email_settings']"),
|
||||
"email settings section is displayed"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".sidebar-section[data-section-name='admin-email_logs']"),
|
||||
"email logs settings section is displayed"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".sidebar-section[data-section-name='admin-security']"),
|
||||
"security settings section is displayed"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".sidebar-section[data-section-name='admin-plugins']"),
|
||||
"plugins section is displayed"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".sidebar-section[data-section-name='admin-advanced']"),
|
||||
"advanced section is displayed"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-section[data-section-name='admin-root']")
|
||||
.exists("root section is displayed");
|
||||
assert
|
||||
.dom(".sidebar-section[data-section-name='admin-account']")
|
||||
.exists("account section is displayed");
|
||||
assert
|
||||
.dom(".sidebar-section[data-section-name='admin-reports']")
|
||||
.exists("reports section is displayed");
|
||||
assert
|
||||
.dom(".sidebar-section[data-section-name='admin-community']")
|
||||
.exists("community section is displayed");
|
||||
assert
|
||||
.dom(".sidebar-section[data-section-name='admin-appearance']")
|
||||
.exists("appearance section is displayed");
|
||||
assert
|
||||
.dom(".sidebar-section[data-section-name='admin-email_settings']")
|
||||
.exists("email settings section is displayed");
|
||||
assert
|
||||
.dom(".sidebar-section[data-section-name='admin-email_logs']")
|
||||
.exists("email logs settings section is displayed");
|
||||
assert
|
||||
.dom(".sidebar-section[data-section-name='admin-security']")
|
||||
.exists("security settings section is displayed");
|
||||
assert
|
||||
.dom(".sidebar-section[data-section-name='admin-plugins']")
|
||||
.exists("plugins section is displayed");
|
||||
assert
|
||||
.dom(".sidebar-section[data-section-name='admin-advanced']")
|
||||
.exists("advanced section is displayed");
|
||||
});
|
||||
|
||||
test("filter sections and clear filter with ESC", async function (assert) {
|
||||
await visit("/admin");
|
||||
await fillIn(".sidebar-filter__input", "advanced");
|
||||
assert.notOk(
|
||||
exists(".sidebar-section[data-section-name='admin-plugins']"),
|
||||
"plugins section is hidden"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".sidebar-section[data-section-name='admin-advanced']"),
|
||||
"advanced section is displayed"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-section[data-section-name='admin-plugins']")
|
||||
.doesNotExist("plugins section is hidden");
|
||||
assert
|
||||
.dom(".sidebar-section[data-section-name='admin-advanced']")
|
||||
.exists("advanced section is displayed");
|
||||
|
||||
await triggerKeyEvent(".sidebar-filter__input", "keydown", "Escape");
|
||||
assert.ok(
|
||||
exists(".sidebar-section[data-section-name='admin-plugins']"),
|
||||
"plugins section is displayed"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".sidebar-section[data-section-name='admin-advanced']"),
|
||||
"advanced section is displayed"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-section[data-section-name='admin-plugins']")
|
||||
.exists("plugins section is displayed");
|
||||
assert
|
||||
.dom(".sidebar-section[data-section-name='admin-advanced']")
|
||||
.exists("advanced section is displayed");
|
||||
});
|
||||
|
||||
test("enabled plugin admin routes have links added", async function (assert) {
|
||||
|
|
|
@ -45,10 +45,9 @@ acceptance("Admin - Site Settings", function (needs) {
|
|||
test("upload site setting", async function (assert) {
|
||||
await visit("/admin/site_settings");
|
||||
|
||||
assert.ok(
|
||||
exists(".row.setting.upload .image-uploader"),
|
||||
"image uploader is present"
|
||||
);
|
||||
assert
|
||||
.dom(".row.setting.upload .image-uploader")
|
||||
.exists("image uploader is present");
|
||||
|
||||
assert.ok(exists(".row.setting.upload .undo"), "undo button is present");
|
||||
});
|
||||
|
@ -75,43 +74,37 @@ acceptance("Admin - Site Settings", function (needs) {
|
|||
|
||||
await fillIn(".input-setting-string", "Test");
|
||||
await click("button.cancel");
|
||||
assert.ok(
|
||||
!exists(".row.setting.overridden"),
|
||||
"canceling doesn't mark setting as overridden"
|
||||
);
|
||||
assert
|
||||
.dom(".row.setting.overridden")
|
||||
.doesNotExist("canceling doesn't mark setting as overridden");
|
||||
|
||||
await fillIn(".input-setting-string", "Test");
|
||||
await click("button.ok");
|
||||
assert.ok(
|
||||
exists(".row.setting.overridden"),
|
||||
"saving marks setting as overridden"
|
||||
);
|
||||
assert
|
||||
.dom(".row.setting.overridden")
|
||||
.exists("saving marks setting as overridden");
|
||||
|
||||
await click("button.undo");
|
||||
assert.ok(
|
||||
!exists(".row.setting.overridden"),
|
||||
"setting isn't marked as overridden after undo"
|
||||
);
|
||||
assert
|
||||
.dom(".row.setting.overridden")
|
||||
.doesNotExist("setting isn't marked as overridden after undo");
|
||||
|
||||
await click("button.cancel");
|
||||
assert.ok(
|
||||
exists(".row.setting.overridden"),
|
||||
"setting is marked as overridden after cancel"
|
||||
);
|
||||
assert
|
||||
.dom(".row.setting.overridden")
|
||||
.exists("setting is marked as overridden after cancel");
|
||||
|
||||
await click("button.undo");
|
||||
await click("button.ok");
|
||||
assert.ok(
|
||||
!exists(".row.setting.overridden"),
|
||||
"setting isn't marked as overridden after undo"
|
||||
);
|
||||
assert
|
||||
.dom(".row.setting.overridden")
|
||||
.doesNotExist("setting isn't marked as overridden after undo");
|
||||
|
||||
await fillIn(".input-setting-string", "Test");
|
||||
await triggerKeyEvent(".input-setting-string", "keydown", "Enter");
|
||||
assert.ok(
|
||||
exists(".row.setting.overridden"),
|
||||
"saving via Enter key marks setting as overridden"
|
||||
);
|
||||
assert
|
||||
.dom(".row.setting.overridden")
|
||||
.exists("saving via Enter key marks setting as overridden");
|
||||
});
|
||||
|
||||
test("always shows filtered site settings if a filter is set", async function (assert) {
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
import { click, currentURL, fillIn, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import { SECOND_FACTOR_METHODS } from "discourse/models/user";
|
||||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import I18n from "discourse-i18n";
|
||||
|
||||
|
@ -173,10 +169,9 @@ acceptance("Admin - User Index", function (needs) {
|
|||
|
||||
assert.dom(".post-edits-count .value").hasText("6");
|
||||
|
||||
assert.ok(
|
||||
exists(".post-edits-count .controls .btn.btn-icon"),
|
||||
"View edits button exists"
|
||||
);
|
||||
assert
|
||||
.dom(".post-edits-count .controls .btn.btn-icon")
|
||||
.exists("View edits button exists");
|
||||
});
|
||||
|
||||
test("a link to view post edits report exists", async function (assert) {
|
||||
|
@ -196,10 +191,9 @@ acceptance("Admin - User Index", function (needs) {
|
|||
test("hides the 'view Edits' button if the count is zero", async function (assert) {
|
||||
await visit("/admin/users/2/sam");
|
||||
|
||||
assert.ok(
|
||||
!exists(".post-edits-count .controls .btn.btn-icon"),
|
||||
"View Edits button not present"
|
||||
);
|
||||
assert
|
||||
.dom(".post-edits-count .controls .btn.btn-icon")
|
||||
.doesNotExist("View Edits button not present");
|
||||
});
|
||||
|
||||
test("will clear unsaved groups when switching user", async function (assert) {
|
||||
|
@ -224,10 +218,9 @@ acceptance("Admin - User Index", function (needs) {
|
|||
.dom(".display-row.username .value")
|
||||
.hasText("eviltrout", "the name should be correct");
|
||||
|
||||
assert.ok(
|
||||
!exists('.group-chooser span[title="Macdonald"]'),
|
||||
"group should not be set"
|
||||
);
|
||||
assert
|
||||
.dom('.group-chooser span[title="Macdonald"]')
|
||||
.doesNotExist("group should not be set");
|
||||
});
|
||||
|
||||
test("grant admin - shows the confirmation dialog", async function (assert) {
|
||||
|
@ -247,10 +240,9 @@ acceptance("Admin - User Index", function (needs) {
|
|||
await click(".grant-admin");
|
||||
assert.dom(".dialog-content").exists();
|
||||
|
||||
assert.ok(
|
||||
exists(".dialog-content .dialog-body strong"),
|
||||
"HTML is rendered in the dialog"
|
||||
);
|
||||
assert
|
||||
.dom(".dialog-content .dialog-body strong")
|
||||
.exists("HTML is rendered in the dialog");
|
||||
});
|
||||
|
||||
test("grant admin - redirects to the 2fa page", async function (assert) {
|
||||
|
|
|
@ -15,10 +15,9 @@ acceptance("Categories - 'categories_only'", function (needs) {
|
|||
});
|
||||
test("basic functionality", async function (assert) {
|
||||
await visit("/categories");
|
||||
assert.ok(
|
||||
exists("table.category-list tr[data-category-id=1]"),
|
||||
"shows the topic list"
|
||||
);
|
||||
assert
|
||||
.dom("table.category-list tr[data-category-id='1']")
|
||||
.exists("shows the topic list");
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -28,14 +27,12 @@ acceptance("Categories - 'categories_and_latest_topics'", function (needs) {
|
|||
});
|
||||
test("basic functionality", async function (assert) {
|
||||
await visit("/categories");
|
||||
assert.ok(
|
||||
exists("table.category-list tr[data-category-id=1]"),
|
||||
"shows a category"
|
||||
);
|
||||
assert.ok(
|
||||
exists("div.latest-topic-list div[data-topic-id=8]"),
|
||||
"shows the topic list"
|
||||
);
|
||||
assert
|
||||
.dom("table.category-list tr[data-category-id='1']")
|
||||
.exists("shows a category");
|
||||
assert
|
||||
.dom("div.latest-topic-list div[data-topic-id='8']")
|
||||
.exists("shows the topic list");
|
||||
assert.notOk(
|
||||
query(".more-topics a").href.endsWith("?order=created"),
|
||||
"the load more button doesn't include the order=created param"
|
||||
|
@ -66,14 +63,12 @@ acceptance("Categories - 'categories_with_featured_topics'", function (needs) {
|
|||
});
|
||||
test("basic functionality", async function (assert) {
|
||||
await visit("/categories");
|
||||
assert.ok(
|
||||
exists("table.category-list.with-topics tr[data-category-id=1]"),
|
||||
"shows a category"
|
||||
);
|
||||
assert.ok(
|
||||
exists("table.category-list.with-topics div[data-topic-id=11994]"),
|
||||
"shows a featured topic"
|
||||
);
|
||||
assert
|
||||
.dom("table.category-list.with-topics tr[data-category-id='1']")
|
||||
.exists("shows a category");
|
||||
assert
|
||||
.dom("table.category-list.with-topics div[data-topic-id='11994']")
|
||||
.exists("shows a featured topic");
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -91,12 +86,12 @@ acceptance(
|
|||
);
|
||||
assert.ok(
|
||||
exists(
|
||||
"table.subcategory-list.with-topics tr[data-category-id=26] h3 .category-name"
|
||||
"table.subcategory-list.with-topics tr[data-category-id='26'] h3 .category-name"
|
||||
),
|
||||
"shows table row for subcategories"
|
||||
);
|
||||
assert.ok(
|
||||
exists("table.category-list.with-topics div[data-topic-id=11994]"),
|
||||
exists("table.category-list.with-topics div[data-topic-id='11994']"),
|
||||
"shows a featured topic"
|
||||
);
|
||||
});
|
||||
|
@ -118,12 +113,12 @@ acceptance(
|
|||
);
|
||||
assert.ok(
|
||||
exists(
|
||||
"div.subcategory-list.with-topics div[data-category-id=26] h3 .category-name"
|
||||
"div.subcategory-list.with-topics div[data-category-id='26'] h3 .category-name"
|
||||
),
|
||||
"shows element for subcategories"
|
||||
);
|
||||
assert.ok(
|
||||
exists("div.category-list.with-topics a[data-topic-id=11994]"),
|
||||
exists("div.category-list.with-topics a[data-topic-id='11994']"),
|
||||
"shows a featured topic"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -83,16 +83,14 @@ acceptance("Category New", function (needs) {
|
|||
);
|
||||
|
||||
await click(".edit-category-security a");
|
||||
assert.ok(
|
||||
exists(".permission-row button.reply-toggle"),
|
||||
"it can switch to the security tab"
|
||||
);
|
||||
assert
|
||||
.dom(".permission-row button.reply-toggle")
|
||||
.exists("it can switch to the security tab");
|
||||
|
||||
await click(".edit-category-settings a");
|
||||
assert.ok(
|
||||
exists("#category-search-priority"),
|
||||
"it can switch to the settings tab"
|
||||
);
|
||||
assert
|
||||
.dom("#category-search-priority")
|
||||
.exists("it can switch to the settings tab");
|
||||
|
||||
sinon.stub(DiscourseURL, "routeTo");
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import userFixtures from "discourse/tests/fixtures/user-fixtures";
|
|||
import {
|
||||
acceptance,
|
||||
count,
|
||||
exists,
|
||||
query,
|
||||
selectText,
|
||||
updateCurrentUser,
|
||||
|
@ -90,10 +89,9 @@ acceptance("Composer Actions", function (needs) {
|
|||
"test replying as whisper to topic when initially not a whisper"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
!exists(".composer-actions svg.d-icon-far-eye-slash"),
|
||||
"whisper icon is not visible"
|
||||
);
|
||||
assert
|
||||
.dom(".composer-actions svg.d-icon-far-eye-slash")
|
||||
.doesNotExist("whisper icon is not visible");
|
||||
assert.strictEqual(
|
||||
count(".composer-actions svg.d-icon-share"),
|
||||
1,
|
||||
|
@ -108,10 +106,9 @@ acceptance("Composer Actions", function (needs) {
|
|||
1,
|
||||
"whisper icon is visible"
|
||||
);
|
||||
assert.ok(
|
||||
!exists(".composer-actions svg.d-icon-share"),
|
||||
"reply icon is not visible"
|
||||
);
|
||||
assert
|
||||
.dom(".composer-actions svg.d-icon-share")
|
||||
.doesNotExist("reply icon is not visible");
|
||||
});
|
||||
|
||||
test("replying to post - reply_as_new_topic", async function (assert) {
|
||||
|
@ -155,10 +152,9 @@ acceptance("Composer Actions", function (needs) {
|
|||
await click(".create.reply");
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
await composerActions.expand();
|
||||
assert.ok(
|
||||
!exists(".composer-actions svg.d-icon-plus"),
|
||||
"reply as new topic icon is not visible"
|
||||
);
|
||||
assert
|
||||
.dom(".composer-actions svg.d-icon-plus")
|
||||
.doesNotExist("reply as new topic icon is not visible");
|
||||
});
|
||||
|
||||
test("reply_as_new_group_message", async function (assert) {
|
||||
|
@ -247,10 +243,9 @@ acceptance("Composer Actions", function (needs) {
|
|||
await visit("/t/short-topic-with-two-posts/54077");
|
||||
await click("article#post_2 button.reply");
|
||||
|
||||
assert.ok(
|
||||
!exists(".composer-actions svg.d-icon-anchor"),
|
||||
"no-bump icon is not visible"
|
||||
);
|
||||
assert
|
||||
.dom(".composer-actions svg.d-icon-anchor")
|
||||
.doesNotExist("no-bump icon is not visible");
|
||||
assert.strictEqual(
|
||||
count(".composer-actions svg.d-icon-share"),
|
||||
1,
|
||||
|
@ -265,18 +260,16 @@ acceptance("Composer Actions", function (needs) {
|
|||
1,
|
||||
"no-bump icon is visible"
|
||||
);
|
||||
assert.ok(
|
||||
!exists(".composer-actions svg.d-icon-share"),
|
||||
"reply icon is not visible"
|
||||
);
|
||||
assert
|
||||
.dom(".composer-actions svg.d-icon-share")
|
||||
.doesNotExist("reply icon is not visible");
|
||||
|
||||
await composerActions.expand();
|
||||
await composerActions.selectRowByValue("toggle_topic_bump");
|
||||
|
||||
assert.ok(
|
||||
!exists(".composer-actions svg.d-icon-anchor"),
|
||||
"no-bump icon is not visible"
|
||||
);
|
||||
assert
|
||||
.dom(".composer-actions svg.d-icon-anchor")
|
||||
.doesNotExist("no-bump icon is not visible");
|
||||
assert.strictEqual(
|
||||
count(".composer-actions svg.d-icon-share"),
|
||||
1,
|
||||
|
@ -290,14 +283,12 @@ acceptance("Composer Actions", function (needs) {
|
|||
await visit("/t/short-topic-with-two-posts/54077");
|
||||
await click("article#post_2 button.reply");
|
||||
|
||||
assert.ok(
|
||||
!exists(".composer-actions svg.d-icon-far-eye-slash"),
|
||||
"whisper icon is not visible"
|
||||
);
|
||||
assert.ok(
|
||||
!exists(".reply-details .whisper .d-icon-anchor"),
|
||||
"no-bump icon is not visible"
|
||||
);
|
||||
assert
|
||||
.dom(".composer-actions svg.d-icon-far-eye-slash")
|
||||
.doesNotExist("whisper icon is not visible");
|
||||
assert
|
||||
.dom(".reply-details .whisper .d-icon-anchor")
|
||||
.doesNotExist("no-bump icon is not visible");
|
||||
assert.strictEqual(
|
||||
count(".composer-actions svg.d-icon-share"),
|
||||
1,
|
||||
|
@ -319,10 +310,9 @@ acceptance("Composer Actions", function (needs) {
|
|||
1,
|
||||
"no-bump icon is visible"
|
||||
);
|
||||
assert.ok(
|
||||
!exists(".composer-actions svg.d-icon-share"),
|
||||
"reply icon is not visible"
|
||||
);
|
||||
assert
|
||||
.dom(".composer-actions svg.d-icon-share")
|
||||
.doesNotExist("reply icon is not visible");
|
||||
});
|
||||
|
||||
test("replying to post as staff", async function (assert) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import I18n from "discourse-i18n";
|
||||
|
||||
acceptance("Composer - Draft saving", function (needs) {
|
||||
|
@ -24,10 +24,9 @@ acceptance("Composer - Draft saving", function (needs) {
|
|||
|
||||
await fillIn(".d-editor-input", draftThatWillBeSaved);
|
||||
|
||||
assert.notOk(
|
||||
exists("div#draft-status span"),
|
||||
"the draft was saved, there's no warning"
|
||||
);
|
||||
assert
|
||||
.dom("div#draft-status span")
|
||||
.doesNotExist("the draft was saved, there's no warning");
|
||||
|
||||
await fillIn(".d-editor-input", "This won't be saved because of error");
|
||||
assert
|
||||
|
@ -36,15 +35,13 @@ acceptance("Composer - Draft saving", function (needs) {
|
|||
I18n.t("composer.drafts_offline"),
|
||||
"the draft wasn't saved, a warning is rendered"
|
||||
);
|
||||
assert.ok(
|
||||
exists("div#draft-status svg.d-icon-triangle-exclamation"),
|
||||
"an exclamation icon is rendered"
|
||||
);
|
||||
assert
|
||||
.dom("div#draft-status svg.d-icon-triangle-exclamation")
|
||||
.exists("an exclamation icon is rendered");
|
||||
|
||||
await fillIn(".d-editor-input", draftThatWillBeSaved);
|
||||
assert.notOk(
|
||||
exists("div#draft-status span"),
|
||||
"the draft was saved again, the warning has disappeared"
|
||||
);
|
||||
assert
|
||||
.dom("div#draft-status span")
|
||||
.doesNotExist("the draft was saved again, the warning has disappeared");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -3,7 +3,6 @@ import { test } from "qunit";
|
|||
import { setCaretPosition } from "discourse/lib/utilities";
|
||||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
fakeTime,
|
||||
loggedInUser,
|
||||
query,
|
||||
|
@ -116,10 +115,9 @@ acceptance("Composer - editor mentions", function (needs) {
|
|||
|
||||
await simulateKeys(editor, "@u");
|
||||
|
||||
assert.ok(
|
||||
exists(`.autocomplete .emoji[alt='${status.emoji}']`),
|
||||
"status emoji is shown"
|
||||
);
|
||||
assert
|
||||
.dom(`.autocomplete .emoji[alt='${status.emoji}']`)
|
||||
.exists("status emoji is shown");
|
||||
|
||||
assert.equal(
|
||||
query(
|
||||
|
|
|
@ -4,7 +4,6 @@ import { withPluginApi } from "discourse/lib/plugin-api";
|
|||
import {
|
||||
acceptance,
|
||||
count,
|
||||
exists,
|
||||
invisible,
|
||||
query,
|
||||
visible,
|
||||
|
@ -148,10 +147,9 @@ acceptance("Composer - Image Preview", function (needs) {
|
|||
);
|
||||
assert.dom(".button-wrapper").doesNotExist();
|
||||
|
||||
assert.ok(
|
||||
!exists("script"),
|
||||
"it does not unescape script tags in code blocks"
|
||||
);
|
||||
assert
|
||||
.dom("script")
|
||||
.doesNotExist("it does not unescape script tags in code blocks");
|
||||
});
|
||||
|
||||
test("Editing alt text (with enter key) for single image in preview updates alt text in composer", async function (assert) {
|
||||
|
@ -420,10 +418,9 @@ acceptance("Composer - Image Preview - Plugin API", function (needs) {
|
|||
"![image_example_0|666x500](upload://q4iRxcuSAzfnbUaCsbjMXcGrpaK.jpeg)"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(".image-wrapper .custom-button-class"),
|
||||
"The custom button is added to the image preview wrapper"
|
||||
);
|
||||
assert
|
||||
.dom(".image-wrapper .custom-button-class")
|
||||
.exists("The custom button is added to the image preview wrapper");
|
||||
|
||||
await click(".custom-button-class");
|
||||
|
||||
|
|
|
@ -159,52 +159,44 @@ acceptance("Composer", function (needs) {
|
|||
await click("#create-topic");
|
||||
assert.ok(exists(".d-editor-input"), "the composer input is visible");
|
||||
await focus(".title-input input");
|
||||
assert.ok(
|
||||
exists(".title-input .popup-tip.good.hide"),
|
||||
"title errors are hidden by default"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".d-editor-textarea-wrapper .popup-tip.bad.hide"),
|
||||
"body errors are hidden by default"
|
||||
);
|
||||
assert
|
||||
.dom(".title-input .popup-tip.good.hide")
|
||||
.exists("title errors are hidden by default");
|
||||
assert
|
||||
.dom(".d-editor-textarea-wrapper .popup-tip.bad.hide")
|
||||
.exists("body errors are hidden by default");
|
||||
|
||||
await click(".toggle-preview");
|
||||
assert.ok(
|
||||
!exists(".d-editor-preview:visible"),
|
||||
"clicking the toggle hides the preview"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-preview")
|
||||
.isNotVisible("clicking the toggle hides the preview");
|
||||
|
||||
await click(".toggle-preview");
|
||||
assert.ok(
|
||||
exists(".d-editor-preview:visible"),
|
||||
"clicking the toggle shows the preview again"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-preview")
|
||||
.isVisible("clicking the toggle shows the preview again");
|
||||
|
||||
await click("#reply-control button.create");
|
||||
assert.ok(
|
||||
exists(".title-input .popup-tip.bad"),
|
||||
"it shows the empty title error"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".d-editor-textarea-wrapper .popup-tip.bad"),
|
||||
"it shows the empty body error"
|
||||
);
|
||||
assert
|
||||
.dom(".title-input .popup-tip.bad")
|
||||
.exists("it shows the empty title error");
|
||||
assert
|
||||
.dom(".d-editor-textarea-wrapper .popup-tip.bad")
|
||||
.exists("it shows the empty body error");
|
||||
|
||||
await fillIn("#reply-title", "this is my new topic title");
|
||||
assert.ok(
|
||||
exists(".title-input .popup-tip.good.hide"),
|
||||
"the title is now good"
|
||||
);
|
||||
assert
|
||||
.dom(".title-input .popup-tip.good.hide")
|
||||
.exists("the title is now good");
|
||||
|
||||
await triggerKeyEvent(
|
||||
".d-editor-textarea-wrapper .popup-tip.bad",
|
||||
"keydown",
|
||||
"Enter"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".d-editor-textarea-wrapper .popup-tip.bad.hide"),
|
||||
"body error is dismissed via keyboard"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-textarea-wrapper .popup-tip.bad.hide")
|
||||
.exists("body error is dismissed via keyboard");
|
||||
|
||||
await fillIn(".d-editor-input", "this is the *content* of a post");
|
||||
assert.strictEqual(
|
||||
|
@ -212,10 +204,9 @@ acceptance("Composer", function (needs) {
|
|||
"<p>this is the <em>content</em> of a post</p>",
|
||||
"it previews content"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".d-editor-textarea-wrapper .popup-tip.good"),
|
||||
"the body is now good"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-textarea-wrapper .popup-tip.good")
|
||||
.exists("the body is now good");
|
||||
|
||||
const textarea = query("#reply-control .d-editor-input");
|
||||
textarea.selectionStart = textarea.value.length;
|
||||
|
@ -317,17 +308,15 @@ acceptance("Composer", function (needs) {
|
|||
test("Create a Reply", async function (assert) {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
assert.ok(
|
||||
!exists('article[data-post-id="12345"]'),
|
||||
"the post is not in the DOM"
|
||||
);
|
||||
assert
|
||||
.dom('article[data-post-id="12345"]')
|
||||
.doesNotExist("the post is not in the DOM");
|
||||
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
assert.ok(exists(".d-editor-input"), "the composer input is visible");
|
||||
assert.ok(
|
||||
!exists("#reply-title"),
|
||||
"there is no title since this is a reply"
|
||||
);
|
||||
assert
|
||||
.dom("#reply-title")
|
||||
.doesNotExist("there is no title since this is a reply");
|
||||
|
||||
await fillIn(".d-editor-input", "this is the content of my reply");
|
||||
await click("#reply-control button.create");
|
||||
|
@ -434,19 +423,17 @@ acceptance("Composer", function (needs) {
|
|||
"moves to second topic"
|
||||
);
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
assert.ok(
|
||||
exists(".discard-draft-modal.modal"),
|
||||
"it pops up the discard drafts modal"
|
||||
);
|
||||
assert
|
||||
.dom(".discard-draft-modal.modal")
|
||||
.exists("it pops up the discard drafts modal");
|
||||
|
||||
await click(".d-modal__footer button.keep-editing");
|
||||
|
||||
assert.ok(invisible(".discard-draft-modal.modal"), "hides modal");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
assert.ok(
|
||||
exists(".discard-draft-modal.modal"),
|
||||
"it pops up the modal again"
|
||||
);
|
||||
assert
|
||||
.dom(".discard-draft-modal.modal")
|
||||
.exists("it pops up the modal again");
|
||||
|
||||
await click(".d-modal__footer button.discard-draft");
|
||||
|
||||
|
@ -474,10 +461,9 @@ acceptance("Composer", function (needs) {
|
|||
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
assert.ok(exists(".d-editor-input"), "the composer input is visible");
|
||||
assert.ok(
|
||||
!exists("#reply-title"),
|
||||
"there is no title since this is a reply"
|
||||
);
|
||||
assert
|
||||
.dom("#reply-title")
|
||||
.doesNotExist("there is no title since this is a reply");
|
||||
|
||||
await fillIn(".d-editor-input", "enqueue this content please");
|
||||
await click("#reply-control button.create");
|
||||
|
@ -496,10 +482,9 @@ acceptance("Composer", function (needs) {
|
|||
test("Edit the first post", async function (assert) {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
assert.ok(
|
||||
!exists(".topic-post:nth-of-type(1) .post-info.edits"),
|
||||
"it has no edits icon at first"
|
||||
);
|
||||
assert
|
||||
.dom(".topic-post:nth-of-type(1) .post-info.edits")
|
||||
.doesNotExist("it has no edits icon at first");
|
||||
|
||||
await click(".topic-post:nth-of-type(1) button.show-more-actions");
|
||||
await click(".topic-post:nth-of-type(1) button.edit");
|
||||
|
@ -512,10 +497,9 @@ acceptance("Composer", function (needs) {
|
|||
await fillIn("#reply-title", "This is the new text for the title");
|
||||
await click("#reply-control button.create");
|
||||
assert.ok(!exists(".d-editor-input"), "it closes the composer");
|
||||
assert.ok(
|
||||
exists(".topic-post:nth-of-type(1) .post-info.edits"),
|
||||
"it has the edits icon"
|
||||
);
|
||||
assert
|
||||
.dom(".topic-post:nth-of-type(1) .post-info.edits")
|
||||
.exists("it has the edits icon");
|
||||
assert.ok(
|
||||
query("#topic-title h1").innerText.includes(
|
||||
"This is the new text for the title"
|
||||
|
@ -577,10 +561,9 @@ acceptance("Composer", function (needs) {
|
|||
await click(".topic-post:nth-of-type(1) button.edit");
|
||||
await fillIn(".d-editor-input", "This is a dirty reply");
|
||||
await click(".topic-post:nth-of-type(2) button.edit");
|
||||
assert.ok(
|
||||
exists(".discard-draft-modal.modal"),
|
||||
"it pops up a confirmation dialog"
|
||||
);
|
||||
assert
|
||||
.dom(".discard-draft-modal.modal")
|
||||
.exists("it pops up a confirmation dialog");
|
||||
|
||||
await click(".d-modal__footer button.discard-draft");
|
||||
assert.ok(
|
||||
|
@ -628,10 +611,9 @@ acceptance("Composer", function (needs) {
|
|||
await menu.expand();
|
||||
await menu.selectRowByName("toggle-whisper");
|
||||
|
||||
assert.ok(
|
||||
!exists(".composer-actions svg.d-icon-far-eye-slash"),
|
||||
"it removes the whisper mode"
|
||||
);
|
||||
assert
|
||||
.dom(".composer-actions svg.d-icon-far-eye-slash")
|
||||
.doesNotExist("it removes the whisper mode");
|
||||
|
||||
await menu.expand();
|
||||
await menu.selectRowByName("toggle-whisper");
|
||||
|
@ -744,10 +726,9 @@ acceptance("Composer", function (needs) {
|
|||
assert.ok(exists("#create-topic"), "the create topic button is visible");
|
||||
|
||||
await click("#create-topic");
|
||||
assert.ok(
|
||||
!exists(".reply-details .whisper .d-icon-far-eye-slash"),
|
||||
"it should reset the state of the composer's model"
|
||||
);
|
||||
assert
|
||||
.dom(".reply-details .whisper .d-icon-far-eye-slash")
|
||||
.doesNotExist("it should reset the state of the composer's model");
|
||||
|
||||
await selectKit(".toolbar-popup-menu-options").expand();
|
||||
await selectKit(".toolbar-popup-menu-options").selectRowByName(
|
||||
|
@ -764,10 +745,9 @@ acceptance("Composer", function (needs) {
|
|||
await visit("/t/this-is-a-test-topic/9");
|
||||
|
||||
await click(".topic-post:nth-of-type(1) button.reply");
|
||||
assert.ok(
|
||||
!exists(".reply-details .whisper"),
|
||||
"it should reset the state of the composer's model"
|
||||
);
|
||||
assert
|
||||
.dom(".reply-details .whisper")
|
||||
.doesNotExist("it should reset the state of the composer's model");
|
||||
});
|
||||
|
||||
test("Composer can toggle whisper when switching from reply to whisper to reply to topic", async function (assert) {
|
||||
|
@ -775,16 +755,14 @@ acceptance("Composer", function (needs) {
|
|||
|
||||
await click(".topic-post:nth-of-type(3) button.reply");
|
||||
await click(".reply-details summary div");
|
||||
assert.ok(
|
||||
!exists('.reply-details li[data-value="toggle_whisper"]'),
|
||||
"toggle whisper is not available when reply to whisper"
|
||||
);
|
||||
assert
|
||||
.dom('.reply-details li[data-value="toggle_whisper"]')
|
||||
.doesNotExist("toggle whisper is not available when reply to whisper");
|
||||
await click('.reply-details li[data-value="reply_to_topic"]');
|
||||
await click(".reply-details summary div");
|
||||
assert.ok(
|
||||
exists('.reply-details li[data-value="toggle_whisper"]'),
|
||||
"toggle whisper is available when reply to topic"
|
||||
);
|
||||
assert
|
||||
.dom('.reply-details li[data-value="toggle_whisper"]')
|
||||
.exists("toggle whisper is available when reply to topic");
|
||||
});
|
||||
|
||||
test("Composer can toggle whisper when clicking reply to topic after reply to whisper", async function (assert) {
|
||||
|
@ -794,10 +772,9 @@ acceptance("Composer", function (needs) {
|
|||
await click("#reply-control .save-or-cancel a.cancel");
|
||||
await click(".topic-footer-main-buttons button.create");
|
||||
await click(".reply-details summary div");
|
||||
assert.ok(
|
||||
exists('.reply-details li[data-value="toggle_whisper"]'),
|
||||
"toggle whisper is available when reply to topic"
|
||||
);
|
||||
assert
|
||||
.dom('.reply-details li[data-value="toggle_whisper"]')
|
||||
.exists("toggle whisper is available when reply to topic");
|
||||
});
|
||||
|
||||
test("Composer draft with dirty reply can toggle to edit", async function (assert) {
|
||||
|
@ -807,10 +784,9 @@ acceptance("Composer", function (needs) {
|
|||
await fillIn(".d-editor-input", "This is a dirty reply");
|
||||
await click(".toggler");
|
||||
await click(".topic-post:nth-of-type(2) button.edit");
|
||||
assert.ok(
|
||||
exists(".discard-draft-modal.modal"),
|
||||
"it pops up a confirmation dialog"
|
||||
);
|
||||
assert
|
||||
.dom(".discard-draft-modal.modal")
|
||||
.exists("it pops up a confirmation dialog");
|
||||
assert.ok(invisible(".d-modal__footer button.save-draft"));
|
||||
assert
|
||||
.dom(".d-modal__footer button.keep-editing")
|
||||
|
@ -834,10 +810,9 @@ acceptance("Composer", function (needs) {
|
|||
await click("#site-logo");
|
||||
await click("#create-topic");
|
||||
|
||||
assert.ok(
|
||||
exists(".discard-draft-modal.modal"),
|
||||
"it pops up a confirmation dialog"
|
||||
);
|
||||
assert
|
||||
.dom(".discard-draft-modal.modal")
|
||||
.exists("it pops up a confirmation dialog");
|
||||
assert
|
||||
.dom(".d-modal__footer button.save-draft")
|
||||
.hasText(
|
||||
|
@ -1026,10 +1001,9 @@ acceptance("Composer", function (needs) {
|
|||
await click("#topic-footer-buttons .create");
|
||||
|
||||
await fillIn(".d-editor-input", "[quote]\n@staff\n[/quote]");
|
||||
assert.notOk(
|
||||
exists(".composer-popup"),
|
||||
"Doesn't show the 'group_mentioned' notice in a quote"
|
||||
);
|
||||
assert
|
||||
.dom(".composer-popup")
|
||||
.doesNotExist("Doesn't show the 'group_mentioned' notice in a quote");
|
||||
|
||||
await fillIn(".d-editor-input", "@staff");
|
||||
assert.ok(exists(".composer-popup"), "Shows the 'group_mentioned' notice");
|
||||
|
|
|
@ -22,10 +22,9 @@ acceptance("Composer topic featured links", function (needs) {
|
|||
query(".d-editor-preview").innerHTML.trim().includes("onebox"),
|
||||
"it pastes the link into the body and previews it"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".d-editor-textarea-wrapper .popup-tip.good"),
|
||||
"the body is now good"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-textarea-wrapper .popup-tip.good")
|
||||
.exists("the body is now good");
|
||||
assert.strictEqual(
|
||||
query(".title-input input").value,
|
||||
"An interesting article",
|
||||
|
@ -41,10 +40,9 @@ acceptance("Composer topic featured links", function (needs) {
|
|||
query(".d-editor-preview").innerHTML.trim().includes("onebox"),
|
||||
"it pastes the link into the body and previews it"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".d-editor-textarea-wrapper .popup-tip.good"),
|
||||
"the body is now good"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-textarea-wrapper .popup-tip.good")
|
||||
.exists("the body is now good");
|
||||
assert.strictEqual(
|
||||
query(".title-input input").value,
|
||||
"http://www.example.com/no-title.html",
|
||||
|
@ -71,10 +69,9 @@ acceptance("Composer topic featured links", function (needs) {
|
|||
query(".d-editor-preview").innerHTML.trim().includes("onebox"),
|
||||
"it pastes the link into the body and previews it"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".d-editor-textarea-wrapper .popup-tip.good"),
|
||||
"link is pasted into body"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-textarea-wrapper .popup-tip.good")
|
||||
.exists("link is pasted into body");
|
||||
assert.strictEqual(
|
||||
query(".title-input input").value,
|
||||
"http://www.example.com/nope-onebox.html",
|
||||
|
@ -114,10 +111,9 @@ acceptance("Composer topic featured links", function (needs) {
|
|||
query(".d-editor-preview").innerHTML.trim().includes("onebox"),
|
||||
"it pastes the link into the body and previews it"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".d-editor-textarea-wrapper .popup-tip.good"),
|
||||
"the body is now good"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-textarea-wrapper .popup-tip.good")
|
||||
.exists("the body is now good");
|
||||
assert.strictEqual(
|
||||
query(".title-input input").value,
|
||||
"An interesting article",
|
||||
|
@ -156,10 +152,9 @@ acceptance("Composer topic featured links", function (needs) {
|
|||
query(".d-editor-preview").innerHTML.trim().includes("onebox"),
|
||||
"it pastes the link into the body and previews it"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".d-editor-textarea-wrapper .popup-tip.good"),
|
||||
"the body is now good"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-textarea-wrapper .popup-tip.good")
|
||||
.exists("the body is now good");
|
||||
assert.blank(query(".title-input input").value, "title is blank");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -36,10 +36,9 @@ acceptance("Dashboard", function (needs) {
|
|||
await visit("/admin");
|
||||
|
||||
assert.ok(exists(".dashboard .navigation-item.general"), "general tab");
|
||||
assert.ok(
|
||||
exists(".dashboard .navigation-item.moderation"),
|
||||
"moderation tab"
|
||||
);
|
||||
assert
|
||||
.dom(".dashboard .navigation-item.moderation")
|
||||
.exists("moderation tab");
|
||||
assert.ok(exists(".dashboard .navigation-item.security"), "security tab");
|
||||
assert.ok(exists(".dashboard .navigation-item.reports"), "reports tab");
|
||||
});
|
||||
|
@ -51,14 +50,12 @@ acceptance("Dashboard", function (needs) {
|
|||
assert.ok(exists(".admin-report.signups"), "signups report");
|
||||
assert.ok(exists(".admin-report.posts"), "posts report");
|
||||
assert.ok(exists(".admin-report.dau-by-mau"), "dau-by-mau report");
|
||||
assert.ok(
|
||||
exists(".admin-report.daily-engaged-users"),
|
||||
"daily-engaged-users report"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".admin-report.new-contributors"),
|
||||
"new-contributors report"
|
||||
);
|
||||
assert
|
||||
.dom(".admin-report.daily-engaged-users")
|
||||
.exists("daily-engaged-users report");
|
||||
assert
|
||||
.dom(".admin-report.new-contributors")
|
||||
.exists("new-contributors report");
|
||||
});
|
||||
|
||||
test("moderation tab", async function (assert) {
|
||||
|
@ -66,10 +63,9 @@ acceptance("Dashboard", function (needs) {
|
|||
await click(".dashboard .navigation-item.moderation .navigation-link");
|
||||
|
||||
assert.ok(exists(".custom-date-range-button"), "custom date range button");
|
||||
assert.ok(
|
||||
exists(".admin-report.moderators-activity"),
|
||||
"moderators activity report"
|
||||
);
|
||||
assert
|
||||
.dom(".admin-report.moderators-activity")
|
||||
.exists("moderators activity report");
|
||||
});
|
||||
|
||||
test("activity metrics", async function (assert) {
|
||||
|
@ -134,10 +130,9 @@ acceptance("Dashboard: dashboard_visible_tabs", function (needs) {
|
|||
await visit("/admin");
|
||||
|
||||
assert.ok(exists(".dashboard .navigation-item.general"), "general tab");
|
||||
assert.notOk(
|
||||
exists(".dashboard .navigation-item.moderation"),
|
||||
"moderation tab"
|
||||
);
|
||||
assert
|
||||
.dom(".dashboard .navigation-item.moderation")
|
||||
.doesNotExist("moderation tab");
|
||||
assert.ok(exists(".dashboard .navigation-item.security"), "security tab");
|
||||
assert.ok(exists(".dashboard .navigation-item.reports"), "reports tab");
|
||||
});
|
||||
|
@ -155,9 +150,8 @@ acceptance("Dashboard: dashboard_hidden_reports", function (needs) {
|
|||
|
||||
assert.ok(exists(".admin-report.signups.is-visible"), "signups report");
|
||||
assert.notOk(exists(".admin-report.is-visible.posts"), "posts report");
|
||||
assert.notOk(
|
||||
exists(".admin-report.is-visible.dau-by-mau"),
|
||||
"dau-by-mau report"
|
||||
);
|
||||
assert
|
||||
.dom(".admin-report.is-visible.dau-by-mau")
|
||||
.doesNotExist("dau-by-mau report");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -89,10 +89,9 @@ acceptance("Do not disturb", function (needs) {
|
|||
|
||||
await visit("/");
|
||||
|
||||
assert.ok(
|
||||
exists(".do-not-disturb-background"),
|
||||
"The active dnd icon is shown"
|
||||
);
|
||||
assert
|
||||
.dom(".do-not-disturb-background")
|
||||
.exists("The active dnd icon is shown");
|
||||
|
||||
await click(".header-dropdown-toggle.current-user button");
|
||||
await click("#user-menu-button-profile");
|
||||
|
@ -101,25 +100,23 @@ acceptance("Do not disturb", function (needs) {
|
|||
"1h",
|
||||
"the Do Not Disturb button shows how much time is left for DND mode"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".do-not-disturb .d-icon-toggle-on"),
|
||||
"the Do Not Disturb button has the toggle-on icon"
|
||||
);
|
||||
assert
|
||||
.dom(".do-not-disturb .d-icon-toggle-on")
|
||||
.exists("the Do Not Disturb button has the toggle-on icon");
|
||||
|
||||
await click("#quick-access-profile .do-not-disturb .btn");
|
||||
|
||||
assert.notOk(
|
||||
exists(".do-not-disturb-background"),
|
||||
"The active dnd icon is removed"
|
||||
);
|
||||
assert.notOk(
|
||||
exists(".do-not-disturb .relative-date"),
|
||||
"the text showing how much time is left for DND mode is gone"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".do-not-disturb .d-icon-toggle-off"),
|
||||
"the Do Not Disturb button has the toggle-off icon"
|
||||
);
|
||||
assert
|
||||
.dom(".do-not-disturb-background")
|
||||
.doesNotExist("The active dnd icon is removed");
|
||||
assert
|
||||
.dom(".do-not-disturb .relative-date")
|
||||
.doesNotExist(
|
||||
"the text showing how much time is left for DND mode is gone"
|
||||
);
|
||||
assert
|
||||
.dom(".do-not-disturb .d-icon-toggle-off")
|
||||
.exists("the Do Not Disturb button has the toggle-off icon");
|
||||
});
|
||||
|
||||
test("user menu gets closed when the DnD modal is opened", async function (assert) {
|
||||
|
|
|
@ -2,7 +2,6 @@ import { visit } from "@ember/test-helpers";
|
|||
import { test } from "qunit";
|
||||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import I18n from "discourse-i18n";
|
||||
|
@ -13,19 +12,17 @@ acceptance("Email Disabled Banner", function (needs) {
|
|||
test("when disabled", async function (assert) {
|
||||
this.siteSettings.disable_emails = "no";
|
||||
await visit("/");
|
||||
assert.notOk(
|
||||
exists(".alert-emails-disabled"),
|
||||
"alert is not displayed when email enabled"
|
||||
);
|
||||
assert
|
||||
.dom(".alert-emails-disabled")
|
||||
.doesNotExist("alert is not displayed when email enabled");
|
||||
});
|
||||
|
||||
test("when enabled", async function (assert) {
|
||||
this.siteSettings.disable_emails = "yes";
|
||||
await visit("/latest");
|
||||
assert.ok(
|
||||
exists(".alert-emails-disabled"),
|
||||
"alert is displayed when email disabled"
|
||||
);
|
||||
assert
|
||||
.dom(".alert-emails-disabled")
|
||||
.exists("alert is displayed when email disabled");
|
||||
assert
|
||||
.dom(".alert-emails-disabled .text")
|
||||
.hasText(I18n.t("emails_are_disabled"), "alert uses the correct text");
|
||||
|
@ -34,10 +31,9 @@ acceptance("Email Disabled Banner", function (needs) {
|
|||
test("when non-staff", async function (assert) {
|
||||
this.siteSettings.disable_emails = "non-staff";
|
||||
await visit("/");
|
||||
assert.ok(
|
||||
exists(".alert-emails-disabled"),
|
||||
"alert is displayed when email disabled for non-staff"
|
||||
);
|
||||
assert
|
||||
.dom(".alert-emails-disabled")
|
||||
.exists("alert is displayed when email disabled for non-staff");
|
||||
assert
|
||||
.dom(".alert-emails-disabled .text")
|
||||
.hasText(
|
||||
|
@ -47,10 +43,9 @@ acceptance("Email Disabled Banner", function (needs) {
|
|||
|
||||
updateCurrentUser({ moderator: true });
|
||||
await visit("/");
|
||||
assert.ok(
|
||||
exists(".alert-emails-disabled"),
|
||||
"alert is displayed to staff when email disabled for non-staff"
|
||||
);
|
||||
assert
|
||||
.dom(".alert-emails-disabled")
|
||||
.exists("alert is displayed to staff when email disabled for non-staff");
|
||||
assert
|
||||
.dom(".alert-emails-disabled .text")
|
||||
.hasText(
|
||||
|
|
|
@ -90,10 +90,9 @@ acceptance("EmojiPicker", function (needs) {
|
|||
"it shows recent selected emoji"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists('.emoji-picker .category-button[data-section="recent"]'),
|
||||
"it shows recent category icon"
|
||||
);
|
||||
assert
|
||||
.dom('.emoji-picker .category-button[data-section="recent"]')
|
||||
.exists("it shows recent category icon");
|
||||
|
||||
await click(".emoji-picker .trash-recent");
|
||||
|
||||
|
@ -104,15 +103,13 @@ acceptance("EmojiPicker", function (needs) {
|
|||
"it has cleared recent emojis"
|
||||
);
|
||||
|
||||
assert.notOk(
|
||||
exists('.emoji-picker .section[data-section="recent"]'),
|
||||
"it hides recent section"
|
||||
);
|
||||
assert
|
||||
.dom('.emoji-picker .section[data-section="recent"]')
|
||||
.doesNotExist("it hides recent section");
|
||||
|
||||
assert.notOk(
|
||||
exists('.emoji-picker .category-button[data-section="recent"]'),
|
||||
"it hides recent category icon"
|
||||
);
|
||||
assert
|
||||
.dom('.emoji-picker .category-button[data-section="recent"]')
|
||||
.doesNotExist("it hides recent category icon");
|
||||
});
|
||||
|
||||
test("emoji picker correctly orders recently used emojis", async function (assert) {
|
||||
|
@ -174,10 +171,9 @@ acceptance("EmojiPicker", function (needs) {
|
|||
await click("button.emoji.btn");
|
||||
await click("button.emoji.btn");
|
||||
|
||||
assert.ok(
|
||||
exists(".emoji-picker button.diversity-scale.medium-dark .d-icon"),
|
||||
"it stores diversity scale"
|
||||
);
|
||||
assert
|
||||
.dom(".emoji-picker button.diversity-scale.medium-dark .d-icon")
|
||||
.exists("it stores diversity scale");
|
||||
});
|
||||
|
||||
test("emoji can be selected with keyboard", async function (assert) {
|
||||
|
|
|
@ -107,18 +107,15 @@ acceptance("flagging", function (needs) {
|
|||
await openFlagModal();
|
||||
await click("#radio_inappropriate");
|
||||
await selectKit(".reviewable-action-dropdown").expand();
|
||||
assert.ok(
|
||||
exists("[data-value='agree_and_silence']"),
|
||||
"it shows the silence action option"
|
||||
);
|
||||
assert.ok(
|
||||
exists("[data-value='agree_and_suspend']"),
|
||||
"it shows the suspend action option"
|
||||
);
|
||||
assert.ok(
|
||||
exists("[data-value='agree_and_hide']"),
|
||||
"it shows the hide action option"
|
||||
);
|
||||
assert
|
||||
.dom("[data-value='agree_and_silence']")
|
||||
.exists("it shows the silence action option");
|
||||
assert
|
||||
.dom("[data-value='agree_and_suspend']")
|
||||
.exists("it shows the suspend action option");
|
||||
assert
|
||||
.dom("[data-value='agree_and_hide']")
|
||||
.exists("it shows the hide action option");
|
||||
});
|
||||
|
||||
test("Can silence from take action", async function (assert) {
|
||||
|
@ -197,14 +194,13 @@ acceptance("flagging", function (needs) {
|
|||
|
||||
const modal = query(".d-modal");
|
||||
await pressEnter(modal, "ctrlKey");
|
||||
assert.ok(
|
||||
exists(".d-modal:visible"),
|
||||
"The modal wasn't closed because the accept button was disabled"
|
||||
);
|
||||
assert
|
||||
.dom(".d-modal")
|
||||
.exists("The modal wasn't closed because the accept button was disabled");
|
||||
|
||||
await click("#radio_inappropriate"); // this enables the accept button
|
||||
await pressEnter(modal, "ctrlKey");
|
||||
assert.ok(!exists(".d-modal:visible"), "The modal was closed");
|
||||
assert.dom(".d-modal").doesNotExist("The modal was closed");
|
||||
});
|
||||
|
||||
test("CMD or WINDOWS-KEY + ENTER accepts the modal", async function (assert) {
|
||||
|
@ -213,13 +209,12 @@ acceptance("flagging", function (needs) {
|
|||
|
||||
const modal = query(".d-modal");
|
||||
await pressEnter(modal, "metaKey");
|
||||
assert.ok(
|
||||
exists(".d-modal:visible"),
|
||||
"The modal wasn't closed because the accept button was disabled"
|
||||
);
|
||||
assert
|
||||
.dom(".d-modal")
|
||||
.exists("The modal wasn't closed because the accept button was disabled");
|
||||
|
||||
await click("#radio_inappropriate"); // this enables the accept button
|
||||
await pressEnter(modal, "ctrlKey");
|
||||
assert.ok(!exists(".d-modal:visible"), "The modal was closed");
|
||||
assert.dom(".d-modal").doesNotExist("The modal was closed");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import I18n from "discourse-i18n";
|
||||
|
||||
let userFound = false;
|
||||
|
@ -56,10 +52,9 @@ acceptance("Forgot password", function (needs) {
|
|||
|
||||
await click(".forgot-password-reset");
|
||||
|
||||
assert.notOk(
|
||||
exists(".alert-error"),
|
||||
"it should remove the flash error when succeeding"
|
||||
);
|
||||
assert
|
||||
.dom(".alert-error")
|
||||
.doesNotExist("it should remove the flash error when succeeding");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-modal__body").innerHTML.trim(),
|
||||
|
|
|
@ -22,10 +22,9 @@ acceptance("Group Members - Anonymous", function () {
|
|||
);
|
||||
assert.ok(exists(".group-members .group-member"), "it lists group members");
|
||||
|
||||
assert.ok(
|
||||
!exists(".group-member-dropdown"),
|
||||
"it does not allow anon user to manage group members"
|
||||
);
|
||||
assert
|
||||
.dom(".group-member-dropdown")
|
||||
.doesNotExist("it does not allow anon user to manage group members");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".group-username-filter").getAttribute("placeholder"),
|
||||
|
@ -60,10 +59,9 @@ acceptance("Group Members", function (needs) {
|
|||
test("Viewing Members as an admin user", async function (assert) {
|
||||
await visit("/g/discourse");
|
||||
|
||||
assert.ok(
|
||||
exists(".group-member-dropdown"),
|
||||
"it allows admin user to manage group members"
|
||||
);
|
||||
assert
|
||||
.dom(".group-member-dropdown")
|
||||
.exists("it allows admin user to manage group members");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".group-username-filter").getAttribute("placeholder"),
|
||||
|
@ -83,20 +81,17 @@ acceptance("Group Members", function (needs) {
|
|||
const memberDropdown = selectKit(".bulk-group-member-dropdown");
|
||||
await memberDropdown.expand();
|
||||
|
||||
assert.ok(
|
||||
exists('[data-value="removeMembers"]'),
|
||||
"it includes remove member option"
|
||||
);
|
||||
assert
|
||||
.dom('[data-value="removeMembers"]')
|
||||
.exists("it includes remove member option");
|
||||
|
||||
assert.ok(
|
||||
exists('[data-value="makeOwners"]'),
|
||||
"it includes make owners option"
|
||||
);
|
||||
assert
|
||||
.dom('[data-value="makeOwners"]')
|
||||
.exists("it includes make owners option");
|
||||
|
||||
assert.ok(
|
||||
exists('[data-value="setPrimary"]'),
|
||||
"it includes set primary option"
|
||||
);
|
||||
assert
|
||||
.dom('[data-value="setPrimary"]')
|
||||
.exists("it includes set primary option");
|
||||
});
|
||||
|
||||
test("Shows bulk actions as a group owner", async function (assert) {
|
||||
|
@ -112,37 +107,32 @@ acceptance("Group Members", function (needs) {
|
|||
const memberDropdown = selectKit(".bulk-group-member-dropdown");
|
||||
await memberDropdown.expand();
|
||||
|
||||
assert.ok(
|
||||
exists('[data-value="removeMembers"]'),
|
||||
"it includes remove member option"
|
||||
);
|
||||
assert
|
||||
.dom('[data-value="removeMembers"]')
|
||||
.exists("it includes remove member option");
|
||||
|
||||
assert.ok(
|
||||
exists('[data-value="makeOwners"]'),
|
||||
"it includes make owners option"
|
||||
);
|
||||
assert
|
||||
.dom('[data-value="makeOwners"]')
|
||||
.exists("it includes make owners option");
|
||||
|
||||
assert.notOk(
|
||||
exists('[data-value="setPrimary"]'),
|
||||
"it does not include set primary (staff only) option"
|
||||
);
|
||||
assert
|
||||
.dom('[data-value="setPrimary"]')
|
||||
.doesNotExist("it does not include set primary (staff only) option");
|
||||
});
|
||||
|
||||
test("Bulk actions - Menu, Select all and Clear all buttons", async function (assert) {
|
||||
await visit("/g/discourse");
|
||||
|
||||
assert.ok(
|
||||
!exists(".bulk-select-buttons-wrap details"),
|
||||
"it does not show menu button if nothing is selected"
|
||||
);
|
||||
assert
|
||||
.dom(".bulk-select-buttons-wrap details")
|
||||
.doesNotExist("it does not show menu button if nothing is selected");
|
||||
|
||||
await click("button.bulk-select");
|
||||
await click(".bulk-select-all");
|
||||
|
||||
assert.ok(
|
||||
exists(".bulk-select-buttons-wrap details"),
|
||||
"it shows menu button if something is selected"
|
||||
);
|
||||
assert
|
||||
.dom(".bulk-select-buttons-wrap details")
|
||||
.exists("it shows menu button if something is selected");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ import { test } from "qunit";
|
|||
import {
|
||||
acceptance,
|
||||
count,
|
||||
exists,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
|
@ -11,10 +10,9 @@ acceptance("Managing Group Category Notification Defaults", function () {
|
|||
test("As an anonymous user", async function (assert) {
|
||||
await visit("/g/discourse/manage/categories");
|
||||
|
||||
assert.ok(
|
||||
exists(".group-members .group-member"),
|
||||
"it should redirect to members page for an anonymous user"
|
||||
);
|
||||
assert
|
||||
.dom(".group-members .group-member")
|
||||
.exists("it should redirect to members page for an anonymous user");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import Site from "discourse/models/site";
|
|||
import {
|
||||
acceptance,
|
||||
count,
|
||||
exists,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
|
@ -88,10 +87,9 @@ acceptance("Managing Group Membership", function (needs) {
|
|||
"it should disable group public admission input"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
!exists(".group-form-public-exit[disabled]"),
|
||||
"it should not disable group public exit input"
|
||||
);
|
||||
assert
|
||||
.dom(".group-form-public-exit[disabled]")
|
||||
.doesNotExist("it should not disable group public exit input");
|
||||
|
||||
assert.strictEqual(
|
||||
count(".group-form-membership-request-template"),
|
||||
|
@ -133,10 +131,11 @@ acceptance("Managing Group Membership", function (needs) {
|
|||
|
||||
await visit("/g/alternative-group/manage/membership");
|
||||
|
||||
assert.ok(
|
||||
!exists('label[for="automatic_membership_associated_groups"]'),
|
||||
"it should not display associated groups automatic membership label"
|
||||
);
|
||||
assert
|
||||
.dom('label[for="automatic_membership_associated_groups"]')
|
||||
.doesNotExist(
|
||||
"it should not display associated groups automatic membership label"
|
||||
);
|
||||
});
|
||||
|
||||
test("As a group owner", async function (assert) {
|
||||
|
@ -144,30 +143,29 @@ acceptance("Managing Group Membership", function (needs) {
|
|||
|
||||
await visit("/g/discourse/manage/membership");
|
||||
|
||||
assert.ok(
|
||||
!exists('label[for="automatic_membership"]'),
|
||||
"it should not display automatic membership label"
|
||||
);
|
||||
assert
|
||||
.dom('label[for="automatic_membership"]')
|
||||
.doesNotExist("it should not display automatic membership label");
|
||||
|
||||
assert.ok(
|
||||
!exists('label[for="automatic_membership_associated_groups"]'),
|
||||
"it should not display associated groups automatic membership label"
|
||||
);
|
||||
assert
|
||||
.dom('label[for="automatic_membership_associated_groups"]')
|
||||
.doesNotExist(
|
||||
"it should not display associated groups automatic membership label"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
!exists(".groups-form-automatic-membership-retroactive"),
|
||||
"it should not display automatic membership retroactive checkbox"
|
||||
);
|
||||
assert
|
||||
.dom(".groups-form-automatic-membership-retroactive")
|
||||
.doesNotExist(
|
||||
"it should not display automatic membership retroactive checkbox"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
!exists(".groups-form-primary-group"),
|
||||
"it should not display set as primary group checkbox"
|
||||
);
|
||||
assert
|
||||
.dom(".groups-form-primary-group")
|
||||
.doesNotExist("it should not display set as primary group checkbox");
|
||||
|
||||
assert.ok(
|
||||
!exists(".groups-form-grant-trust-level"),
|
||||
"it should not display grant trust level selector"
|
||||
);
|
||||
assert
|
||||
.dom(".groups-form-grant-trust-level")
|
||||
.doesNotExist("it should not display grant trust level selector");
|
||||
|
||||
assert.strictEqual(
|
||||
count(".group-form-public-admission"),
|
||||
|
|
|
@ -3,7 +3,6 @@ import { test } from "qunit";
|
|||
import {
|
||||
acceptance,
|
||||
count,
|
||||
exists,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
|
@ -11,10 +10,9 @@ acceptance("Managing Group Profile", function () {
|
|||
test("As an anonymous user", async function (assert) {
|
||||
await visit("/g/discourse/manage/profile");
|
||||
|
||||
assert.ok(
|
||||
exists(".group-members .group-member"),
|
||||
"it should redirect to members page for an anonymous user"
|
||||
);
|
||||
assert
|
||||
.dom(".group-members .group-member")
|
||||
.exists("it should redirect to members page for an anonymous user");
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -50,9 +48,8 @@ acceptance("Managing Group Profile", function (needs) {
|
|||
|
||||
await visit("/g/discourse/manage/profile");
|
||||
|
||||
assert.ok(
|
||||
!exists(".group-form-name"),
|
||||
"it should not display group name input"
|
||||
);
|
||||
assert
|
||||
.dom(".group-form-name")
|
||||
.doesNotExist("it should not display group name input");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -3,7 +3,6 @@ import { test } from "qunit";
|
|||
import {
|
||||
acceptance,
|
||||
count,
|
||||
exists,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
|
@ -11,10 +10,9 @@ acceptance("Managing Group Tag Notification Defaults", function () {
|
|||
test("As an anonymous user", async function (assert) {
|
||||
await visit("/g/discourse/manage/tags");
|
||||
|
||||
assert.ok(
|
||||
exists(".group-members .group-member"),
|
||||
"it should redirect to members page for an anonymous user"
|
||||
);
|
||||
assert
|
||||
.dom(".group-members .group-member")
|
||||
.exists("it should redirect to members page for an anonymous user");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -28,10 +28,9 @@ acceptance("Group - Anonymous", function (needs) {
|
|||
test("Anonymous Viewing Group", async function (assert) {
|
||||
await visit("/g/discourse");
|
||||
|
||||
assert.ok(
|
||||
!exists(".nav-pills li a[title='Messages']"),
|
||||
"it does not show group messages navigation link"
|
||||
);
|
||||
assert
|
||||
.dom(".nav-pills li a[title='Messages']")
|
||||
.doesNotExist("it does not show group messages navigation link");
|
||||
|
||||
await click(".nav-pills li a[title='Activity']");
|
||||
|
||||
|
@ -45,14 +44,12 @@ acceptance("Group - Anonymous", function (needs) {
|
|||
await click(".activity-nav li a[href='/g/discourse/activity/mentions']");
|
||||
|
||||
assert.ok(exists(".user-stream-item"), "it lists stream items");
|
||||
assert.ok(
|
||||
!exists(".nav-pills li a[title='Edit Group']"),
|
||||
"it should not show messages tab if user is not admin"
|
||||
);
|
||||
assert.ok(
|
||||
!exists(".nav-pills li a[title='Logs']"),
|
||||
"it should not show Logs tab if user is not admin"
|
||||
);
|
||||
assert
|
||||
.dom(".nav-pills li a[title='Edit Group']")
|
||||
.doesNotExist("it should not show messages tab if user is not admin");
|
||||
assert
|
||||
.dom(".nav-pills li a[title='Logs']")
|
||||
.doesNotExist("it should not show Logs tab if user is not admin");
|
||||
assert.ok(exists(".user-stream-item"), "it lists stream items");
|
||||
|
||||
const groupDropdown = selectKit(".group-dropdown");
|
||||
|
@ -72,19 +69,17 @@ acceptance("Group - Anonymous", function (needs) {
|
|||
|
||||
await groupDropdown.expand();
|
||||
|
||||
assert.ok(
|
||||
!exists(".group-dropdown-filter"),
|
||||
"it should not display the default header"
|
||||
);
|
||||
assert
|
||||
.dom(".group-dropdown-filter")
|
||||
.doesNotExist("it should not display the default header");
|
||||
});
|
||||
|
||||
test("Anonymous Viewing Automatic Group", async function (assert) {
|
||||
await visit("/g/moderators");
|
||||
|
||||
assert.ok(
|
||||
!exists(".nav-pills li a[title='Manage']"),
|
||||
"it does not show group messages navigation link"
|
||||
);
|
||||
assert
|
||||
.dom(".nav-pills li a[title='Manage']")
|
||||
.doesNotExist("it does not show group messages navigation link");
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -301,10 +296,9 @@ acceptance("Group - Authenticated", function (needs) {
|
|||
|
||||
await click(".group-members-add.btn");
|
||||
|
||||
assert.ok(
|
||||
exists(".group-add-members-modal #set-owner"),
|
||||
"it allows moderators to set group owners"
|
||||
);
|
||||
assert
|
||||
.dom(".group-add-members-modal #set-owner")
|
||||
.exists("it allows moderators to set group owners");
|
||||
|
||||
await click(".group-add-members-modal .modal-close");
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ import { test } from "qunit";
|
|||
import {
|
||||
acceptance,
|
||||
count,
|
||||
exists,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import I18n from "discourse-i18n";
|
||||
|
@ -12,10 +11,9 @@ acceptance("New Group - Anonymous", function () {
|
|||
test("As an anon user", async function (assert) {
|
||||
await visit("/g");
|
||||
|
||||
assert.ok(
|
||||
!exists(".groups-header-new"),
|
||||
"it should not display the button to create a group"
|
||||
);
|
||||
assert
|
||||
.dom(".groups-header-new")
|
||||
.doesNotExist("it should not display the button to create a group");
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -79,10 +77,9 @@ acceptance("New Group - Authenticated", function (needs) {
|
|||
|
||||
await click(".group-form-public-admission");
|
||||
|
||||
assert.ok(
|
||||
!exists("groups-new-allow-membership-requests"),
|
||||
"it should disable the membership requests checkbox"
|
||||
);
|
||||
assert
|
||||
.dom("groups-new-allow-membership-requests")
|
||||
.doesNotExist("it should disable the membership requests checkbox");
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
|
|
|
@ -44,38 +44,33 @@ acceptance("Accept Invite - User Fields", function (needs) {
|
|||
await visit("/invites/myvalidinvitetoken");
|
||||
assert.ok(exists(".invites-show"), "shows the accept invite page");
|
||||
assert.ok(exists(".user-field"), "it has at least one user field");
|
||||
assert.ok(
|
||||
exists(".invites-show .btn-primary:disabled"),
|
||||
"submit is disabled"
|
||||
);
|
||||
assert
|
||||
.dom(".invites-show .btn-primary:disabled")
|
||||
.exists("submit is disabled");
|
||||
|
||||
await fillIn("#new-account-name", "John Doe");
|
||||
await fillIn("#new-account-username", "validname");
|
||||
await fillIn("#new-account-password", "secur3ty4Y0uAndMe");
|
||||
|
||||
assert.ok(exists(".username-input .good"), "username is valid");
|
||||
assert.ok(
|
||||
exists(".invites-show .btn-primary:disabled"),
|
||||
"submit is still disabled due to lack of user fields"
|
||||
);
|
||||
assert
|
||||
.dom(".invites-show .btn-primary:disabled")
|
||||
.exists("submit is still disabled due to lack of user fields");
|
||||
|
||||
await fillIn(".user-field input[type=text]:nth-of-type(1)", "Barky");
|
||||
|
||||
assert.ok(
|
||||
exists(".invites-show .btn-primary:disabled"),
|
||||
"submit is disabled because field is not checked"
|
||||
);
|
||||
assert
|
||||
.dom(".invites-show .btn-primary:disabled")
|
||||
.exists("submit is disabled because field is not checked");
|
||||
|
||||
await click(".user-field input[type=checkbox]");
|
||||
assert.notOk(
|
||||
exists(".invites-show .btn-primary:disabled"),
|
||||
"submit is enabled because field is checked"
|
||||
);
|
||||
assert
|
||||
.dom(".invites-show .btn-primary:disabled")
|
||||
.doesNotExist("submit is enabled because field is checked");
|
||||
|
||||
await click(".user-field input[type=checkbox]");
|
||||
assert.ok(
|
||||
exists(".invites-show .btn-primary:disabled"),
|
||||
"unclicking the checkbox disables the submit"
|
||||
);
|
||||
assert
|
||||
.dom(".invites-show .btn-primary:disabled")
|
||||
.exists("unclicking the checkbox disables the submit");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -52,22 +52,19 @@ acceptance("Keyboard Shortcuts - Anonymous Users", function (needs) {
|
|||
test("j/k navigation moves selection up/down", async function (assert) {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
await triggerKeyEvent(document, "keypress", "J");
|
||||
assert.ok(
|
||||
exists(".post-stream .topic-post.selected #post_1"),
|
||||
"first post is selected"
|
||||
);
|
||||
assert
|
||||
.dom(".post-stream .topic-post.selected #post_1")
|
||||
.exists("first post is selected");
|
||||
|
||||
await triggerKeyEvent(document, "keypress", "J");
|
||||
assert.ok(
|
||||
exists(".post-stream .topic-post.selected #post_2"),
|
||||
"pressing j moves selection to next post"
|
||||
);
|
||||
assert
|
||||
.dom(".post-stream .topic-post.selected #post_2")
|
||||
.exists("pressing j moves selection to next post");
|
||||
|
||||
await triggerKeyEvent(document, "keypress", "K");
|
||||
assert.ok(
|
||||
exists(".post-stream .topic-post.selected #post_1"),
|
||||
"pressing k moves selection to previous post"
|
||||
);
|
||||
assert
|
||||
.dom(".post-stream .topic-post.selected #post_1")
|
||||
.exists("pressing k moves selection to previous post");
|
||||
});
|
||||
|
||||
// FIXME: For reasons unknown this test if flaky on firefox
|
||||
|
@ -148,15 +145,13 @@ acceptance("Keyboard Shortcuts - Authenticated Users", function (needs) {
|
|||
await visit("/");
|
||||
document.getElementById("ember-testing-container").scrollTop = 0;
|
||||
await visit("/unread");
|
||||
assert.ok(
|
||||
exists("#dismiss-topics-top"),
|
||||
"dismiss unread top button is present"
|
||||
);
|
||||
assert
|
||||
.dom("#dismiss-topics-top")
|
||||
.exists("dismiss unread top button is present");
|
||||
await triggerKeyEvent(document, "keydown", "D", { shiftKey: true });
|
||||
assert.ok(
|
||||
exists("#dismiss-read-confirm"),
|
||||
"confirmation modal to dismiss unread is present"
|
||||
);
|
||||
assert
|
||||
.dom("#dismiss-read-confirm")
|
||||
.exists("confirmation modal to dismiss unread is present");
|
||||
assert
|
||||
.dom(".d-modal__body")
|
||||
.hasText(I18n.t("topics.bulk.also_dismiss_topics"));
|
||||
|
@ -176,16 +171,14 @@ acceptance("Keyboard Shortcuts - Authenticated Users", function (needs) {
|
|||
// visit root first so topic list starts fresh
|
||||
await visit("/");
|
||||
await visit("/unread");
|
||||
assert.notOk(
|
||||
exists("#dismiss-topics-bottom"),
|
||||
"dismiss unread bottom button is hidden"
|
||||
);
|
||||
assert
|
||||
.dom("#dismiss-topics-bottom")
|
||||
.doesNotExist("dismiss unread bottom button is hidden");
|
||||
|
||||
await triggerKeyEvent(document, "keydown", "D", { shiftKey: true });
|
||||
assert.ok(
|
||||
exists("#dismiss-read-confirm"),
|
||||
"confirmation modal to dismiss unread is present"
|
||||
);
|
||||
assert
|
||||
.dom("#dismiss-read-confirm")
|
||||
.exists("confirmation modal to dismiss unread is present");
|
||||
assert
|
||||
.dom(".d-modal__body")
|
||||
.hasText(
|
||||
|
@ -223,10 +216,9 @@ acceptance("Keyboard Shortcuts - Authenticated Users", function (needs) {
|
|||
// visit root first so topic list starts fresh
|
||||
await visit("/");
|
||||
await visit("/new");
|
||||
assert.notOk(
|
||||
exists("#dismiss-new-bottom"),
|
||||
"dismiss new bottom button has been hidden"
|
||||
);
|
||||
assert
|
||||
.dom("#dismiss-new-bottom")
|
||||
.doesNotExist("dismiss new bottom button has been hidden");
|
||||
|
||||
await triggerKeyEvent(document, "keydown", "D", { shiftKey: true });
|
||||
assert.strictEqual(resetNewCalled, 2);
|
||||
|
@ -241,14 +233,12 @@ acceptance("Keyboard Shortcuts - Authenticated Users", function (needs) {
|
|||
await visit("/");
|
||||
document.getElementById("ember-testing-container").scrollTop = 0;
|
||||
await visit("/new");
|
||||
assert.ok(
|
||||
exists("#dismiss-new-top"),
|
||||
"dismiss new top button is present before double click test"
|
||||
);
|
||||
assert.ok(
|
||||
exists("#dismiss-new-bottom"),
|
||||
"dismiss new bottom button is present"
|
||||
);
|
||||
assert
|
||||
.dom("#dismiss-new-top")
|
||||
.exists("dismiss new top button is present before double click test");
|
||||
assert
|
||||
.dom("#dismiss-new-bottom")
|
||||
.exists("dismiss new bottom button is present");
|
||||
|
||||
await triggerKeyEvent(document, "keydown", "D", { shiftKey: true });
|
||||
|
||||
|
@ -258,16 +248,14 @@ acceptance("Keyboard Shortcuts - Authenticated Users", function (needs) {
|
|||
test("share shortcuts", async function (assert) {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
await triggerKeyEvent(document, "keypress", "J");
|
||||
assert.ok(
|
||||
exists(".post-stream .topic-post.selected #post_1"),
|
||||
"first post is selected"
|
||||
);
|
||||
assert
|
||||
.dom(".post-stream .topic-post.selected #post_1")
|
||||
.exists("first post is selected");
|
||||
|
||||
await triggerKeyEvent(document, "keypress", "J");
|
||||
assert.ok(
|
||||
exists(".post-stream .topic-post.selected #post_2"),
|
||||
"pressing j moves selection to next post"
|
||||
);
|
||||
assert
|
||||
.dom(".post-stream .topic-post.selected #post_2")
|
||||
.exists("pressing j moves selection to next post");
|
||||
|
||||
await triggerKeyEvent(document, "keypress", "S");
|
||||
assert
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
import { visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("User Directory - Mobile", function (needs) {
|
||||
needs.mobileView();
|
||||
|
||||
test("Visit Page", async function (assert) {
|
||||
await visit("/u");
|
||||
assert.ok(
|
||||
exists(".directory .directory-table__row"),
|
||||
"has a list of users"
|
||||
);
|
||||
assert
|
||||
.dom(".directory .directory-table__row")
|
||||
.exists("has a list of users");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { click, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Login with email disabled", function (needs) {
|
||||
needs.settings({
|
||||
|
@ -12,14 +12,12 @@ acceptance("Login with email disabled", function (needs) {
|
|||
await visit("/");
|
||||
await click("header .login-button");
|
||||
|
||||
assert.ok(
|
||||
exists(".btn-social.facebook"),
|
||||
"it displays the facebook login button"
|
||||
);
|
||||
assert
|
||||
.dom(".btn-social.facebook")
|
||||
.exists("it displays the facebook login button");
|
||||
|
||||
assert.notOk(
|
||||
exists("#email-login-link"),
|
||||
"it displays the login with email button"
|
||||
);
|
||||
assert
|
||||
.dom("#email-login-link")
|
||||
.doesNotExist("it displays the login with email button");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,11 +2,7 @@ import { click, fillIn, visit } from "@ember/test-helpers";
|
|||
import { test } from "qunit";
|
||||
import sinon from "sinon";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import I18n from "discourse-i18n";
|
||||
|
||||
const TOKEN = "sometoken";
|
||||
|
@ -42,15 +38,13 @@ acceptance("Login with email", function (needs) {
|
|||
await visit("/");
|
||||
await click("header .login-button");
|
||||
|
||||
assert.ok(
|
||||
exists(".btn-social.facebook"),
|
||||
"it displays the facebook login button"
|
||||
);
|
||||
assert
|
||||
.dom(".btn-social.facebook")
|
||||
.exists("it displays the facebook login button");
|
||||
|
||||
assert.ok(
|
||||
exists("#email-login-link"),
|
||||
"it displays the login with email button"
|
||||
);
|
||||
assert
|
||||
.dom("#email-login-link")
|
||||
.exists("it displays the login with email button");
|
||||
|
||||
await fillIn("#login-account-name", "someuser");
|
||||
await click("#email-login-link");
|
||||
|
|
|
@ -95,15 +95,13 @@ acceptance("Password Reset", function (needs) {
|
|||
"server validation error message shows"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists("#new-account-password[type='password']"),
|
||||
"password is masked by default"
|
||||
);
|
||||
assert
|
||||
.dom("#new-account-password[type='password']")
|
||||
.exists("password is masked by default");
|
||||
await click(".toggle-password-mask");
|
||||
assert.ok(
|
||||
exists("#new-account-password[type='text']"),
|
||||
"password is unmasked after toggle is clicked"
|
||||
);
|
||||
assert
|
||||
.dom("#new-account-password[type='text']")
|
||||
.exists("password is unmasked after toggle is clicked");
|
||||
|
||||
await fillIn(".password-reset input", "perf3ctly5ecur3");
|
||||
sinon.stub(DiscourseURL, "redirectTo");
|
||||
|
|
|
@ -8,14 +8,12 @@ acceptance("Post - Admin Menu - Anonymous", function () {
|
|||
await click(".show-more-actions");
|
||||
|
||||
assert.ok(exists("#topic"), "The topic was rendered");
|
||||
assert.ok(
|
||||
exists("#post_1 .post-controls .edit"),
|
||||
"The edit button was not rendered"
|
||||
);
|
||||
assert.ok(
|
||||
!exists(".show-post-admin-menu"),
|
||||
"The wrench button was not rendered"
|
||||
);
|
||||
assert
|
||||
.dom("#post_1 .post-controls .edit")
|
||||
.exists("The edit button was not rendered");
|
||||
assert
|
||||
.dom(".show-post-admin-menu")
|
||||
.doesNotExist("The wrench button was not rendered");
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -26,10 +24,9 @@ acceptance("Post - Admin Menu - Authenticated", function (needs) {
|
|||
await click(".show-more-actions");
|
||||
await click(".show-post-admin-menu");
|
||||
|
||||
assert.ok(
|
||||
exists("#post_1 .post-controls .edit"),
|
||||
"The edit button was rendered"
|
||||
);
|
||||
assert
|
||||
.dom("#post_1 .post-controls .edit")
|
||||
.exists("The edit button was rendered");
|
||||
assert.ok(exists(".add-notice"), "The add notice button was rendered");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -3,7 +3,6 @@ import { test } from "qunit";
|
|||
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
||||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
publishToMessageBus,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
|
@ -50,10 +49,9 @@ acceptance("Post inline mentions", function (needs) {
|
|||
|
||||
await visit(`/t/lorem-ipsum-dolor-sit-amet/${topicId}`);
|
||||
|
||||
assert.ok(
|
||||
exists(".topic-post .cooked .mention .user-status-message"),
|
||||
"user status is shown"
|
||||
);
|
||||
assert
|
||||
.dom(".topic-post .cooked .mention .user-status-message")
|
||||
.exists("user status is shown");
|
||||
const statusElement = query(
|
||||
".topic-post .cooked .mention .user-status-message img"
|
||||
);
|
||||
|
@ -69,10 +67,9 @@ acceptance("Post inline mentions", function (needs) {
|
|||
});
|
||||
await visit(`/t/lorem-ipsum-dolor-sit-amet/${topicId}`);
|
||||
|
||||
assert.notOk(
|
||||
exists(".topic-post .cooked .mention .user-status-message"),
|
||||
"user status isn't shown"
|
||||
);
|
||||
assert
|
||||
.dom(".topic-post .cooked .mention .user-status-message")
|
||||
.doesNotExist("user status isn't shown");
|
||||
|
||||
await publishToMessageBus("/user-status", {
|
||||
[mentionedUserId]: {
|
||||
|
@ -81,10 +78,9 @@ acceptance("Post inline mentions", function (needs) {
|
|||
},
|
||||
});
|
||||
|
||||
assert.ok(
|
||||
exists(".topic-post .cooked .mention .user-status-message"),
|
||||
"user status is shown"
|
||||
);
|
||||
assert
|
||||
.dom(".topic-post .cooked .mention .user-status-message")
|
||||
.exists("user status is shown");
|
||||
const statusElement = query(
|
||||
".topic-post .cooked .mention .user-status-message img"
|
||||
);
|
||||
|
@ -100,10 +96,9 @@ acceptance("Post inline mentions", function (needs) {
|
|||
});
|
||||
await visit(`/t/lorem-ipsum-dolor-sit-amet/${topicId}`);
|
||||
|
||||
assert.ok(
|
||||
exists(".topic-post .cooked .mention .user-status-message"),
|
||||
"initial user status is shown"
|
||||
);
|
||||
assert
|
||||
.dom(".topic-post .cooked .mention .user-status-message")
|
||||
.exists("initial user status is shown");
|
||||
|
||||
const newStatus = {
|
||||
description: "off to dentist",
|
||||
|
@ -116,10 +111,9 @@ acceptance("Post inline mentions", function (needs) {
|
|||
},
|
||||
});
|
||||
|
||||
assert.ok(
|
||||
exists(".topic-post .cooked .mention .user-status-message"),
|
||||
"updated user status is shown"
|
||||
);
|
||||
assert
|
||||
.dom(".topic-post .cooked .mention .user-status-message")
|
||||
.exists("updated user status is shown");
|
||||
const statusElement = query(
|
||||
".topic-post .cooked .mention .user-status-message img"
|
||||
);
|
||||
|
@ -135,19 +129,17 @@ acceptance("Post inline mentions", function (needs) {
|
|||
});
|
||||
await visit(`/t/lorem-ipsum-dolor-sit-amet/${topicId}`);
|
||||
|
||||
assert.ok(
|
||||
exists(".topic-post .cooked .mention .user-status-message"),
|
||||
"initial user status is shown"
|
||||
);
|
||||
assert
|
||||
.dom(".topic-post .cooked .mention .user-status-message")
|
||||
.exists("initial user status is shown");
|
||||
|
||||
await publishToMessageBus("/user-status", {
|
||||
[mentionedUserId]: null,
|
||||
});
|
||||
|
||||
assert.notOk(
|
||||
exists(".topic-post .cooked .mention .user-status-message"),
|
||||
"updated user has disappeared"
|
||||
);
|
||||
assert
|
||||
.dom(".topic-post .cooked .mention .user-status-message")
|
||||
.doesNotExist("updated user has disappeared");
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -172,10 +164,9 @@ acceptance("Post inline mentions – user status tooltip", function (needs) {
|
|||
});
|
||||
|
||||
await visit(`/t/lorem-ipsum-dolor-sit-amet/${topicId}`);
|
||||
assert.ok(
|
||||
exists(".topic-post .cooked .mention .user-status-message"),
|
||||
"user status is shown"
|
||||
);
|
||||
assert
|
||||
.dom(".topic-post .cooked .mention .user-status-message")
|
||||
.exists("user status is shown");
|
||||
|
||||
await mouseMove(".user-status-message");
|
||||
const statusTooltip = document.querySelector(
|
||||
|
@ -210,10 +201,9 @@ acceptance("Post inline mentions as an anonymous user", function () {
|
|||
});
|
||||
await visit(`/t/lorem-ipsum-dolor-sit-amet/${topicId}`);
|
||||
|
||||
assert.ok(
|
||||
exists(".topic-post .cooked .mention .user-status-message"),
|
||||
"user status is shown"
|
||||
);
|
||||
assert
|
||||
.dom(".topic-post .cooked .mention .user-status-message")
|
||||
.exists("user status is shown");
|
||||
});
|
||||
|
||||
test("an anonymous user can see user status with an end date on mentions", async function (assert) {
|
||||
|
@ -230,9 +220,8 @@ acceptance("Post inline mentions as an anonymous user", function () {
|
|||
});
|
||||
await visit(`/t/lorem-ipsum-dolor-sit-amet/${topicId}`);
|
||||
|
||||
assert.ok(
|
||||
exists(".topic-post .cooked .mention .user-status-message"),
|
||||
"user status is shown"
|
||||
);
|
||||
assert
|
||||
.dom(".topic-post .cooked .mention .user-status-message")
|
||||
.exists("user status is shown");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -10,10 +10,9 @@ acceptance("Post Table Wrapper Test", function () {
|
|||
test("fullscreen table wrapper appears on post with large table", async function (assert) {
|
||||
await visit("/t/54081");
|
||||
const postWithLargeTable = ".post-stream .topic-post:first-child";
|
||||
assert.ok(
|
||||
exists(`${postWithLargeTable} .fullscreen-table-wrapper`),
|
||||
"The wrapper is present on the post with the large table"
|
||||
);
|
||||
assert
|
||||
.dom(`${postWithLargeTable} .fullscreen-table-wrapper`)
|
||||
.exists("The wrapper is present on the post with the large table");
|
||||
|
||||
assert.ok(
|
||||
exists(
|
||||
|
@ -38,23 +37,20 @@ acceptance("Post Table Wrapper Test", function () {
|
|||
`${postWithLargeTable} .fullscreen-table-wrapper .btn-expand-table`
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(".fullscreen-table-modal"),
|
||||
"The fullscreen table modal appears"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".fullscreen-table-modal table"),
|
||||
"The table is present inside the modal"
|
||||
);
|
||||
assert
|
||||
.dom(".fullscreen-table-modal")
|
||||
.exists("The fullscreen table modal appears");
|
||||
assert
|
||||
.dom(".fullscreen-table-modal table")
|
||||
.exists("The table is present inside the modal");
|
||||
|
||||
await click(".fullscreen-table-modal .modal-close");
|
||||
await click(
|
||||
`${postWithLargeTable} .fullscreen-table-wrapper .btn-expand-table svg`
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(".fullscreen-table-modal"),
|
||||
"Fullscreen table modal appears on clicking svg icon"
|
||||
);
|
||||
assert
|
||||
.dom(".fullscreen-table-modal")
|
||||
.exists("Fullscreen table modal appears on clicking svg icon");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -37,26 +37,22 @@ acceptance("Review", function (needs) {
|
|||
|
||||
assert.ok(exists(".reviewable-item"), "has a list of items");
|
||||
assert.ok(exists(user));
|
||||
assert.ok(
|
||||
exists(`${user}.reviewable-user`),
|
||||
"applies a class for the type"
|
||||
);
|
||||
assert.ok(
|
||||
exists(`${user} .reviewable-action.approve`),
|
||||
"creates a button for approve"
|
||||
);
|
||||
assert.ok(
|
||||
exists(`${user} .reviewable-action.reject`),
|
||||
"creates a button for reject"
|
||||
);
|
||||
assert
|
||||
.dom(`${user}.reviewable-user`)
|
||||
.exists("applies a class for the type");
|
||||
assert
|
||||
.dom(`${user} .reviewable-action.approve`)
|
||||
.exists("creates a button for approve");
|
||||
assert
|
||||
.dom(`${user} .reviewable-action.reject`)
|
||||
.exists("creates a button for reject");
|
||||
});
|
||||
|
||||
test("Grouped by topic", async function (assert) {
|
||||
await visit("/review/topics");
|
||||
assert.ok(
|
||||
exists(".reviewable-topic"),
|
||||
"it has a list of reviewable topics"
|
||||
);
|
||||
assert
|
||||
.dom(".reviewable-topic")
|
||||
.exists("it has a list of reviewable topics");
|
||||
});
|
||||
|
||||
test("Reject user", async function (assert) {
|
||||
|
@ -107,10 +103,9 @@ acceptance("Review", function (needs) {
|
|||
test("Flag related", async function (assert) {
|
||||
await visit("/review");
|
||||
|
||||
assert.ok(
|
||||
exists(".reviewable-flagged-post .post-contents .username a[href]"),
|
||||
"it has a link to the user"
|
||||
);
|
||||
assert
|
||||
.dom(".reviewable-flagged-post .post-contents .username a[href]")
|
||||
.exists("it has a link to the user");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".reviewable-flagged-post .post-body").innerHTML.trim(),
|
||||
|
@ -158,17 +153,15 @@ acceptance("Review", function (needs) {
|
|||
await click(`${topic} .reviewable-action.edit`);
|
||||
await click(`${topic} .reviewable-action.save-edit`);
|
||||
|
||||
assert.ok(
|
||||
exists(`${topic} .reviewable-action.approve`),
|
||||
"saving without changes is a cancel"
|
||||
);
|
||||
assert
|
||||
.dom(`${topic} .reviewable-action.approve`)
|
||||
.exists("saving without changes is a cancel");
|
||||
|
||||
await click(`${topic} .reviewable-action.edit`);
|
||||
|
||||
assert.ok(
|
||||
!exists(`${topic} .reviewable-action.approve`),
|
||||
"when editing actions are disabled"
|
||||
);
|
||||
assert
|
||||
.dom(`${topic} .reviewable-action.approve`)
|
||||
.doesNotExist("when editing actions are disabled");
|
||||
|
||||
await fillIn(".editable-field.payload-raw textarea", "new raw contents");
|
||||
await click(`${topic} .reviewable-action.cancel-edit`);
|
||||
|
|
|
@ -15,29 +15,26 @@ acceptance("Search - Mobile", function (needs) {
|
|||
|
||||
await click("#search-button");
|
||||
|
||||
assert.ok(
|
||||
exists("input.full-page-search"),
|
||||
"it shows the full page search form"
|
||||
);
|
||||
assert
|
||||
.dom("input.full-page-search")
|
||||
.exists("it shows the full page search form");
|
||||
|
||||
assert.ok(!exists(".search-results .fps-topic"), "no results by default");
|
||||
|
||||
await click(".advanced-filters summary");
|
||||
|
||||
assert.ok(
|
||||
exists(".advanced-filters[open]"),
|
||||
"it should expand advanced search filters"
|
||||
);
|
||||
assert
|
||||
.dom(".advanced-filters[open]")
|
||||
.exists("it should expand advanced search filters");
|
||||
|
||||
await fillIn(".search-query", "discourse");
|
||||
await click(".search-cta");
|
||||
|
||||
assert.strictEqual(count(".fps-topic"), 1, "has one post");
|
||||
|
||||
assert.notOk(
|
||||
exists(".advanced-filters[open]"),
|
||||
"it should collapse advanced search filters"
|
||||
);
|
||||
assert
|
||||
.dom(".advanced-filters[open]")
|
||||
.doesNotExist("it should collapse advanced search filters");
|
||||
|
||||
await click("#search-button");
|
||||
|
||||
|
|
|
@ -63,10 +63,9 @@ acceptance("Search - Anonymous", function (needs) {
|
|||
await click("#search-button");
|
||||
|
||||
assert.ok(exists("#search-term"), "it shows the search input");
|
||||
assert.ok(
|
||||
exists(".show-advanced-search"),
|
||||
"it shows full page search button"
|
||||
);
|
||||
assert
|
||||
.dom(".show-advanced-search")
|
||||
.exists("it shows full page search button");
|
||||
});
|
||||
|
||||
test("random quick tips", async function (assert) {
|
||||
|
@ -74,10 +73,9 @@ acceptance("Search - Anonymous", function (needs) {
|
|||
await click("#search-button");
|
||||
await fillIn("#search-term", "dev");
|
||||
|
||||
assert.ok(
|
||||
!exists(".search-menu .results ul li.search-random-quick-tip"),
|
||||
"quick tip is no longer shown"
|
||||
);
|
||||
assert
|
||||
.dom(".search-menu .results ul li.search-random-quick-tip")
|
||||
.doesNotExist("quick tip is no longer shown");
|
||||
});
|
||||
|
||||
test("advanced search", async function (assert) {
|
||||
|
@ -98,10 +96,9 @@ acceptance("Search - Anonymous", function (needs) {
|
|||
.dom(".search-menu .search-menu-panel")
|
||||
.doesNotExist("closes search menu after clicking advanced search button");
|
||||
|
||||
assert.ok(
|
||||
exists(".search-advanced-options"),
|
||||
"advanced search is expanded"
|
||||
);
|
||||
assert
|
||||
.dom(".search-advanced-options")
|
||||
.exists("advanced search is expanded");
|
||||
});
|
||||
|
||||
test("search button toggles search menu", async function (assert) {
|
||||
|
@ -141,15 +138,13 @@ acceptance("Search - Anonymous", function (needs) {
|
|||
"first dropdown item includes correct suffix"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(".search-menu .search-result-category ul li"),
|
||||
"shows matching category results"
|
||||
);
|
||||
assert
|
||||
.dom(".search-menu .search-result-category ul li")
|
||||
.exists("shows matching category results");
|
||||
|
||||
assert.ok(
|
||||
exists(".search-menu .search-result-user ul li"),
|
||||
"shows matching user results"
|
||||
);
|
||||
assert
|
||||
.dom(".search-menu .search-result-user ul li")
|
||||
.exists("shows matching user results");
|
||||
});
|
||||
|
||||
test("initial options - tag search scope", async function (assert) {
|
||||
|
@ -216,10 +211,9 @@ acceptance("Search - Anonymous", function (needs) {
|
|||
"second option includes category slug"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(`${contextSelector} span.badge-category__wrapper`),
|
||||
"category badge is a span (i.e. not a link)"
|
||||
);
|
||||
assert
|
||||
.dom(`${contextSelector} span.badge-category__wrapper`)
|
||||
.exists("category badge is a span (i.e. not a link)");
|
||||
});
|
||||
|
||||
test("initial options - topic search scope", async function (assert) {
|
||||
|
@ -250,10 +244,9 @@ acceptance("Search - Anonymous", function (needs) {
|
|||
await click(
|
||||
".search-menu .results .search-menu-initial-options .search-menu-assistant-item:first-child"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".search-result-topic"),
|
||||
"search result is a list of topics"
|
||||
);
|
||||
assert
|
||||
.dom(".search-result-topic")
|
||||
.exists("search result is a list of topics");
|
||||
});
|
||||
|
||||
test("initial options - topic search scope - 'in this topic' searches posts within topic", async function (assert) {
|
||||
|
@ -264,10 +257,9 @@ acceptance("Search - Anonymous", function (needs) {
|
|||
await click(
|
||||
".search-menu .results .search-menu-initial-options .search-menu-assistant-item:nth-child(2)"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".search-result-post"),
|
||||
"search result is a list of posts"
|
||||
);
|
||||
assert
|
||||
.dom(".search-result-post")
|
||||
.exists("search result is a list of posts");
|
||||
});
|
||||
|
||||
test("initial options - topic search scope - keep 'in this topic' filter in full page search", async function (assert) {
|
||||
|
@ -285,10 +277,9 @@ acceptance("Search - Anonymous", function (needs) {
|
|||
"it goes to full search page and preserves search term + context"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(".search-advanced-options"),
|
||||
"advanced search is expanded"
|
||||
);
|
||||
assert
|
||||
.dom(".search-advanced-options")
|
||||
.exists("advanced search is expanded");
|
||||
});
|
||||
|
||||
test("initial options - topic search scope - special case when matching a single user", async function (assert) {
|
||||
|
@ -341,15 +332,13 @@ acceptance("Search - Anonymous", function (needs) {
|
|||
await triggerKeyEvent("#search-term", "keyup", "ArrowDown");
|
||||
await click(document.activeElement);
|
||||
|
||||
assert.ok(
|
||||
exists(".search-menu .search-result-topic ul li"),
|
||||
"shows topic results"
|
||||
);
|
||||
assert
|
||||
.dom(".search-menu .search-result-topic ul li")
|
||||
.exists("shows topic results");
|
||||
|
||||
assert.ok(
|
||||
exists(".search-menu .results ul li .topic-title[data-topic-id]"),
|
||||
"topic has data-topic-id"
|
||||
);
|
||||
assert
|
||||
.dom(".search-menu .results ul li .topic-title[data-topic-id]")
|
||||
.exists("topic has data-topic-id");
|
||||
});
|
||||
|
||||
test("topic results - topic search scope", async function (assert) {
|
||||
|
@ -360,10 +349,9 @@ acceptance("Search - Anonymous", function (needs) {
|
|||
await triggerKeyEvent(document.activeElement, "keydown", "ArrowDown");
|
||||
await click(document.activeElement);
|
||||
|
||||
assert.ok(
|
||||
exists(".search-menu .search-result-post ul li"),
|
||||
"clicking second option scopes search to current topic"
|
||||
);
|
||||
assert
|
||||
.dom(".search-menu .search-result-post ul li")
|
||||
.exists("clicking second option scopes search to current topic");
|
||||
|
||||
assert.strictEqual(
|
||||
query("#post_7 span.highlighted").textContent.trim(),
|
||||
|
@ -371,10 +359,9 @@ acceptance("Search - Anonymous", function (needs) {
|
|||
"highlights the post correctly"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(".search-menu .search-context"),
|
||||
"search context indicator is visible"
|
||||
);
|
||||
assert
|
||||
.dom(".search-menu .search-context")
|
||||
.exists("search context indicator is visible");
|
||||
|
||||
await click(".clear-search");
|
||||
assert.strictEqual(
|
||||
|
@ -384,10 +371,9 @@ acceptance("Search - Anonymous", function (needs) {
|
|||
);
|
||||
|
||||
await click(".search-context");
|
||||
assert.ok(
|
||||
!exists(".search-menu .search-context"),
|
||||
"search context indicator is no longer visible"
|
||||
);
|
||||
assert
|
||||
.dom(".search-menu .search-context")
|
||||
.doesNotExist("search context indicator is no longer visible");
|
||||
|
||||
await fillIn("#search-term", "dev");
|
||||
await query("#search-term").focus();
|
||||
|
@ -395,19 +381,17 @@ acceptance("Search - Anonymous", function (needs) {
|
|||
await triggerKeyEvent(document.activeElement, "keydown", "ArrowDown");
|
||||
await click(document.activeElement);
|
||||
|
||||
assert.ok(
|
||||
exists(".search-menu .search-context"),
|
||||
"search context indicator is visible"
|
||||
);
|
||||
assert
|
||||
.dom(".search-menu .search-context")
|
||||
.exists("search context indicator is visible");
|
||||
|
||||
await fillIn("#search-term", "");
|
||||
await query("#search-term").focus();
|
||||
await triggerKeyEvent("#search-term", "keyup", "Backspace");
|
||||
|
||||
assert.ok(
|
||||
!exists(".search-menu .search-context"),
|
||||
"backspace resets search context"
|
||||
);
|
||||
assert
|
||||
.dom(".search-menu .search-context")
|
||||
.doesNotExist("backspace resets search context");
|
||||
});
|
||||
|
||||
test("topic results - search result escapes html in topic title", async function (assert) {
|
||||
|
@ -590,10 +574,9 @@ acceptance("Search - Authenticated", function (needs) {
|
|||
assert.ok(exists(query(`${container} ul li`)), "has a list of items");
|
||||
|
||||
await triggerKeyEvent("#search-term", "keyup", "Enter");
|
||||
assert.ok(
|
||||
exists(query(`${container} .search-result-topic`)),
|
||||
"has topic results"
|
||||
);
|
||||
assert
|
||||
.dom(query(`${container} .search-result-topic`))
|
||||
.exists("has topic results");
|
||||
|
||||
await triggerKeyEvent("#search-term", "keyup", "ArrowDown");
|
||||
assert.strictEqual(
|
||||
|
@ -638,20 +621,17 @@ acceptance("Search - Authenticated", function (needs) {
|
|||
);
|
||||
|
||||
await triggerKeyEvent("#search-term", "keyup", "Enter");
|
||||
assert.ok(
|
||||
exists(query(`${container} .search-result-topic`)),
|
||||
"has topic results"
|
||||
);
|
||||
assert
|
||||
.dom(query(`${container} .search-result-topic`))
|
||||
.exists("has topic results");
|
||||
|
||||
await triggerKeyEvent("#search-term", "keyup", "Enter");
|
||||
assert.ok(
|
||||
exists(query(`.search-container`)),
|
||||
"second Enter hit goes to full page search"
|
||||
);
|
||||
assert.ok(
|
||||
!exists(query(`.search-menu`)),
|
||||
"search dropdown is collapsed after second Enter hit"
|
||||
);
|
||||
assert
|
||||
.dom(query(`.search-container`))
|
||||
.exists("second Enter hit goes to full page search");
|
||||
assert
|
||||
.dom(query(`.search-menu`))
|
||||
.doesNotExist("search dropdown is collapsed after second Enter hit");
|
||||
|
||||
//new search launched, Enter key should be reset
|
||||
await click("#search-button");
|
||||
|
@ -1254,10 +1234,9 @@ acceptance("Search - assistant", function (needs) {
|
|||
|
||||
await clickOutside();
|
||||
await click("#search-button");
|
||||
assert.ok(
|
||||
exists(".btn.search-context"),
|
||||
"it shows the button when reinvoking search"
|
||||
);
|
||||
assert
|
||||
.dom(".btn.search-context")
|
||||
.exists("it shows the button when reinvoking search");
|
||||
|
||||
await fillIn("#search-term", "emoji");
|
||||
await query("input#search-term").focus();
|
||||
|
|
|
@ -106,149 +106,140 @@ acceptance("Second Factor Auth Page", function (needs) {
|
|||
|
||||
test("default 2FA method", async function (assert) {
|
||||
await visit("/session/2fa?nonce=ok111111");
|
||||
assert.ok(
|
||||
exists("#security-key-authenticate-button"),
|
||||
"security key is the default method"
|
||||
);
|
||||
assert.ok(
|
||||
!exists("form.totp-token"),
|
||||
"totp is not shown by default when security key is allowed"
|
||||
);
|
||||
assert.ok(
|
||||
!exists("form.backup-code-token"),
|
||||
"backup code form is not shown by default when security key is allowed"
|
||||
);
|
||||
assert
|
||||
.dom("#security-key-authenticate-button")
|
||||
.exists("security key is the default method");
|
||||
assert
|
||||
.dom("form.totp-token")
|
||||
.doesNotExist(
|
||||
"totp is not shown by default when security key is allowed"
|
||||
);
|
||||
assert
|
||||
.dom("form.backup-code-token")
|
||||
.doesNotExist(
|
||||
"backup code form is not shown by default when security key is allowed"
|
||||
);
|
||||
|
||||
await visit("/");
|
||||
await visit("/session/2fa?nonce=ok111110");
|
||||
assert.ok(
|
||||
!exists("#security-key-authenticate-button"),
|
||||
"security key method is not shown when it's not allowed"
|
||||
);
|
||||
assert.ok(
|
||||
exists("form.totp-token"),
|
||||
"totp is the default method when security key is not allowed"
|
||||
);
|
||||
assert.ok(
|
||||
!exists("form.backup-code-token"),
|
||||
"backup code form is not shown by default when TOTP is allowed"
|
||||
);
|
||||
assert
|
||||
.dom("#security-key-authenticate-button")
|
||||
.doesNotExist("security key method is not shown when it's not allowed");
|
||||
assert
|
||||
.dom("form.totp-token")
|
||||
.exists("totp is the default method when security key is not allowed");
|
||||
assert
|
||||
.dom("form.backup-code-token")
|
||||
.doesNotExist(
|
||||
"backup code form is not shown by default when TOTP is allowed"
|
||||
);
|
||||
|
||||
await visit("/");
|
||||
await visit("/session/2fa?nonce=ok110111");
|
||||
assert.ok(
|
||||
!exists("#security-key-authenticate-button"),
|
||||
"security key method is not shown when it's not enabled"
|
||||
);
|
||||
assert.ok(
|
||||
exists("form.totp-token"),
|
||||
"totp is the default method when security key is not enabled"
|
||||
);
|
||||
assert.ok(
|
||||
!exists("form.backup-code-token"),
|
||||
"backup code form is not shown by default when TOTP is enabled"
|
||||
);
|
||||
assert
|
||||
.dom("#security-key-authenticate-button")
|
||||
.doesNotExist("security key method is not shown when it's not enabled");
|
||||
assert
|
||||
.dom("form.totp-token")
|
||||
.exists("totp is the default method when security key is not enabled");
|
||||
assert
|
||||
.dom("form.backup-code-token")
|
||||
.doesNotExist(
|
||||
"backup code form is not shown by default when TOTP is enabled"
|
||||
);
|
||||
});
|
||||
|
||||
test("alternative 2FA methods", async function (assert) {
|
||||
await visit("/session/2fa?nonce=ok111111");
|
||||
assert.ok(
|
||||
exists(".toggle-second-factor-method.totp"),
|
||||
"TOTP is shown as an alternative method if it's enabled and allowed"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".toggle-second-factor-method.backup-code"),
|
||||
"backup code is shown as an alternative method if it's enabled and allowed"
|
||||
);
|
||||
assert.ok(
|
||||
!exists(".toggle-second-factor-method.security-key"),
|
||||
"security key is not shown as an alternative method when it's selected"
|
||||
);
|
||||
assert
|
||||
.dom(".toggle-second-factor-method.totp")
|
||||
.exists(
|
||||
"TOTP is shown as an alternative method if it's enabled and allowed"
|
||||
);
|
||||
assert
|
||||
.dom(".toggle-second-factor-method.backup-code")
|
||||
.exists(
|
||||
"backup code is shown as an alternative method if it's enabled and allowed"
|
||||
);
|
||||
assert
|
||||
.dom(".toggle-second-factor-method.security-key")
|
||||
.doesNotExist(
|
||||
"security key is not shown as an alternative method when it's selected"
|
||||
);
|
||||
|
||||
await visit("/");
|
||||
await visit("/session/2fa?nonce=ok100111");
|
||||
assert.ok(
|
||||
!exists(".toggle-second-factor-method"),
|
||||
"no alternative methods are shown if only 1 method is enabled"
|
||||
);
|
||||
assert
|
||||
.dom(".toggle-second-factor-method")
|
||||
.doesNotExist(
|
||||
"no alternative methods are shown if only 1 method is enabled"
|
||||
);
|
||||
|
||||
await visit("/");
|
||||
await visit("/session/2fa?nonce=ok111010");
|
||||
assert.ok(
|
||||
!exists(".toggle-second-factor-method"),
|
||||
"no alternative methods are shown if only 1 method is allowed"
|
||||
);
|
||||
assert
|
||||
.dom(".toggle-second-factor-method")
|
||||
.doesNotExist(
|
||||
"no alternative methods are shown if only 1 method is allowed"
|
||||
);
|
||||
});
|
||||
|
||||
test("switching 2FA methods", async function (assert) {
|
||||
await visit("/session/2fa?nonce=ok111111");
|
||||
assert.ok(
|
||||
exists("#security-key-authenticate-button"),
|
||||
"security key form is shown because it's the default"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".toggle-second-factor-method.totp"),
|
||||
"TOTP is shown as an alternative method"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".toggle-second-factor-method.backup-code"),
|
||||
"backup code is shown as an alternative method"
|
||||
);
|
||||
assert.ok(
|
||||
!exists(".toggle-second-factor-method.security-key"),
|
||||
"security key is not shown as an alternative method because it's selected"
|
||||
);
|
||||
assert
|
||||
.dom("#security-key-authenticate-button")
|
||||
.exists("security key form is shown because it's the default");
|
||||
assert
|
||||
.dom(".toggle-second-factor-method.totp")
|
||||
.exists("TOTP is shown as an alternative method");
|
||||
assert
|
||||
.dom(".toggle-second-factor-method.backup-code")
|
||||
.exists("backup code is shown as an alternative method");
|
||||
assert
|
||||
.dom(".toggle-second-factor-method.security-key")
|
||||
.doesNotExist(
|
||||
"security key is not shown as an alternative method because it's selected"
|
||||
);
|
||||
|
||||
await click(".toggle-second-factor-method.totp");
|
||||
assert.ok(exists("form.totp-token"), "TOTP form is now shown");
|
||||
assert.ok(
|
||||
exists(".toggle-second-factor-method.security-key"),
|
||||
"security key is now shown as alternative method"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".toggle-second-factor-method.backup-code"),
|
||||
"backup code is still shown as an alternative method"
|
||||
);
|
||||
assert.ok(
|
||||
!exists(".toggle-second-factor-method.totp"),
|
||||
"TOTP is no longer shown as an alternative method"
|
||||
);
|
||||
assert
|
||||
.dom(".toggle-second-factor-method.security-key")
|
||||
.exists("security key is now shown as alternative method");
|
||||
assert
|
||||
.dom(".toggle-second-factor-method.backup-code")
|
||||
.exists("backup code is still shown as an alternative method");
|
||||
assert
|
||||
.dom(".toggle-second-factor-method.totp")
|
||||
.doesNotExist("TOTP is no longer shown as an alternative method");
|
||||
|
||||
await click(".toggle-second-factor-method.backup-code");
|
||||
assert.ok(
|
||||
exists("form.backup-code-token"),
|
||||
"backup code form is now shown"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".toggle-second-factor-method.security-key"),
|
||||
"security key is still shown as alternative method"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".toggle-second-factor-method.totp"),
|
||||
"TOTP is now shown as an alternative method"
|
||||
);
|
||||
assert.ok(
|
||||
!exists(".toggle-second-factor-method.backup-code"),
|
||||
"backup code is no longer shown as an alternative method"
|
||||
);
|
||||
assert
|
||||
.dom("form.backup-code-token")
|
||||
.exists("backup code form is now shown");
|
||||
assert
|
||||
.dom(".toggle-second-factor-method.security-key")
|
||||
.exists("security key is still shown as alternative method");
|
||||
assert
|
||||
.dom(".toggle-second-factor-method.totp")
|
||||
.exists("TOTP is now shown as an alternative method");
|
||||
assert
|
||||
.dom(".toggle-second-factor-method.backup-code")
|
||||
.doesNotExist("backup code is no longer shown as an alternative method");
|
||||
|
||||
await click(".toggle-second-factor-method.security-key");
|
||||
assert.ok(
|
||||
exists("#security-key-authenticate-button"),
|
||||
"security key form is back"
|
||||
);
|
||||
assert.ok(
|
||||
!exists(".toggle-second-factor-method.security-key"),
|
||||
"security key is no longer shown as alternative method"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".toggle-second-factor-method.totp"),
|
||||
"TOTP is now shown as an alternative method"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".toggle-second-factor-method.backup-code"),
|
||||
"backup code is now shown as an alternative method"
|
||||
);
|
||||
assert
|
||||
.dom("#security-key-authenticate-button")
|
||||
.exists("security key form is back");
|
||||
assert
|
||||
.dom(".toggle-second-factor-method.security-key")
|
||||
.doesNotExist("security key is no longer shown as alternative method");
|
||||
assert
|
||||
.dom(".toggle-second-factor-method.totp")
|
||||
.exists("TOTP is now shown as an alternative method");
|
||||
assert
|
||||
.dom(".toggle-second-factor-method.backup-code")
|
||||
.exists("backup code is now shown as an alternative method");
|
||||
});
|
||||
|
||||
test("2FA action description", async function (assert) {
|
||||
|
|
|
@ -57,10 +57,9 @@ acceptance("Select-kit - Composer - Accessibility", function (needs) {
|
|||
"Escape"
|
||||
);
|
||||
|
||||
assert.notOk(
|
||||
exists(".mini-tag-chooser .select-kit-body .select-kit-row"),
|
||||
"Hitting Escape dismisses the tag chooser"
|
||||
);
|
||||
assert
|
||||
.dom(".mini-tag-chooser .select-kit-body .select-kit-row")
|
||||
.doesNotExist("Hitting Escape dismisses the tag chooser");
|
||||
|
||||
assert.ok(exists(".composer-fields"), "Escape does not dismiss composer");
|
||||
});
|
||||
|
|
|
@ -29,19 +29,17 @@ acceptance("Share and Invite modal", function (needs) {
|
|||
test("Topic footer button", async function (assert) {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
assert.ok(
|
||||
exists("#topic-footer-button-share-and-invite"),
|
||||
"the button exists"
|
||||
);
|
||||
assert
|
||||
.dom("#topic-footer-button-share-and-invite")
|
||||
.exists("the button exists");
|
||||
|
||||
await click("#topic-footer-button-share-and-invite");
|
||||
|
||||
assert.ok(exists(".share-topic-modal"), "it shows the modal");
|
||||
|
||||
assert.notOk(
|
||||
exists("#modal-alert.alert-warning"),
|
||||
"it does not show the alert with restricted groups"
|
||||
);
|
||||
assert
|
||||
.dom("#modal-alert.alert-warning")
|
||||
.doesNotExist("it does not show the alert with restricted groups");
|
||||
|
||||
assert.ok(
|
||||
query("input.invite-link").value.includes(
|
||||
|
@ -50,10 +48,9 @@ acceptance("Share and Invite modal", function (needs) {
|
|||
"it shows the topic sharing url"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(".link-share-actions .invite"),
|
||||
"it shows the invite button"
|
||||
);
|
||||
assert
|
||||
.dom(".link-share-actions .invite")
|
||||
.exists("it shows the invite button");
|
||||
|
||||
await click(".link-share-actions .invite");
|
||||
|
||||
|
@ -80,18 +77,16 @@ acceptance("Share and Invite modal", function (needs) {
|
|||
test("Share topic in a restricted category", async function (assert) {
|
||||
await visit("/t/topic-in-restricted-group/2481");
|
||||
|
||||
assert.ok(
|
||||
exists("#topic-footer-button-share-and-invite"),
|
||||
"the button exists"
|
||||
);
|
||||
assert
|
||||
.dom("#topic-footer-button-share-and-invite")
|
||||
.exists("the button exists");
|
||||
|
||||
await click("#topic-footer-button-share-and-invite");
|
||||
|
||||
assert.ok(exists(".share-topic-modal"), "it shows the modal");
|
||||
assert.ok(
|
||||
exists("#modal-alert.alert-warning"),
|
||||
"it shows restricted warning"
|
||||
);
|
||||
assert
|
||||
.dom("#modal-alert.alert-warning")
|
||||
.exists("it shows restricted warning");
|
||||
assert.dom("#modal-alert.alert-warning").hasText(
|
||||
I18n.t("topic.share.restricted_groups", {
|
||||
count: 2,
|
||||
|
@ -109,10 +104,9 @@ acceptance("Share and Invite modal - mobile", function (needs) {
|
|||
test("Topic footer mobile button", async function (assert) {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
assert.ok(
|
||||
!exists("#topic-footer-button-share-and-invite"),
|
||||
"the button doesn’t exist"
|
||||
);
|
||||
assert
|
||||
.dom("#topic-footer-button-share-and-invite")
|
||||
.doesNotExist("the button doesn’t exist");
|
||||
|
||||
const subject = selectKit(".topic-footer-mobile-dropdown");
|
||||
await subject.expand();
|
||||
|
|
|
@ -52,10 +52,9 @@ acceptance("Sidebar - Anonymous - Categories Section", function (needs) {
|
|||
sidebarCategories[4].name
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists("a.sidebar-section-link[data-link-name='all-categories']"),
|
||||
"all categories link is visible"
|
||||
);
|
||||
assert
|
||||
.dom("a.sidebar-section-link[data-link-name='all-categories']")
|
||||
.exists("all categories link is visible");
|
||||
});
|
||||
|
||||
test("category section links ordered by default category's position when default_navigation_menu_categories has not been configured and site setting to fix categories positions is enabled", async function (assert) {
|
||||
|
@ -96,10 +95,9 @@ acceptance("Sidebar - Anonymous - Categories Section", function (needs) {
|
|||
siteCategories[5].name
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists("a.sidebar-section-link[data-link-name='all-categories']"),
|
||||
"all categories link is visible"
|
||||
);
|
||||
assert
|
||||
.dom("a.sidebar-section-link[data-link-name='all-categories']")
|
||||
.exists("all categories link is visible");
|
||||
});
|
||||
|
||||
test("category section links in sidebar when default_navigation_menu_categories site setting has been configured and site setting to fix category position is enabled", async function (assert) {
|
||||
|
@ -117,10 +115,9 @@ acceptance("Sidebar - Anonymous - Categories Section", function (needs) {
|
|||
assert.strictEqual(categories[1].textContent.trim(), "blog");
|
||||
assert.strictEqual(categories[2].textContent.trim(), "bug");
|
||||
|
||||
assert.ok(
|
||||
exists("a.sidebar-section-link[data-link-name='all-categories']"),
|
||||
"all categories link is visible"
|
||||
);
|
||||
assert
|
||||
.dom("a.sidebar-section-link[data-link-name='all-categories']")
|
||||
.exists("all categories link is visible");
|
||||
});
|
||||
|
||||
test("default uncategorized category section links is not shown when allow_uncategorized_topics is disabled", async function (assert) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { click, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Sidebar - Anonymous User", function (needs) {
|
||||
needs.settings({
|
||||
|
@ -15,15 +15,13 @@ acceptance("Sidebar - Anonymous User", function (needs) {
|
|||
"adds sidebar utility class to body"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(".sidebar-container"),
|
||||
"sidebar exists for anonymous user"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-container")
|
||||
.exists("sidebar exists for anonymous user");
|
||||
|
||||
assert.ok(
|
||||
exists(".header-sidebar-toggle"),
|
||||
"toggle button for anonymous user"
|
||||
);
|
||||
assert
|
||||
.dom(".header-sidebar-toggle")
|
||||
.exists("toggle button for anonymous user");
|
||||
});
|
||||
|
||||
test("sidebar hamburger panel dropdown when sidebar has been disabled", async function (assert) {
|
||||
|
@ -32,10 +30,11 @@ acceptance("Sidebar - Anonymous User", function (needs) {
|
|||
await visit("/");
|
||||
await click(".hamburger-dropdown button");
|
||||
|
||||
assert.ok(
|
||||
exists(".sidebar-hamburger-dropdown .sidebar-sections-anonymous"),
|
||||
"sidebar hamburger panel dropdown renders anonymous sidebar sections"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-hamburger-dropdown .sidebar-sections-anonymous")
|
||||
.exists(
|
||||
"sidebar hamburger panel dropdown renders anonymous sidebar sections"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -48,14 +47,12 @@ acceptance("Sidebar - Anonymous User - Login Required", function (needs) {
|
|||
test("sidebar and toggle button is hidden", async function (assert) {
|
||||
await visit("/");
|
||||
|
||||
assert.ok(
|
||||
!exists(".sidebar-container"),
|
||||
"sidebar is hidden for anonymous user"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-container")
|
||||
.doesNotExist("sidebar is hidden for anonymous user");
|
||||
|
||||
assert.ok(
|
||||
!exists(".header-sidebar-toggle"),
|
||||
"toggle button is hidden for anonymous user"
|
||||
);
|
||||
assert
|
||||
.dom(".header-sidebar-toggle")
|
||||
.doesNotExist("toggle button is hidden for anonymous user");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -33,17 +33,15 @@ acceptance("Sidebar - Narrow Desktop", function (needs) {
|
|||
});
|
||||
await click(".btn-sidebar-toggle");
|
||||
|
||||
assert.ok(
|
||||
exists(".sidebar-hamburger-dropdown"),
|
||||
"cloak sidebar is displayed"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-hamburger-dropdown")
|
||||
.exists("cloak sidebar is displayed");
|
||||
|
||||
await triggerEvent(document.querySelector(".header-cloak"), "pointerdown");
|
||||
|
||||
assert.ok(
|
||||
!exists(".sidebar-hamburger-dropdown"),
|
||||
"cloak sidebar is collapsed"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-hamburger-dropdown")
|
||||
.doesNotExist("cloak sidebar is collapsed");
|
||||
|
||||
document.body.style.width = "1200px";
|
||||
await waitFor("#d-sidebar", {
|
||||
|
|
|
@ -295,10 +295,9 @@ acceptance("Sidebar - Plugin API", function (needs) {
|
|||
"displays first link with correct text"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(".sidebar-section-link.my-class-name"),
|
||||
"sets the custom class name for the section link"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-section-link.my-class-name")
|
||||
.exists("sets the custom class name for the section link");
|
||||
|
||||
assert.strictEqual(
|
||||
links[0].title,
|
||||
|
@ -453,10 +452,9 @@ acceptance("Sidebar - Plugin API", function (needs) {
|
|||
"displays header with correct text"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists("button.sidebar-section-header-button"),
|
||||
"displays single header action button"
|
||||
);
|
||||
assert
|
||||
.dom("button.sidebar-section-header-button")
|
||||
.exists("displays single header action button");
|
||||
|
||||
assert.ok(
|
||||
!exists(
|
||||
|
@ -505,10 +503,9 @@ acceptance("Sidebar - Plugin API", function (needs) {
|
|||
|
||||
await visit("/");
|
||||
|
||||
assert.notOk(
|
||||
exists(".sidebar-section[data-section-name='test-chat-channels']"),
|
||||
"does not display the section"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-section[data-section-name='test-chat-channels']")
|
||||
.doesNotExist("does not display the section");
|
||||
});
|
||||
|
||||
test("Registering a custom countable for a section link in the user's sidebar categories section", async function (assert) {
|
||||
|
|
|
@ -152,10 +152,9 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) {
|
|||
|
||||
await visit("/");
|
||||
|
||||
assert.ok(
|
||||
exists(".sidebar-section[data-section-name='categories']"),
|
||||
"categories section is shown"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-section[data-section-name='categories']")
|
||||
.exists("categories section is shown");
|
||||
|
||||
const categorySectionLinks = queryAll(
|
||||
".sidebar-section[data-section-name='categories'] .sidebar-section-link-wrapper[data-category-id]"
|
||||
|
|
|
@ -120,10 +120,9 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {
|
|||
"only one link is marked as active"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(`.sidebar-section-link-wrapper[data-tag-name=tag1] a.active`),
|
||||
"the tag1 section link is marked as active"
|
||||
);
|
||||
assert
|
||||
.dom(`.sidebar-section-link-wrapper[data-tag-name=tag1] a.active`)
|
||||
.exists("the tag1 section link is marked as active");
|
||||
|
||||
await click(".sidebar-section-link-wrapper[data-tag-name=tag2] a");
|
||||
|
||||
|
@ -141,10 +140,9 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {
|
|||
"only one link is marked as active"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(`.sidebar-section-link-wrapper[data-tag-name=tag2] a.active`),
|
||||
"the tag2 section link is marked as active"
|
||||
);
|
||||
assert
|
||||
.dom(`.sidebar-section-link-wrapper[data-tag-name=tag2] a.active`)
|
||||
.exists("the tag2 section link is marked as active");
|
||||
});
|
||||
|
||||
test("clicking tag section links - sidebar_link_to_filtered_list set to true and no unread or new topics", async function (assert) {
|
||||
|
@ -171,10 +169,9 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {
|
|||
"only one link is marked as active"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(`.sidebar-section-link-wrapper[data-tag-name=tag1] a.active`),
|
||||
"the tag1 section link is marked as active"
|
||||
);
|
||||
assert
|
||||
.dom(`.sidebar-section-link-wrapper[data-tag-name=tag1] a.active`)
|
||||
.exists("the tag1 section link is marked as active");
|
||||
});
|
||||
|
||||
test("clicking tag section links - sidebar_link_to_filtered_list set to true with new topics", async function (assert) {
|
||||
|
@ -215,10 +212,9 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {
|
|||
"only one link is marked as active"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(`.sidebar-section-link-wrapper[data-tag-name=tag1] a.active`),
|
||||
"the tag1 section link is marked as active"
|
||||
);
|
||||
assert
|
||||
.dom(`.sidebar-section-link-wrapper[data-tag-name=tag1] a.active`)
|
||||
.exists("the tag1 section link is marked as active");
|
||||
});
|
||||
|
||||
test("clicking tag section links - sidebar_link_to_filtered_list set to true with unread topics", async function (assert) {
|
||||
|
@ -259,10 +255,9 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {
|
|||
"only one link is marked as active"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(`.sidebar-section-link-wrapper[data-tag-name=tag1] a.active`),
|
||||
"the tag1 section link is marked as active"
|
||||
);
|
||||
assert
|
||||
.dom(`.sidebar-section-link-wrapper[data-tag-name=tag1] a.active`)
|
||||
.exists("the tag1 section link is marked as active");
|
||||
});
|
||||
|
||||
test("private message tag section links for user", async function (assert) {
|
||||
|
@ -284,10 +279,9 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {
|
|||
"only one link is marked as active"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(`.sidebar-section-link-wrapper[data-tag-name=tag4] a.active`),
|
||||
"the tag4 section link is marked as active"
|
||||
);
|
||||
assert
|
||||
.dom(`.sidebar-section-link-wrapper[data-tag-name=tag4] a.active`)
|
||||
.exists("the tag4 section link is marked as active");
|
||||
});
|
||||
|
||||
test("visiting tag discovery top route", async function (assert) {
|
||||
|
@ -301,10 +295,9 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {
|
|||
"only one link is marked as active"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(".sidebar-section-link-wrapper[data-tag-name=tag1] a.active"),
|
||||
"the tag1 section link is marked as active for the top route"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-section-link-wrapper[data-tag-name=tag1] a.active")
|
||||
.exists("the tag1 section link is marked as active for the top route");
|
||||
});
|
||||
|
||||
test("visiting tag discovery new ", async function (assert) {
|
||||
|
@ -318,10 +311,9 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {
|
|||
"only one link is marked as active"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(".sidebar-section-link-wrapper[data-tag-name=tag1] a.active"),
|
||||
"the tag1 section link is marked as active for the new route"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-section-link-wrapper[data-tag-name=tag1] a.active")
|
||||
.exists("the tag1 section link is marked as active for the new route");
|
||||
});
|
||||
|
||||
test("visiting tag discovery unread route", async function (assert) {
|
||||
|
@ -335,10 +327,9 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {
|
|||
"only one link is marked as active"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(".sidebar-section-link-wrapper[data-tag-name=tag1] a.active"),
|
||||
"the tag1 section link is marked as active for the unread route"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-section-link-wrapper[data-tag-name=tag1] a.active")
|
||||
.exists("the tag1 section link is marked as active for the unread route");
|
||||
});
|
||||
|
||||
test("show suffix indicator for new content on tag section links", async function (assert) {
|
||||
|
|
|
@ -13,29 +13,25 @@ acceptance("Signing In", function () {
|
|||
await fillIn("#login-account-password", "incorrect");
|
||||
await click(".d-modal__footer .btn-primary");
|
||||
assert.ok(exists("#modal-alert:visible"), "it displays the login error");
|
||||
assert.notOk(
|
||||
exists(".d-modal__footer .btn-primary:disabled"),
|
||||
"enables the login button"
|
||||
);
|
||||
assert
|
||||
.dom(".d-modal__footer .btn-primary:disabled")
|
||||
.doesNotExist("enables the login button");
|
||||
|
||||
// Test password unmasking
|
||||
assert.ok(
|
||||
exists("#login-account-password[type='password']"),
|
||||
"password is masked by default"
|
||||
);
|
||||
assert
|
||||
.dom("#login-account-password[type='password']")
|
||||
.exists("password is masked by default");
|
||||
await click(".toggle-password-mask");
|
||||
assert.ok(
|
||||
exists("#login-account-password[type='text']"),
|
||||
"password is unmasked after toggle is clicked"
|
||||
);
|
||||
assert
|
||||
.dom("#login-account-password[type='text']")
|
||||
.exists("password is unmasked after toggle is clicked");
|
||||
|
||||
// Use the correct password
|
||||
await fillIn("#login-account-password", "correct");
|
||||
await click(".d-modal__footer .btn-primary");
|
||||
assert.ok(
|
||||
exists(".d-modal__footer .btn-primary:disabled"),
|
||||
"disables the login button"
|
||||
);
|
||||
assert
|
||||
.dom(".d-modal__footer .btn-primary:disabled")
|
||||
.exists("disables the login button");
|
||||
});
|
||||
|
||||
test("sign in - not activated", async function (assert) {
|
||||
|
@ -87,26 +83,20 @@ acceptance("Signing In", function () {
|
|||
await fillIn("#login-account-password", "need-second-factor");
|
||||
await click(".d-modal__footer .btn-primary");
|
||||
|
||||
assert.notOk(
|
||||
exists("#credentials:visible"),
|
||||
"it hides the username and password prompt"
|
||||
);
|
||||
assert.ok(
|
||||
exists("#second-factor:visible"),
|
||||
"it displays the second factor prompt"
|
||||
);
|
||||
assert.notOk(
|
||||
exists(".d-modal__footer .btn-primary:disabled"),
|
||||
"enables the login button"
|
||||
);
|
||||
assert
|
||||
.dom("#credentials")
|
||||
.isNotVisible("hides the username and password prompt");
|
||||
assert.dom("#second-factor").isVisible("displays the second factor prompt");
|
||||
assert
|
||||
.dom(".d-modal__footer .btn-primary:disabled")
|
||||
.doesNotExist("enables the login button");
|
||||
|
||||
await fillIn("#login-second-factor", "123456");
|
||||
await click(".d-modal__footer .btn-primary");
|
||||
|
||||
assert.ok(
|
||||
exists(".d-modal__footer .btn-primary:disabled"),
|
||||
"disables the login button"
|
||||
);
|
||||
assert
|
||||
.dom(".d-modal__footer .btn-primary:disabled")
|
||||
.exists("disables the login button");
|
||||
});
|
||||
|
||||
test("security key", async function (assert) {
|
||||
|
@ -119,19 +109,14 @@ acceptance("Signing In", function () {
|
|||
await fillIn("#login-account-password", "need-security-key");
|
||||
await click(".d-modal__footer .btn-primary");
|
||||
|
||||
assert.notOk(
|
||||
exists("#credentials:visible"),
|
||||
"it hides the username and password prompt"
|
||||
);
|
||||
assert.notOk(
|
||||
exists("#login-second-factor:visible"),
|
||||
"it does not display the second factor prompt"
|
||||
);
|
||||
assert.ok(
|
||||
exists("#security-key:visible"),
|
||||
"it shows the security key prompt"
|
||||
);
|
||||
assert.notOk(exists("#login-button:visible"), "hides the login button");
|
||||
assert
|
||||
.dom("#credentials")
|
||||
.isNotVisible("hides the username and password prompt");
|
||||
assert
|
||||
.dom("#login-second-factor")
|
||||
.isNotVisible("does not display the second factor prompt");
|
||||
assert.dom("#security-key").isVisible("shows the security key prompt");
|
||||
assert.dom("#login-button").isNotVisible("hides the login button");
|
||||
});
|
||||
|
||||
test("second factor backup - valid token", async function (assert) {
|
||||
|
@ -144,10 +129,9 @@ acceptance("Signing In", function () {
|
|||
await fillIn("#login-second-factor", "123456");
|
||||
await click(".d-modal__footer .btn-primary");
|
||||
|
||||
assert.ok(
|
||||
exists(".d-modal__footer .btn-primary:disabled"),
|
||||
"it closes the modal when the code is valid"
|
||||
);
|
||||
assert
|
||||
.dom(".d-modal__footer .btn-primary:disabled")
|
||||
.exists("it closes the modal when the code is valid");
|
||||
});
|
||||
|
||||
test("second factor backup - invalid token", async function (assert) {
|
||||
|
@ -160,9 +144,8 @@ acceptance("Signing In", function () {
|
|||
await fillIn("#login-second-factor", "something");
|
||||
await click(".d-modal__footer .btn-primary");
|
||||
|
||||
assert.ok(
|
||||
exists("#modal-alert:visible"),
|
||||
"it shows an error when the code is invalid"
|
||||
);
|
||||
assert
|
||||
.dom("#modal-alert")
|
||||
.exists("shows an error when the code is invalid");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import { setPrefix } from "discourse-common/lib/get-url";
|
||||
|
||||
|
@ -82,10 +78,9 @@ acceptance("Tag Groups", function (needs) {
|
|||
await click(".tag-group-content .btn.btn-primary");
|
||||
await click(".tag-groups-sidebar li:first-child a");
|
||||
|
||||
assert.ok(
|
||||
exists("#visible-permission:checked"),
|
||||
"selected permission does not change after saving"
|
||||
);
|
||||
assert
|
||||
.dom("#visible-permission:checked")
|
||||
.exists("selected permission does not change after saving");
|
||||
});
|
||||
|
||||
test("going back to tags supports subfolder", async function (assert) {
|
||||
|
|
|
@ -206,10 +206,7 @@ acceptance("Theme", function (needs) {
|
|||
|
||||
await click(".admin-install-theme-modal .d-modal__footer .btn-danger");
|
||||
|
||||
assert.notOk(
|
||||
exists(".admin-install-theme-modal:visible"),
|
||||
"modal is closed"
|
||||
);
|
||||
assert.dom(".admin-install-theme-modal").doesNotExist("modal is closed");
|
||||
});
|
||||
|
||||
test("can continue installation", async function (assert) {
|
||||
|
|
|
@ -12,10 +12,9 @@ acceptance("Topic - Admin Menu Anonymous Users", function () {
|
|||
test("Enter as a regular user", async function (assert) {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
assert.ok(exists("#topic"), "The topic was rendered");
|
||||
assert.ok(
|
||||
!exists(".toggle-admin-menu"),
|
||||
"The admin menu button was not rendered"
|
||||
);
|
||||
assert
|
||||
.dom(".toggle-admin-menu")
|
||||
.doesNotExist("The admin menu button was not rendered");
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -26,10 +25,9 @@ acceptance("Topic - Admin Menu", function (needs) {
|
|||
|
||||
await visit("/t/topic-for-group-moderators/2480");
|
||||
assert.ok(exists("#topic"), "The topic was rendered");
|
||||
assert.ok(
|
||||
exists(".toggle-admin-menu"),
|
||||
"The admin menu button was rendered"
|
||||
);
|
||||
assert
|
||||
.dom(".toggle-admin-menu")
|
||||
.exists("The admin menu button was rendered");
|
||||
|
||||
await click(".toggle-admin-menu");
|
||||
assert.ok(exists(".topic-admin-delete"), "The delete item was rendered");
|
||||
|
@ -40,10 +38,9 @@ acceptance("Topic - Admin Menu", function (needs) {
|
|||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
assert.ok(exists("#topic"), "The topic was rendered");
|
||||
assert.ok(
|
||||
exists(".toggle-admin-menu"),
|
||||
"The admin menu button was rendered"
|
||||
);
|
||||
assert
|
||||
.dom(".toggle-admin-menu")
|
||||
.exists("The admin menu button was rendered");
|
||||
});
|
||||
|
||||
test("Button added using addTopicAdminMenuButton", async function (assert) {
|
||||
|
@ -66,10 +63,9 @@ acceptance("Topic - Admin Menu", function (needs) {
|
|||
await visit("/t/internationalization-localization/280");
|
||||
assert.ok(exists("#topic"), "The topic was rendered");
|
||||
await click(".toggle-admin-menu");
|
||||
assert.ok(
|
||||
exists(".extra-button svg.d-icon-heart"),
|
||||
"The icon was rendered"
|
||||
);
|
||||
assert
|
||||
.dom(".extra-button svg.d-icon-heart")
|
||||
.exists("The icon was rendered");
|
||||
assert
|
||||
.dom(".extra-button .d-button-label")
|
||||
.hasText(I18n.t("yes_value"), "The label was rendered");
|
||||
|
|
|
@ -7,10 +7,9 @@ acceptance("Topic - Anonymous", function () {
|
|||
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(
|
||||
!exists(".shared-draft-notice"),
|
||||
"no shared draft unless there's a dest category id"
|
||||
);
|
||||
assert
|
||||
.dom(".shared-draft-notice")
|
||||
.doesNotExist("no shared draft unless there's a dest category id");
|
||||
});
|
||||
|
||||
test("Enter without an id", async function (assert) {
|
||||
|
|
|
@ -78,42 +78,38 @@ acceptance("Topic Discovery", function (needs) {
|
|||
|
||||
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"
|
||||
);
|
||||
assert
|
||||
.dom(".category-boxes")
|
||||
.exists("The list of subcategories were rendered with box style");
|
||||
|
||||
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"
|
||||
);
|
||||
assert
|
||||
.dom(".category-boxes-with-topics")
|
||||
.exists(
|
||||
"The list of subcategories were rendered with box-with-featured-topics style"
|
||||
);
|
||||
assert
|
||||
.dom(".category-boxes-with-topics .featured-topics")
|
||||
.exists("The featured topics are there too");
|
||||
});
|
||||
|
||||
test("Clearing state after leaving a category", async function (assert) {
|
||||
await visit("/c/dev");
|
||||
assert.ok(
|
||||
exists('.topic-list-item[data-topic-id="11994"] .topic-excerpt'),
|
||||
"it expands pinned topics in a subcategory"
|
||||
);
|
||||
assert
|
||||
.dom('.topic-list-item[data-topic-id="11994"] .topic-excerpt')
|
||||
.exists("it expands pinned topics in a subcategory");
|
||||
await visit("/");
|
||||
assert.ok(
|
||||
!exists('.topic-list-item[data-topic-id="11557"] .topic-excerpt'),
|
||||
"it doesn't expand all pinned in the latest category"
|
||||
);
|
||||
assert
|
||||
.dom('.topic-list-item[data-topic-id="11557"] .topic-excerpt')
|
||||
.doesNotExist("it doesn't expand all pinned in the latest category");
|
||||
});
|
||||
|
||||
test("Live update unread state", async function (assert) {
|
||||
await visit("/");
|
||||
assert.ok(
|
||||
exists(".topic-list-item:not(.visited) a[data-topic-id='11995']"),
|
||||
"shows the topic unread"
|
||||
);
|
||||
assert
|
||||
.dom(".topic-list-item:not(.visited) a[data-topic-id='11995']")
|
||||
.exists("shows the topic unread");
|
||||
|
||||
await publishToMessageBus("/latest", {
|
||||
message_type: "read",
|
||||
|
@ -126,10 +122,9 @@ acceptance("Topic Discovery", function (needs) {
|
|||
},
|
||||
});
|
||||
|
||||
assert.ok(
|
||||
exists(".topic-list-item.visited a[data-topic-id='11995']"),
|
||||
"shows the topic read"
|
||||
);
|
||||
assert
|
||||
.dom(".topic-list-item.visited a[data-topic-id='11995']")
|
||||
.exists("shows the topic read");
|
||||
});
|
||||
|
||||
test("Using period chooser when query params are present", async function (assert) {
|
||||
|
|
|
@ -5,7 +5,6 @@ import Site from "discourse/models/site";
|
|||
import topicFixtures from "discourse/tests/fixtures/discovery-fixtures";
|
||||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
publishToMessageBus,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
|
@ -64,24 +63,27 @@ acceptance("Topic Discovery Tracked", function (needs) {
|
|||
|
||||
await visit("/");
|
||||
|
||||
assert.ok(
|
||||
exists("#navigation-bar li.categories"),
|
||||
"the categories nav item is displayed when tracked filter is not present"
|
||||
);
|
||||
assert
|
||||
.dom("#navigation-bar li.categories")
|
||||
.exists(
|
||||
"the categories nav item is displayed when tracked filter is not present"
|
||||
);
|
||||
|
||||
await visit("/categories");
|
||||
|
||||
assert.ok(
|
||||
exists("#navigation-bar li.categories"),
|
||||
"the categories nav item is displayed on categories route when tracked filter is not present"
|
||||
);
|
||||
assert
|
||||
.dom("#navigation-bar li.categories")
|
||||
.exists(
|
||||
"the categories nav item is displayed on categories route when tracked filter is not present"
|
||||
);
|
||||
|
||||
await visit("/?f=tracked");
|
||||
|
||||
assert.ok(
|
||||
!exists("#navigation-bar li.categories"),
|
||||
"the categories nav item is not displayed when tracked filter is present"
|
||||
);
|
||||
assert
|
||||
.dom("#navigation-bar li.categories")
|
||||
.doesNotExist(
|
||||
"the categories nav item is not displayed when tracked filter is present"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
query("#navigation-bar li.unread a").href.endsWith("/unread?f=tracked"),
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
} from "discourse/lib/topic-list-tracker";
|
||||
import discoveryFixtures from "discourse/tests/fixtures/discovery-fixtures";
|
||||
import topicFixtures from "discourse/tests/fixtures/topic";
|
||||
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { cloneJSON } from "discourse-common/lib/object";
|
||||
|
||||
acceptance("Topic list tracking", function (needs) {
|
||||
|
@ -65,10 +65,9 @@ acceptance("Topic list tracking", function (needs) {
|
|||
|
||||
await visit("/");
|
||||
|
||||
assert.ok(
|
||||
exists("tr[data-topic-id='11557'] .unread-posts"),
|
||||
"unread count for topic is shown"
|
||||
);
|
||||
assert
|
||||
.dom("tr[data-topic-id='11557'] .unread-posts")
|
||||
.exists("unread count for topic is shown");
|
||||
});
|
||||
|
||||
test("unread count is not set on topic that user is not tracking", async function (assert) {
|
||||
|
@ -80,9 +79,8 @@ acceptance("Topic list tracking", function (needs) {
|
|||
|
||||
await visit("/");
|
||||
|
||||
assert.notOk(
|
||||
exists("tr[data-topic-id='11557'] .unread-posts"),
|
||||
"unread count for topic is not shown"
|
||||
);
|
||||
assert
|
||||
.dom("tr[data-topic-id='11557'] .unread-posts")
|
||||
.doesNotExist("unread count for topic is not shown");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import I18n from "discourse-i18n";
|
||||
|
||||
acceptance("Topic move posts", function (needs) {
|
||||
|
@ -127,10 +123,11 @@ acceptance("Topic move posts", function (needs) {
|
|||
|
||||
await fillIn(".choose-topic-modal #choose-topic-title", "Topic");
|
||||
|
||||
assert.notOk(
|
||||
exists(".choose-topic-modal .checkbox-label"),
|
||||
"there is no chronological order checkbox when no topic is selected"
|
||||
);
|
||||
assert
|
||||
.dom(".choose-topic-modal .checkbox-label")
|
||||
.doesNotExist(
|
||||
"there is no chronological order checkbox when no topic is selected"
|
||||
);
|
||||
|
||||
await click(".choose-topic-list .existing-topic:first-child input");
|
||||
|
||||
|
@ -221,10 +218,11 @@ acceptance("Topic move posts", function (needs) {
|
|||
|
||||
await fillIn(".choose-topic-modal #choose-message-title", "Topic");
|
||||
|
||||
assert.notOk(
|
||||
exists(".choose-topic-modal .checkbox-label"),
|
||||
"there is no chronological order checkbox when no message is selected"
|
||||
);
|
||||
assert
|
||||
.dom(".choose-topic-modal .checkbox-label")
|
||||
.doesNotExist(
|
||||
"there is no chronological order checkbox when no message is selected"
|
||||
);
|
||||
|
||||
await click(".choose-topic-modal .existing-message:first-of-type input");
|
||||
|
||||
|
|
|
@ -45,14 +45,12 @@ acceptance("Topic - Quote button - logged in", function (needs) {
|
|||
await selectText("#post_5 blockquote");
|
||||
|
||||
assert.ok(exists(".quote-sharing"), "it shows the quote sharing options");
|
||||
assert.ok(
|
||||
exists(`.quote-sharing .btn[title='${I18n.t("share.twitter")}']`),
|
||||
"it includes the twitter share button"
|
||||
);
|
||||
assert.ok(
|
||||
exists(`.quote-sharing .btn[title='${I18n.t("share.email")}']`),
|
||||
"it includes the email share button"
|
||||
);
|
||||
assert
|
||||
.dom(`.quote-sharing .btn[title='${I18n.t("share.twitter")}']`)
|
||||
.exists("it includes the twitter share button");
|
||||
assert
|
||||
.dom(`.quote-sharing .btn[title='${I18n.t("share.email")}']`)
|
||||
.exists("it includes the email share button");
|
||||
});
|
||||
|
||||
test("Quoting a Onebox should not copy the formatting of the rendered Onebox", async function (assert) {
|
||||
|
@ -105,14 +103,12 @@ acceptance("Topic - Quote button - anonymous", function (needs) {
|
|||
await selectText("#post_5 blockquote");
|
||||
|
||||
assert.ok(queryAll(".quote-sharing"), "it shows the quote sharing options");
|
||||
assert.ok(
|
||||
exists(`.quote-sharing .btn[title='${I18n.t("share.twitter")}']`),
|
||||
"it includes the twitter share button"
|
||||
);
|
||||
assert.ok(
|
||||
exists(`.quote-sharing .btn[title='${I18n.t("share.email")}']`),
|
||||
"it includes the email share button"
|
||||
);
|
||||
assert
|
||||
.dom(`.quote-sharing .btn[title='${I18n.t("share.twitter")}']`)
|
||||
.exists("it includes the twitter share button");
|
||||
assert
|
||||
.dom(`.quote-sharing .btn[title='${I18n.t("share.email")}']`)
|
||||
.exists("it includes the email share button");
|
||||
assert.ok(!exists(".insert-quote"), "it does not show the quote button");
|
||||
});
|
||||
|
||||
|
@ -123,14 +119,12 @@ acceptance("Topic - Quote button - anonymous", function (needs) {
|
|||
await selectText("#post_5 blockquote");
|
||||
|
||||
assert.ok(exists(".quote-sharing"), "it shows the quote sharing options");
|
||||
assert.ok(
|
||||
exists(`.quote-sharing .btn[title='${I18n.t("share.twitter")}']`),
|
||||
"it includes the twitter share button"
|
||||
);
|
||||
assert.ok(
|
||||
!exists(".quote-share-label"),
|
||||
"it does not show the Share label"
|
||||
);
|
||||
assert
|
||||
.dom(`.quote-sharing .btn[title='${I18n.t("share.twitter")}']`)
|
||||
.exists("it includes the twitter share button");
|
||||
assert
|
||||
.dom(".quote-share-label")
|
||||
.doesNotExist("it does not show the Share label");
|
||||
});
|
||||
|
||||
test("Shows nothing when visibility is disabled", async function (assert) {
|
||||
|
|
|
@ -95,10 +95,9 @@ acceptance("Topic", function (needs) {
|
|||
await visit("/t/internationalization-localization/280");
|
||||
await click(".topic-post:first-child button.post-action-menu__copy-link");
|
||||
|
||||
assert.ok(
|
||||
exists(".post-action-menu__copy-link-checkmark"),
|
||||
"it shows the Link Copied! message"
|
||||
);
|
||||
assert
|
||||
.dom(".post-action-menu__copy-link-checkmark")
|
||||
.exists("it shows the Link Copied! message");
|
||||
});
|
||||
|
||||
test("Showing and hiding the edit controls", async function (assert) {
|
||||
|
@ -107,10 +106,9 @@ acceptance("Topic", function (needs) {
|
|||
await click("#topic-title .d-icon-pencil");
|
||||
|
||||
assert.ok(exists("#edit-title"), "it shows the editing controls");
|
||||
assert.ok(
|
||||
!exists(".title-wrapper .remove-featured-link"),
|
||||
"link to remove featured link is not shown"
|
||||
);
|
||||
assert
|
||||
.dom(".title-wrapper .remove-featured-link")
|
||||
.doesNotExist("link to remove featured link is not shown");
|
||||
|
||||
await fillIn("#edit-title", "this is the new title");
|
||||
await click("#topic-title .cancel-edit");
|
||||
|
@ -258,10 +256,9 @@ acceptance("Topic", function (needs) {
|
|||
test("Suspended user posts", async function (assert) {
|
||||
await visit("/t/topic-from-suspended-user/54077");
|
||||
|
||||
assert.ok(
|
||||
exists(".topic-post.user-suspended > #post_1"),
|
||||
"it has a class applied"
|
||||
);
|
||||
assert
|
||||
.dom(".topic-post.user-suspended > #post_1")
|
||||
.exists("it has a class applied");
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -285,16 +282,14 @@ acceptance("Topic featured links", function (needs) {
|
|||
|
||||
test("remove featured link", async function (assert) {
|
||||
await visit("/t/-/299/1");
|
||||
assert.ok(
|
||||
exists(".title-wrapper .topic-featured-link"),
|
||||
"link is shown with topic title"
|
||||
);
|
||||
assert
|
||||
.dom(".title-wrapper .topic-featured-link")
|
||||
.exists("link is shown with topic title");
|
||||
|
||||
await click(".title-wrapper .edit-topic");
|
||||
assert.ok(
|
||||
exists(".title-wrapper .remove-featured-link"),
|
||||
"link to remove featured link"
|
||||
);
|
||||
assert
|
||||
.dom(".title-wrapper .remove-featured-link")
|
||||
.exists("link to remove featured link");
|
||||
|
||||
// TODO: decide if we want to test this, test is flaky so it
|
||||
// was commented out.
|
||||
|
@ -332,10 +327,9 @@ acceptance("Topic featured links", function (needs) {
|
|||
await click(".topic-admin-visible .btn");
|
||||
|
||||
await click(".toggle-admin-menu");
|
||||
assert.ok(
|
||||
exists(".topic-admin-pin"),
|
||||
"it should show the multi select menu"
|
||||
);
|
||||
assert
|
||||
.dom(".topic-admin-pin")
|
||||
.exists("it should show the multi select menu");
|
||||
});
|
||||
|
||||
test("selecting posts", async function (assert) {
|
||||
|
@ -343,15 +337,13 @@ acceptance("Topic featured links", function (needs) {
|
|||
await click(".toggle-admin-menu");
|
||||
await click(".topic-admin-multi-select .btn");
|
||||
|
||||
assert.ok(
|
||||
exists(".selected-posts:not(.hidden)"),
|
||||
"it should show the multi select menu"
|
||||
);
|
||||
assert
|
||||
.dom(".selected-posts:not(.hidden)")
|
||||
.exists("it should show the multi select menu");
|
||||
|
||||
assert.ok(
|
||||
exists(".select-all"),
|
||||
"it should allow users to select all the posts"
|
||||
);
|
||||
assert
|
||||
.dom(".select-all")
|
||||
.exists("it should allow users to select all the posts");
|
||||
});
|
||||
|
||||
test("select below", async function (assert) {
|
||||
|
@ -459,16 +451,14 @@ acceptance("Topic featured links", function (needs) {
|
|||
|
||||
test("remove featured link", async function (assert) {
|
||||
await visit("/t/-/299/1");
|
||||
assert.ok(
|
||||
exists(".title-wrapper .topic-featured-link"),
|
||||
"link is shown with topic title"
|
||||
);
|
||||
assert
|
||||
.dom(".title-wrapper .topic-featured-link")
|
||||
.exists("link is shown with topic title");
|
||||
|
||||
await click(".title-wrapper .edit-topic");
|
||||
assert.ok(
|
||||
exists(".title-wrapper .remove-featured-link"),
|
||||
"link to remove featured link"
|
||||
);
|
||||
assert
|
||||
.dom(".title-wrapper .remove-featured-link")
|
||||
.exists("link to remove featured link");
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -510,15 +500,13 @@ acceptance("Topic pinning/unpinning as an admin", function (needs) {
|
|||
await click(".toggle-admin-menu");
|
||||
await click(".topic-admin-pin .btn");
|
||||
|
||||
assert.ok(
|
||||
exists(".feature-topic .btn-primary"),
|
||||
"it should show the 'Pin Topic' button"
|
||||
);
|
||||
assert
|
||||
.dom(".feature-topic .btn-primary")
|
||||
.exists("it should show the 'Pin Topic' button");
|
||||
|
||||
assert.ok(
|
||||
exists(".make-banner"),
|
||||
"it should show the 'Banner Topic' button"
|
||||
);
|
||||
assert
|
||||
.dom(".make-banner")
|
||||
.exists("it should show the 'Banner Topic' button");
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -531,15 +519,13 @@ acceptance("Topic pinning/unpinning as a staff member", function (needs) {
|
|||
await click(".toggle-admin-menu");
|
||||
await click(".topic-admin-pin .btn");
|
||||
|
||||
assert.ok(
|
||||
exists(".feature-topic .btn-primary"),
|
||||
"it should show the 'Pin Topic' button"
|
||||
);
|
||||
assert
|
||||
.dom(".feature-topic .btn-primary")
|
||||
.exists("it should show the 'Pin Topic' button");
|
||||
|
||||
assert.ok(
|
||||
exists(".make-banner"),
|
||||
"it should show the 'Banner Topic' button"
|
||||
);
|
||||
assert
|
||||
.dom(".make-banner")
|
||||
.exists("it should show the 'Banner Topic' button");
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -552,15 +538,13 @@ acceptance("Topic pinning/unpinning as a group moderator", function (needs) {
|
|||
await click(".toggle-admin-menu");
|
||||
await click(".topic-admin-pin .btn");
|
||||
|
||||
assert.ok(
|
||||
exists(".feature-topic .btn-primary"),
|
||||
"it should show the 'Pin Topic' button"
|
||||
);
|
||||
assert
|
||||
.dom(".feature-topic .btn-primary")
|
||||
.exists("it should show the 'Pin Topic' button");
|
||||
|
||||
assert.ok(
|
||||
!exists(".make-banner"),
|
||||
"it should not show the 'Banner Topic' button"
|
||||
);
|
||||
assert
|
||||
.dom(".make-banner")
|
||||
.doesNotExist("it should not show the 'Banner Topic' button");
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -570,17 +554,15 @@ acceptance("Topic last visit line", function (needs) {
|
|||
test("visit topic", async function (assert) {
|
||||
await visit("/t/-/280");
|
||||
|
||||
assert.ok(
|
||||
exists(".topic-post-visited-line.post-10"),
|
||||
"shows the last visited line on the right post"
|
||||
);
|
||||
assert
|
||||
.dom(".topic-post-visited-line.post-10")
|
||||
.exists("shows the last visited line on the right post");
|
||||
|
||||
await visit("/t/-/9");
|
||||
|
||||
assert.ok(
|
||||
!exists(".topic-post-visited-line"),
|
||||
"does not show last visited line if post is the last post"
|
||||
);
|
||||
assert
|
||||
.dom(".topic-post-visited-line")
|
||||
.doesNotExist("does not show last visited line if post is the last post");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { click, currentURL, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Glimmer Topic Timeline", function (needs) {
|
||||
needs.user({
|
||||
|
@ -334,26 +334,23 @@ acceptance("Glimmer Topic Timeline", function (needs) {
|
|||
|
||||
test("it has a topic admin menu", async function (assert) {
|
||||
await visit("/t/internationalization-localization");
|
||||
assert.ok(
|
||||
exists(".timeline-controls .topic-admin-menu-button"),
|
||||
"admin menu is present"
|
||||
);
|
||||
assert
|
||||
.dom(".timeline-controls .topic-admin-menu-button")
|
||||
.exists("admin menu is present");
|
||||
});
|
||||
|
||||
test("it has a reply-to-post button", async function (assert) {
|
||||
await visit("/t/internationalization-localization");
|
||||
assert.ok(
|
||||
exists(".timeline-footer-controls .reply-to-post"),
|
||||
"reply to post button is present"
|
||||
);
|
||||
assert
|
||||
.dom(".timeline-footer-controls .reply-to-post")
|
||||
.exists("reply to post button is present");
|
||||
});
|
||||
|
||||
test("it has a topic notification button", async function (assert) {
|
||||
await visit("/t/internationalization-localization");
|
||||
assert.ok(
|
||||
exists(".timeline-footer-controls .topic-notifications-button"),
|
||||
"topic notifications button is present"
|
||||
);
|
||||
assert
|
||||
.dom(".timeline-footer-controls .topic-notifications-button")
|
||||
.exists("topic notifications button is present");
|
||||
});
|
||||
|
||||
test("Shows dates of first and last posts", async function (assert) {
|
||||
|
|
|
@ -3,7 +3,6 @@ import { test } from "qunit";
|
|||
import TopicFixtures from "discourse/tests/fixtures/topic";
|
||||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
publishToMessageBus,
|
||||
query,
|
||||
queryAll,
|
||||
|
@ -121,10 +120,9 @@ acceptance("Topic - User Status - live updates", function (needs) {
|
|||
|
||||
await publishToMessageBus(`/user-status`, { [userId]: null });
|
||||
|
||||
assert.notOk(
|
||||
exists(".topic-post .user-status-message"),
|
||||
"status on all posts has disappeared"
|
||||
);
|
||||
assert
|
||||
.dom(".topic-post .user-status-message")
|
||||
.doesNotExist("status on all posts has disappeared");
|
||||
|
||||
const newStatus = { emoji: "surfing_man", description: "surfing" };
|
||||
await publishToMessageBus(`/user-status`, { [userId]: newStatus });
|
||||
|
|
|
@ -2,7 +2,7 @@ import { click, visit } from "@ember/test-helpers";
|
|||
import { test } from "qunit";
|
||||
import I18n from "discourse-i18n";
|
||||
import userFixtures from "../fixtures/user-fixtures";
|
||||
import { acceptance, exists, query, queryAll } from "../helpers/qunit-helpers";
|
||||
import { acceptance, query, queryAll } from "../helpers/qunit-helpers";
|
||||
|
||||
acceptance("User Activity / Topics - bulk actions", function (needs) {
|
||||
const currentUser = "eviltrout";
|
||||
|
@ -29,10 +29,9 @@ acceptance("User Activity / Topics - bulk actions", function (needs) {
|
|||
await click(".bulk-select-topics-dropdown-trigger");
|
||||
await click(".dropdown-menu__item .close-topics");
|
||||
|
||||
assert.notOk(
|
||||
exists("div.bulk-buttons"),
|
||||
"The bulk actions modal was closed"
|
||||
);
|
||||
assert
|
||||
.dom("div.bulk-buttons")
|
||||
.doesNotExist("The bulk actions modal was closed");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -29,10 +29,9 @@ acceptance("User Drafts", function (needs) {
|
|||
|
||||
await visit("/");
|
||||
assert.ok(visible("#create-topic"));
|
||||
assert.ok(
|
||||
!exists("#create-topic.open-draft"),
|
||||
"Open Draft button is not present"
|
||||
);
|
||||
assert
|
||||
.dom("#create-topic.open-draft")
|
||||
.doesNotExist("Open Draft button is not present");
|
||||
});
|
||||
|
||||
test("Stream - resume draft", async function (assert) {
|
||||
|
|
|
@ -148,10 +148,9 @@ acceptance("User menu", function (needs) {
|
|||
"/review/17",
|
||||
"clicking on an item results in navigation to the item's page"
|
||||
);
|
||||
assert.notOk(
|
||||
exists(".user-menu"),
|
||||
"clicking on an item closes the menu after navigating"
|
||||
);
|
||||
assert
|
||||
.dom(".user-menu")
|
||||
.doesNotExist("clicking on an item closes the menu after navigating");
|
||||
|
||||
await click(".d-header-icons .current-user button");
|
||||
await click("#user-menu-button-review-queue");
|
||||
|
@ -162,10 +161,9 @@ acceptance("User menu", function (needs) {
|
|||
"/review/17",
|
||||
"clicking on the same item again keeps on the same page"
|
||||
);
|
||||
assert.notOk(
|
||||
exists(".user-menu"),
|
||||
"clicking on the same item again closes the menu"
|
||||
);
|
||||
assert
|
||||
.dom(".user-menu")
|
||||
.doesNotExist("clicking on the same item again closes the menu");
|
||||
});
|
||||
|
||||
test("tabs have title attributes", async function (assert) {
|
||||
|
@ -294,14 +292,12 @@ acceptance("User menu", function (needs) {
|
|||
await visit("/");
|
||||
await click(".d-header-icons .current-user button");
|
||||
|
||||
assert.ok(
|
||||
exists("#user-menu-button-custom-tab-1"),
|
||||
"first custom tab is rendered"
|
||||
);
|
||||
assert.ok(
|
||||
exists("#user-menu-button-custom-tab-2"),
|
||||
"second custom tab is rendered"
|
||||
);
|
||||
assert
|
||||
.dom("#user-menu-button-custom-tab-1")
|
||||
.exists("first custom tab is rendered");
|
||||
assert
|
||||
.dom("#user-menu-button-custom-tab-2")
|
||||
.exists("second custom tab is rendered");
|
||||
|
||||
const tabs = [...queryAll(".tabs-list.top-tabs .btn")];
|
||||
|
||||
|
@ -355,15 +351,13 @@ acceptance("User menu", function (needs) {
|
|||
|
||||
await click("#user-menu-button-custom-tab-1");
|
||||
|
||||
assert.ok(
|
||||
exists("#user-menu-button-custom-tab-1.active"),
|
||||
"custom tabs can be clicked on and become active"
|
||||
);
|
||||
assert
|
||||
.dom("#user-menu-button-custom-tab-1.active")
|
||||
.exists("custom tabs can be clicked on and become active");
|
||||
|
||||
assert.ok(
|
||||
exists("#quick-access-custom-tab-1 button.btn"),
|
||||
"the tab's content is now displayed in the panel"
|
||||
);
|
||||
assert
|
||||
.dom("#quick-access-custom-tab-1 button.btn")
|
||||
.exists("the tab's content is now displayed in the panel");
|
||||
});
|
||||
|
||||
test("notifications tab applies model transformations registered by plugins", async function (assert) {
|
||||
|
@ -502,10 +496,9 @@ acceptance("User menu", function (needs) {
|
|||
|
||||
await click("#user-menu-button-profile");
|
||||
|
||||
assert.notOk(
|
||||
exists("#quick-access-profile ul li.invites"),
|
||||
"invites link not shown when the user can't invite"
|
||||
);
|
||||
assert
|
||||
.dom("#quick-access-profile ul li.invites")
|
||||
.doesNotExist("invites link not shown when the user can't invite");
|
||||
|
||||
const draftsLink = query("#quick-access-profile ul li.drafts a");
|
||||
assert.ok(
|
||||
|
@ -576,10 +569,9 @@ acceptance("User menu", function (needs) {
|
|||
"Do Not Disturb button has the right icon when Do Not Disturb is enabled"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists("#quick-access-profile ul li.enable-anonymous .btn"),
|
||||
"toggle anon button is shown"
|
||||
);
|
||||
assert
|
||||
.dom("#quick-access-profile ul li.enable-anonymous .btn")
|
||||
.exists("toggle anon button is shown");
|
||||
let toggleAnonButton = query(
|
||||
"#quick-access-profile ul li.enable-anonymous .btn"
|
||||
);
|
||||
|
@ -631,14 +623,16 @@ acceptance("User menu", function (needs) {
|
|||
await click(".d-header-icons .current-user button");
|
||||
await click("#user-menu-button-profile");
|
||||
|
||||
assert.notOk(
|
||||
exists("#quick-access-profile ul li.enable-anonymous"),
|
||||
"toggle anon button isn't shown when the user can't use it"
|
||||
);
|
||||
assert.notOk(
|
||||
exists("#quick-access-profile ul li.disable-anonymous"),
|
||||
"toggle anon button isn't shown when the user can't use it"
|
||||
);
|
||||
assert
|
||||
.dom("#quick-access-profile ul li.enable-anonymous")
|
||||
.doesNotExist(
|
||||
"toggle anon button isn't shown when the user can't use it"
|
||||
);
|
||||
assert
|
||||
.dom("#quick-access-profile ul li.disable-anonymous")
|
||||
.doesNotExist(
|
||||
"toggle anon button isn't shown when the user can't use it"
|
||||
);
|
||||
|
||||
await clickOutside();
|
||||
updateCurrentUser({
|
||||
|
@ -654,10 +648,9 @@ acceptance("User menu", function (needs) {
|
|||
await click(".d-header-icons .current-user button");
|
||||
await click("#user-menu-button-profile");
|
||||
|
||||
assert.ok(
|
||||
exists("#quick-access-profile ul li.disable-anonymous"),
|
||||
"toggle anon button is always shown if the user is anonymous"
|
||||
);
|
||||
assert
|
||||
.dom("#quick-access-profile ul li.disable-anonymous")
|
||||
.exists("toggle anon button is always shown if the user is anonymous");
|
||||
|
||||
await clickOutside();
|
||||
updateCurrentUser({
|
||||
|
@ -675,10 +668,11 @@ acceptance("User menu", function (needs) {
|
|||
await click(".d-header-icons .current-user button");
|
||||
await click("#user-menu-button-profile");
|
||||
|
||||
assert.notOk(
|
||||
exists("#quick-access-profile ul li.enable-anonymous"),
|
||||
"toggle anon button is not shown if the allow_anonymous_posting setting is false"
|
||||
);
|
||||
assert
|
||||
.dom("#quick-access-profile ul li.enable-anonymous")
|
||||
.doesNotExist(
|
||||
"toggle anon button is not shown if the allow_anonymous_posting setting is false"
|
||||
);
|
||||
|
||||
await clickOutside();
|
||||
updateCurrentUser({
|
||||
|
@ -694,10 +688,11 @@ acceptance("User menu", function (needs) {
|
|||
await click(".d-header-icons .current-user button");
|
||||
await click("#user-menu-button-profile");
|
||||
|
||||
assert.notOk(
|
||||
exists("#quick-access-profile ul li.enable-anonymous"),
|
||||
"toggle anon button is not shown if the user is not allowed to post anonymously"
|
||||
);
|
||||
assert
|
||||
.dom("#quick-access-profile ul li.enable-anonymous")
|
||||
.doesNotExist(
|
||||
"toggle anon button is not shown if the user is not allowed to post anonymously"
|
||||
);
|
||||
|
||||
const logoutButton = query("#quick-access-profile ul li.logout .btn");
|
||||
assert.strictEqual(
|
||||
|
@ -878,10 +873,11 @@ acceptance("User menu", function (needs) {
|
|||
"Enter"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists("#quick-access-other-notifications"),
|
||||
"the other notifications panel can display using keyboard navigation"
|
||||
);
|
||||
assert
|
||||
.dom("#quick-access-other-notifications")
|
||||
.exists(
|
||||
"the other notifications panel can display using keyboard navigation"
|
||||
);
|
||||
});
|
||||
|
||||
test("closes the menu when navigating away", async function (assert) {
|
||||
|
@ -982,14 +978,12 @@ acceptance("User menu - Dismiss button", function (needs) {
|
|||
);
|
||||
|
||||
await click("#user-menu-button-bookmarks");
|
||||
assert.ok(
|
||||
exists("#quick-access-bookmarks ul li.notification"),
|
||||
"bookmark reminder notifications are visible"
|
||||
);
|
||||
assert.ok(
|
||||
exists("#quick-access-bookmarks ul li.bookmark"),
|
||||
"bookmarks are visible"
|
||||
);
|
||||
assert
|
||||
.dom("#quick-access-bookmarks ul li.notification")
|
||||
.exists("bookmark reminder notifications are visible");
|
||||
assert
|
||||
.dom("#quick-access-bookmarks ul li.bookmark")
|
||||
.exists("bookmarks are visible");
|
||||
|
||||
await click(".user-menu .notifications-dismiss");
|
||||
|
||||
|
@ -1006,18 +1000,15 @@ acceptance("User menu - Dismiss button", function (needs) {
|
|||
|
||||
await click(".d-modal__footer .btn-primary"); // confirm dismiss on the dismiss modal
|
||||
|
||||
assert.notOk(
|
||||
exists("#quick-access-bookmarks ul li.notification"),
|
||||
"bookmark reminder notifications are gone"
|
||||
);
|
||||
assert.ok(
|
||||
exists("#quick-access-bookmarks ul li.bookmark"),
|
||||
"bookmarks are still visible"
|
||||
);
|
||||
assert.notOk(
|
||||
exists("#user-menu-button-bookmarks .badge-notification"),
|
||||
"bookmarks tab no longer has bubble"
|
||||
);
|
||||
assert
|
||||
.dom("#quick-access-bookmarks ul li.notification")
|
||||
.doesNotExist("bookmark reminder notifications are gone");
|
||||
assert
|
||||
.dom("#quick-access-bookmarks ul li.bookmark")
|
||||
.exists("bookmarks are still visible");
|
||||
assert
|
||||
.dom("#user-menu-button-bookmarks .badge-notification")
|
||||
.doesNotExist("bookmarks tab no longer has bubble");
|
||||
assert.ok(markRead, "mark-read request is sent");
|
||||
assert.strictEqual(
|
||||
markReadRequestBody,
|
||||
|
@ -1038,14 +1029,12 @@ acceptance("User menu - Dismiss button", function (needs) {
|
|||
);
|
||||
|
||||
await click("#user-menu-button-messages");
|
||||
assert.ok(
|
||||
exists("#quick-access-messages ul li.notification"),
|
||||
"messages notifications are visible"
|
||||
);
|
||||
assert.ok(
|
||||
exists("#quick-access-messages ul li.message"),
|
||||
"messages are visible"
|
||||
);
|
||||
assert
|
||||
.dom("#quick-access-messages ul li.notification")
|
||||
.exists("messages notifications are visible");
|
||||
assert
|
||||
.dom("#quick-access-messages ul li.message")
|
||||
.exists("messages are visible");
|
||||
|
||||
await click(".user-menu .notifications-dismiss");
|
||||
|
||||
|
@ -1062,18 +1051,15 @@ acceptance("User menu - Dismiss button", function (needs) {
|
|||
|
||||
await click(".d-modal__footer .btn-primary"); // confirm dismiss on the dismiss modal
|
||||
|
||||
assert.notOk(
|
||||
exists("#quick-access-messages ul li.notification"),
|
||||
"messages notifications are gone"
|
||||
);
|
||||
assert.ok(
|
||||
exists("#quick-access-messages ul li.message"),
|
||||
"messages are still visible"
|
||||
);
|
||||
assert.notOk(
|
||||
exists("#user-menu-button-messages .badge-notification"),
|
||||
"messages tab no longer has bubble"
|
||||
);
|
||||
assert
|
||||
.dom("#quick-access-messages ul li.notification")
|
||||
.doesNotExist("messages notifications are gone");
|
||||
assert
|
||||
.dom("#quick-access-messages ul li.message")
|
||||
.exists("messages are still visible");
|
||||
assert
|
||||
.dom("#user-menu-button-messages .badge-notification")
|
||||
.doesNotExist("messages tab no longer has bubble");
|
||||
assert.ok(markRead, "mark-read request is sent");
|
||||
assert.strictEqual(
|
||||
markReadRequestBody,
|
||||
|
|
|
@ -121,10 +121,9 @@ acceptance("User Preferences - Account", function (needs) {
|
|||
test("connected accounts", async function (assert) {
|
||||
await visit("/u/eviltrout/preferences/account");
|
||||
|
||||
assert.ok(
|
||||
exists(".pref-associated-accounts"),
|
||||
"it has the connected accounts section"
|
||||
);
|
||||
assert
|
||||
.dom(".pref-associated-accounts")
|
||||
.exists("it has the connected accounts section");
|
||||
|
||||
assert.ok(
|
||||
query(
|
||||
|
@ -155,15 +154,13 @@ acceptance("User Preferences - Account", function (needs) {
|
|||
await visit("/u/eviltrout/preferences/account");
|
||||
await click(".pref-avatar .btn");
|
||||
|
||||
assert.ok(
|
||||
exists(".selectable-avatars"),
|
||||
"opens the avatar selection modal"
|
||||
);
|
||||
assert
|
||||
.dom(".selectable-avatars")
|
||||
.exists("opens the avatar selection modal");
|
||||
|
||||
assert.ok(
|
||||
exists("#uploaded-avatar"),
|
||||
"avatar selection modal includes option to upload"
|
||||
);
|
||||
assert
|
||||
.dom("#uploaded-avatar")
|
||||
.exists("avatar selection modal includes option to upload");
|
||||
});
|
||||
|
||||
test("avatars are not selectable for non-staff user when `selectable_avatars_mode` site setting is set to `staff`", async function (assert) {
|
||||
|
@ -177,15 +174,13 @@ acceptance("User Preferences - Account", function (needs) {
|
|||
await visit("/u/eviltrout/preferences/account");
|
||||
await click(".pref-avatar .btn");
|
||||
|
||||
assert.ok(
|
||||
exists(".selectable-avatars"),
|
||||
"opens the avatar selection modal"
|
||||
);
|
||||
assert
|
||||
.dom(".selectable-avatars")
|
||||
.exists("opens the avatar selection modal");
|
||||
|
||||
assert.notOk(
|
||||
exists("#uploaded-avatar"),
|
||||
"avatar selection modal does not include option to upload"
|
||||
);
|
||||
assert
|
||||
.dom("#uploaded-avatar")
|
||||
.doesNotExist("avatar selection modal does not include option to upload");
|
||||
});
|
||||
|
||||
test("avatars not selectable when `selectable_avatars_mode` site setting is set to `no_one`", async function (assert) {
|
||||
|
@ -198,15 +193,13 @@ acceptance("User Preferences - Account", function (needs) {
|
|||
await visit("/u/eviltrout/preferences/account");
|
||||
await click(".pref-avatar .btn");
|
||||
|
||||
assert.ok(
|
||||
exists(".selectable-avatars"),
|
||||
"opens the avatar selection modal"
|
||||
);
|
||||
assert
|
||||
.dom(".selectable-avatars")
|
||||
.exists("opens the avatar selection modal");
|
||||
|
||||
assert.notOk(
|
||||
exists("#uploaded-avatar"),
|
||||
"avatar selection modal does not include option to upload"
|
||||
);
|
||||
assert
|
||||
.dom("#uploaded-avatar")
|
||||
.doesNotExist("avatar selection modal does not include option to upload");
|
||||
});
|
||||
|
||||
test("avatars are selectable for user with required trust level when `selectable_avatars_mode` site setting is set to `tl3`", async function (assert) {
|
||||
|
@ -221,15 +214,13 @@ acceptance("User Preferences - Account", function (needs) {
|
|||
await visit("/u/eviltrout/preferences/account");
|
||||
await click(".pref-avatar .btn");
|
||||
|
||||
assert.ok(
|
||||
exists(".selectable-avatars"),
|
||||
"opens the avatar selection modal"
|
||||
);
|
||||
assert
|
||||
.dom(".selectable-avatars")
|
||||
.exists("opens the avatar selection modal");
|
||||
|
||||
assert.ok(
|
||||
exists("#uploaded-avatar"),
|
||||
"avatar selection modal includes option to upload"
|
||||
);
|
||||
assert
|
||||
.dom("#uploaded-avatar")
|
||||
.exists("avatar selection modal includes option to upload");
|
||||
});
|
||||
|
||||
test("avatars are not selectable for user without required trust level when `selectable_avatars_mode` site setting is set to `tl3`", async function (assert) {
|
||||
|
@ -244,15 +235,13 @@ acceptance("User Preferences - Account", function (needs) {
|
|||
await visit("/u/eviltrout/preferences/account");
|
||||
await click(".pref-avatar .btn");
|
||||
|
||||
assert.ok(
|
||||
exists(".selectable-avatars"),
|
||||
"opens the avatar selection modal"
|
||||
);
|
||||
assert
|
||||
.dom(".selectable-avatars")
|
||||
.exists("opens the avatar selection modal");
|
||||
|
||||
assert.notOk(
|
||||
exists("#uploaded-avatar"),
|
||||
"avatar selection modal does not include option to upload"
|
||||
);
|
||||
assert
|
||||
.dom("#uploaded-avatar")
|
||||
.doesNotExist("avatar selection modal does not include option to upload");
|
||||
});
|
||||
|
||||
test("avatars are selectable for staff user when `selectable_avatars_mode` site setting is set to `tl3`", async function (assert) {
|
||||
|
@ -267,15 +256,13 @@ acceptance("User Preferences - Account", function (needs) {
|
|||
await visit("/u/eviltrout/preferences/account");
|
||||
await click(".pref-avatar .btn");
|
||||
|
||||
assert.ok(
|
||||
exists(".selectable-avatars"),
|
||||
"opens the avatar selection modal"
|
||||
);
|
||||
assert
|
||||
.dom(".selectable-avatars")
|
||||
.exists("opens the avatar selection modal");
|
||||
|
||||
assert.ok(
|
||||
exists("#uploaded-avatar"),
|
||||
"avatar selection modal includes option to upload"
|
||||
);
|
||||
assert
|
||||
.dom("#uploaded-avatar")
|
||||
.exists("avatar selection modal includes option to upload");
|
||||
});
|
||||
|
||||
test("default avatar selector", async function (assert) {
|
||||
|
@ -286,10 +273,9 @@ acceptance("User Preferences - Account", function (needs) {
|
|||
|
||||
await click(".avatar-selector-refresh-gravatar");
|
||||
|
||||
assert.ok(
|
||||
exists(".avatar[src='/images/gravatar_is_not_avatar.png']"),
|
||||
"displays the new gravatar image"
|
||||
);
|
||||
assert
|
||||
.dom(".avatar[src='/images/gravatar_is_not_avatar.png']")
|
||||
.exists("displays the new gravatar image");
|
||||
|
||||
await click("#gravatar");
|
||||
await click(".d-modal__footer .btn");
|
||||
|
|
|
@ -2,7 +2,6 @@ import { click, fillIn, visit } from "@ember/test-helpers";
|
|||
import { test } from "qunit";
|
||||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
query,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
|
@ -44,14 +43,12 @@ acceptance("User Profile - Account - User Status", function (needs) {
|
|||
|
||||
await visit(`/u/${username}/preferences/account`);
|
||||
|
||||
assert.ok(
|
||||
exists(".pref-user-status .user-status-message"),
|
||||
"status is shown"
|
||||
);
|
||||
assert.ok(
|
||||
exists(`.pref-user-status .emoji[alt='${status.emoji}']`),
|
||||
"status emoji is correct"
|
||||
);
|
||||
assert
|
||||
.dom(".pref-user-status .user-status-message")
|
||||
.exists("status is shown");
|
||||
assert
|
||||
.dom(`.pref-user-status .emoji[alt='${status.emoji}']`)
|
||||
.exists("status emoji is correct");
|
||||
assert.equal(
|
||||
query(
|
||||
`.pref-user-status .user-status-message-description`
|
||||
|
@ -75,21 +72,18 @@ acceptance("User Profile - Account - User Status", function (needs) {
|
|||
updateCurrentUser({ status: null });
|
||||
|
||||
await visit(`/u/${username}/preferences/account`);
|
||||
assert.notOk(
|
||||
exists(".pref-user-status .user-status-message"),
|
||||
"status isn't shown"
|
||||
);
|
||||
assert
|
||||
.dom(".pref-user-status .user-status-message")
|
||||
.doesNotExist("status isn't shown");
|
||||
|
||||
await setStatus(status);
|
||||
|
||||
assert.ok(
|
||||
exists(".pref-user-status .user-status-message"),
|
||||
"status is shown"
|
||||
);
|
||||
assert.ok(
|
||||
exists(`.pref-user-status .emoji[alt='${status.emoji}']`),
|
||||
"status emoji is correct"
|
||||
);
|
||||
assert
|
||||
.dom(".pref-user-status .user-status-message")
|
||||
.exists("status is shown");
|
||||
assert
|
||||
.dom(`.pref-user-status .emoji[alt='${status.emoji}']`)
|
||||
.exists("status emoji is correct");
|
||||
assert.equal(
|
||||
query(
|
||||
`.pref-user-status .user-status-message-description`
|
||||
|
@ -106,14 +100,12 @@ acceptance("User Profile - Account - User Status", function (needs) {
|
|||
const newStatus = { emoji: "surfing_man", description: "surfing" };
|
||||
await setStatus(newStatus);
|
||||
|
||||
assert.ok(
|
||||
exists(".pref-user-status .user-status-message"),
|
||||
"status is shown"
|
||||
);
|
||||
assert.ok(
|
||||
exists(`.pref-user-status .emoji[alt='${newStatus.emoji}']`),
|
||||
"status emoji is correct"
|
||||
);
|
||||
assert
|
||||
.dom(".pref-user-status .user-status-message")
|
||||
.exists("status is shown");
|
||||
assert
|
||||
.dom(`.pref-user-status .emoji[alt='${newStatus.emoji}']`)
|
||||
.exists("status emoji is correct");
|
||||
assert.equal(
|
||||
query(
|
||||
`.pref-user-status .user-status-message-description`
|
||||
|
@ -130,9 +122,8 @@ acceptance("User Profile - Account - User Status", function (needs) {
|
|||
await openUserStatusModal();
|
||||
await click(".btn.delete-status");
|
||||
|
||||
assert.notOk(
|
||||
exists(".pref-user-status .user-status-message"),
|
||||
"status isn't shown"
|
||||
);
|
||||
assert
|
||||
.dom(".pref-user-status .user-status-message")
|
||||
.doesNotExist("status isn't shown");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -17,9 +17,8 @@ acceptance("User Preferences Admin - Mobile", function (needs) {
|
|||
|
||||
test("Mobile user admin button", async function (assert) {
|
||||
await visit("/u/eviltrout");
|
||||
assert.ok(
|
||||
exists(".user-nav__admin"),
|
||||
"mobile user admin nav button exists"
|
||||
);
|
||||
assert
|
||||
.dom(".user-nav__admin")
|
||||
.exists("mobile user admin nav button exists");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -150,10 +150,9 @@ acceptance("User Preferences - Interface", function (needs) {
|
|||
|
||||
await visit("/u/eviltrout/preferences/interface");
|
||||
|
||||
assert.ok(
|
||||
exists(".pref-reset-seen-user-tips"),
|
||||
"has reset seen user tips button"
|
||||
);
|
||||
assert
|
||||
.dom(".pref-reset-seen-user-tips")
|
||||
.exists("has reset seen user tips button");
|
||||
|
||||
await click(".pref-reset-seen-user-tips");
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ import { test } from "qunit";
|
|||
import {
|
||||
acceptance,
|
||||
count,
|
||||
exists,
|
||||
fakeTime,
|
||||
loggedInUser,
|
||||
queryAll,
|
||||
|
@ -17,15 +16,13 @@ acceptance("User notification schedule", function (needs) {
|
|||
test("the schedule interface is hidden until enabled", async function (assert) {
|
||||
await visit("/u/eviltrout/preferences/notifications");
|
||||
|
||||
assert.ok(
|
||||
!exists(".notification-schedule-table"),
|
||||
"notification schedule is hidden"
|
||||
);
|
||||
assert
|
||||
.dom(".notification-schedule-table")
|
||||
.doesNotExist("notification schedule is hidden");
|
||||
await click(".control-group.notification-schedule input");
|
||||
assert.ok(
|
||||
exists(".notification-schedule-table"),
|
||||
"notification schedule is visible"
|
||||
);
|
||||
assert
|
||||
.dom(".notification-schedule-table")
|
||||
.exists("notification schedule is visible");
|
||||
});
|
||||
|
||||
test("By default every day is selected 8:00am - 5:00pm", async function (assert) {
|
||||
|
|
|
@ -33,10 +33,9 @@ acceptance("User Preferences - Second Factor Backup", function (needs) {
|
|||
await visit("/u/eviltrout/preferences/second-factor");
|
||||
await click(".new-second-factor-backup");
|
||||
|
||||
assert.ok(
|
||||
exists(".second-factor-backup-edit-modal"),
|
||||
"shows the 2fa backup panel"
|
||||
);
|
||||
assert
|
||||
.dom(".second-factor-backup-edit-modal")
|
||||
.exists("shows the 2fa backup panel");
|
||||
|
||||
await click(".second-factor-backup-edit-modal .btn-primary");
|
||||
|
||||
|
|
|
@ -70,10 +70,9 @@ acceptance("User Preferences - Second Factor", function (needs) {
|
|||
assert.ok(exists(".qr-code img"), "shows qr code image");
|
||||
|
||||
await click(".modal a.show-second-factor-key");
|
||||
assert.ok(
|
||||
exists(".modal .second-factor-key"),
|
||||
"displays second factor key"
|
||||
);
|
||||
assert
|
||||
.dom(".modal .second-factor-key")
|
||||
.exists("displays second factor key");
|
||||
|
||||
await click(".add-totp");
|
||||
assert.ok(
|
||||
|
@ -112,20 +111,18 @@ acceptance("User Preferences - Second Factor", function (needs) {
|
|||
assert.dom("#dialog-title").hasText("Deleting an authenticator");
|
||||
await click(".dialog-close");
|
||||
|
||||
assert.ok(
|
||||
exists(".security-key .second-factor-item"),
|
||||
"User has a physical security key"
|
||||
);
|
||||
assert
|
||||
.dom(".security-key .second-factor-item")
|
||||
.exists("User has a physical security key");
|
||||
|
||||
await click(".security-key-dropdown .select-kit-header");
|
||||
await click("li[data-name='Disable']");
|
||||
|
||||
assert.dom("#dialog-title").hasText("Deleting an authenticator");
|
||||
await click(".dialog-footer .btn-danger");
|
||||
assert.notOk(
|
||||
exists(".security-key .second-factor-item"),
|
||||
"security key row is removed after a successful delete"
|
||||
);
|
||||
assert
|
||||
.dom(".security-key .second-factor-item")
|
||||
.doesNotExist("security key row is removed after a successful delete");
|
||||
|
||||
await click(".pref-second-factor-disable-all .btn-danger");
|
||||
assert
|
||||
|
|
|
@ -3,7 +3,6 @@ import { test } from "qunit";
|
|||
import {
|
||||
acceptance,
|
||||
count,
|
||||
exists,
|
||||
query,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
|
@ -94,15 +93,13 @@ acceptance("User Preferences - Security", function (needs) {
|
|||
"displays the scope for the API key"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(".pref-user-api-keys__created-at"),
|
||||
"displays the created at date for the API key"
|
||||
);
|
||||
assert
|
||||
.dom(".pref-user-api-keys__created-at")
|
||||
.exists("displays the created at date for the API key");
|
||||
|
||||
assert.ok(
|
||||
exists(".pref-user-api-keys__last-used-at"),
|
||||
"displays the last used at date for the API key"
|
||||
);
|
||||
assert
|
||||
.dom(".pref-user-api-keys__last-used-at")
|
||||
.exists("displays the last used at date for the API key");
|
||||
});
|
||||
|
||||
test("Viewing Passkeys - user has a key", async function (assert) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { click, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
|
||||
acceptance("User Preferences - Tracking", function (needs) {
|
||||
|
@ -24,10 +24,9 @@ acceptance("User Preferences - Tracking", function (needs) {
|
|||
|
||||
await visit("/u/eviltrout/preferences/tracking");
|
||||
|
||||
assert.notOk(
|
||||
exists(".tag-notifications"),
|
||||
"tag notification levels section is not displayed"
|
||||
);
|
||||
assert
|
||||
.dom(".tag-notifications")
|
||||
.doesNotExist("tag notification levels section is not displayed");
|
||||
});
|
||||
|
||||
test("updating notification levels of tags when tagging is enabled", async function (assert) {
|
||||
|
|
|
@ -24,10 +24,9 @@ acceptance("User Profile - Summary", function (needs) {
|
|||
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"
|
||||
);
|
||||
assert
|
||||
.dom(".top-categories-section .category-link")
|
||||
.exists("top categories");
|
||||
});
|
||||
|
||||
test("Top Categories Search", async function (assert) {
|
||||
|
|
|
@ -129,10 +129,9 @@ acceptance("User Status", function (needs) {
|
|||
|
||||
await fillIn(".emoji-picker-content .filter", userStatusEmoji);
|
||||
await click(".results .emoji");
|
||||
assert.ok(
|
||||
exists(`.btn-emoji img.emoji[title=${userStatusEmoji}]`),
|
||||
"chosen status emoji is shown"
|
||||
);
|
||||
assert
|
||||
.dom(`.btn-emoji img.emoji[title=${userStatusEmoji}]`)
|
||||
.exists("chosen status emoji is shown");
|
||||
});
|
||||
|
||||
test("setting user status", async function (assert) {
|
||||
|
@ -143,10 +142,9 @@ acceptance("User Status", function (needs) {
|
|||
|
||||
await fillIn(".user-status-description", userStatus);
|
||||
await pickEmoji(userStatusEmoji);
|
||||
assert.ok(
|
||||
exists(`.btn-emoji img.emoji[title=${userStatusEmoji}]`),
|
||||
"chosen status emoji is shown"
|
||||
);
|
||||
assert
|
||||
.dom(`.btn-emoji img.emoji[title=${userStatusEmoji}]`)
|
||||
.exists("chosen status emoji is shown");
|
||||
await click(".btn-primary"); // save
|
||||
|
||||
assert.equal(
|
||||
|
@ -262,10 +260,9 @@ acceptance("User Status", function (needs) {
|
|||
await openUserStatusModal();
|
||||
await fillIn(".user-status-description", "some status");
|
||||
|
||||
assert.ok(
|
||||
exists(`.btn-emoji img.emoji[title=${defaultStatusEmoji}]`),
|
||||
"default status emoji is shown"
|
||||
);
|
||||
assert
|
||||
.dom(`.btn-emoji img.emoji[title=${defaultStatusEmoji}]`)
|
||||
.exists("default status emoji is shown");
|
||||
});
|
||||
|
||||
test("shows actual status on the modal after canceling the modal and opening it again", async function (assert) {
|
||||
|
@ -500,10 +497,9 @@ acceptance("User Status - user menu", function (needs) {
|
|||
await click("#user-menu-button-profile");
|
||||
|
||||
assert.ok(exists("li.set-user-status .btn"), "shows the button");
|
||||
assert.ok(
|
||||
exists("li.set-user-status svg.d-icon-circle-plus"),
|
||||
"shows the icon on the button"
|
||||
);
|
||||
assert
|
||||
.dom("li.set-user-status svg.d-icon-circle-plus")
|
||||
.exists("shows the icon on the button");
|
||||
});
|
||||
|
||||
test("shows user status on the button", async function (assert) {
|
||||
|
|
|
@ -88,19 +88,17 @@ acceptance("User Routes", function (needs) {
|
|||
|
||||
await visit("/u/charlie/summary");
|
||||
|
||||
assert.notOk(
|
||||
exists(".user-nav > .user-nav__notifications"),
|
||||
"does not have the notifications tab"
|
||||
);
|
||||
assert
|
||||
.dom(".user-nav > .user-nav__notifications")
|
||||
.doesNotExist("does not have the notifications tab");
|
||||
|
||||
updateCurrentUser({ moderator: false, admin: true });
|
||||
|
||||
await visit("/u/charlie/summary");
|
||||
|
||||
assert.ok(
|
||||
exists(".user-nav > .user-nav__notifications"),
|
||||
"has the notifications tab"
|
||||
);
|
||||
assert
|
||||
.dom(".user-nav > .user-nav__notifications")
|
||||
.exists("has the notifications tab");
|
||||
});
|
||||
|
||||
test("Root URL - Viewing Self", async function (assert) {
|
||||
|
@ -120,16 +118,14 @@ acceptance("User Routes", function (needs) {
|
|||
test("Viewing Drafts", async function (assert) {
|
||||
await visit("/u/eviltrout/activity/drafts");
|
||||
assert.ok(exists(".user-stream"), "has drafts stream");
|
||||
assert.ok(
|
||||
exists(".user-stream .user-stream-item-draft-actions"),
|
||||
"has draft action buttons"
|
||||
);
|
||||
assert
|
||||
.dom(".user-stream .user-stream-item-draft-actions")
|
||||
.exists("has draft action buttons");
|
||||
|
||||
await click(".user-stream button.resume-draft:nth-of-type(1)");
|
||||
assert.ok(
|
||||
exists(".d-editor-input"),
|
||||
"composer is visible after resuming a draft"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.exists("composer is visible after resuming a draft");
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -392,10 +388,9 @@ acceptance("User - Logout", function (needs) {
|
|||
await publishToMessageBus("/logout/19");
|
||||
|
||||
assert.dom(".dialog-body").exists();
|
||||
assert.ok(
|
||||
!exists(".dialog-footer .btn-default"),
|
||||
"no cancel button present"
|
||||
);
|
||||
assert
|
||||
.dom(".dialog-footer .btn-default")
|
||||
.doesNotExist("no cancel button present");
|
||||
assert
|
||||
.dom(".dialog-footer .btn-primary")
|
||||
.hasText(I18n.t("house"), "primary dialog button is present");
|
||||
|
|
|
@ -18,10 +18,9 @@ acceptance("User Directory", function () {
|
|||
document.body.classList.contains("users-page"),
|
||||
"has the body class"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".directory .directory-table .directory-table__row"),
|
||||
"has a list of users"
|
||||
);
|
||||
assert
|
||||
.dom(".directory .directory-table .directory-table__row")
|
||||
.exists("has a list of users");
|
||||
});
|
||||
|
||||
test("Visit All Time", async function (assert) {
|
||||
|
@ -35,10 +34,9 @@ acceptance("User Directory", function () {
|
|||
document.body.classList.contains("users-page"),
|
||||
"has the body class"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".directory .directory-table .directory-table__row"),
|
||||
"has a list of users"
|
||||
);
|
||||
assert
|
||||
.dom(".directory .directory-table .directory-table__row")
|
||||
.exists("has a list of users");
|
||||
});
|
||||
|
||||
test("Visit With Group Exclusion", async function (assert) {
|
||||
|
@ -65,10 +63,9 @@ acceptance("User Directory", function () {
|
|||
document.body.classList.contains("users-page"),
|
||||
"has the body class"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".directory .directory-table .directory-table__row"),
|
||||
"has a list of users"
|
||||
);
|
||||
assert
|
||||
.dom(".directory .directory-table .directory-table__row")
|
||||
.exists("has a list of users");
|
||||
});
|
||||
|
||||
test("Custom user fields are present", async function (assert) {
|
||||
|
|
|
@ -54,38 +54,32 @@ module("Integration | Component | d-button", function (hooks) {
|
|||
|
||||
await render(hbs`<DButton @isLoading={{this.isLoading}} />`);
|
||||
|
||||
assert.ok(
|
||||
exists("button.is-loading .loading-icon"),
|
||||
"it has a spinner showing"
|
||||
);
|
||||
assert.ok(
|
||||
exists("button[disabled]"),
|
||||
"while loading the button is disabled"
|
||||
);
|
||||
assert
|
||||
.dom("button.is-loading .loading-icon")
|
||||
.exists("it has a spinner showing");
|
||||
assert
|
||||
.dom("button[disabled]")
|
||||
.exists("while loading the button is disabled");
|
||||
|
||||
this.set("isLoading", false);
|
||||
|
||||
assert.notOk(
|
||||
exists("button .loading-icon"),
|
||||
"it doesn't have a spinner showing"
|
||||
);
|
||||
assert.ok(
|
||||
exists("button:not([disabled])"),
|
||||
"while not loading the button is enabled"
|
||||
);
|
||||
assert
|
||||
.dom("button .loading-icon")
|
||||
.doesNotExist("it doesn't have a spinner showing");
|
||||
assert
|
||||
.dom("button:not([disabled])")
|
||||
.exists("while not loading the button is enabled");
|
||||
});
|
||||
|
||||
test("button without isLoading attribute", async function (assert) {
|
||||
await render(hbs`<DButton />`);
|
||||
|
||||
assert.notOk(
|
||||
exists("button.is-loading"),
|
||||
"it doesn't have class is-loading"
|
||||
);
|
||||
assert.notOk(
|
||||
exists("button .loading-icon"),
|
||||
"it doesn't have a spinner showing"
|
||||
);
|
||||
assert
|
||||
.dom("button.is-loading")
|
||||
.doesNotExist("it doesn't have class is-loading");
|
||||
assert
|
||||
.dom("button .loading-icon")
|
||||
.doesNotExist("it doesn't have a spinner showing");
|
||||
assert.notOk(exists("button[disabled]"), "it isn't disabled");
|
||||
});
|
||||
|
||||
|
@ -94,14 +88,12 @@ module("Integration | Component | d-button", function (hooks) {
|
|||
|
||||
await render(hbs`<DButton @isLoading={{this.isLoading}} />`);
|
||||
|
||||
assert.notOk(
|
||||
exists("button.is-loading"),
|
||||
"it doesn't have class is-loading"
|
||||
);
|
||||
assert.notOk(
|
||||
exists("button .loading-icon"),
|
||||
"it doesn't have a spinner showing"
|
||||
);
|
||||
assert
|
||||
.dom("button.is-loading")
|
||||
.doesNotExist("it doesn't have class is-loading");
|
||||
assert
|
||||
.dom("button .loading-icon")
|
||||
.doesNotExist("it doesn't have a spinner showing");
|
||||
assert.notOk(exists("button[disabled]"), "it isn't disabled");
|
||||
});
|
||||
|
||||
|
|
|
@ -12,16 +12,14 @@ module("Integration | Component | group-membership-button", function (hooks) {
|
|||
|
||||
await render(hbs`<GroupMembershipButton @model={{this.model}} />`);
|
||||
|
||||
assert.ok(
|
||||
!exists(".group-index-join"),
|
||||
"can't join group if public_admission is false"
|
||||
);
|
||||
assert
|
||||
.dom(".group-index-join")
|
||||
.doesNotExist("can't join group if public_admission is false");
|
||||
|
||||
this.set("model.public_admission", true);
|
||||
assert.ok(
|
||||
!exists(".group-index-join"),
|
||||
"can't join group if user is already in the group"
|
||||
);
|
||||
assert
|
||||
.dom(".group-index-join")
|
||||
.doesNotExist("can't join group if user is already in the group");
|
||||
|
||||
this.set("model.is_group_user", false);
|
||||
assert.ok(exists(".group-index-join"), "allowed to join group");
|
||||
|
@ -32,16 +30,14 @@ module("Integration | Component | group-membership-button", function (hooks) {
|
|||
|
||||
await render(hbs`<GroupMembershipButton @model={{this.model}} />`);
|
||||
|
||||
assert.ok(
|
||||
!exists(".group-index-leave"),
|
||||
"can't leave group if public_exit is false"
|
||||
);
|
||||
assert
|
||||
.dom(".group-index-leave")
|
||||
.doesNotExist("can't leave group if public_exit is false");
|
||||
|
||||
this.set("model.public_exit", true);
|
||||
assert.ok(
|
||||
!exists(".group-index-leave"),
|
||||
"can't leave group if user is not in the group"
|
||||
);
|
||||
assert
|
||||
.dom(".group-index-leave")
|
||||
.doesNotExist("can't leave group if user is not in the group");
|
||||
|
||||
this.set("model.is_group_user", true);
|
||||
assert.strictEqual(
|
||||
|
@ -59,14 +55,14 @@ module("Integration | Component | group-membership-button", function (hooks) {
|
|||
|
||||
await render(hbs`<GroupMembershipButton @model={{this.model}} />`);
|
||||
|
||||
assert.ok(
|
||||
!exists(".group-index-request"),
|
||||
"can't request for membership if user is already in the group"
|
||||
);
|
||||
assert
|
||||
.dom(".group-index-request")
|
||||
.doesNotExist(
|
||||
"can't request for membership if user is already in the group"
|
||||
);
|
||||
this.set("model.is_group_user", false);
|
||||
assert.ok(
|
||||
exists(".group-index-request"),
|
||||
"allowed to request for group membership"
|
||||
);
|
||||
assert
|
||||
.dom(".group-index-request")
|
||||
.exists("allowed to request for group membership");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -32,19 +32,17 @@ module("Integration | Component | search-menu", function (hooks) {
|
|||
|
||||
await render(<template><SearchMenu /></template>);
|
||||
|
||||
assert.ok(
|
||||
exists(".show-advanced-search"),
|
||||
"it shows full page search button"
|
||||
);
|
||||
assert
|
||||
.dom(".show-advanced-search")
|
||||
.exists("it shows full page search button");
|
||||
|
||||
assert.notOk(exists(".menu-panel"), "Menu panel is not rendered yet");
|
||||
|
||||
await click("#search-term");
|
||||
|
||||
assert.ok(
|
||||
exists(".menu-panel .search-menu-initial-options"),
|
||||
"Menu panel is rendered with initial options"
|
||||
);
|
||||
assert
|
||||
.dom(".menu-panel .search-menu-initial-options")
|
||||
.exists("Menu panel is rendered with initial options");
|
||||
|
||||
await fillIn("#search-term", "test");
|
||||
|
||||
|
@ -56,10 +54,9 @@ module("Integration | Component | search-menu", function (hooks) {
|
|||
|
||||
await triggerKeyEvent("#search-term", "keyup", "Enter");
|
||||
|
||||
assert.ok(
|
||||
exists(".search-result-topic"),
|
||||
"search result is a list of topics"
|
||||
);
|
||||
assert
|
||||
.dom(".search-result-topic")
|
||||
.exists("search result is a list of topics");
|
||||
|
||||
await triggerKeyEvent("#search-term", "keydown", "Escape");
|
||||
|
||||
|
@ -68,10 +65,9 @@ module("Integration | Component | search-menu", function (hooks) {
|
|||
await click("#search-term");
|
||||
await click("#search-term");
|
||||
|
||||
assert.ok(
|
||||
exists(".search-result-topic"),
|
||||
"Clicking the term brought back search results"
|
||||
);
|
||||
assert
|
||||
.dom(".search-result-topic")
|
||||
.exists("Clicking the term brought back search results");
|
||||
});
|
||||
|
||||
test("clicking outside results hides and blurs input", async function (assert) {
|
||||
|
@ -91,9 +87,8 @@ module("Integration | Component | search-menu", function (hooks) {
|
|||
document.body,
|
||||
"Clicking outside blurs focus and closes panel"
|
||||
);
|
||||
assert.notOk(
|
||||
exists(".menu-panel .search-menu-initial-options"),
|
||||
"Menu panel is hidden"
|
||||
);
|
||||
assert
|
||||
.dom(".menu-panel .search-menu-initial-options")
|
||||
.doesNotExist("Menu panel is hidden");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@ import { blur, click, fillIn, render } from "@ember/test-helpers";
|
|||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import { count, exists, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { count, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import I18n from "discourse-i18n";
|
||||
|
||||
module("Integration | Component | secret-value-list", function (hooks) {
|
||||
|
@ -73,10 +73,9 @@ module("Integration | Component | secret-value-list", function (hooks) {
|
|||
await fillIn(".new-value-input.secret", "keyWithAPipe|Hidden");
|
||||
await click(".add-value-btn");
|
||||
|
||||
assert.ok(
|
||||
!exists(".values .value"),
|
||||
"it doesn't add the value to the list of values"
|
||||
);
|
||||
assert
|
||||
.dom(".values .value")
|
||||
.doesNotExist("it doesn't add the value to the list of values");
|
||||
|
||||
assert.deepEqual(
|
||||
this.values,
|
||||
|
|
|
@ -2,7 +2,7 @@ import { render } from "@ember/test-helpers";
|
|||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import { exists, paste, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { paste, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
|
||||
const DEFAULT_CONTENT = [
|
||||
|
@ -127,9 +127,8 @@ module("Integration | Component | select-kit/multi-select", function (hooks) {
|
|||
`);
|
||||
await this.subject.expand();
|
||||
|
||||
assert.notOk(
|
||||
exists(".selected-content"),
|
||||
"it doesn’t render an empty content div"
|
||||
);
|
||||
assert
|
||||
.dom(".selected-content")
|
||||
.doesNotExist("it doesn’t render an empty content div");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -19,10 +19,9 @@ module("Integration | Component | sidebar | section", function (hooks) {
|
|||
this.headerActions = [];
|
||||
await render(template);
|
||||
|
||||
assert.ok(
|
||||
exists(".sidebar-section-wrapper"),
|
||||
"section is displayed by default if no display arg is provided"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-section-wrapper")
|
||||
.exists("section is displayed by default if no display arg is provided");
|
||||
});
|
||||
|
||||
test("displaySection is dynamic based on argument", async function (assert) {
|
||||
|
@ -39,10 +38,9 @@ module("Integration | Component | sidebar | section", function (hooks) {
|
|||
this.headerActions = [];
|
||||
await render(template);
|
||||
|
||||
assert.notOk(
|
||||
exists(".sidebar-section-wrapper"),
|
||||
"section is not displayed"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-section-wrapper")
|
||||
.doesNotExist("section is not displayed");
|
||||
|
||||
this.set("displaySection", true);
|
||||
assert.ok(exists(".sidebar-section-wrapper"), "section is displayed");
|
||||
|
@ -65,9 +63,8 @@ module("Integration | Component | sidebar | section", function (hooks) {
|
|||
|
||||
await click(".sidebar-section-header-caret");
|
||||
|
||||
assert.notOk(
|
||||
exists(".sidebar-section-content"),
|
||||
"does not show content after collapsing"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-section-content")
|
||||
.doesNotExist("does not show content after collapsing");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import { count, exists, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { count, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
module("Integration | Component | simple-list", function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
@ -18,10 +18,9 @@ module("Integration | Component | simple-list", function (hooks) {
|
|||
|
||||
await render(hbs`<SimpleList @values={{this.values}} />`);
|
||||
|
||||
assert.ok(
|
||||
exists(".add-value-btn[disabled]"),
|
||||
"while loading the + button is disabled"
|
||||
);
|
||||
assert
|
||||
.dom(".add-value-btn[disabled]")
|
||||
.exists("while loading the + button is disabled");
|
||||
|
||||
await fillIn(".add-value-input", "penar");
|
||||
await click(".add-value-btn");
|
||||
|
|
|
@ -54,9 +54,8 @@ module("Integration | Component | slow-mode-info", function (hooks) {
|
|||
hbs`<SlowModeInfo @topic={{this.topic}} @user={{this.user}} />`
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
!exists(".slow-mode-remove"),
|
||||
"it doesn't let you disable slow mode"
|
||||
);
|
||||
assert
|
||||
.dom(".slow-mode-remove")
|
||||
.doesNotExist("it doesn't let you disable slow mode");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -4,7 +4,6 @@ import { module, test } from "qunit";
|
|||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import {
|
||||
count,
|
||||
exists,
|
||||
publishToMessageBus,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
|
@ -14,10 +13,9 @@ module("Integration | Component | software-update-prompt", function (hooks) {
|
|||
test("software-update-prompt gets correct CSS class after messageBus message", async function (assert) {
|
||||
await render(hbs`{{software-update-prompt}}`);
|
||||
|
||||
assert.ok(
|
||||
!exists("div.software-update-prompt"),
|
||||
"it does not have the class to show the prompt"
|
||||
);
|
||||
assert
|
||||
.dom("div.software-update-prompt")
|
||||
.doesNotExist("it does not have the class to show the prompt");
|
||||
|
||||
await publishToMessageBus("/global/asset-version", "somenewversion");
|
||||
|
||||
|
|
|
@ -56,10 +56,11 @@ module("Integration | Component | themes-list", function (hooks) {
|
|||
"components tab is not active"
|
||||
);
|
||||
|
||||
assert.notOk(
|
||||
exists(".inactive-indicator"),
|
||||
"there is no inactive themes separator when all themes are inactive"
|
||||
);
|
||||
assert
|
||||
.dom(".inactive-indicator")
|
||||
.doesNotExist(
|
||||
"there is no inactive themes separator when all themes are inactive"
|
||||
);
|
||||
assert.strictEqual(
|
||||
count(".themes-list-container__item .info"),
|
||||
5,
|
||||
|
@ -85,10 +86,11 @@ module("Integration | Component | themes-list", function (hooks) {
|
|||
|
||||
this.themes.forEach((theme) => theme.set("user_selectable", true));
|
||||
this.set("themes", this.themes);
|
||||
assert.notOk(
|
||||
exists(".inactive-indicator"),
|
||||
"there is no inactive themes separator when all themes are user-selectable"
|
||||
);
|
||||
assert
|
||||
.dom(".inactive-indicator")
|
||||
.doesNotExist(
|
||||
"there is no inactive themes separator when all themes are user-selectable"
|
||||
);
|
||||
|
||||
this.set("themes", []);
|
||||
assert.strictEqual(
|
||||
|
@ -167,10 +169,9 @@ module("Integration | Component | themes-list", function (hooks) {
|
|||
hbs`<ThemesList @themes={{this.themes}} @components={{(array)}} @currentTab={{this.currentTab}} />`
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
!exists(".themes-list-search"),
|
||||
"search input not shown when we have fewer than 10 themes"
|
||||
);
|
||||
assert
|
||||
.dom(".themes-list-search")
|
||||
.doesNotExist("search input not shown when we have fewer than 10 themes");
|
||||
});
|
||||
|
||||
test("themes search keeps themes whose names include the search term", async function (assert) {
|
||||
|
|
|
@ -72,10 +72,9 @@ module("Integration | Component | time-shortcut-picker", function (hooks) {
|
|||
|
||||
await render(hbs`<TimeShortcutPicker @_itsatrap={{this.itsatrap}} />`);
|
||||
|
||||
assert.notOk(
|
||||
exists("#tap_tile_later_this_week"),
|
||||
"it does not have later this week"
|
||||
);
|
||||
assert
|
||||
.dom("#tap_tile_later_this_week")
|
||||
.doesNotExist("it does not have later this week");
|
||||
});
|
||||
|
||||
test("does not show 'Later Today' if 'Later Today' is tomorrow", async function (assert) {
|
||||
|
@ -87,10 +86,9 @@ module("Integration | Component | time-shortcut-picker", function (hooks) {
|
|||
|
||||
await render(hbs`<TimeShortcutPicker @_itsatrap={{this.itsatrap}} />`);
|
||||
|
||||
assert.notOk(
|
||||
exists("#tap_tile_later_today"),
|
||||
"it does not have later today"
|
||||
);
|
||||
assert
|
||||
.dom("#tap_tile_later_today")
|
||||
.doesNotExist("it does not have later today");
|
||||
});
|
||||
|
||||
test("shows 'Later Today' if it is before 5pm", async function (assert) {
|
||||
|
@ -114,10 +112,9 @@ module("Integration | Component | time-shortcut-picker", function (hooks) {
|
|||
|
||||
await render(hbs`<TimeShortcutPicker @_itsatrap={{this.itsatrap}} />`);
|
||||
|
||||
assert.notOk(
|
||||
exists("#tap_tile_later_today"),
|
||||
"it does not have later today"
|
||||
);
|
||||
assert
|
||||
.dom("#tap_tile_later_today")
|
||||
.doesNotExist("it does not have later today");
|
||||
});
|
||||
|
||||
test("default custom date time is in one hour from now", async function (assert) {
|
||||
|
|
|
@ -24,10 +24,9 @@ module("Integration | Component | uppy-image-uploader", function (hooks) {
|
|||
"it displays the trash icon"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
!exists(".placeholder-overlay"),
|
||||
"it does not display the placeholder image"
|
||||
);
|
||||
assert
|
||||
.dom(".placeholder-overlay")
|
||||
.doesNotExist("it does not display the placeholder image");
|
||||
|
||||
await click(".image-uploader-lightbox-btn");
|
||||
|
||||
|
@ -49,10 +48,9 @@ module("Integration | Component | uppy-image-uploader", function (hooks) {
|
|||
|
||||
assert.ok(!exists(".d-icon-trash-can"), "it does not display trash icon");
|
||||
|
||||
assert.ok(
|
||||
!exists(".image-uploader-lightbox-btn"),
|
||||
"it does not display the button to open image lightbox"
|
||||
);
|
||||
assert
|
||||
.dom(".image-uploader-lightbox-btn")
|
||||
.doesNotExist("it does not display the button to open image lightbox");
|
||||
});
|
||||
|
||||
test("with placeholder", async function (assert) {
|
||||
|
@ -68,10 +66,9 @@ module("Integration | Component | uppy-image-uploader", function (hooks) {
|
|||
|
||||
assert.ok(!exists(".d-icon-trash-can"), "it does not display trash icon");
|
||||
|
||||
assert.ok(
|
||||
!exists(".image-uploader-lightbox-btn"),
|
||||
"it does not display the button to open image lightbox"
|
||||
);
|
||||
assert
|
||||
.dom(".image-uploader-lightbox-btn")
|
||||
.doesNotExist("it does not display the button to open image lightbox");
|
||||
|
||||
assert.strictEqual(
|
||||
count(".placeholder-overlay"),
|
||||
|
|
|
@ -5,7 +5,7 @@ import { NOTIFICATION_TYPES } from "discourse/tests/fixtures/concerns/notificati
|
|||
import UserMenuFixtures from "discourse/tests/fixtures/user-menu";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
||||
import { exists, query, queryAll } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { query, queryAll } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { cloneJSON, deepMerge } from "discourse-common/lib/object";
|
||||
import I18n from "discourse-i18n";
|
||||
|
||||
|
@ -282,10 +282,11 @@ module("Integration | Component | user-menu | messages-list", function (hooks) {
|
|||
this.currentUser.set("grouped_unread_notifications", {});
|
||||
await settled();
|
||||
|
||||
assert.notOk(
|
||||
exists(".panel-body-bottom .notifications-dismiss"),
|
||||
"dismiss button is not shown if the user no unread private_message notifications"
|
||||
);
|
||||
assert
|
||||
.dom(".panel-body-bottom .notifications-dismiss")
|
||||
.doesNotExist(
|
||||
"dismiss button is not shown if the user no unread private_message notifications"
|
||||
);
|
||||
});
|
||||
|
||||
test("empty state (aka blank page syndrome)", async function (assert) {
|
||||
|
@ -302,10 +303,9 @@ module("Integration | Component | user-menu | messages-list", function (hooks) {
|
|||
I18n.t("user.no_messages_title"),
|
||||
"empty state title is shown"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".empty-state-body svg.d-icon-envelope"),
|
||||
"icon is correctly rendered in the empty state body"
|
||||
);
|
||||
assert
|
||||
.dom(".empty-state-body svg.d-icon-envelope")
|
||||
.exists("icon is correctly rendered in the empty state body");
|
||||
const emptyStateBodyLink = query(".empty-state-body a");
|
||||
assert.ok(
|
||||
emptyStateBodyLink.href.endsWith("/about"),
|
||||
|
|
|
@ -13,10 +13,9 @@ module("Integration | Component | Widget | button", function (hooks) {
|
|||
await render(hbs`<MountWidget @widget="button" @args={{this.args}} />`);
|
||||
|
||||
assert.ok(exists("button.btn.btn-icon.no-text"), "it has all the classes");
|
||||
assert.ok(
|
||||
exists("button .d-icon.d-icon-far-face-smile"),
|
||||
"it has the icon"
|
||||
);
|
||||
assert
|
||||
.dom("button .d-icon.d-icon-far-face-smile")
|
||||
.exists("it has the icon");
|
||||
});
|
||||
|
||||
test("icon and text button", async function (assert) {
|
||||
|
|
|
@ -173,10 +173,9 @@ module("Integration | Component | Widget | post-menu", function (hooks) {
|
|||
|
||||
await render(hbs`<MountWidget @widget="post-menu" @args={{this.args}} />`);
|
||||
|
||||
assert.ok(
|
||||
!exists("h1.post-menu-replacement"),
|
||||
"replacement is not rendered"
|
||||
);
|
||||
assert
|
||||
.dom("h1.post-menu-replacement")
|
||||
.doesNotExist("replacement is not rendered");
|
||||
assert.ok(exists(".actions .reply"), "reply button is present");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -222,10 +222,9 @@ module("Integration | Component | Widget | post", function (hooks) {
|
|||
|
||||
await render(hbs`<MountWidget @widget="post" @args={{this.args}} />`);
|
||||
|
||||
assert.ok(
|
||||
exists(".actions button.post-action-menu__copy-link"),
|
||||
"it renders a copy link button"
|
||||
);
|
||||
assert
|
||||
.dom(".actions button.post-action-menu__copy-link")
|
||||
.exists("it renders a copy link button");
|
||||
});
|
||||
|
||||
test("liking", async function (assert) {
|
||||
|
|
|
@ -55,10 +55,9 @@ module("Integration | Component | Widget | topic-status", function (hooks) {
|
|||
);
|
||||
|
||||
assert.ok(exists(".topic-statuses .pinned"), "pinned icon is shown");
|
||||
assert.ok(
|
||||
!exists(".topic-statuses .unpinned"),
|
||||
"unpinned icon is not shown"
|
||||
);
|
||||
assert
|
||||
.dom(".topic-statuses .unpinned")
|
||||
.doesNotExist("unpinned icon is not shown");
|
||||
|
||||
await click(".topic-statuses .pin-toggle-button");
|
||||
|
||||
|
@ -68,9 +67,8 @@ module("Integration | Component | Widget | topic-status", function (hooks) {
|
|||
await click(".topic-statuses .pin-toggle-button");
|
||||
|
||||
assert.ok(exists(".topic-statuses .pinned"), "pinned icon is shown");
|
||||
assert.ok(
|
||||
!exists(".topic-statuses .unpinned"),
|
||||
"unpinned icon is not shown"
|
||||
);
|
||||
assert
|
||||
.dom(".topic-statuses .unpinned")
|
||||
.doesNotExist("unpinned icon is not shown");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,7 +2,6 @@ import { click, fillIn, settled, visit } from "@ember/test-helpers";
|
|||
import { skip } from "qunit";
|
||||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
publishToMessageBus,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
|
@ -100,10 +99,9 @@ acceptance("Discourse Chat - Composer - unreliable network", function (needs) {
|
|||
await fillIn(".chat-composer__input", "network-error-message");
|
||||
await click(".chat-composer-button.-send");
|
||||
|
||||
assert.ok(
|
||||
exists(".chat-message-container[data-id='1'] .retry-staged-message-btn"),
|
||||
"it adds a retry button"
|
||||
);
|
||||
assert
|
||||
.dom(".chat-message-container[data-id='1'] .retry-staged-message-btn")
|
||||
.exists("it adds a retry button");
|
||||
|
||||
await fillIn(".chat-composer__input", "network-error-message");
|
||||
await click(".chat-composer-button.-send");
|
||||
|
@ -117,14 +115,12 @@ acceptance("Discourse Chat - Composer - unreliable network", function (needs) {
|
|||
},
|
||||
});
|
||||
|
||||
assert.notOk(
|
||||
exists(".chat-message-container[data-id='1'] .retry-staged-message-btn"),
|
||||
"it removes the staged message"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".chat-message-container[data-id='175']"),
|
||||
"it sends the message"
|
||||
);
|
||||
assert
|
||||
.dom(".chat-message-container[data-id='1'] .retry-staged-message-btn")
|
||||
.doesNotExist("it removes the staged message");
|
||||
assert
|
||||
.dom(".chat-message-container[data-id='175']")
|
||||
.exists("it sends the message");
|
||||
assert.strictEqual(
|
||||
query(".chat-composer__input").value,
|
||||
"",
|
||||
|
@ -137,9 +133,8 @@ acceptance("Discourse Chat - Composer - unreliable network", function (needs) {
|
|||
this.chatService.set("isNetworkUnreliable", true);
|
||||
await settled();
|
||||
|
||||
assert.ok(
|
||||
exists(".chat-composer__unreliable-network"),
|
||||
"it displays a network error icon"
|
||||
);
|
||||
assert
|
||||
.dom(".chat-composer__unreliable-network")
|
||||
.exists("it displays a network error icon");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -134,7 +134,6 @@ acceptance("Discourse Chat - Chat live pane collapse", function (needs) {
|
|||
});
|
||||
|
||||
skip("lightbox shows up before and after expand and collapse", async function (assert) {
|
||||
const lightboxImage = ".mfp-img";
|
||||
const image = ".chat-message-container[data-id='2'] .chat-img-upload";
|
||||
const expandImage =
|
||||
".chat-message-container[data-id='2'] .chat-message-collapser-closed";
|
||||
|
@ -145,20 +144,14 @@ acceptance("Discourse Chat - Chat live pane collapse", function (needs) {
|
|||
|
||||
await click(image);
|
||||
|
||||
assert.ok(
|
||||
exists(document.querySelector(lightboxImage)),
|
||||
"can see lightbox"
|
||||
);
|
||||
await click(document.querySelector(".mfp-container"));
|
||||
assert.dom(".mfp-img").exists("can see lightbox");
|
||||
await click(".mfp-container");
|
||||
|
||||
await click(collapseImage);
|
||||
await click(expandImage);
|
||||
|
||||
await click(image);
|
||||
assert.ok(
|
||||
exists(document.querySelector(lightboxImage)),
|
||||
"can see lightbox after collapse expand"
|
||||
);
|
||||
await click(document.querySelector(".mfp-container"));
|
||||
assert.dom(".mfp-img").exists("can see lightbox after collapse expand");
|
||||
await click(".mfp-container");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -155,10 +155,9 @@ acceptance("Discourse Presence Plugin", function (needs) {
|
|||
|
||||
const avatarSelector =
|
||||
".topic-above-footer-buttons-outlet.presence .presence-avatars .avatar";
|
||||
assert.ok(
|
||||
exists(".topic-above-footer-buttons-outlet.presence"),
|
||||
"includes the presence component"
|
||||
);
|
||||
assert
|
||||
.dom(".topic-above-footer-buttons-outlet.presence")
|
||||
.exists("includes the presence component");
|
||||
assert.strictEqual(count(avatarSelector), 0, "no avatars displayed");
|
||||
|
||||
await joinChannel("/discourse-presence/reply/280", {
|
||||
|
|
|
@ -2,7 +2,6 @@ import { test } from "qunit";
|
|||
import { AUTO_GROUPS } from "discourse/lib/constants";
|
||||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { displayPollBuilderButton } from "discourse/plugins/poll/helpers/display-poll-builder-button";
|
||||
|
@ -24,10 +23,9 @@ acceptance("Poll Builder - polls are disabled", function (needs) {
|
|||
|
||||
await displayPollBuilderButton();
|
||||
|
||||
assert.ok(
|
||||
!exists(".select-kit-row[data-value='showPollBuilder']"),
|
||||
"it hides the builder button"
|
||||
);
|
||||
assert
|
||||
.dom(".select-kit-row[data-value='showPollBuilder']")
|
||||
.doesNotExist("it hides the builder button");
|
||||
});
|
||||
|
||||
test("regular user - insufficient permissions", async function (assert) {
|
||||
|
@ -40,10 +38,9 @@ acceptance("Poll Builder - polls are disabled", function (needs) {
|
|||
|
||||
await displayPollBuilderButton();
|
||||
|
||||
assert.ok(
|
||||
!exists(".select-kit-row[data-value='showPollBuilder']"),
|
||||
"it hides the builder button"
|
||||
);
|
||||
assert
|
||||
.dom(".select-kit-row[data-value='showPollBuilder']")
|
||||
.doesNotExist("it hides the builder button");
|
||||
});
|
||||
|
||||
test("staff", async function (assert) {
|
||||
|
@ -51,9 +48,8 @@ acceptance("Poll Builder - polls are disabled", function (needs) {
|
|||
|
||||
await displayPollBuilderButton();
|
||||
|
||||
assert.ok(
|
||||
!exists(".select-kit-row[data-value='showPollBuilder']"),
|
||||
"it hides the builder button"
|
||||
);
|
||||
assert
|
||||
.dom(".select-kit-row[data-value='showPollBuilder']")
|
||||
.doesNotExist("it hides the builder button");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -64,10 +64,9 @@ acceptance("Poll Builder - polls are enabled", function (needs) {
|
|||
|
||||
await displayPollBuilderButton();
|
||||
|
||||
assert.ok(
|
||||
!exists(".select-kit-row[data-value='showPollBuilder]"),
|
||||
"it hides the builder button"
|
||||
);
|
||||
assert
|
||||
.dom(".select-kit-row[data-value='showPollBuilder']")
|
||||
.doesNotExist("hides the builder button");
|
||||
});
|
||||
|
||||
test("staff - with insufficient trust level", async function (assert) {
|
||||
|
|
Loading…
Reference in New Issue