augment-vir - v31.51.1
    Preparing search index...

    Variable testPlaywrightConst

    testPlaywright: {
        checkHasClass: (
            locator: Readonly<Locator>,
            className: string,
        ) => Promise<boolean>;
        enterTextByLabel: (
            testContext: Readonly<UniversalTestContext>,
            __namedParameters: { label: string; text: string },
        ) => Promise<void>;
        expectAllVisible: (
            locator: Readonly<Locator>,
            isVisible: boolean,
        ) => Promise<void>;
        getMenuOption: (
            testContext: Readonly<UniversalTestContext>,
            options?: {} & Partial<{ nth: number }>,
        ) => Locator;
        handleNewPageOrDownload: (
            testContext: Readonly<UniversalTestContext>,
            trigger: () => MaybePromise<void>,
        ) => Promise<
            _RequireExactlyOne<
                { download: Download; newPage: Page },
                "newPage" | "download",
            >,
        >;
        navigation: {
            extractNavUrl: (
                testContext: Readonly<UniversalTestContext>,
                options: Readonly<NavOptions>,
            ) => string;
            navigateTo: (
                testContext: Readonly<UniversalTestContext>,
                options: Readonly<NavOptions>,
            ) => Promise<void>;
        };
        readLocalStorage: (
            testContext: Readonly<UniversalTestContext>,
            storageKey: string,
        ) => Promise<string | undefined>;
        screenshot: {
            expectScreenshot: (
                testContext: Readonly<UniversalTestContext>,
                options: Readonly<SaveScreenshotOptions>,
            ) => Promise<void>;
            getScreenshotPath: (
                testContext: Readonly<UniversalTestContext>,
                screenshotBaseName: string,
            ) => string;
            takeScreenshot: (
                testContext: Readonly<UniversalTestContext>,
                options: Readonly<SaveScreenshotOptions>,
            ) => Promise<string>;
        };
    } = ...

    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.

    Type Declaration

    • checkHasClass: (locator: Readonly<Locator>, className: string) => Promise<boolean>

      Checks if a locator contains the given class.

    • enterTextByLabel: (
          testContext: Readonly<UniversalTestContext>,
          __namedParameters: { label: string; text: string },
      ) => Promise<void>

      Clicks a label to select its input and then types the given text.

    • expectAllVisible: (locator: Readonly<Locator>, isVisible: boolean) => Promise<void>

      Expects that all matches for the given locator are either visible or hidden (controlled by isVisible).

    • getMenuOption: (
          testContext: Readonly<UniversalTestContext>,
          options?: {} & Partial<{ nth: number }>,
      ) => Locator

      Find the matching (or first) element with the "option" role.

    • handleNewPageOrDownload: (
          testContext: Readonly<UniversalTestContext>,
          trigger: () => MaybePromise<void>,
      ) => Promise<
          _RequireExactlyOne<
              { download: Download; newPage: Page },
              "newPage" | "download",
          >,
      >

      Run the trigger and catch a new page or a new download (sometimes Playwright inconsistently chooses on or the other).

    • readLocalStorage: (
          testContext: Readonly<UniversalTestContext>,
          storageKey: string,
      ) => Promise<string | undefined>

      Read from a page's local storage (using page.evaluate).

    • screenshot: {
          expectScreenshot: (
              testContext: Readonly<UniversalTestContext>,
              options: Readonly<SaveScreenshotOptions>,
          ) => Promise<void>;
          getScreenshotPath: (
              testContext: Readonly<UniversalTestContext>,
              screenshotBaseName: string,
          ) => string;
          takeScreenshot: (
              testContext: Readonly<UniversalTestContext>,
              options: Readonly<SaveScreenshotOptions>,
          ) => Promise<string>;
      }

      Screenshot methods.

      • expectScreenshot: (
            testContext: Readonly<UniversalTestContext>,
            options: Readonly<SaveScreenshotOptions>,
        ) => Promise<void>

        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).

      • getScreenshotPath: (
            testContext: Readonly<UniversalTestContext>,
            screenshotBaseName: string,
        ) => string

        Get the path to save the given screenshot file name to.

      • takeScreenshot: (
            testContext: Readonly<UniversalTestContext>,
            options: Readonly<SaveScreenshotOptions>,
        ) => Promise<string>

        Take and immediately save a screenshot.

        The path that the screenshot was saved to.