-
Notifications
You must be signed in to change notification settings - Fork 7
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
15 changed files
with
257 additions
and
33 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
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
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,15 @@ | ||
import { Locator, Page } from '@playwright/test'; | ||
|
||
export class StakeBlock { | ||
page: Page; | ||
mainComponent: Locator; | ||
referralAddressInput: Locator; | ||
stakeBtn: Locator; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
this.mainComponent = this.page.getByTestId('StakeBlock'); | ||
this.referralAddressInput = this.mainComponent.locator('input'); | ||
this.stakeBtn = this.mainComponent.locator('button :has-text("Stake")'); | ||
} | ||
} |
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,17 @@ | ||
import { Locator, Page } from '@playwright/test'; | ||
|
||
export class Toast { | ||
page: Page; | ||
successToast: Locator; | ||
errorToast: Locator; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
this.successToast = this.page.locator( | ||
'.Toastify__toast--success :has-text("Success")', | ||
); | ||
this.errorToast = this.page.locator( | ||
'.Toastify__toast--error :has-text("Error")', | ||
); | ||
} | ||
} |
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
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 |
---|---|---|
|
@@ -2,5 +2,6 @@ export const TIMEOUT = { | |
LOW: 500, | ||
DEFAULT: 1000, | ||
MEDIUM: 5000, | ||
HIGH: 30000, | ||
RPC_WAIT: 60000, | ||
}; |
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,82 @@ | ||
import { expect, test } from '@playwright/test'; | ||
import { Tags, TIMEOUT } from '@test-data'; | ||
import { BrowserService, initBrowserWithWallet } from '@browser'; | ||
import { ReefKnotService, toCut } from '@services'; | ||
import { ReefKnotPage } from '@pages'; | ||
import { qase } from 'playwright-qase-reporter'; | ||
import { REEF_KNOT_CONFIG } from '@config'; | ||
|
||
REEF_KNOT_CONFIG.WALLETS.forEach((wallet) => { | ||
test.describe( | ||
`ReefKnot. Stake transaction progress (${wallet.name})`, | ||
{ tag: [Tags.connectedWallet, `@${wallet.name}`] }, | ||
async () => { | ||
const stakeAmount = '0.0003'; | ||
let browserService: BrowserService; | ||
let reefKnotService: ReefKnotService; | ||
let reefKnotPage: ReefKnotPage; | ||
|
||
test.beforeAll(async () => { | ||
({ browserService, reefKnotService } = await initBrowserWithWallet( | ||
wallet.name, | ||
)); | ||
reefKnotPage = reefKnotService.reefKnotPage; | ||
await reefKnotPage.goto(); | ||
await reefKnotPage.allowUseCookies(); | ||
await reefKnotService.connectWallet(); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await reefKnotService.disconnectWalletForce(); | ||
await browserService.teardown(); | ||
}); | ||
|
||
test(`Stake ${stakeAmount} ETH`, async () => { | ||
await qase.groupParameters({ | ||
wallet: wallet.name, | ||
txAmount: stakeAmount, | ||
}); | ||
|
||
const newStEthBalance = | ||
await test.step('Calculate the stETH amount result', async () => { | ||
const stEthBalance = parseFloat( | ||
await reefKnotPage.waitForBalance( | ||
reefKnotPage.statsBlock.stethBalance, | ||
), | ||
); | ||
return toCut(String(stEthBalance + parseFloat(stakeAmount)), 4); | ||
}); | ||
|
||
const txPage = | ||
await test.step('Fill the amount input and click to Submit button', async () => { | ||
await reefKnotPage.statsBlock.amountInput.fill(stakeAmount); | ||
return await reefKnotPage.clickStakeButton(); | ||
}); | ||
|
||
await reefKnotService.walletPage.confirmTx(txPage, true); | ||
|
||
await test.step('Waiting for transaction success', async () => { | ||
await expect( | ||
reefKnotPage.stakeBlock.stakeBtn, | ||
'The Stake button should be disabled', | ||
).toBeDisabled(); | ||
await reefKnotPage.toast.successToast.waitFor({ | ||
state: 'visible', | ||
timeout: TIMEOUT.RPC_WAIT, | ||
}); | ||
await expect( | ||
reefKnotPage.stakeBlock.stakeBtn, | ||
'The Stake button should be enabled after success tx', | ||
).toBeEnabled(); | ||
}); | ||
|
||
await test.step('Check the new stETH balance', async () => { | ||
await expect( | ||
reefKnotPage.statsBlock.stethBalance, | ||
'The displayed stETH balance should be updated after transaction success', | ||
).toContainText(newStEthBalance, { timeout: TIMEOUT.HIGH }); | ||
}); | ||
}); | ||
}, | ||
); | ||
}); |
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.