testing-library/playwright-testing-library

Using with TypeScript

jrolfs opened this issue · 1 comments

Mirroring an issue originally filed by @regikek over on the upstream Puppeteer repo: testing-library/pptr-testing-library#35


when using with typescript, getting a few error:

  • Cannot redeclare block-scoped variable 'getDocument'. multiple tests importing

  • All files must be modules when the '--isolatedModules' flag is provided. because im requiring pptr testing library into my tests.

// errors here.
const { getDocument, queries } = require('playwright-testing-library');
const { getByTestId } = queries
const { getSiteURL } = require('../utils');

describe("Form Tests - all Browsers", () => {
  it("Unable to Submit Empty Form", async () => {
    await page.goto(getSiteURL());

    const document = await getDocument(page);
    const form = await getByTestId(document, 'something')
    expect(form).toBeTruthy();

    await browser.close();
  }, 15000);
});

I'm going to close this unless I hear from @regikek as I suspect this may be an individual configuration issue.