Docs (4.0.0)
class TestCase method

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

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