@playwright/test#it TypeScript Examples

The following examples show how to use @playwright/test#it. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: test.spec.ts    From playwright-test with Apache License 2.0 6 votes vote down vote up
// Run this test with the '--param screenshotOnFailure' command line parameter
// or 'npm run test'.

it('is a basic test with the page', async ({ page, browserName, testInfo }) => {
  await page.setContent(`<div style="height: 500px; background-color: red">
    This test's title is ${testInfo.title}<br>
    It is opening in ${browserName}!
  </div>`);
  expect(await page.innerText('body')).toBe('Nooo!');
});
Example #2
Source File: test.spec.ts    From playwright-test with Apache License 2.0 5 votes vote down vote up
it('is a basic test with the page', async ({ page }) => {
  await page.goto('https://playwright.dev/');
  expect(await page.innerText('.navbar__title')).toBe('Playwright');
});