How to use pptr-testing-library - 10 common examples

To help you get started, we’ve selected a few pptr-testing-library 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 commercetools / ui-kit / src / components / inputs / async-select-input / async-select-input.visualspec.js View on Github external
it('Open', async () => {
    await page.goto(`${HOST}/async-select-input-open`);
    const doc = await getDocument(page);
    const select = await getByText(doc, 'One');
    await select.click();
    // typing triggers async loadOptions
    await select.type('Two');
    await percySnapshot(page, 'AsyncSelectInput - open');
  });
});
github commercetools / ui-kit / src / components / fields / async-creatable-select-field / async-creatable-select-field.visualspec.js View on Github external
it('When open', async () => {
      await page.goto(
        `${HOST}/async-creatable-select-field/interaction/without-default-options`
      );
      const doc = await getDocument(page);
      const selects = await getAllByLabelText(doc, 'State');
      const select = selects[0];
      await select.click();
      await percySnapshot(
        page,
        'AsyncCreatableSelectField - withDefaultOptions disabled - open'
      );
      // typing triggers async loadOptions
      await select.type('Three');
      await percySnapshot(
        page,
        'AsyncCreatableSelectField - withDefaultOptions disabled - open - after typing'
      );
    });
  });
github commercetools / ui-kit / src / components / inputs / async-creatable-select-input / async-creatable-select-input.visualspec.js View on Github external
it('Open', async () => {
    await page.goto(`${HOST}/async-creatable-select-input-open`);
    const doc = await getDocument(page);
    const select = await getByText(doc, 'One');
    await select.click();
    // typing triggers async loadOptions
    await select.type('Two');
    await percySnapshot(page, 'AsyncCreatableSelectInput - open after typing');
  });
});
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 / ui-kit / src / components / inputs / localized-rich-text-input / localized-rich-text-input.visualspec.js View on Github external
it('Interactive', async () => {
    await page.goto(`${HOST}/localized-rich-text-input/interactive`);
    const doc = await getDocument(page);
    let input = await getByTestId(doc, 'rich-text-data-test-en');

    // make the text bold
    let boldButton = await getByLabelText(doc, 'Bold');
    await boldButton.click();

    await input.type('Hello world');
    await wait(() => getByText(doc, 'Hello world'));

    // check that there is now a strong tag in the document.
    let numOfTags = await getNumberOfTags('strong');

    expect(numOfTags).toEqual(1);

    // select the text
    await selectAllText(input);
github commercetools / ui-kit / src / components / fields / async-select-field / async-select-field.visualspec.js View on Github external
it('Open', async () => {
      await page.goto(
        `${HOST}/async-select-field/interaction/without-default-options`
      );
      const doc = await getDocument(page);
      const selects = await getAllByLabelText(doc, 'State');
      const select = selects[0];
      await select.click();
      await percySnapshot(
        page,
        'AsyncSelectField - withDefaultOptions disabled - open'
      );
      // typing triggers async loadOptions
      await select.type('O');
      await percySnapshot(
        page,
        'AsyncSelectField - withDefaultOptions disabled - open - after typing'
      );
    });
  });
github commercetools / ui-kit / src / components / dropdowns / primary-action-dropdown / primary-action-dropdown.visualspec.js View on Github external
it('When open', async () => {
    await page.goto(`${HOST}/primary-action-dropdown/interaction`);
    const doc = await getDocument(page);
    const dropdowns = await getAllByLabelText(doc, 'Open Dropdown');
    await dropdowns[0].click();
    await percySnapshot(page, 'PrimaryActionDropdown - Open');
  });
});
github commercetools / ui-kit / src / components / inputs / localized-money-input / localized-money-input.visualspec.js View on Github external
it('Default', async () => {
    const doc = await getDocument(page);
    const cadInputs = await getAllByLabelText(doc, 'CAD');
    expect(cadInputs).toBeTruthy();
    await percySnapshot(page, 'LocalizedMoneyInput');
  });
});
github commercetools / ui-kit / src / components / buttons / secondary-button / secondary-button.visualspec.js View on Github external
it('Default', async () => {
    const doc = await getDocument(page);
    const button = await getAllByLabelText(doc, 'A label text');
    expect(button).toBeTruthy();
    await percySnapshot(page, 'SecondaryButton');
  });
});
github ifiokjr / remirror / e2e / wysiwyg.puppeteer.ts View on Github external
beforeEach(async () => {
    await page.goto(path);
    $document = await getDocument(page);
    $editor = await getByRole($document, 'textbox');
  });

pptr-testing-library

puppeteer + dom-testing-library

MIT
Latest version published 9 months ago

Package Health Score

64 / 100
Full package analysis

Popular pptr-testing-library functions