diff --git a/pages/login-page.ts b/pages/login-page.ts index 46977cd..1d7d615 100644 --- a/pages/login-page.ts +++ b/pages/login-page.ts @@ -11,7 +11,7 @@ export class LoginPage { private signInButton: Locator; - constructor(page) { + constructor(page: Page) { this.page = page; //this.getStartedLink = page.locator('div', { hasText: 'Sign In' }); //this.pomLink = page.locator('li', {hasText: 'Guides',}).locator('a', {hasText: 'Page Object Model',}); diff --git a/pages/portal-page.ts b/pages/portal-page.ts index 52cc942..8f292ad 100644 --- a/pages/portal-page.ts +++ b/pages/portal-page.ts @@ -1,6 +1,5 @@ import { expect, Page, Locator } from '@playwright/test'; -import { time } from 'console'; -import { setTimeout } from 'timers/promises'; + export class PortalPage { private page: Page; @@ -16,7 +15,7 @@ export class PortalPage { async portalHeaderIsDisplayed() { await expect(this.portalHeader, 'Portal header "ScoreSense" is not displayed') // assertion - .toBeVisible(); + .toBeVisible({ timeout: 15000}); } async performSomeAction() { diff --git a/tests/oleg.test.spec.ts b/tests/oleg.test.spec.ts index 0303f5a..028b613 100644 --- a/tests/oleg.test.spec.ts +++ b/tests/oleg.test.spec.ts @@ -1,18 +1,16 @@ import { test } from '@playwright/test'; -import { defineConfig } from '@playwright/test'; import { LoginPage } from '../pages/login-page.js'; import { PortalPage } from '../pages/portal-page.js'; -export default defineConfig({ // global timeout for all tests - timeout: 1 * 15 * 1000, // is equivalent to 15 seconds -}); - test('Login Test', async ({ page }) => { // 'Login Test' is the name of the test const loginPage = new LoginPage(page); const portalPage = new PortalPage(page); await loginPage.goto(); await loginPage.login(); await portalPage.portalHeaderIsDisplayed(); - +}); + +test.afterAll(async ({ page }) => { + console.log('Closing the browser...'); await page.context().close(); }); \ No newline at end of file