Praman — Agent-First SAP UI5 Test Automation Plugin - v1.2.0
    Preparing search index...

    Function createUI5Matcher

    • Wraps a raw check function with pollUntilPass auto-retry semantics.

      Type Parameters

      • TArgs extends readonly unknown[] = readonly unknown[]

        Tuple of additional arguments the check function expects.

      Parameters

      Returns UI5MatcherFn

      A matcher function with auto-retry, suitable for registerUI5Matcher.

      Provide a factory so custom matchers automatically get web-first retry behavior identical to built-in Praman matchers.

      matchers.toHaveUI5Text

      Returns a matcher function that retries the check with pollUntilPass semantics.

      The returned function:

      1. Extracts an optional trailing MatcherOptions from the arguments
      2. Calls the user's check function inside pollUntilPass
      3. Returns a standard MatcherResult
      import { createUI5Matcher, registerUI5Matcher } from 'playwright-praman';
      import { getControlProperty } from 'playwright-praman';

      const checkUI5Icon = createUI5Matcher<[string]>(
      async (page, controlId, expected) => {
      const actual = await getControlProperty(page, controlId, 'icon');
      const pass = actual === expected;
      return {
      pass,
      message: () =>
      pass
      ? `Expected icon not to be '${expected}'`
      : `Expected icon to be '${expected}', got '${String(actual)}'`,
      actual,
      expected,
      };
      },
      );

      registerUI5Matcher('toHaveUI5Icon', checkUI5Icon);