-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
address refactoring suggestion to use pom and fixtures
- Loading branch information
1 parent
1ab1926
commit 8a67955
Showing
4 changed files
with
286 additions
and
86 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
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,46 @@ | ||
import { Page, Locator } from "@playwright/test"; | ||
|
||
export class BucketSummaryPage { | ||
page: Page; | ||
bucketName: string; | ||
|
||
/* Locators */ | ||
deleteBucketBtn: Locator | undefined; | ||
|
||
constructor(page: Page, bucketName: string) { | ||
this.page = page; | ||
this.bucketName = bucketName; | ||
|
||
this.initLocators(); | ||
} | ||
getLocator(selector: string): Locator { | ||
const page = this.page; | ||
const locator: Locator = page.locator(`${selector}`); | ||
return locator; | ||
} | ||
|
||
initLocators() { | ||
this.deleteBucketBtn = this.getLocator("#delete-bucket-button"); | ||
} | ||
|
||
async loadPage() { | ||
await this.clickOnTab(`Summary`); | ||
} | ||
|
||
async clickOnTab(tabName: string) { | ||
const page = this.page; | ||
await page.getByRole("tab", { name: tabName }).click(); | ||
|
||
// await page.goto(`${BUCKET_LIST_PAGE}/${this.bucketName}/admin/${tabName}`); | ||
} | ||
|
||
async confirmDeleteBucket() { | ||
await this.getLocator("#delete-bucket-button").click(); | ||
await this.getLocator("#confirm-ok").click(); | ||
} | ||
|
||
async getObjectVersionOption() { | ||
await this.page.getByRole("button", { name: "Add Lifecycle Rule" }).click(); | ||
return this.getLocator("#object_version"); | ||
} | ||
} |
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,56 @@ | ||
import { Page, Locator } from "@playwright/test"; | ||
import { BUCKET_LIST_PAGE } from "../consts"; | ||
|
||
export class BucketsListPage { | ||
page: Page; | ||
|
||
/* Locators */ | ||
|
||
createBucketBtn: Locator | undefined; | ||
refreshBucketsBtn: Locator | undefined; | ||
setReplicationBtn: Locator | undefined; | ||
|
||
bucketListItemPrefix = "#manageBucket-"; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
this.initLocators(); | ||
} | ||
getLocator(selector: string): Locator { | ||
const page = this.page; | ||
const locator: Locator = page.locator(`${selector}`); | ||
return locator; | ||
} | ||
|
||
initLocators() { | ||
this.createBucketBtn = this.getLocator("#create-bucket"); | ||
this.refreshBucketsBtn = this.getLocator("#refresh-buckets"); | ||
this.setReplicationBtn = this.getLocator("#set-replication"); | ||
} | ||
|
||
locateBucket(bucketName: string): Locator { | ||
const bucketRow = this.getLocator( | ||
`${this.bucketListItemPrefix}${bucketName}` | ||
); | ||
return bucketRow; | ||
} | ||
|
||
async clickOnBucketRow(bucketName: string) { | ||
const bucketRow = this.locateBucket(bucketName); | ||
await bucketRow.click(); | ||
} | ||
async goToCreateBucket() { | ||
await this.createBucketBtn?.click(); | ||
} | ||
|
||
async isBucketExist(bucketName: string) { | ||
const existBukCount = await this.locateBucket(bucketName).count(); | ||
|
||
return existBukCount; | ||
} | ||
|
||
async loadPage() { | ||
const page = this.page; | ||
await page.goto(BUCKET_LIST_PAGE); | ||
} | ||
} |
Oops, something went wrong.