-
Notifications
You must be signed in to change notification settings - Fork 5k
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
1 parent
6d8bd52
commit f828fb5
Showing
8 changed files
with
200 additions
and
36 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
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,69 @@ | ||
import HomePage from './homepage'; | ||
|
||
class SolanaHomepage extends HomePage { | ||
protected readonly solanaBalance = | ||
'.coin-overview__primary-balance'; | ||
|
||
private readonly bridgeButton = { | ||
text: 'Bridge', | ||
tag: 'button', | ||
}; | ||
|
||
private readonly buySellButton = '[data-testid="coin-overview-buy"]'; | ||
|
||
private readonly receiveButton = '[data-testid="coin-overview-receive"]'; | ||
|
||
protected readonly sendButton = '[data-testid="coin-overview-send"]'; | ||
|
||
private readonly swapButton = { | ||
text: 'Swap', | ||
tag: 'button', | ||
}; | ||
|
||
/** | ||
* Checks if the expected solana balance is displayed on homepage. | ||
* | ||
* @param expectedBalance - The expected bitcoin balance to be displayed. Defaults to '0'. | ||
*/ | ||
async getSolanaBalance( | ||
expectedBalance: number = 0, | ||
): Promise<string> { | ||
console.log( | ||
`Check if expected Solana balance is displayed: ${expectedBalance} SOL`, | ||
); | ||
const balanceValue = await this.driver.waitForSelector(this.solanaBalance, { timeout: 120000 }) | ||
const singleBalanceText = await balanceValue.getText(); | ||
const trimmedBalance = singleBalanceText.replaceAll(/\s+/g, ' ').trim() | ||
return singleBalanceText.replaceAll(/\s+/g, ' ').trim() | ||
} | ||
|
||
/** | ||
* Checks if the receive button is enabled on bitcoin account homepage. | ||
*/ | ||
async check_isReceiveButtonEnabled(): Promise<boolean> { | ||
try { | ||
await this.driver.findClickableElement(this.receiveButton, 1000); | ||
} catch (e) { | ||
console.log('Receive button not enabled', e); | ||
return false; | ||
} | ||
console.log('Receive button is enabled'); | ||
return true; | ||
} | ||
|
||
/** | ||
* Checks if the swap button is enabled on bitcoin account homepage. | ||
*/ | ||
async check_isSwapButtonEnabled(): Promise<boolean> { | ||
try { | ||
await this.driver.findClickableElement(this.swapButton, 1000); | ||
} catch (e) { | ||
console.log('Swap button not enabled', e); | ||
return false; | ||
} | ||
console.log('Swap button is enabled'); | ||
return true; | ||
} | ||
} | ||
|
||
export default SolanaHomepage; |