DEV: Try to make admin email-preview test resilent (#28782)

This commit is contained in:
Jarek Radosz 2024-09-06 17:26:13 +02:00 committed by GitHub
parent ad7d5426d8
commit 498212bb5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 8 deletions

View File

@ -1,6 +1,6 @@
import { click, visit, waitUntil } 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";
acceptance("Admin - email-preview", function (needs) {
needs.user();
@ -15,18 +15,18 @@ acceptance("Admin - email-preview", function (needs) {
test("preview rendering", async function (assert) {
await visit("/admin/email/preview-digest");
const iframe = query(".preview-output iframe");
const iframe = document.querySelector(".preview-output iframe");
// Rendered as a separate document, so Ember's built-in waiters don't work properly
await waitUntil(() => iframe.contentWindow.document.body);
await waitUntil(() =>
iframe.contentWindow.document.body?.querySelector("span")
);
const iframeBody = iframe.contentWindow.document.body;
assert.strictEqual(
iframeBody.querySelector("span").innerText,
"Hello world",
"html content is rendered inside iframe"
);
assert
.dom("span", iframeBody)
.hasText("Hello world", "html content is rendered inside iframe");
await click("a.show-text-link");
assert