Purpose
The NavigablePage interface gives page objects a common navigation contract.
In this repo, it is used with the gotoHelper utility so tests can work with consistent navigation behavior across multiple page objects.
Definition
// page-objects/interfaces/navigable-page.ts
import type { GotoVariants } from '../../utils/gotoHelper';
export interface NavigablePage {
goto: GotoVariants;
}
Typical Use
this.goto = createGotoWithVariants(
async () => await this.gotoViaSidebarMenu(),
async () => await this.gotoViaDirectLink()
);
That gives page objects a shared navigation contract with:
-
a deterministic default
goto() -
explicit
goto.viaMenu()andgoto.viaDirectLink()methods -
an explicit
goto.random()method for intentional randomized coverage
Benefits
-
keeps navigation expectations consistent across page objects
-
makes multiple navigation strategies easier to reuse
-
supports cleaner page-object contracts in tests
-
makes randomized navigation an intentional choice instead of accidental behavior