Skip to content

Commit

Permalink
Global timeout doesn't work. Get back to implicit one
Browse files Browse the repository at this point in the history
  • Loading branch information
da-oleg-ignatiev committed Jun 4, 2024
1 parent 3a92f80 commit bc5800e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pages/login-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',});
Expand Down
5 changes: 2 additions & 3 deletions pages/portal-page.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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() {
Expand Down
10 changes: 4 additions & 6 deletions tests/oleg.test.spec.ts
Original file line number Diff line number Diff line change
@@ -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();
});

0 comments on commit bc5800e

Please sign in to comment.