Menu test

This commit is contained in:
Lukáš 2024-02-01 22:47:24 +01:00
parent 0f7c9b6e26
commit ae779c761a
3 changed files with 56 additions and 1 deletions

View File

@ -1 +1,4 @@
Kommit Kde -N ### Your Travel Assistant
- Je první povnný projekt v rámci Akademie Engeto front-end developer.
- Jak prauji na projektu a přidávám nové funkce tak jsem se rozhodl k němu, napsat aspoň pár základních testů v playwright.

View File

@ -1,14 +1,50 @@
import { Locator, Page } from "@playwright/test"; import { Locator, Page } from "@playwright/test";
export class HomePage { export class HomePage {
page: Page; page: Page;
aboutUsButtonClick: Locator;
whatWeDoButtonClick: Locator;
ourTripsButtonClick: Locator;
whereToGoButtonClick: Locator;
reviewsButtonClick: Locator;
constructor(page: Page) { constructor(page: Page) {
this.page = page; this.page = page;
this.aboutUsButtonClick = page.locator("#about");
this.whatWeDoButtonClick = page.locator("#what-we-do");
this.ourTripsButtonClick = page.locator("#trips");
this.whereToGoButtonClick = page.locator("#where");
this.reviewsButtonClick = page.locator("#reviews");
} }
async gotoHome() { async gotoHome() {
await this.page.goto( await this.page.goto(
"https://lukaskanka.cz/YourTravelAssistant/cestovatel.html" "https://lukaskanka.cz/YourTravelAssistant/cestovatel.html"
); );
return this;
}
async clickAboutUsButton() {
await this.aboutUsButtonClick.click();
return this;
}
async clickWhatWeDoButton() {
await this.whatWeDoButtonClick.click();
return this;
}
async clickOurTripsButton() {
await this.ourTripsButtonClick.click();
return this;
}
async clickWhereToGoButton() {
await this.whereToGoButtonClick.click();
return this;
}
async clickReviewButtonClick() {
await this.reviewsButtonClick.click();
return this;
} }
} }

16
tests/menuButton.test.ts Normal file
View File

@ -0,0 +1,16 @@
import { test, expect } from "@playwright/test";
import { HomePage } from "../page-objects/HomePage";
// test odsouhlasení cookies
test("Menu button test", async ({ page }) => {
const homePage = new HomePage(page);
await await (
await (
await (
await (
await (await homePage.gotoHome()).clickAboutUsButton()
).clickWhatWeDoButton()
).clickOurTripsButton()
).clickWhereToGoButton()
).clickReviewButtonClick();
});