How to use @percy/puppeteer - 10 common examples

To help you get started, we’ve selected a few @percy/puppeteer 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 Shopify / polaris-react / scripts / percy-snapshots.js View on Github external
(async () => {
  // If a build is from a forked repository, CircleCI does not pass environment
  // environment variables into the build to prevent credential leakage.
  // In that case, exit cleanly so the build does not fail.
  // Once we start using @percy/puppeteer v1 this can be removed as it is
  // checked within Percy. See https://github.com/percy/percy-puppeteer/pull/3
  if (!process.env.PERCY_TOKEN) {
    console.log('No PERCY_TOKEN provided. Skipping snapshots.');
    process.exit();
  }

  const percy = new Percy({
    loaders: [
      new FileSystemAssetLoader({
        buildDir: './playground/build/assets',
        mountPath: '/assets',
      }),
    ],
  });

  const browsers = [
    {
      browser: await puppeteer.launch(),
      taken: new Promise((resolve) => {
        resolve();
      }),
    },
    {
github commercetools / ui-kit / src / components / inputs / rich-text-input / rich-text-input.visualspec.js View on Github external
/* Testing Blocks */

    // start by removing all the text
    await selectAllText(input);
    await input.press('Backspace');

    // next, open the Style menu

    // blur input first to test that editor focus works correctly
    await blur(input);

    const styleMenuButton = await getByLabelText(doc, 'Style');
    await styleMenuButton.click();

    await wait(() => getByText(doc, 'Headline H1'));
    await percySnapshot(page, 'RichTextInput - style menu open');

    // then click on the H1 button
    const h1Button = await getByText(doc, 'Headline H1');
    await h1Button.click();

    // now type into the input
    const h1Text = 'here is our first h1';
    await input.type(h1Text);

    // text we typed should be visible on the screen
    await wait(() => getByText(doc, h1Text));

    // h1 should be in document
    numOfTags = await getNumberOfTags('h1');
    expect(numOfTags).toEqual(1);
github commercetools / ui-kit / src / components / inputs / date-input / date-input.visualspec.js View on Github external
it('Open', async () => {
    await page.goto(`${HOST}/date-input-open`);
    await page.click('#date-input');
    await expect(page).toMatch('November');
    await percySnapshot(page, 'DateInput - open');

    const doc = await getDocument(page);
    const input = await getByTestId(doc, 'date-input');

    const prevMonthButton = await getByLabelText(doc, 'show prev month');
    await prevMonthButton.click();

    await wait(() => getByText(doc, 'October'));
    // our input should still be focused even though we clicked a header button

    await input.press('Backspace');
    await input.press('Backspace');
    await input.press('Backspace');
    await input.press('Backspace');
    await input.type('2017');
    await wait(() => getByText(doc, '2017'));
github commercetools / merchant-center-application-kit / visual-testing-app / src / components / info-modal-page / info-modal-page.visualspec.ts View on Github external
it('Default', async () => {
    await expect(page).toMatch('InfoModalPage');
    await percySnapshot(page, 'InfoModalPage');
  });
});
github commercetools / merchant-center-application-kit / visual-testing-app / src / components / form-modal-page / form-modal-page.visualspec.ts View on Github external
it('Default', async () => {
    await expect(page).toMatch('FormModalPage');
    await percySnapshot(page, 'FormModalPage');
  });
});
github commercetools / ui-kit / src / components / inputs / date-input / date-input.visualspec.js View on Github external
it('Default', async () => {
    await page.goto(`${HOST}/date-input`);
    await expect(page).toMatch('minimal');
    await percySnapshot(page, 'DateInput');
  });
  it('Open', async () => {
github commercetools / ui-kit / packages / components / card / src / card.visualspec.js View on Github external
it('Default', async () => {
    await expect(page).toMatch('Type - Raised, Theme - Light');
    await percySnapshot(page, 'Card');
  });
});
github commercetools / ui-kit / src / components / inputs / creatable-select-input / creatable-select-input.visualspec.js View on Github external
it('CreatableSelectInput', async () => {
    await page.goto('http://localhost:3001/creatable-select-input');
    await expect(page).toMatch('minimal');
    await percySnapshot(page, 'CreatableSelectInput');
  });
github commercetools / ui-kit / src / components / inputs / select-input / select-input.visualspec.js View on Github external
it('Open', async () => {
    await page.goto(`${HOST}/select-input/open`);
    await page.click('#select-input');
    await expect(page).toMatch('One');
    await percySnapshot(page, 'SelectInput - open - without option groups');
  });
  it('Open - dark', async () => {
github commercetools / ui-kit / src / components / inputs / select-input / select-input.visualspec.js View on Github external
it('Open with option groups', async () => {
    await page.goto(`${HOST}/select-input/open-with-option-groups`);
    await page.click('#select-input');
    await percySnapshot(
      page,
      'SelectInput - open - option group with no divider'
    );
  });
  it('Open with option groups and divider', async () => {

@percy/puppeteer

Pupppeteer client library for visual testing with Percy

MIT
Latest version published 2 years ago

Package Health Score

54 / 100
Full package analysis

Popular @percy/puppeteer functions