-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
13 changed files
with
127 additions
and
64 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 |
---|---|---|
@@ -1,30 +1,44 @@ | ||
import LoginPage from '../pages/login-page'; | ||
import HomePage from '../pages/homepage'; | ||
import { Driver } from '../../webdriver/driver'; | ||
import { DEFAULT_GANACHE_ETH_BALANCE_DEC } from '../../constants'; | ||
import { WALLET_PASSWORD } from '../../helpers'; | ||
import { Ganache } from '../../seeder/ganache'; | ||
|
||
/** | ||
* This method unlocks the wallet and verifies that the user lands on the homepage with the expected balance. It is designed to be the initial step in setting up a test environment. | ||
* This method unlocks the wallet and lands the user on the homepage. | ||
* | ||
* @param driver - The webdriver instance. | ||
* @param expectedBalance - The expected balance to be displayed on the homepage after successful login. Defaults to DEFAULT_GANACHE_ETH_BALANCE_DEC, reflecting common usage in test setups. | ||
* @param password - The password used to unlock the wallet. Defaults to WALLET_PASSWORD. | ||
* @param password - The password used to unlock the wallet. | ||
*/ | ||
export const loginWithBalanceValidation = async ( | ||
export const loginWithoutBalanceValidation = async ( | ||
driver: Driver, | ||
expectedBalance: string = DEFAULT_GANACHE_ETH_BALANCE_DEC, | ||
password: string = WALLET_PASSWORD, | ||
password?: string, | ||
) => { | ||
console.log('Navigate to unlock page and try to login with pasword'); | ||
console.log('Navigate to unlock page and try to login with password'); | ||
await driver.navigate(); | ||
const loginPage = new LoginPage(driver); | ||
await loginPage.check_pageIsLoaded(); | ||
await loginPage.fillPassword(password); | ||
await loginPage.clickUnlockButton(); | ||
await loginPage.loginToHomepage(password); | ||
|
||
// user should land on homepage after successfully logging in with password | ||
const homePage = new HomePage(driver); | ||
await homePage.check_pageIsLoaded(); | ||
await homePage.check_expectedBalanceIsDisplayed(expectedBalance); | ||
}; | ||
|
||
/** | ||
* This method unlocks the wallet and verifies that the user lands on the homepage with the expected balance. It is designed to be the initial step in setting up a test environment. | ||
* | ||
* @param driver - The webdriver instance. | ||
* @param ganacheServer - The ganache server instance | ||
* @param password - The password used to unlock the wallet. | ||
*/ | ||
export const loginWithBalanceValidation = async ( | ||
driver: Driver, | ||
ganacheServer?: Ganache, | ||
password?: string, | ||
) => { | ||
await loginWithoutBalanceValidation(driver, password); | ||
// Verify the expected balance on the homepage | ||
if (ganacheServer) { | ||
await new HomePage(driver).check_ganacheBalanceIsDisplayed(ganacheServer); | ||
} | ||
}; |
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
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