How to use the @qawolf/config.CONFIG.dataAttribute function in @qawolf/config

To help you get started, we’ve selected a few @qawolf/config examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qawolf / qawolf / packages / browser / src / page / injectBundle.ts View on Github external
export const bundleJs = (
  recordDom: boolean,
  recordEvents: boolean,
  pageIndex: number
) => {
  const recordEventsJs = `window.qaw_recorder = window.qaw_recorder || new qawolf.Recorder("${CONFIG.dataAttribute}", ${pageIndex}, (event) => qaw_onEvent(event));`;

  let bundle = qawolfJs;
  if (recordDom) bundle += recordDomJs;
  if (recordEvents) bundle += recordEventsJs;
  return bundle;
};
github qawolf / qawolf / packages / browser / src / Browser.ts View on Github external
`Browser: find element for ${JSON.stringify(step.target).substring(
        0,
        100
      )}`
    );

    const page = await this.getPage(step.pageId, true);

    const jsHandle = await page.evaluateHandle(
      (locator: Locator) => {
        const qawolf: QAWolfWeb = (window as any).qawolf;
        return qawolf.locate.waitForElement(locator);
      },
      {
        action: step.action,
        dataAttribute: CONFIG.dataAttribute,
        target: step.target,
        timeoutMs: CONFIG.locatorTimeoutMs
      } as Serializable
    );

    const handle = jsHandle.asElement();
    if (!handle) {
      throw new Error(`No element handle found for step ${step}`);
    }

    return handle;
  }