From 4c15d826901fa682cf07fdfe2e3bee0acf8f37bb Mon Sep 17 00:00:00 2001 From: Dave Gordon Date: Sat, 11 May 2024 12:14:07 +0100 Subject: [PATCH] [playwright] feat: Page object examples --- playwright/tests/note.spec.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/playwright/tests/note.spec.ts b/playwright/tests/note.spec.ts index fe97e8d4..4a4e0539 100644 --- a/playwright/tests/note.spec.ts +++ b/playwright/tests/note.spec.ts @@ -1,18 +1,17 @@ import { test, expect, Page } from '@playwright/test'; +import { faker } from '@faker-js/faker'; import LoginPage from '../pages/LoginPage'; import NotesPage from '../pages/NotesPage'; -const TIMESTAMP = Date.now(); -const NOTE_TITLE = `My note ${TIMESTAMP}`; -const NOTE_CONTENT = `My note content ${TIMESTAMP}`; -const EDITED_NOTE_TITLE = `Edited note ${TIMESTAMP}`; -const EDITED_NOTE_CONTENT = `Edited note content ${TIMESTAMP}`; - let page: Page; let loginPage: LoginPage; let notesPage: NotesPage; const timeout = 60 * 1000; +const NOTE_TITLE = faker.lorem.sentence(); +const NOTE_CONTENT = faker.lorem.lines({ min: 1, max: 5 }); +const EDITED_NOTE_TITLE = faker.lorem.sentence(); +const EDITED_NOTE_CONTENT = faker.lorem.lines({ min: 1, max: 5 }); test.beforeAll(async ({ browser }) => { page = await browser.newPage();