How to use the @testing-library/dom.screen.findByText function in @testing-library/dom

To help you get started, we’ve selected a few @testing-library/dom 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 DefinitelyTyped / DefinitelyTyped / types / testing-library__dom / testing-library__dom-tests.ts View on Github external
async function testQueries() {
    // element queries
    const element = document.createElement('div');
    getByText(element, 'foo');
    queryByText(element, 'foo');
    await findByText(element, 'foo');
    getAllByText(element, 'bar');
    queryAllByText(element, 'bar');
    await findAllByText(element, 'bar');

    // screen queries
    screen.getByText('foo');
    screen.queryByText('foo');
    await screen.findByText('foo');
    screen.getAllByText('bar');
    screen.queryAllByText('bar');
    await screen.findAllByText('bar');
}
github gitlabhq / gitlabhq / spec / frontend_integration / ide / user_opens_ide_spec.js View on Github external
beforeEach(async () => {
      vm = startWebIDE(container);

      await screen.findByText('README'); // wait for file tree to load
    });
github gitlabhq / gitlabhq / spec / frontend_integration / ide / user_opens_ide_spec.js View on Github external
beforeEach(async () => {
      vm = startWebIDE(container, { path: 'files/images' });

      // wait for folders in left sidebar to be expanded
      await screen.findByText('images');
    });
github gitlabhq / gitlabhq / spec / frontend_integration / ide / user_opens_ide_spec.js View on Github external
it('shows empty state in the main editor window', async () => {
      expect(
        await screen.findByText(
          "Select a file from the left sidebar to begin editing. Afterwards, you'll be able to commit your changes.",
        ),
      ).toBeDefined();
    });
  });
github gitlabhq / gitlabhq / spec / frontend_integration / ide / user_opens_ide_spec.js View on Github external
it('shows "No files" in the left sidebar', async () => {
      expect(await screen.findByText('No files')).toBeDefined();
    });
github gitlabhq / gitlabhq / spec / frontend_integration / ide / user_opens_ide_spec.js View on Github external
it('shows download viewer', async () => {
      const downloadButton = await screen.findByText('Download');

      expect(downloadButton.getAttribute('download')).toEqual('Gemfile.zip');
      expect(downloadButton.getAttribute('href')).toContain('/raw/');
    });
  });