nx/nx-dev/nx-dev-e2e/src/helpers.ts
James Henry 68eeb2eeed
feat(linter): create new workspaces with ESLint v9 and typescript-eslint v8 (#27404)
Closes #27451

---------

Co-authored-by: Leosvel Pérez Espinosa <leosvel.perez.espinosa@gmail.com>
Co-authored-by: Jack Hsu <jack.hsu@gmail.com>
2024-09-12 16:02:27 -04:00

23 lines
558 B
TypeScript

import { expect, test } from '@playwright/test';
/**
* Assert a text is present on the visited page.
* @param page
* @param path
* @param title
* @param selector
*/
export function assertTextOnPage(
path: string,
title: string,
selector: string = 'h1'
): void {
// eslint-disable-next-line playwright/valid-title
test.describe(path, () => {
test(`should display "${title}"`, async ({ page }) => {
await page.goto(path);
const locator = page.locator(selector);
await expect(locator).toContainText(title);
});
});
}