-
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
Showing
4 changed files
with
120 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Driver } from '../../webdriver/driver'; | ||
|
||
class TokenOverviewPage { | ||
private driver: Driver; | ||
|
||
private readonly sendButton = '[data-testid="coin-overview-send"]'; | ||
|
||
private readonly receiveButton = '[data-testid="coin-overview-receive"]'; | ||
|
||
private readonly swapButton = '[data-testid="token-overview-button-swap"]'; | ||
|
||
constructor(driver: Driver) { | ||
this.driver = driver; | ||
} | ||
|
||
async check_pageIsLoaded(): Promise<void> { | ||
try { | ||
await this.driver.waitForMultipleSelectors([ | ||
this.sendButton, | ||
this.receiveButton, | ||
this.swapButton, | ||
]); | ||
} catch (e) { | ||
console.log( | ||
'Timeout while waiting for Token overview page to be loaded', | ||
e, | ||
); | ||
throw e; | ||
} | ||
console.log('Token overview page is loaded'); | ||
} | ||
|
||
async clickSend(): Promise<void> { | ||
await this.driver.clickElement(this.sendButton); | ||
} | ||
|
||
async clickReceive(): Promise<void> { | ||
await this.driver.clickElement(this.receiveButton); | ||
} | ||
|
||
async clickSwap(): Promise<void> { | ||
await this.driver.clickElement(this.swapButton); | ||
} | ||
} | ||
|
||
export default TokenOverviewPage; |
This file was deleted.
Oops, something went wrong.
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,52 @@ | ||
import { | ||
defaultGanacheOptions, | ||
withFixtures, | ||
unlockWallet, | ||
} from '../../helpers'; | ||
import { SMART_CONTRACTS } from '../../seeder/smart-contracts'; | ||
import FixtureBuilder from '../../fixture-builder'; | ||
|
||
import AssetListPage from '../../page-objects/pages/home/asset-list'; | ||
import HomePage from '../../page-objects/pages/home/homepage'; | ||
import SendTokenPage from '../../page-objects/pages/send/send-token-page'; | ||
import TokenOverviewPage from '../../page-objects/pages/token-overview-page'; | ||
|
||
describe('Send ERC20 token to contract address', function () { | ||
const smartContract = SMART_CONTRACTS.HST; | ||
|
||
it('should display the token contract warning to the user', async function () { | ||
await withFixtures( | ||
{ | ||
dapp: true, | ||
fixtures: new FixtureBuilder().withTokensControllerERC20().build(), | ||
ganacheOptions: defaultGanacheOptions, | ||
smartContract, | ||
title: this.test?.fullTitle(), | ||
}, | ||
async ({ driver, contractRegistry }) => { | ||
const contractAddress: string = | ||
await contractRegistry.getContractAddress(smartContract); | ||
await unlockWallet(driver); | ||
|
||
const homePage = new HomePage(driver); | ||
const assetListPage = new AssetListPage(driver); | ||
await homePage.check_pageIsLoaded(); | ||
await assetListPage.clickOnAsset('Ethereum'); | ||
|
||
// Send TST | ||
const tokenOverviewPage = new TokenOverviewPage(driver); | ||
await tokenOverviewPage.check_pageIsLoaded(); | ||
await tokenOverviewPage.clickSend(); | ||
|
||
const sendTokenPage = new SendTokenPage(driver); | ||
await sendTokenPage.check_pageIsLoaded(); | ||
await sendTokenPage.fillRecipient(contractAddress); | ||
|
||
// Verify warning | ||
const warningText = | ||
'Warning: you are about to send to a token contract which could result in a loss of funds. Learn more'; | ||
await sendTokenPage.check_warningMessage(warningText); | ||
}, | ||
); | ||
}); | ||
}); |