e2e-tests: Replace deprecated page.waitForTimeout.

https://pptr.dev/api/puppeteer.page.waitfortimeout
https://nodejs.org/api/timers.html#timerspromisessettimeoutdelay-value-options

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-04-19 16:52:09 -07:00 committed by Anders Kaseorg
parent 303b7d6d9f
commit 77a669c15c
1 changed files with 2 additions and 1 deletions

View File

@ -1,6 +1,7 @@
import {strict as assert} from "assert"; import {strict as assert} from "assert";
import "css.escape"; import "css.escape";
import path from "path"; import path from "path";
import timersPromises from "timers/promises";
import ErrorStackParser from "error-stack-parser"; import ErrorStackParser from "error-stack-parser";
import type {Browser, ConsoleMessage, ConsoleMessageLocation, ElementHandle, Page} from "puppeteer"; import type {Browser, ConsoleMessage, ConsoleMessageLocation, ElementHandle, Page} from "puppeteer";
@ -317,7 +318,7 @@ export async function assert_compose_box_content(
export async function wait_for_fully_processed_message(page: Page, content: string): Promise<void> { export async function wait_for_fully_processed_message(page: Page, content: string): Promise<void> {
// Wait in parallel for the message list scroll animation, which // Wait in parallel for the message list scroll animation, which
// interferes with Puppeteer accurately clicking on messages. // interferes with Puppeteer accurately clicking on messages.
const scroll_delay = page.waitForTimeout(400); const scroll_delay = timersPromises.setTimeout(400);
await page.waitForFunction( await page.waitForFunction(
(content: string) => { (content: string) => {