mirror of
https://github.com/zulip/zulip.git
synced 2025-11-13 18:36:36 +00:00
This commit renames the variables, functions used in confirm_dialog.js and classes and ids used in confirm_dialog.hbs. This change is made so that we can easily migrate edit_fields_modal to use this same code with some more changes. We will change the file names and correspondingly import variables in the next commit.
41 lines
1.5 KiB
TypeScript
41 lines
1.5 KiB
TypeScript
import type {Page} from "puppeteer";
|
|
|
|
import common from "../puppeteer_lib/common";
|
|
|
|
async function click_delete_and_return_last_msg_id(page: Page): Promise<string | undefined> {
|
|
return await page.evaluate(() => {
|
|
const msg = $("#zhome .message_row").last();
|
|
msg.find(".message_control_button.actions_hover").trigger("click");
|
|
$(".delete_message").trigger("click");
|
|
return msg.attr("id");
|
|
});
|
|
}
|
|
|
|
async function delete_message_test(page: Page): Promise<void> {
|
|
await common.log_in(page);
|
|
await page.click(".top_left_all_messages");
|
|
await page.waitForSelector("#zhome .message_row", {visible: true});
|
|
const messages_quantitiy = await page.evaluate(() => $("#zhome .message_row").length);
|
|
const last_message_id = await click_delete_and_return_last_msg_id(page);
|
|
|
|
await page.waitForSelector("#dialog_widget_modal", {visible: true});
|
|
await page.click(".dialog_submit_button");
|
|
await page.waitForSelector(".dialog_submit_button .loader", {
|
|
visible: true,
|
|
});
|
|
await page.waitForSelector(".dialog_submit_button span", {hidden: true});
|
|
|
|
await page.waitForFunction(
|
|
(expected_length: number) => $("#zhome .message_row").length === expected_length,
|
|
{},
|
|
messages_quantitiy - 1,
|
|
);
|
|
|
|
await page.waitForSelector(`#${CSS.escape(last_message_id!)}`, {hidden: true});
|
|
await page.waitForSelector(".dialog_submit_button .loader", {
|
|
hidden: true,
|
|
});
|
|
}
|
|
|
|
common.run_test(delete_message_test);
|