Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
47 lines
1.8 KiB
TypeScript
47 lines
1.8 KiB
TypeScript
import assert from "node:assert/strict";
|
|
|
|
import type {Page} from "puppeteer";
|
|
|
|
import * as common from "./lib/common.ts";
|
|
|
|
async function click_delete_and_return_last_msg_id(page: Page): Promise<string> {
|
|
const msg = (await page.$$(".message-list .message_row")).at(-1);
|
|
assert.ok(msg !== undefined);
|
|
const id = await (await msg.getProperty("id")).jsonValue();
|
|
await msg.hover();
|
|
const info = await page.waitForSelector(
|
|
`#${CSS.escape(id)} .message_control_button.actions_hover`,
|
|
{visible: true},
|
|
);
|
|
assert.ok(info !== null);
|
|
await info.click();
|
|
await page.waitForSelector(".delete_message", {visible: true});
|
|
await page.click(".delete_message");
|
|
return id;
|
|
}
|
|
|
|
async function delete_message_test(page: Page): Promise<void> {
|
|
await common.log_in(page);
|
|
await page.click("#left-sidebar-navigation-list .top_left_all_messages");
|
|
const message_list_id = await common.get_current_msg_list_id(page, true);
|
|
await page.waitForSelector(
|
|
`.message-list[data-message-list-id='${message_list_id}'] .message_row`,
|
|
{visible: true},
|
|
);
|
|
// Assert that there is only one message list.
|
|
assert.equal((await page.$$(".message-list")).length, 1);
|
|
const messages_quantity = (await page.$$(".message-list .message_row")).length;
|
|
const last_message_id = await click_delete_and_return_last_msg_id(page);
|
|
|
|
await common.wait_for_micromodal_to_open(page);
|
|
await page.evaluate(() => {
|
|
document.querySelector<HTMLButtonElement>(".dialog_submit_button")?.click();
|
|
});
|
|
await common.wait_for_micromodal_to_close(page);
|
|
|
|
await page.waitForSelector(`#${CSS.escape(last_message_id)}`, {hidden: true});
|
|
assert.equal((await page.$$(".message-list .message_row")).length, messages_quantity - 1);
|
|
}
|
|
|
|
await common.run_test(delete_message_test);
|