tests: Fix admin.test.ts puppeteer test case failing.

The puppeteer test case for checking the save discard widget button
states was failing sometimes as the button was being updated too soon.

Due to this, sometimes the assertion check would execute after the
button label has already been updated — resulting in mismatched results.

(cherry picked from commit e1acec52eb)
This commit is contained in:
Sayam Samal
2025-04-08 22:44:46 +05:30
committed by Tim Abbott
parent 5c1451dd21
commit 68c9866a6e

View File

@@ -10,11 +10,8 @@ async function submit_announcements_stream_settings(page: Page): Promise<void> {
});
const save_button = "#org-notifications .save-button";
assert.strictEqual(
await common.get_text_from_selector(page, save_button),
"Save changes",
"Save button has incorrect text.",
);
const button_text = await common.get_text_from_selector(page, save_button);
assert.strictEqual(button_text, "Save changes", "Save button has incorrect text.");
await page.click(save_button);
await page.waitForSelector('#org-notifications .save-button[data-status="saved"]', {