Docs (4.0.0)
class TestCase method

expectNavAsync

Waits for the global navigation location to match the given page ID and detail.

expectNavAsync(timeout: number, pageId: string, detail?: string): Promise<void>

Summary

This method starts checking the navigation controller periodically, and waits for the path to match the provided string. If the path still doesn’t match after the given timeout (number of milliseconds) this method throws an error.

Note
This method is asynchronous and must be await-ed.

Parameters

  • timeout — Timeout, in milliseconds
  • pageId — Page ID to wait for, must be an exact match
  • detail — Detail string to wait for (defaults to empty string), must be an exact match

Return value

A promise (void) that’s resolved when the patch matches, or rejected when a timeout occurs.

Example

describe("My scope", () => {
  test("Wait for navigation", async (t) => {
    // ... navigate to a path somehow
    await t.expectNavAsync(100, "foo");
  });
});

Related