@augment-vir/test
Version:
A universal testing suite that works with Mocha style test runners _and_ Node.js's built-in test runner.
57 lines (56 loc) • 3.09 kB
TypeScript
import { RuntimeEnvError } from '@augment-vir/core';
export { type MenuOptionOptions } from '../test-playwright/get-option.js';
export { type NavOptions } from '../test-playwright/nav.js';
export { type LocatorScreenshotOptions, type SaveScreenshotOptions, type TakeScreenshotOptions, } from '../test-playwright/screenshot.js';
declare function importPlaywrightTestApi(this: void): Promise<RuntimeEnvError | {
navigation: {
/** Navigate to a URL in Playwright via given paths. */
navigateTo: typeof import("../test-playwright/nav.js").navigateTo;
extractNavUrl: typeof import("../test-playwright/nav.js").extractNavUrl;
};
/**
* Expects that all matches for the given locator are either visible or hidden (controlled
* by `isVisible`).
*/
expectAllVisible: typeof import("../test-playwright/all-visible.js").expectAllVisible;
/** Clicks a label to select its input and then types the given text. */
enterTextByLabel: typeof import("../test-playwright/enter-text.js").enterTextByLabel;
/** Find the matching (or first) element with the "option" role. */
getMenuOption: typeof import("../test-playwright/get-option.js").getMenuOption;
/** Checks if a locator contains the given class. */
checkHasClass: typeof import("../test-playwright/has-class.js").checkHasClass;
/**
* Run the trigger and catch a new page _or_ a new download (sometimes Playwright
* inconsistently chooses on or the other).
*/
handleNewPageOrDownload: typeof import("../test-playwright/new-page-or-download.js").handleNewPageOrDownload;
/** Read from a page's local storage (using `page.evaluate`). */
readLocalStorage: typeof import("../test-playwright/local-storage.js").readLocalStorage;
/** Screenshot methods. */
screenshot: {
/**
* Similar to Playwright's `expect().toHaveScreenshot` but allows images to have
* different sizes and has default comparison threshold options that are wide enough to
* allow testing between different operating systems without failure (usually).
*/
expectScreenshot: typeof import("../test-playwright/screenshot.js").expectScreenshot;
/** Get the path to save the given screenshot file name to. */
getScreenshotPath: typeof import("../test-playwright/screenshot.js").getScreenshotPath;
/**
* Take and immediately save a screenshot.
*
* @returns The path that the screenshot was saved to.
*/
takeScreenshot: typeof import("../test-playwright/screenshot.js").takeScreenshot;
};
}>;
/**
* A suite of Playwright test helpers. This is only accessible within a Playwright test runtime. If
* accessed outside of a Playwright runtime, it'll be an Error instead of a collection of test
* helpers.
*
* @category Test
* @category Package : @augment-vir/test
* @package [`@augment-vir/test`](https://www.npmjs.com/package/@augment-vir/test)
*/
export declare const testPlaywright: Exclude<Awaited<ReturnType<typeof importPlaywrightTestApi>>, Error>;