-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Oskar <[email protected]>
- Loading branch information
Showing
17 changed files
with
945 additions
and
937 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
68 changes: 34 additions & 34 deletions
68
packages/app/src/features/dialogs/claim-rewards/ClaimRewardsDialog.PageObject.ts
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,41 +1,41 @@ | ||
import { Locator, Page, expect } from '@playwright/test' | ||
// import { Locator, Page, expect } from '@playwright/test' | ||
|
||
import { testIds } from '@/ui/utils/testIds' | ||
// import { testIds } from '@/ui/utils/testIds' | ||
|
||
import { DialogPageObject } from '../common/Dialog.PageObject' | ||
// import { DialogPageObject } from '../common/Dialog.PageObject' | ||
|
||
export class ClaimRewardsDialogPageObject extends DialogPageObject { | ||
constructor(page: Page) { | ||
super(page, /.*/) | ||
this.region = this.locateDialogByHeader('Claim rewards') | ||
} | ||
// export class ClaimRewardsDialogPageObject extends DialogPageObject { | ||
// constructor(page: Page) { | ||
// super(page, /.*/) | ||
// this.region = this.locateDialogByHeader('Claim rewards') | ||
// } | ||
|
||
// #region assertions | ||
async expectRewards(rows: Reward[], locator?: Locator): Promise<void> { | ||
if (!locator) { | ||
locator = this.region | ||
} | ||
// // #region assertions | ||
// async expectRewards(rows: Reward[], locator?: Locator): Promise<void> { | ||
// if (!locator) { | ||
// locator = this.region | ||
// } | ||
|
||
for (const [index, row] of rows.entries()) { | ||
const rowLocator = this.page.getByTestId(testIds.dialog.claimRewards.transactionOverview.row(index)).first() | ||
await expect(rowLocator.getByTestId(testIds.dialog.claimRewards.transactionOverview.amount)).toHaveText( | ||
`${row.amount} ${row.tokenSymbol}`, | ||
) | ||
await expect(rowLocator.getByTestId(testIds.dialog.claimRewards.transactionOverview.amountUSD)).toHaveText( | ||
row.amountUSD, | ||
) | ||
} | ||
} | ||
// for (const [index, row] of rows.entries()) { | ||
// const rowLocator = this.page.getByTestId(testIds.dialog.claimRewards.transactionOverview.row(index)).first() | ||
// await expect(rowLocator.getByTestId(testIds.dialog.claimRewards.transactionOverview.amount)).toHaveText( | ||
// `${row.amount} ${row.tokenSymbol}`, | ||
// ) | ||
// await expect(rowLocator.getByTestId(testIds.dialog.claimRewards.transactionOverview.amountUSD)).toHaveText( | ||
// row.amountUSD, | ||
// ) | ||
// } | ||
// } | ||
|
||
async expectClaimRewardsSuccessPage(rows: Reward[]): Promise<void> { | ||
await expect(this.page.getByRole('heading', { name: 'Congrats, all done!' })).toBeVisible() | ||
await this.expectRewards(rows, this.page.getByTestId(testIds.dialog.success)) | ||
} | ||
// #endregion assertions | ||
} | ||
// async expectClaimRewardsSuccessPage(rows: Reward[]): Promise<void> { | ||
// await expect(this.page.getByRole('heading', { name: 'Congrats, all done!' })).toBeVisible() | ||
// await this.expectRewards(rows, this.page.getByTestId(testIds.dialog.success)) | ||
// } | ||
// // #endregion assertions | ||
// } | ||
|
||
interface Reward { | ||
tokenSymbol: string | ||
amount: string | ||
amountUSD: string | ||
} | ||
// interface Reward { | ||
// tokenSymbol: string | ||
// amount: string | ||
// amountUSD: string | ||
// } |
76 changes: 38 additions & 38 deletions
76
packages/app/src/features/dialogs/collateral/CollateralDialog.PageObject.ts
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,44 +1,44 @@ | ||
import { Page, expect } from '@playwright/test' | ||
// import { Page, expect } from '@playwright/test' | ||
|
||
import { ActionsPageObject } from '@/features/actions/ActionsContainer.PageObject' | ||
import { testIds } from '@/ui/utils/testIds' | ||
// import { ActionsPageObject } from '@/features/actions/ActionsContainer.PageObject' | ||
// import { testIds } from '@/ui/utils/testIds' | ||
|
||
import { CollateralSetting } from '../collateral/types' | ||
import { DialogPageObject } from '../common/Dialog.PageObject' | ||
// import { CollateralSetting } from '../collateral/types' | ||
// import { DialogPageObject } from '../common/Dialog.PageObject' | ||
|
||
export class CollateralDialogPageObject extends DialogPageObject { | ||
constructor(page: Page) { | ||
super(page, /.*/) | ||
this.region = this.locateDialogByHeader('Collateral') | ||
} | ||
// export class CollateralDialogPageObject extends DialogPageObject { | ||
// constructor(page: Page) { | ||
// super(page, /.*/) | ||
// this.region = this.locateDialogByHeader('Collateral') | ||
// } | ||
|
||
// #region actions | ||
async setUseAsCollateralAction({ | ||
assetName, | ||
setting, | ||
updateBrowserAndNextBlockTime, | ||
}: { | ||
assetName: string | ||
setting: CollateralSetting | ||
updateBrowserAndNextBlockTime: () => Promise<void> | ||
}): Promise<void> { | ||
const actionsContainer = new ActionsPageObject(this.locatePanelByHeader('Actions')) | ||
await actionsContainer.acceptAllActionsAction(1, updateBrowserAndNextBlockTime) | ||
// // #region actions | ||
// async setUseAsCollateralAction({ | ||
// assetName, | ||
// setting, | ||
// updateBrowserAndNextBlockTime, | ||
// }: { | ||
// assetName: string | ||
// setting: CollateralSetting | ||
// updateBrowserAndNextBlockTime: () => Promise<void> | ||
// }): Promise<void> { | ||
// const actionsContainer = new ActionsPageObject(this.locatePanelByHeader('Actions')) | ||
// await actionsContainer.acceptAllActionsAction(1, updateBrowserAndNextBlockTime) | ||
|
||
// assertion used for waiting | ||
if (setting === 'enabled') { | ||
await this.expectSetUseAsCollateralSuccessPage(assetName, 'enabled') | ||
} else { | ||
await this.expectSetUseAsCollateralSuccessPage(assetName, 'disabled') | ||
} | ||
} | ||
// #endregion actions | ||
// // assertion used for waiting | ||
// if (setting === 'enabled') { | ||
// await this.expectSetUseAsCollateralSuccessPage(assetName, 'enabled') | ||
// } else { | ||
// await this.expectSetUseAsCollateralSuccessPage(assetName, 'disabled') | ||
// } | ||
// } | ||
// // #endregion actions | ||
|
||
// #region assertions | ||
async expectSetUseAsCollateralSuccessPage(assetName: string, setting: CollateralSetting): Promise<void> { | ||
await expect(this.region.getByRole('heading', { name: 'Congrats, all done!' })).toBeVisible() | ||
await expect(this.region.getByTestId(testIds.dialog.success)).toContainText(assetName) | ||
await expect(this.region.getByTestId(testIds.dialog.success)).toContainText(`Collateral ${setting}`) | ||
} | ||
// #endregion assertions | ||
} | ||
// // #region assertions | ||
// async expectSetUseAsCollateralSuccessPage(assetName: string, setting: CollateralSetting): Promise<void> { | ||
// await expect(this.region.getByRole('heading', { name: 'Congrats, all done!' })).toBeVisible() | ||
// await expect(this.region.getByTestId(testIds.dialog.success)).toContainText(assetName) | ||
// await expect(this.region.getByTestId(testIds.dialog.success)).toContainText(`Collateral ${setting}`) | ||
// } | ||
// // #endregion assertions | ||
// } |
22 changes: 12 additions & 10 deletions
22
packages/app/src/features/dialogs/common/Dialog.PageObject.ts
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
Oops, something went wrong.