diff --git a/pages/login-page.ts b/pages/login-page.ts index 6ea0dca..5eb8782 100644 --- a/pages/login-page.ts +++ b/pages/login-page.ts @@ -2,34 +2,40 @@ import { expect, Page, Locator } from '@playwright/test'; export class LoginPage { page; - getStartedLink; + //getStartedLink; gettingStartedHeader; - pomLink - tocList; + //pomLink + //tocList; + username; + password; + signInButton; + constructor(page) { this.page = page; - this.getStartedLink = page.locator('div', { hasText: 'Sign In' }); - this.gettingStartedHeader = page.locator('div', { hasText: 'Sign In' }); - this.pomLink = page.locator('li', { - hasText: 'Guides', - }).locator('a', { - hasText: 'Page Object Model', - }); - this.tocList = page.locator('article div.markdown ul > li > a'); + //this.getStartedLink = page.locator('div', { hasText: 'Sign In' }); + //this.pomLink = page.locator('li', {hasText: 'Guides',}).locator('a', {hasText: 'Page Object Model',}); + //this.tocList = page.locator('article div.markdown ul > li > a'); // toc is a common abbreviation for "Table of Contents" + + this.username = page.getByTitle('Please enter your username.'); + this.password = page.getByTitle('Please enter your password.'); + this.signInButton = page.locator("css=[class='login-page-main-sign-in-button']"); + this.gettingStartedHeader = this.signInButton; } async goto() { await this.page.goto('https://ss-spa-qa1.ottest.net/Authentication'); - } - - async getStarted() { - await this.getStartedLink.first().click(); await expect(this.gettingStartedHeader).toBeVisible(); } - async pageObjectModel() { - await this.getStarted(); - await this.pomLink.click(); + async login() { + await expect(this.username.fill('anneotestcsid@dataart.com')).resolves.toBeUndefined(); + await expect(this.password.fill('password1')).resolves.toBeUndefined(); + await this.signInButton.click(); } + + // async getStarted() { + // await this.getStartedLink.first().click(); + // await expect(this.gettingStartedHeader).toBeVisible(); + // } } \ No newline at end of file diff --git a/pages/portal-page.ts b/pages/portal-page.ts new file mode 100644 index 0000000..4aa760b --- /dev/null +++ b/pages/portal-page.ts @@ -0,0 +1,21 @@ +import { Page } from 'playwright'; + +export class PortalPage { + private page: Page; + + constructor(page: Page) { + this.page = page; + } + + // Add your methods and actions for the portal page here + + async navigateToPortal() { + // Implement the logic to navigate to the portal page + } + + async performSomeAction() { + // Implement the logic to perform some action on the portal page + } + + // Add more methods as needed +} \ No newline at end of file diff --git a/tests/oleg.test.spec.ts b/tests/oleg.test.spec.ts index 349ab3f..099db48 100644 --- a/tests/oleg.test.spec.ts +++ b/tests/oleg.test.spec.ts @@ -6,13 +6,5 @@ import { LoginPage } from '../pages/login-page.js'; test('ScoreSense', async ({ page }) => { const loginPage = new LoginPage(page); await loginPage.goto(); - - // move to LoginPage class - await expect(page.getByTitle('Please enter your username.').fill('anneotestcsid@dataart.com')).resolves.toBeUndefined(); - - // move to LoginPage class - await expect(page.getByTitle('Please enter your password.').fill('password1')).resolves.toBeUndefined(); - - // move to LoginPage class - await page.locator("css=[class='login-page-main-sign-in-button']").click(); + await loginPage.login(); }); \ No newline at end of file