mirror of https://github.com/zulip/zulip.git
puppeteer_tests: Remove buggy assert_selector_doesnt_exist helper.
It was checking whether the selector string is itself null, not whether it selects anything! Use page.waitForSelector(…, {hidden: true}) instead. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
0ca543396a
commit
72142273c0
|
@ -92,10 +92,6 @@ class CommonUtils {
|
|||
});
|
||||
}
|
||||
|
||||
async assert_selector_doesnt_exist(page, selector) {
|
||||
await page.waitForFunction((selector) => $(selector === null), {}, selector);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function takes a params object whose fields
|
||||
* are referenced by name attribute of an input field and
|
||||
|
|
|
@ -351,16 +351,14 @@ async function test_users_search(page) {
|
|||
async function assert_selected(page, name) {
|
||||
await page.waitForSelector(
|
||||
`#user_presences li.highlighted_user [data-name="${CSS.escape(name)}"]`,
|
||||
{
|
||||
visible: true,
|
||||
},
|
||||
{visible: true},
|
||||
);
|
||||
}
|
||||
|
||||
async function assert_not_selected(page, name) {
|
||||
await common.assert_selector_doesnt_exist(
|
||||
page,
|
||||
await page.waitForSelector(
|
||||
`#user_presences li.highlighted_user [data-name="${CSS.escape(name)}"]`,
|
||||
{hidden: true},
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ async function test_delete_draft(page) {
|
|||
await page.click("#drafts_table .message_row.private-message .delete-draft");
|
||||
const drafts_count = await get_drafts_count(page);
|
||||
assert.strictEqual(drafts_count, 1, "Draft not deleted.");
|
||||
await common.assert_selector_doesnt_exist(page, "#drafts_table .message_row.private-message");
|
||||
await page.waitForSelector("#drafts_table .message_row.private-message", {hidden: true});
|
||||
await page.click(`${drafts_overlay} .exit`);
|
||||
await wait_for_drafts_to_dissapear(page);
|
||||
await page.click("body");
|
||||
|
@ -242,7 +242,7 @@ async function test_delete_draft_on_sending(page) {
|
|||
await wait_for_drafts_to_appear(page);
|
||||
const drafts_count = await get_drafts_count(page);
|
||||
assert.strictEqual(drafts_count, 1, "Draft wasn't cleared on sending.");
|
||||
await common.assert_selector_doesnt_exist(page, "#drafts_table .message_row.private-message");
|
||||
await page.waitForSelector("#drafts_table .message_row.private-message", {hidden: true});
|
||||
}
|
||||
|
||||
async function drafts_test(page) {
|
||||
|
|
|
@ -29,7 +29,7 @@ async function delete_message_test(page) {
|
|||
messages_quantitiy - 1,
|
||||
);
|
||||
|
||||
await common.assert_selector_doesnt_exist(page, last_message_id);
|
||||
await page.waitForSelector(last_message_id, {hidden: true});
|
||||
await page.waitForSelector("#do_delete_message_spinner .loading_indicator_spinner", {
|
||||
hidden: true,
|
||||
});
|
||||
|
|
|
@ -219,7 +219,7 @@ async function test_duplicate_alert_words_cannot_be_added(page, duplicate_word)
|
|||
async function delete_alert_word(page, word) {
|
||||
const delete_btn_selector = `.remove-alert-word[data-word="${CSS.escape(word)}"]`;
|
||||
await page.click(delete_btn_selector);
|
||||
await common.assert_selector_doesnt_exist(page, delete_btn_selector);
|
||||
await page.waitForSelector(delete_btn_selector, {hidden: true});
|
||||
}
|
||||
|
||||
async function test_alert_word_deletion(page, word) {
|
||||
|
|
Loading…
Reference in New Issue