Skip to content

Commit

Permalink
page objects: navigate to home page thro new Navigate page object’s p…
Browse files Browse the repository at this point in the history
…rovided method
  • Loading branch information
ashwiniraokarai committed Apr 23, 2024
1 parent ec6b881 commit 753dd25
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/adding-items.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { test, expect, Locator } from "@playwright/test";
import { TodoForm } from "./page-classes/todo-form.ts";
import { TodoList } from "./page-classes/todo-list.ts";
import { Navigate } from "./page-classes/navigate.ts";

let todoForm: TodoForm;
let newTodoField: Locator;
Expand All @@ -9,10 +10,12 @@ let todoList: TodoList;
let countOfRemainingToDos: Locator;
let displayedTodoItems: Locator;

let navigate: Navigate;

test.beforeEach(
async({ page })=>{
await page.goto("https://todomvc.com/examples/emberjs/todomvc/dist/");
navigate = new Navigate(page);
await navigate.toHomePage();

//Invoke the page object to grab locator(s)
todoForm = new TodoForm(page);
Expand Down
13 changes: 13 additions & 0 deletions tests/page-classes/navigate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Page } from "@playwright/test"

export class Navigate{
readonly page: Page;

constructor(page: Page){
this.page = page;
}

async toHomePage(){
await this.page.goto("https://todomvc.com/examples/emberjs/todomvc/dist/");
}
}

0 comments on commit 753dd25

Please sign in to comment.