-
Notifications
You must be signed in to change notification settings - Fork 0
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
2 changed files
with
92 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { Page, expect } from '@playwright/test'; | ||
|
||
const updateDelegateEmail = '[email protected]'; | ||
const updatedAlternateEmail = '[email protected]'; | ||
|
||
export default class RepresentativesPage { | ||
readonly updateDelegateBtn = this.page.getByTestId( | ||
'edit-representative-info-2' | ||
); | ||
readonly saveDelegateInfoBtn = this.page.getByTestId( | ||
'save-representative-info-2' | ||
); | ||
readonly updateAlternateBtn = this.page.getByTestId( | ||
'edit-representative-info-3' | ||
); | ||
readonly saveAlternateBtn = this.page.getByTestId( | ||
'save-representative-info-3' | ||
); | ||
readonly transferVotingPowerBtn = this.page.getByTestId( | ||
'edit-active-voter-1' | ||
); | ||
readonly saveUpdatedVotingPowerBtn = this.page.getByTestId( | ||
'save-active-voter-1' | ||
); | ||
|
||
constructor(private readonly page: Page) {} | ||
|
||
async goto(): Promise<void> { | ||
await this.page.goto('/representatives/manage'); | ||
} | ||
|
||
async updateDelegateProfile(): Promise<void> { | ||
await this.goto(); | ||
await this.updateDelegateBtn.click(); | ||
await this.page.getByRole('textbox').nth(1).fill(updateDelegateEmail); | ||
await this.saveDelegateInfoBtn.click({ force: true }); | ||
} | ||
|
||
async isDelegateUpdated(): Promise<void> { | ||
const representativeEmailList = await this.page | ||
.locator('[data-field="email"]') | ||
.allInnerTexts(); | ||
expect(representativeEmailList).toContain(updateDelegateEmail); | ||
} | ||
|
||
async updateAlternateProfile(): Promise<void> { | ||
await this.goto(); | ||
await this.updateAlternateBtn.click(); | ||
await this.page.getByRole('textbox').nth(1).fill(updatedAlternateEmail); | ||
await this.saveAlternateBtn.click({ force: true }); | ||
} | ||
|
||
async isAlternateUpdated(): Promise<void> { | ||
const representativeEmailList = await this.page | ||
.locator('[data-field="email"]') | ||
.allInnerTexts(); | ||
expect(representativeEmailList).toContain(updatedAlternateEmail); | ||
} | ||
|
||
async transferVotePowerToAlternate(): Promise<void> { | ||
await this.goto(); | ||
await this.transferVotingPowerBtn.click(); | ||
await this.page.getByRole('combobox').nth(1).click(); | ||
await this.page | ||
.getByRole('option', { name: 'Alternate' }) | ||
.click({ force: true }); | ||
await this.saveUpdatedVotingPowerBtn.click(); | ||
} | ||
|
||
async transferVotePowerToDelegate(): Promise<void> { | ||
await this.goto(); | ||
await this.transferVotingPowerBtn.click(); | ||
await this.page.getByRole('combobox').nth(1).click(); | ||
await this.page | ||
.getByRole('option', { name: 'Delegate' }) | ||
.click({ force: true }); | ||
await this.saveUpdatedVotingPowerBtn.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