-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
406 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Locator, Page } from "@playwright/test"; | ||
|
||
export class ChangelogPage { | ||
readonly page: Page; | ||
readonly root: Locator; | ||
readonly title: Locator; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
this.root = page.getByRole("main"); | ||
this.title = this.root.getByText("Changelog"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Locator, Page } from "@playwright/test"; | ||
|
||
export class ChangesPage { | ||
readonly page: Page; | ||
readonly root: Locator; | ||
readonly title: Locator; | ||
readonly pushButton: Locator; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
this.root = page.getByRole("main").first(); | ||
this.title = this.root.getByRole("link", { name: "Changes" }); | ||
this.title = this.root.getByRole("button", { name: "Push Changes" }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,33 @@ | ||
import { expect, Locator, Page } from "@playwright/test"; | ||
import { Locator, Page } from "@playwright/test"; | ||
|
||
export class MenuPage { | ||
readonly page: Page; | ||
readonly root: Locator; | ||
readonly appHeader: Locator; | ||
readonly pageTypesLink: Locator; | ||
readonly customTypesLink: Locator; | ||
readonly slicesLink: Locator; | ||
readonly changesLink: Locator; | ||
readonly tutorialLink: Locator; | ||
readonly changelogLink: Locator; | ||
readonly appVersion: Locator; | ||
readonly changesIcon: Locator; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
this.appHeader = page.locator("h5", { hasText: "Slice Machine" }); | ||
this.customTypesLink = page.locator("nav a", { hasText: "Custom Types" }); | ||
this.slicesLink = page.locator("nav a", { hasText: "Slices" }); | ||
this.changesLink = page.locator("nav a", { hasText: "Changes" }); | ||
this.tutorialLink = page.locator("a", { hasText: "Video tutorials" }); | ||
this.changelogLink = page.locator("a", { hasText: "Changelog" }); | ||
this.appVersion = page.locator('a[href="/changelog"] > div:nth-child(2)'); | ||
this.appVersion = page.getByTestId('changes-number'); | ||
} | ||
|
||
async gotoCustomTypes() { | ||
await this.customTypesLink.click(); | ||
await expect( | ||
this.page.locator("main a", { hasText: "Custom Types" }) | ||
).toBeVisible(); | ||
} | ||
|
||
async gotoSlices() { | ||
await this.slicesLink.click(); | ||
await expect( | ||
this.page.locator("main a", { hasText: "Slices" }).first() | ||
).toBeVisible(); | ||
} | ||
|
||
async gotoChanges() { | ||
await this.changesLink.click(); | ||
await expect( | ||
this.page.locator("main a", { hasText: "Changes" }) | ||
).toBeVisible(); | ||
} | ||
|
||
async gotoChangelog() { | ||
await this.changelogLink.click(); | ||
await expect(this.page.getByText("All versions")).toBeVisible(); | ||
this.root = page.getByRole("navigation"); | ||
this.appHeader = this.root.locator("h5", { hasText: "Slice Machine" }); | ||
this.pageTypesLink = this.root.getByRole("link", { name: "Page Types" }); | ||
this.customTypesLink = this.root.getByRole("link", { | ||
name: "Custom Types", | ||
}); | ||
this.slicesLink = this.root.getByRole("link", { name: "Slices" }); | ||
this.changesLink = this.root.getByRole("link", { name: "Changes" }); | ||
this.tutorialLink = this.root.getByRole("link", { | ||
name: "Video tutorials", | ||
}); | ||
this.changelogLink = this.page.getByRole("link", { name: "Changelog" }); | ||
this.appVersion = this.root.locator( | ||
'a[href="/changelog"] > div:nth-child(2)' | ||
); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Locator, Page } from "@playwright/test"; | ||
|
||
export class TypesListPage { | ||
readonly page: Page; | ||
readonly root: Locator; | ||
readonly path: string; | ||
readonly title: Locator; | ||
readonly createButton: Locator; | ||
readonly actionIcon: Locator; | ||
|
||
protected constructor(page: Page, title: string, path: string) { | ||
this.page = page; | ||
this.path = path; | ||
this.root = page.getByRole("main"); | ||
this.title = this.root.getByLabel("Breadcrumb").getByText(title); | ||
this.createButton = this.root | ||
.getByTestId("create-ct") | ||
.or( | ||
this.root.getByRole("article").getByRole("button", { name: "Create" }) | ||
); | ||
this.actionIcon = this.root.getByTestId("ct-action-icon"); | ||
} | ||
|
||
async goto() { | ||
await this.page.goto("/custom-types"); | ||
await this.title.isVisible(); | ||
} | ||
|
||
getRow(name: string): Locator { | ||
return this.page.getByRole("row", { | ||
name, | ||
}); | ||
} | ||
|
||
async clickRow(name: string) { | ||
await this.getRow(name).getByRole("button", { name }).click(); | ||
} | ||
|
||
async openCreateModal() { | ||
await this.createButton.first().click(); | ||
} | ||
|
||
async openActionModal(name: string, action: "Rename" | "Delete") { | ||
await this.getRow(name).locator('[data-testid="editDropdown"]').click(); | ||
await this.page.getByRole("menuitem", { name: action }).click(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { expect, Locator, Page } from "@playwright/test"; | ||
|
||
export class CreateTypeModalPage { | ||
readonly page: Page; | ||
readonly title: Locator; | ||
readonly nameInput: Locator; | ||
readonly closeButton: Locator; | ||
readonly cancelButton: Locator; | ||
readonly submitButton: Locator; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
const root = page.getByTestId("create-ct-modal"); | ||
this.title = root.getByRole("heading", { | ||
name: /Create a new (page|custom) type/, | ||
}); | ||
this.nameInput = root.getByTestId("ct-name-input"); | ||
this.closeButton = root.getByRole("button", { name: "Close" }); | ||
this.cancelButton = root.getByRole("button", { name: "Cancel" }); | ||
this.submitButton = root.getByRole("button", { name: "Create" }); | ||
} | ||
|
||
async createType(name: string) { | ||
await expect(this.title).toBeVisible(); | ||
await this.nameInput.fill(name); | ||
await this.submitButton.click(); | ||
await expect(this.title).not.toBeVisible(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Locator, Page } from "@playwright/test"; | ||
import { TypesListPage } from "./TypesList.page"; | ||
import { TypeDetailsPage } from "./typeDetails.page"; | ||
|
||
export class CustomTypesDetailsPage extends TypeDetailsPage { | ||
constructor(page: Page) { | ||
super(page); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Locator, Page } from "@playwright/test"; | ||
import { TypesListPage } from "./TypesList.page"; | ||
|
||
export class CustomTypesListPage extends TypesListPage { | ||
constructor(page: Page) { | ||
super(page, "Custom Types", "/custom-types"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Locator, Page } from "@playwright/test"; | ||
import { TypesListPage } from "./TypesList.page"; | ||
|
||
export class PageTypesListPage extends TypesListPage { | ||
constructor(page: Page) { | ||
super(page, "Page Types", "/page-types"); | ||
} | ||
} |
Oops, something went wrong.