Documentation

API Referencefunction

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

Parameters

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);
});