mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Add e2e testcase for token details functionality (#13818)
* Add e2e testcase for token details functionality * Remove unnecessary delays on token details testcase * Add helper function for check if element exists * Move helper function to driver.js * Improve name of function
This commit is contained in:
parent
1be1cb0c85
commit
bc62e77cc3
50
test/e2e/tests/token-details.spec.js
Normal file
50
test/e2e/tests/token-details.spec.js
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
const { strict: assert } = require('assert');
|
||||||
|
const { convertToHexValue, withFixtures } = require('../helpers');
|
||||||
|
|
||||||
|
describe('Token Details', function () {
|
||||||
|
const ganacheOptions = {
|
||||||
|
accounts: [
|
||||||
|
{
|
||||||
|
secretKey:
|
||||||
|
'0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC',
|
||||||
|
balance: convertToHexValue(25000000000000000000),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
it('should show token details for an imported token', async function () {
|
||||||
|
await withFixtures(
|
||||||
|
{
|
||||||
|
fixtures: 'imported-account',
|
||||||
|
ganacheOptions,
|
||||||
|
title: this.test.title,
|
||||||
|
},
|
||||||
|
async ({ driver }) => {
|
||||||
|
await driver.navigate();
|
||||||
|
await driver.fill('#password', 'correct horse battery staple');
|
||||||
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
|
await driver.clickElement({ text: 'import tokens', tag: 'a' });
|
||||||
|
await driver.clickElement({ text: 'Custom Token', tag: 'button' });
|
||||||
|
|
||||||
|
const tokenAddress = '0x2EFA2Cb29C2341d8E5Ba7D3262C9e9d6f1Bf3711';
|
||||||
|
const tokenSymbol = 'AAVE';
|
||||||
|
|
||||||
|
await driver.fill('#custom-address', tokenAddress);
|
||||||
|
await driver.waitForSelector('#custom-symbol-helper-text');
|
||||||
|
await driver.fill('#custom-symbol', tokenSymbol);
|
||||||
|
await driver.clickElement({ text: 'Add Custom Token', tag: 'button' });
|
||||||
|
await driver.clickElement({ text: 'Import Tokens', tag: 'button' });
|
||||||
|
await driver.clickElement('[title="Asset options"]');
|
||||||
|
await driver.clickElement({ text: 'Token details', tag: 'span' });
|
||||||
|
|
||||||
|
const tokenAddressFound = {
|
||||||
|
text: tokenAddress,
|
||||||
|
};
|
||||||
|
|
||||||
|
const exists = await driver.isElementPresent(tokenAddressFound);
|
||||||
|
|
||||||
|
assert.ok(exists, 'Token details are not correct.');
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
@ -248,6 +248,15 @@ class Driver {
|
|||||||
assert.ok(!dataTab, 'Found element that should not be present');
|
assert.ok(!dataTab, 'Found element that should not be present');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async isElementPresent(element) {
|
||||||
|
try {
|
||||||
|
await this.findElement(element);
|
||||||
|
return true;
|
||||||
|
} catch (err) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Navigation
|
// Navigation
|
||||||
|
|
||||||
async navigate(page = Driver.PAGES.HOME) {
|
async navigate(page = Driver.PAGES.HOME) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user