diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-user-emails-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-user-emails-test.js
index 7358c04b4a8..547aa55055a 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/admin-user-emails-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-user-emails-test.js
@@ -1,34 +1,29 @@
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
-import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
+import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import { i18n } from "discourse-i18n";
function assertNoSecondary(assert) {
- assert.strictEqual(
- query(".display-row.email .value a").innerText,
- "eviltrout@example.com",
- "it should display the primary email"
- );
+ assert
+ .dom(".display-row.email .value a")
+ .hasText("eviltrout@example.com", "displays the primary email");
- assert.strictEqual(
- query(".display-row.secondary-emails .value").innerText.trim(),
- i18n("user.email.no_secondary"),
- "it should not display secondary emails"
- );
+ assert
+ .dom(".display-row.secondary-emails .value")
+ .hasText(
+ i18n("user.email.no_secondary"),
+ "does not display secondary emails"
+ );
}
function assertMultipleSecondary(assert, firstEmail, secondEmail) {
- assert.strictEqual(
- query(".display-row.secondary-emails .value li:first-of-type a").innerText,
- firstEmail,
- "it should display the first secondary email"
- );
+ assert
+ .dom(".display-row.secondary-emails .value li:first-of-type a")
+ .hasText(firstEmail, "displays the first secondary email");
- assert.strictEqual(
- query(".display-row.secondary-emails .value li:last-of-type a").innerText,
- secondEmail,
- "it should display the second secondary email"
- );
+ assert
+ .dom(".display-row.secondary-emails .value li:last-of-type a")
+ .hasText(secondEmail, "displays the second secondary email");
}
acceptance("Admin - User Emails", function (needs) {
@@ -45,10 +40,7 @@ acceptance("Admin - User Emails", function (needs) {
assert
.dom(".display-row.email .value a")
- .hasText(
- "markvanlan@example.com",
- "it should display the user's primary email"
- );
+ .hasText("markvanlan@example.com", "displays the user's primary email");
assertMultipleSecondary(
assert,
diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-users-list-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-users-list-test.js
index 244a6af6fff..d7a6534a277 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/admin-users-list-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-users-list-test.js
@@ -1,6 +1,6 @@
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
-import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
+import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import { i18n } from "discourse-i18n";
acceptance("Admin - Users List", function (needs) {
@@ -58,12 +58,9 @@ acceptance("Admin - Users List", function (needs) {
await click(".hide-emails");
- assert.strictEqual(
- query(".users-list .user:nth-child(1) .email .directory-table__value")
- .innerText,
- "",
- "hides the emails"
- );
+ assert
+ .dom(".users-list .user:nth-child(1) .email .directory-table__value")
+ .hasNoText("hides the emails");
});
test("switching tabs", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/category-edit-security-test.js b/app/assets/javascripts/discourse/tests/acceptance/category-edit-security-test.js
index d7c20b65eea..98d81a7a319 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/category-edit-security-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/category-edit-security-test.js
@@ -14,10 +14,7 @@ acceptance("Category Edit - Security", function (needs) {
test("default", async function (assert) {
await visit("/c/bug/edit/security");
- const firstRow = query(".row-body");
- const badgeName = firstRow.querySelector(".group-name-label").innerText;
- assert.strictEqual(badgeName, "everyone");
-
+ assert.dom(".row-body .group-name-label").hasText("everyone");
assert.dom(".d-icon-square-check").exists({ count: 3 });
});
@@ -57,10 +54,7 @@ acceptance("Category Edit - Security", function (needs) {
const addedRow = [...queryAll(".row-body")].at(-1);
- assert.strictEqual(
- addedRow.querySelector(".group-name-link").innerText,
- "staff"
- );
+ assert.dom(".group-name-link", addedRow).hasText("staff");
assert.strictEqual(
addedRow.querySelectorAll(".d-icon-square-check").length,
3,
@@ -85,10 +79,7 @@ acceptance("Category Edit - Security", function (needs) {
const firstRow = query(".row-body");
- assert.strictEqual(
- firstRow.querySelector(".group-name-label").innerText,
- "everyone"
- );
+ assert.dom(".group-name-label", firstRow).hasText("everyone");
assert.strictEqual(
firstRow.querySelectorAll(".d-icon-square-check").length,
1,
diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-test.js
index d1dffe548b8..94f0e38fbe6 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/composer-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/composer-test.js
@@ -521,10 +521,9 @@ acceptance("Composer", function (needs) {
// at this point, request is in flight, so post is staged
assert.dom(".topic-post").exists();
assert.dom(".topic-post").hasClass("staged");
- assert.strictEqual(
- query(".topic-post.staged .cooked").innerText.trim(),
- "will return empty json"
- );
+ assert
+ .dom(".topic-post.staged .cooked")
+ .hasText("will return empty json");
return response(200, {});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/custom-html-template-test.js b/app/assets/javascripts/discourse/tests/acceptance/custom-html-template-test.js
index 6e2f391857f..c5f943bb4a6 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/custom-html-template-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/custom-html-template-test.js
@@ -1,7 +1,7 @@
import { visit } from "@ember/test-helpers";
import { hbs } from "ember-cli-htmlbars";
import { test } from "qunit";
-import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
+import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import { registerTemporaryModule } from "discourse/tests/helpers/temporary-module-helper";
import { withSilencedDeprecationsAsync } from "discourse-common/lib/deprecated";
@@ -18,11 +18,7 @@ acceptance("CustomHTML template", function (needs) {
"discourse.custom_html_template",
async () => {
await visit("/static/faq");
- assert.strictEqual(
- query("span.top-span").innerText,
- "TOP",
- "it inserted the template"
- );
+ assert.dom("span.top-span").hasText("TOP", "inserted the template");
}
);
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-manage-email-settings-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-manage-email-settings-test.js
index f5d504a2def..cfe0f633780 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/group-manage-email-settings-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/group-manage-email-settings-test.js
@@ -111,21 +111,19 @@ acceptance(
await formKit().submit();
await click(".group-manage-save");
- assert.strictEqual(
- query(".group-manage-save-button > span").innerText,
- "Saved!"
- );
+ assert.dom(".group-manage-save-button > span").hasText("Saved!");
assert
.dom("#enable_imap")
.isEnabled("IMAP is able to be enabled now that SMTP is saved");
await click("#enable_smtp");
- assert.strictEqual(
- query(".dialog-body").innerText.trim(),
- i18n("groups.manage.email.smtp_disable_confirm"),
- "shows a confirm dialogue warning SMTP settings will be wiped"
- );
+ assert
+ .dom(".dialog-body")
+ .hasText(
+ i18n("groups.manage.email.smtp_disable_confirm"),
+ "shows a confirm dialogue warning SMTP settings will be wiped"
+ );
await click(".dialog-footer .btn-primary");
});
@@ -172,10 +170,7 @@ acceptance(
await click(".group-manage-save");
- assert.strictEqual(
- query(".group-manage-save-button > span").innerText,
- "Saved!"
- );
+ assert.dom(".group-manage-save-button > span").hasText("Saved!");
assert
.dom(".imap-no-mailbox-selected")
@@ -194,11 +189,12 @@ acceptance(
.doesNotExist("no longer shows a no mailbox selected message");
await click("#enable_imap");
- assert.strictEqual(
- query(".dialog-body").innerText.trim(),
- i18n("groups.manage.email.imap_disable_confirm"),
- "shows a confirm dialogue warning IMAP settings will be wiped"
- );
+ assert
+ .dom(".dialog-body")
+ .hasText(
+ i18n("groups.manage.email.imap_disable_confirm"),
+ "shows a confirm dialogue warning IMAP settings will be wiped"
+ );
await click(".dialog-footer .btn-primary");
});
}
@@ -349,8 +345,7 @@ acceptance(
await formKit().field("email_password").fillIn("password");
await formKit().submit();
- assert.strictEqual(
- query(".dialog-body").innerText.trim(),
+ assert.dom(".dialog-body").hasText(
i18n("generic_error_with_reason", {
error:
"There was an issue with the SMTP credentials provided, check the username and password and try again.",
diff --git a/app/assets/javascripts/discourse/tests/acceptance/groups-new-test.js b/app/assets/javascripts/discourse/tests/acceptance/groups-new-test.js
index 1663d2e095f..b48fd5e91eb 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/groups-new-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/groups-new-test.js
@@ -1,6 +1,6 @@
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
-import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
+import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import { i18n } from "discourse-i18n";
acceptance("New Group - Anonymous", function () {
@@ -69,12 +69,11 @@ acceptance("New Group - Authenticated", function (needs) {
.dom("groups-new-allow-membership-requests")
.doesNotExist("it should disable the membership requests checkbox");
- assert.strictEqual(
- query(
- ".groups-form-default-notification-level .selected-name .name"
- ).innerText.trim(),
- i18n("groups.notifications.watching.title"),
- "it has a default selection for notification level"
- );
+ assert
+ .dom(".groups-form-default-notification-level .selected-name .name")
+ .hasText(
+ i18n("groups.notifications.watching.title"),
+ "has a default selection for notification level"
+ );
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/review-test.js b/app/assets/javascripts/discourse/tests/acceptance/review-test.js
index 2bc184bb323..a279dafa4e3 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/review-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/review-test.js
@@ -4,7 +4,6 @@ import {
acceptance,
loggedInUser,
publishToMessageBus,
- query,
} from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import { i18n } from "discourse-i18n";
@@ -133,20 +132,10 @@ acceptance("Review", function (needs) {
assert.dom(`${topic} .reviewable-action.approve`).exists();
assert.dom(`${topic} .badge-category__name`).doesNotExist();
- assert.strictEqual(
- query(`${topic} .discourse-tag:nth-of-type(1)`).innerText,
- "hello"
- );
+ assert.dom(`${topic} .discourse-tag:nth-of-type(1)`).hasText("hello");
+ assert.dom(`${topic} .discourse-tag:nth-of-type(2)`).hasText("world");
- assert.strictEqual(
- query(`${topic} .discourse-tag:nth-of-type(2)`).innerText,
- "world"
- );
-
- assert.strictEqual(
- query(`${topic} .post-body`).innerText.trim(),
- "existing body"
- );
+ assert.dom(`${topic} .post-body`).hasText("existing body");
await click(`${topic} .reviewable-action.edit`);
await click(`${topic} .reviewable-action.save-edit`);
@@ -164,11 +153,9 @@ acceptance("Review", function (needs) {
await fillIn(".editable-field.payload-raw textarea", "new raw contents");
await click(`${topic} .reviewable-action.cancel-edit`);
- assert.strictEqual(
- query(`${topic} .post-body`).innerText.trim(),
- "existing body",
- "cancelling does not update the value"
- );
+ assert
+ .dom(`${topic} .post-body`)
+ .hasText("existing body", "cancelling does not update the value");
await click(`${topic} .reviewable-action.edit`);
let category = selectKit(`${topic} .category-id .select-kit`);
@@ -193,27 +180,12 @@ acceptance("Review", function (needs) {
await fillIn(".editable-field.payload-raw textarea", "new raw contents");
await click(`${topic} .reviewable-action.save-edit`);
- assert.strictEqual(
- query(`${topic} .discourse-tag:nth-of-type(1)`).innerText,
- "hello"
- );
- assert.strictEqual(
- query(`${topic} .discourse-tag:nth-of-type(2)`).innerText,
- "world"
- );
- assert.strictEqual(
- query(`${topic} .discourse-tag:nth-of-type(3)`).innerText,
- "monkey"
- );
+ assert.dom(`${topic} .discourse-tag:nth-of-type(1)`).hasText("hello");
+ assert.dom(`${topic} .discourse-tag:nth-of-type(2)`).hasText("world");
+ assert.dom(`${topic} .discourse-tag:nth-of-type(3)`).hasText("monkey");
- assert.strictEqual(
- query(`${topic} .post-body`).innerText.trim(),
- "new raw contents"
- );
- assert.strictEqual(
- query(`${topic} .badge-category__name`).innerText.trim(),
- "support"
- );
+ assert.dom(`${topic} .post-body`).hasText("new raw contents");
+ assert.dom(`${topic} .badge-category__name`).hasText("support");
});
test("Reviewables can become stale", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/search-test.js b/app/assets/javascripts/discourse/tests/acceptance/search-test.js
index 63f0021084b..e8c3f89d9c6 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/search-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/search-test.js
@@ -119,21 +119,20 @@ acceptance("Search - Anonymous", function (needs) {
await click("#search-button");
await fillIn("#search-term", "dev");
- assert.strictEqual(
- query(
+ assert
+ .dom(
".search-menu .results ul.search-menu-initial-options li:first-child .search-item-prefix"
- ).innerText.trim(),
- "dev",
- "first dropdown item includes correct prefix"
- );
+ )
+ .hasText("dev", "first dropdown item includes correct prefix");
- assert.strictEqual(
- query(
+ assert
+ .dom(
".search-menu .results ul.search-menu-initial-options li:first-child .search-item-slug"
- ).innerText.trim(),
- i18n("search.in_topics_posts"),
- "first dropdown item includes correct suffix"
- );
+ )
+ .hasText(
+ i18n("search.in_topics_posts"),
+ "first dropdown item includes correct suffix"
+ );
assert
.dom(".search-menu .search-result-category ul li")
@@ -866,20 +865,15 @@ acceptance("Search - with tagging enabled", function (needs) {
await visit("/tags/c/bug/dev");
await click("#search-button");
- assert.strictEqual(
- query(
+ assert
+ .dom(
".search-menu .results ul.search-menu-assistant .badge-category__name"
- ).innerText,
- "bug",
- "Category is displayed"
- );
+ )
+ .hasText("bug", "Category is displayed");
- assert.strictEqual(
- query(".search-menu .results ul.search-menu-assistant .search-item-tag")
- .innerText,
- "dev",
- "Tag is displayed"
- );
+ assert
+ .dom(".search-menu .results ul.search-menu-assistant .search-item-tag")
+ .hasText("dev", "Tag is displayed");
});
test("initial options - tag and category search scope - updates tag / category combination search suggestion when typing", async function (assert) {
@@ -887,27 +881,19 @@ acceptance("Search - with tagging enabled", function (needs) {
await click("#search-button");
await fillIn("#search-term", "foo bar");
- assert.strictEqual(
- query(
- ".search-menu .results ul.search-menu-assistant .search-item-prefix"
- ).innerText,
- "foo bar",
- "Input is applied to search query"
- );
+ assert
+ .dom(".search-menu .results ul.search-menu-assistant .search-item-prefix")
+ .hasText("foo bar", "Input is applied to search query");
- assert.strictEqual(
- query(
+ assert
+ .dom(
".search-menu .results ul.search-menu-assistant .badge-category__name"
- ).innerText,
- "bug"
- );
+ )
+ .hasText("bug");
- assert.strictEqual(
- query(".search-menu .results ul.search-menu-assistant .search-item-tag")
- .innerText,
- "dev",
- "Tag is displayed"
- );
+ assert
+ .dom(".search-menu .results ul.search-menu-assistant .search-item-tag")
+ .hasText("dev", "Tag is displayed");
});
test("initial options - search history - tag intersection context", async function (assert) {
@@ -923,12 +909,9 @@ acceptance("Search - with tagging enabled", function (needs) {
await visit("/tags/intersection/dev/foo");
await click("#search-button");
- assert.strictEqual(
- query(".search-menu .results ul.search-menu-assistant .search-item-tag")
- .innerText,
- "tags:dev+foo",
- "Tags are displayed"
- );
+ assert
+ .dom(".search-menu .results ul.search-menu-assistant .search-item-tag")
+ .hasText("tags:dev+foo", "Tags are displayed");
});
test("initial options - tag intersection search scope - updates tag intersection search suggestion when typing", async function (assert) {
@@ -936,20 +919,13 @@ acceptance("Search - with tagging enabled", function (needs) {
await click("#search-button");
await fillIn("#search-term", "foo bar");
- assert.strictEqual(
- query(
- ".search-menu .results ul.search-menu-assistant .search-item-prefix"
- ).innerText,
- "foo bar",
- "Input is applied to search query"
- );
+ assert
+ .dom(".search-menu .results ul.search-menu-assistant .search-item-prefix")
+ .hasText("foo bar", "Input is applied to search query");
- assert.strictEqual(
- query(".search-menu .results ul.search-menu-assistant .search-item-tag")
- .innerText,
- "tags:dev+foo",
- "Tags are displayed"
- );
+ assert
+ .dom(".search-menu .results ul.search-menu-assistant .search-item-tag")
+ .hasText("tags:dev+foo", "Tags are displayed");
});
});
@@ -1135,38 +1111,31 @@ acceptance("Search - assistant", function (needs) {
await click("#search-button");
await fillIn("#search-term", "#");
- assert.strictEqual(
- query(
+ assert
+ .dom(
".search-menu .results ul.search-menu-assistant .search-link .badge-category__name"
- ).innerText,
- "support"
- );
+ )
+ .hasText("support");
});
test("initial options - shows in: shortcuts", async function (assert) {
await visit("/");
await click("#search-button");
const firstTarget =
- ".search-menu .results ul.search-menu-assistant .search-link ";
+ ".search-menu .results ul.search-menu-assistant .search-link";
await fillIn("#search-term", "in:");
- assert.strictEqual(
- query(firstTarget.concat(".search-item-slug")).innerText,
- "in:title",
- "keyword is present in suggestion"
- );
+ assert
+ .dom(`${firstTarget} .search-item-slug`)
+ .hasText("in:title", "keyword is present in suggestion");
await fillIn("#search-term", "sam in:");
- assert.strictEqual(
- query(firstTarget.concat(".search-item-prefix")).innerText,
- "sam",
- "term is present in suggestion"
- );
- assert.strictEqual(
- query(firstTarget.concat(".search-item-slug")).innerText,
- "in:title",
- "keyword is present in suggestion"
- );
+ assert
+ .dom(`${firstTarget} .search-item-prefix`)
+ .hasText("sam", "term is present in suggestion");
+ assert
+ .dom(`${firstTarget} .search-item-slug`)
+ .hasText("in:title", "keyword is present in suggestion");
await fillIn("#search-term", "in:mess");
assert.dom(firstTarget).hasText("in:messages");
@@ -1176,13 +1145,22 @@ acceptance("Search - assistant", function (needs) {
await visit("/");
await click("#search-button");
await fillIn("#search-term", "@");
- const firstUser = query(
+ assert
+ .dom(
+ ".search-menu .results ul.search-menu-assistant .search-item-user .username"
+ )
+ .hasText("TeaMoe");
+
+ const username = document
+ .querySelector(
+ ".search-menu .results ul.search-menu-assistant .search-item-user .username"
+ )
+ .innerText.trim();
+
+ await click(
".search-menu .results ul.search-menu-assistant .search-item-user"
);
- const username = firstUser.querySelector(".username").innerText.trim();
- assert.strictEqual(username, "TeaMoe");
- await click(firstUser);
assert.dom("#search-term").hasValue(`@${username}`);
});
@@ -1244,16 +1222,18 @@ acceptance("Search - assistant", function (needs) {
.exists({ count: 1 }, "passes the PM search context to the search query");
});
- test("topic results - updates search term when selecting a initial category option", async function (assert) {
+ test("topic results - updates search term when selecting an initial category option", async function (assert) {
await visit("/");
await click("#search-button");
await fillIn("#search-term", "sam #");
+
const firstCategory =
".search-menu .results ul.search-menu-assistant .search-link";
- const firstCategoryName = query(
+ const firstCategoryName = document.querySelector(
`${firstCategory} .badge-category__name`
).innerText;
- await click(firstCategory);
+
+ await click(`${firstCategory} .badge-category__name`);
assert.strictEqual(
query("#search-term").value,
diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-edit-timer-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-edit-timer-test.js
index c74193d14c4..9ffd477dcba 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/topic-edit-timer-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/topic-edit-timer-test.js
@@ -5,7 +5,6 @@ import {
acceptance,
fakeTime,
loggedInUser,
- query,
queryAll,
updateCurrentUser,
} from "discourse/tests/helpers/qunit-helpers";
@@ -159,10 +158,6 @@ acceptance("Topic - Edit timer", function (needs) {
await click("#tap_tile_start_of_next_business_week");
- const text = query(
- ".edit-topic-timer-modal .topic-timer-info"
- ).innerText.trim();
-
// this needs to be done because there is no simple way to get the
// plain text version of a translation with HTML
let el = document.createElement("p");
@@ -172,7 +167,9 @@ acceptance("Topic - Edit timer", function (needs) {
timeLeft: "in 6 days",
});
- assert.strictEqual(text, el.innerText);
+ assert
+ .dom(".edit-topic-timer-modal .topic-timer-info")
+ .hasText(el.innerText);
});
test("schedule publish to category - visible for a private category", async function (assert) {
@@ -196,10 +193,6 @@ acceptance("Topic - Edit timer", function (needs) {
await click("#tap_tile_start_of_next_business_week");
- const text = query(
- ".edit-topic-timer-modal .topic-timer-info"
- ).innerText.trim();
-
// this needs to be done because there is no simple way to get the
// plain text version of a translation with HTML
let el = document.createElement("p");
@@ -209,7 +202,9 @@ acceptance("Topic - Edit timer", function (needs) {
timeLeft: "in 6 days",
});
- assert.strictEqual(text, el.innerText);
+ assert
+ .dom(".edit-topic-timer-modal .topic-timer-info")
+ .hasText(el.innerText);
});
test("schedule publish to category - visible for an unlisted public topic", async function (assert) {
@@ -237,10 +232,6 @@ acceptance("Topic - Edit timer", function (needs) {
await click("#tap_tile_start_of_next_business_week");
- const text = query(
- ".edit-topic-timer-modal .topic-timer-info"
- ).innerText.trim();
-
// this needs to be done because there is no simple way to get the
// plain text version of a translation with HTML
let el = document.createElement("p");
@@ -250,7 +241,9 @@ acceptance("Topic - Edit timer", function (needs) {
timeLeft: "in 6 days",
});
- assert.strictEqual(text, el.innerText);
+ assert
+ .dom(".edit-topic-timer-modal .topic-timer-info")
+ .hasText(el.innerText);
});
test("schedule publish to category - last custom date and time", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-test.js
index 257340d0e16..9d68862931c 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/topic-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/topic-test.js
@@ -273,8 +273,7 @@ acceptance("Topic featured links", function (needs) {
test("remove nofollow attribute", async function (assert) {
await visit("/t/-/299/1");
- const link = query(".title-wrapper .topic-featured-link");
- assert.strictEqual(link.innerText, "example.com");
+ assert.dom(".title-wrapper .topic-featured-link").hasText("example.com");
assert
.dom(".title-wrapper .topic-featured-link")
.hasAttribute("rel", "ugc");
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-security-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-security-test.js
index 4df111984fa..6e48be5b3b1 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-security-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-security-test.js
@@ -2,7 +2,6 @@ import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import {
acceptance,
- query,
updateCurrentUser,
} from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
@@ -28,13 +27,9 @@ acceptance("User Preferences - Security", function (needs) {
test("recently connected devices", async function (assert) {
await visit("/u/eviltrout/preferences/security");
- assert.strictEqual(
- query(
- ".auth-tokens > .auth-token:nth-of-type(1) .auth-token-device"
- ).innerText.trim(),
- "Linux Computer",
- "it should display active token first"
- );
+ assert
+ .dom(".auth-tokens > .auth-token:nth-of-type(1) .auth-token-device")
+ .hasText("Linux Computer", "displays active token first");
assert
.dom(".pref-auth-tokens > a:nth-of-type(1)")
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-private-messages-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-private-messages-test.js
index 0c383ee0d4d..a7dc6504c57 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-private-messages-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-private-messages-test.js
@@ -356,17 +356,19 @@ acceptance(
await publishUnreadToMessageBus({ topicId: 1 });
await publishNewToMessageBus({ topicId: 2 });
- assert.strictEqual(
- query(".user-nav__messages-new").innerText.trim(),
- i18n("user.messages.new_with_count", { count: 1 }),
- "displays the right count"
- );
+ assert
+ .dom(".user-nav__messages-new")
+ .hasText(
+ i18n("user.messages.new_with_count", { count: 1 }),
+ "displays the right count"
+ );
- assert.strictEqual(
- query(".user-nav__messages-unread").innerText.trim(),
- i18n("user.messages.unread_with_count", { count: 1 }),
- "displays the right count"
- );
+ assert
+ .dom(".user-nav__messages-unread")
+ .hasText(
+ i18n("user.messages.unread_with_count", { count: 1 }),
+ "displays the right count"
+ );
});
test("incoming new messages while viewing new", async function (assert) {
@@ -374,21 +376,23 @@ acceptance(
await publishNewToMessageBus({ topicId: 1 });
- assert.strictEqual(
- query(".messages-nav .user-nav__messages-new").innerText.trim(),
- i18n("user.messages.new_with_count", { count: 1 }),
- "displays the right count"
- );
+ assert
+ .dom(".messages-nav .user-nav__messages-new")
+ .hasText(
+ i18n("user.messages.new_with_count", { count: 1 }),
+ "displays the right count"
+ );
assert.dom(".show-mores").exists("displays the topic incoming info");
await publishNewToMessageBus({ topicId: 2 });
- assert.strictEqual(
- query(".messages-nav .user-nav__messages-new").innerText.trim(),
- i18n("user.messages.new_with_count", { count: 2 }),
- "displays the right count"
- );
+ assert
+ .dom(".messages-nav .user-nav__messages-new")
+ .hasText(
+ i18n("user.messages.new_with_count", { count: 2 }),
+ "displays the right count"
+ );
assert.dom(".show-mores").exists("displays the topic incoming info");
});
@@ -398,11 +402,12 @@ acceptance(
await publishUnreadToMessageBus();
- assert.strictEqual(
- query(".messages-nav .user-nav__messages-unread").innerText.trim(),
- i18n("user.messages.unread_with_count", { count: 1 }),
- "displays the right count"
- );
+ assert
+ .dom(".messages-nav .user-nav__messages-unread")
+ .hasText(
+ i18n("user.messages.unread_with_count", { count: 1 }),
+ "displays the right count"
+ );
assert.dom(".show-mores").exists("displays the topic incoming info");
});
@@ -413,35 +418,31 @@ acceptance(
await publishUnreadToMessageBus({ groupIds: [14], topicId: 1 });
await publishNewToMessageBus({ groupIds: [14], topicId: 2 });
- assert.strictEqual(
- query(
- ".messages-nav .user-nav__messages-group-unread"
- ).innerText.trim(),
- i18n("user.messages.unread_with_count", { count: 1 }),
- "displays the right count"
- );
+ assert
+ .dom(".messages-nav .user-nav__messages-group-unread")
+ .hasText(
+ i18n("user.messages.unread_with_count", { count: 1 }),
+ "displays the right count"
+ );
- assert.strictEqual(
- query(".messages-nav .user-nav__messages-group-new").innerText.trim(),
- i18n("user.messages.new_with_count", { count: 1 }),
- "displays the right count"
- );
+ assert
+ .dom(".messages-nav .user-nav__messages-group-new")
+ .hasText(
+ i18n("user.messages.new_with_count", { count: 1 }),
+ "displays the right count"
+ );
assert.dom(".show-mores").exists("displays the topic incoming info");
await visit("/u/charlie/messages/unread");
- assert.strictEqual(
- query(".messages-nav .user-nav__messages-unread").innerText.trim(),
- i18n("user.messages.unread"),
- "displays the right count"
- );
+ assert
+ .dom(".messages-nav .user-nav__messages-unread")
+ .hasText(i18n("user.messages.unread"), "displays the right count");
- assert.strictEqual(
- query(".messages-nav .user-nav__messages-new").innerText.trim(),
- i18n("user.messages.new"),
- "displays the right count"
- );
+ assert
+ .dom(".messages-nav .user-nav__messages-new")
+ .hasText(i18n("user.messages.new"), "displays the right count");
});
test("incoming messages is not tracked on non user messages route", async function (assert) {
@@ -471,11 +472,9 @@ acceptance(
await click(".btn.dismiss-read");
await click("#dismiss-read-confirm");
- assert.strictEqual(
- query(".user-nav__messages-unread").innerText.trim(),
- i18n("user.messages.unread"),
- "displays the right count"
- );
+ assert
+ .dom(".user-nav__messages-unread")
+ .hasText(i18n("user.messages.unread"), "displays the right count");
assert
.dom(".topic-list-item")
@@ -525,11 +524,9 @@ acceptance(
await click(".btn.dismiss-read");
- assert.strictEqual(
- query(".messages-nav .user-nav__messages-new").innerText.trim(),
- i18n("user.messages.new"),
- "displays the right count"
- );
+ assert
+ .dom(".messages-nav .user-nav__messages-new")
+ .hasText(i18n("user.messages.new"), "displays the right count");
assert
.dom(".topic-list-item")
diff --git a/app/assets/javascripts/discourse/tests/integration/components/form-template-field/dropdown-test.js b/app/assets/javascripts/discourse/tests/integration/components/form-template-field/dropdown-test.js
index 998bedcf833..c10a0c798c5 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/form-template-field/dropdown-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/form-template-field/dropdown-test.js
@@ -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 { query, queryAll } from "discourse/tests/helpers/qunit-helpers";
+import { queryAll } from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
module(
@@ -63,11 +63,9 @@ module(
.dom(".form-template-field__dropdown")
.exists("a dropdown component exists");
- assert.strictEqual(
- query(".form-template-field__dropdown-placeholder").innerText,
- attributes.none_label,
- "None label is correct"
- );
+ assert
+ .dom(".form-template-field__dropdown-placeholder")
+ .hasText(attributes.none_label, "None label is correct");
});
test("doesn't render a label when attribute is missing", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/form-template-field/multi-select-test.js b/app/assets/javascripts/discourse/tests/integration/components/form-template-field/multi-select-test.js
index 27f3e2b3d34..7f886beec9b 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/form-template-field/multi-select-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/form-template-field/multi-select-test.js
@@ -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 { query, queryAll } from "discourse/tests/helpers/qunit-helpers";
+import { queryAll } from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
module(
@@ -64,11 +64,9 @@ module(
.dom(".form-template-field__multi-select")
.exists("a multiselect dropdown component exists");
- assert.strictEqual(
- query(".form-template-field__multi-select-placeholder").innerText,
- attributes.none_label,
- "None label is correct"
- );
+ assert
+ .dom(".form-template-field__multi-select-placeholder")
+ .hasText(attributes.none_label, "None label is correct");
});
test("doesn't render a label when attribute is missing", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/api-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/api-test.js
index f5dc1760c41..9df9bde1ed5 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/api-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/api-test.js
@@ -3,7 +3,6 @@ import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import { withPluginApi } from "discourse/lib/plugin-api";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
-import { query } from "discourse/tests/helpers/qunit-helpers";
import selectKit, {
DEFAULT_CONTENT,
setDefaultState,
@@ -89,7 +88,7 @@ module("Integration | Component | select-kit/api", function (hooks) {
withPluginApi("0.8.43", (api) => {
api.modifySelectKit("combo-box").onChange((component, value, item) => {
- query("#test").innerText = item.name;
+ document.querySelector("#test").innerText = item.name;
});
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-chooser-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-chooser-test.js
index c427d1107be..1a571bfa0e6 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-chooser-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-chooser-test.js
@@ -303,11 +303,9 @@ module(
await this.subject.expand();
- assert.strictEqual(
- this.subject.rowByIndex(0).el().querySelector(".category-desc")
- .innerText,
- 'baz "bar ‘foo’'
- );
+ assert
+ .dom(".category-desc", this.subject.rowByIndex(0).el())
+ .hasText('baz "bar ‘foo’');
});
}
);
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-drop-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-drop-test.js
index 5bd5af9fe06..746c707c6c8 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-drop-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-drop-test.js
@@ -234,13 +234,10 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
const category = Category.findById(7);
const row = this.subject.rowByValue(category.id);
- const topicCount = row.el().querySelector(".topic-count").innerText.trim();
- assert.strictEqual(
- topicCount,
- "× 481",
- "doesn't include the topic count of subcategories"
- );
+ assert
+ .dom(".topic-count", row.el())
+ .hasText("× 481", "doesn't include the topic count of subcategories");
});
test("countSubcategories (true)", async function (assert) {
@@ -261,13 +258,10 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
const category = Category.findById(7);
const row = this.subject.rowByValue(category.id);
- const topicCount = row.el().querySelector(".topic-count").innerText.trim();
- assert.strictEqual(
- topicCount,
- "× 584",
- "includes the topic count of subcategories"
- );
+ assert
+ .dom(".topic-count", row.el())
+ .hasText("× 584", "includes the topic count of subcategories");
});
test("shortcuts:default", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-selector-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-selector-test.js
index 98a67e88475..13825a7b61f 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-selector-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-selector-test.js
@@ -44,14 +44,12 @@ module(
await this.subject.fillInFilter("Parent Category");
assert.strictEqual(this.subject.rows().length, 2);
- assert.strictEqual(
- this.subject.rowByIndex(0).el().innerText.replace("\n", " "),
- "Parent Category × 95"
- );
- assert.strictEqual(
- this.subject.rowByIndex(1).el().innerText.replaceAll("\n", " "),
- "Parent Category × 95 +2 subcategories"
- );
+ assert
+ .dom(this.subject.rowByIndex(0).el())
+ .hasText("Parent Category× 95");
+ assert
+ .dom(this.subject.rowByIndex(1).el())
+ .hasText("Parent Category× 95+2 subcategories");
});
}
);
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.js
index 0d12ec7c78e..db582d6d069 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.js
@@ -58,9 +58,7 @@ module(
await this.subject.fillInFilter("baz");
await this.subject.selectRowByValue("monkey");
- const error = query(".select-kit-error").innerText;
- assert.strictEqual(
- error,
+ assert.dom(".select-kit-error").hasText(
i18n("select_kit.max_content_reached", {
count: this.siteSettings.max_tags_per_topic,
})
@@ -76,9 +74,7 @@ module(
assert.strictEqual(this.subject.header().value(), "cat,kit");
await this.subject.expand();
- const error = query(".select-kit-error").innerText;
- assert.strictEqual(
- error,
+ assert.dom(".select-kit-error").hasText(
i18n("select_kit.max_content_reached", {
count: 0,
})
diff --git a/app/assets/javascripts/discourse/tests/integration/components/themes-list-item-test.js b/app/assets/javascripts/discourse/tests/integration/components/themes-list-item-test.js
index 216249a5d8b..3a73c907cf5 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/themes-list-item-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/themes-list-item-test.js
@@ -2,7 +2,6 @@ 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 { query } from "discourse/tests/helpers/qunit-helpers";
import { i18n } from "discourse-i18n";
import Theme from "admin/models/theme";
@@ -59,21 +58,18 @@ module("Integration | Component | themes-list-item", function (hooks) {
await render(hbs`
written text
" + @@ -107,21 +107,13 @@ module( const text = queryAll(".chat-message-collapser p"); assert.strictEqual(text.length, 3, "shows all written text"); - assert.strictEqual( - text[0].innerText, - "written text", - "first line of written text" - ); - assert.strictEqual( - text[1].innerText, - "more written text", - "third line of written text" - ); - assert.strictEqual( - text[2].innerText, - "and even more", - "fifth line of written text" - ); + assert.dom(text[0]).hasText("written text", "first line of written text"); + assert + .dom(text[1]) + .hasText("more written text", "third line of written text"); + assert + .dom(text[2]) + .hasText("and even more", "fifth line of written text"); }); test("collapses and expands cooked youtube", async function (assert) { @@ -188,11 +180,9 @@ module( hbs`