Skip to main content

@svatah/yam-playwright-test

The bind() fixture for an existing Playwright Test project

Exports

ExportKindSignature
Binderclassexport class BinderA bind() bound to one page.
BindGrounderinterfaceexport interface BindGrounder
BindGroundRequestinterfaceexport interface BindGroundRequestWhat record mode knows about the element it is asked to bind.
BindModetypealiasexport type BindMode = "run" | "record" | "heal";
BindOptionsinterfaceexport interface BindOptions
BindOutcomeinterfaceexport interface BindOutcomeHow a bind() call was answered, for the reporter and the annotations.
clearBindGrounderfunctionexport function clearBindGrounder(): voidPut the default back. For tests, and for a project without module (b).
clearPickerStampfunctionexport async function clearPickerStamp(page: Page): Promise<void>Remove the picker's stamp from wherever it landed.
currentBindGrounderfunctionexport function currentBindGrounder(): BindGrounder
expectvariableexpect: Expect<{}>
hasBindGrounderfunctionexport function hasBindGrounder(): booleanWhether anything but the picker-only default is registered.
HEALED_ANNOTATIONvariableHEALED_ANNOTATION = "healed"The annotation a healed test carries.
modeFromEnvironmentfunctionexport function modeFromEnvironment(value: string | undefined): BindModeYAM_MODE, defaulting to run (LLD §6.5).
NO_BIND_GROUNDERvariableNO_BIND_GROUNDER: BindGrounder The default: module (a) has no model, and says so by declining every request.
parseProgrammaticPicksfunctionexport function parseProgrammaticPicks(Parse YAM_PICK: a JSON object of element id → selector.
Pickinterfaceexport interface Pick
pickInteractivelyfunctionexport async function pickInteractively(Ask a person to click the element, and return a selector for what they chose.
pickSelectorfunctionexport function pickSelector(value: string, testIdAttribute = "data-testid"): stringRead a pick's value as a selector.
PickSourcetypealiasexport type PickSource = "human" | "programmatic";How an element was chosen.
registerBindGrounderfunctionexport function registerBindGrounder(grounder: BindGrounder): voidRegister module (b)'s grounder. @svatah/yam-host-playwright does this when the
testvariabletest = base.extend<YamOptions & YamFixtures>(
YamFixturesinterfaceexport interface YamFixtures
YamOptionsinterfaceexport interface YamOptions