function expectMessageDialogAsync()
Waits for an alert or confirm dialog to be rendered (by the test renderer).
function expectMessageDialogAsync(
timeout: number,
...match: Array<string | RegExp>
): Promise<RenderedTestMessageDialog>;
Notes
- This function uses TestRenderer.expectMessageDialogAsync(), refer to its documentation for details.
- This function is asynchronous and must be
await-ed.
Parameters
- timeout — Timeout, in milliseconds
- match — A list of strings or regular expressions to match the dialog message
Return value
A promise that’s resolved to a RenderedTestMessageDialog instance for checking content or pressing buttons, or rejected when a timeout occurs.
Examples
test("Cancel confirm dialog", async (t) => {
// ...
let p = app.showConfirmDialog("Are you sure?");
await (
await expectMessageDialogAsync(100, /sure/)
).cancelAsync();
let result = await p;
expect(result).toBe(false);
});
