expectMessageDialogAsync
Waits for an alert or confirm dialog to be rendered (by the test renderer).
expectMessageDialogAsync(timeout: number, ...match: Array<string | RegExp>): Promise<RenderedTestMessageDialog>
Notes
- This method uses TestRenderer.expectMessageDialogAsync(), refer to its documentation for details.
- This method 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.
Example
describe("My scope", () => {
test("Cancel confirm dialog", async (t) => {
// ...
let p = app.showConfirmDialog("Are you sure?");
await (
await t.expectMessageDialogAsync(100, /sure/)
).cancelAsync();
let result = await p;
expect(result).toBe(false);
});
});
Related
- class TestCaseA class that represents a single test case, part of a TestScope.