How to use the @percy/agent/dist/utils/sdk-utils.postSnapshot function in @percy/agent

To help you get started, we’ve selected a few @percy/agent 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 elastic / kibana / test / visual_regression / services / visual_testing / visual_testing.ts View on Github external
public async snapshot(options: SnapshotOptions = {}) {
      log.debug('Capturing percy snapshot');

      if (!currentTest) {
        throw new Error('unable to determine current test');
      }

      const [domSnapshot, url] = await Promise.all([
        this.getSnapshot(options.show, options.hide),
        browser.getCurrentUrl(),
      ]);
      const stats = getStats(currentTest);
      stats.snapshotCount += 1;

      const { name } = options;
      const success = await postSnapshot({
        name: `${currentTest.fullTitle()} [${name ? name : stats.snapshotCount}]`,
        url,
        domSnapshot,
        clientInfo: `kibana-ftr:${pkg.version}`,
        ...DEFAULT_OPTIONS,
      });

      if (!success) {
        throw new Error('Percy snapshot failed');
      }
    }
github percy / percy-webdriverio / lib / index.ts View on Github external
async function postDomSnapshot(name: string, domSnapshot: any, url: string, options: any) {
  const postSuccess = await postSnapshot({
    name,
    url,
    domSnapshot,
    clientInfo: clientInfo(),
    ...options,
  });

  if (!postSuccess) {
    console.log('[percy] Error posting snapshot to agent');
  }
}

@percy/agent

An agent process for integrating with Percy.

MIT
Latest version published 3 years ago

Package Health Score

50 / 100
Full package analysis