1
0
Fork 0

DEV: Add waiting for the default message

Dieser Commit ist enthalten in:
jumagura 2023-05-11 04:19:05 -04:00
Ursprung c83e514de9
Commit 69dc96562d

Datei anzeigen

@ -1,6 +1,6 @@
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers"; import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit"; import { test } from "qunit";
import { click, find, findAll, visit } from "@ember/test-helpers"; import { click, find, findAll, visit, waitUntil } from "@ember/test-helpers";
import { import {
getUnsubscribedAdminWizards, getUnsubscribedAdminWizards,
getWizard, getWizard,
@ -33,6 +33,24 @@ acceptance("Admin | Manager", function (needs) {
}); });
}); });
}); });
async function waitForDestructionAndResetMessage() {
// Wait for the "Destruction complete" message to appear
await waitUntil(
() =>
document.querySelector(".message-content")?.innerText ===
"Destruction complete",
{ timeout: 5000 }
);
// Wait for the message to change back to the original text
await waitUntil(
() =>
document.querySelector(".message-content")?.innerText ===
"Export, import or destroy wizards",
{ timeout: 15000 }
);
}
test("viewing manager fields content", async (assert) => { test("viewing manager fields content", async (assert) => {
await visit("/admin/wizards/manager"); await visit("/admin/wizards/manager");
assert.ok( assert.ok(
@ -78,6 +96,7 @@ acceptance("Admin | Manager", function (needs) {
"the destroy button is enabled when destroy checkbox is clicked" "the destroy button is enabled when destroy checkbox is clicked"
); );
await click("#destroy-button"); await click("#destroy-button");
await waitForDestructionAndResetMessage();
assert.notOk( assert.notOk(
find('table tr[data-wizard-id="this-is-testing-wizard"]'), find('table tr[data-wizard-id="this-is-testing-wizard"]'),
"the wizard row is removed after destroy button is clicked" "the wizard row is removed after destroy button is clicked"