mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 20:39:08 +01:00
6e5c2f03bf
* addding the legacy tokenlist, tuning token detection OFF by default, adding new message while importing tokens updating the controller version and calling detectNewToken on network change fixing rebase error Run yarn lavamoat:auto for updating policies updating lavamoat Deleted node modules and run again lavamoat auto fixing rebase issues updating lavamoat policies updating lavamoat after rebasing policies updating custom token warning and blocking detectedtoken link when tpken detection is off for supported networks to update the token in fetchTosync updating the contract map object Revert build-system lavamoat policy changes Move token list selection logic from components to getTokenList selector updating the tokenList Update lavamoat Fix error updating lavamoat lint fix fix unit test fail fix unit test fail lint fix fixing rebase locale error rebase fix Revert build-system policy changes temp addressing review comments * rebase fix
97 lines
3.7 KiB
JavaScript
97 lines
3.7 KiB
JavaScript
const { strict: assert } = require('assert');
|
|
const { withFixtures } = require('../helpers');
|
|
|
|
describe('Swap Eth for another Token', function () {
|
|
const ganacheOptions = {
|
|
accounts: [
|
|
{
|
|
secretKey:
|
|
'0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC',
|
|
balance: 25000000000000000000,
|
|
},
|
|
],
|
|
};
|
|
it('Completes a Swap between Eth and Matic', async function () {
|
|
await withFixtures(
|
|
{
|
|
fixtures: 'special-settings',
|
|
ganacheOptions,
|
|
title: this.test.title,
|
|
failOnConsoleError: false,
|
|
driverOptions: {
|
|
timeOut: 20000,
|
|
},
|
|
},
|
|
async ({ driver }) => {
|
|
await driver.navigate();
|
|
await driver.fill('#password', 'correct horse battery staple');
|
|
await driver.press('#password', driver.Key.ENTER);
|
|
await driver.clickElement(
|
|
'.wallet-overview__buttons .icon-button:nth-child(3)',
|
|
);
|
|
await driver.clickElement(
|
|
'[class*="dropdown-search-list"] + div[class*="MuiFormControl-root MuiTextField-root"]',
|
|
);
|
|
await driver.fill('input[placeholder*="0"]', '2');
|
|
await driver.clickElement(
|
|
'[class*="dropdown-search-list"] + div[class*="MuiFormControl-root MuiTextField-root"]',
|
|
);
|
|
await driver.clickElement(
|
|
'[class="dropdown-search-list__closed-primary-label dropdown-search-list__select-default"]',
|
|
);
|
|
await driver.clickElement('[placeholder="Search for a token"]');
|
|
await driver.fill('[placeholder="Search for a token"]', 'DAI');
|
|
await driver.waitForSelector(
|
|
'[class="searchable-item-list__primary-label"]',
|
|
);
|
|
await driver.clickElement(
|
|
'[class="searchable-item-list__primary-label"]',
|
|
);
|
|
await driver.clickElement({ text: 'Review swap', tag: 'button' });
|
|
await driver.waitForSelector('[class*="box--align-items-center"]');
|
|
const estimatedEth = await driver.waitForSelector({
|
|
css: '[class*="box--align-items-center"]',
|
|
text: 'Estimated gas fee',
|
|
});
|
|
assert.equal(await estimatedEth.getText(), 'Estimated gas fee');
|
|
await driver.waitForSelector(
|
|
'[class="exchange-rate-display main-quote-summary__exchange-rate-display"]',
|
|
);
|
|
await driver.waitForSelector(
|
|
'[class="fee-card__info-tooltip-container"]',
|
|
);
|
|
await driver.waitForSelector({
|
|
css: '[class="countdown-timer__time"]',
|
|
text: '0:24',
|
|
});
|
|
await driver.clickElement({ text: 'Swap', tag: 'button' });
|
|
const sucessfulTransactionMessage = await driver.waitForSelector({
|
|
css: '[class="awaiting-swap__header"]',
|
|
text: 'Transaction complete',
|
|
});
|
|
assert.equal(
|
|
await sucessfulTransactionMessage.getText(),
|
|
'Transaction complete',
|
|
);
|
|
const sucessfulTransactionToken = await driver.waitForSelector({
|
|
css: '[class="awaiting-swap__amount-and-symbol"]',
|
|
text: 'DAI',
|
|
});
|
|
assert.equal(await sucessfulTransactionToken.getText(), 'DAI');
|
|
await driver.clickElement({ text: 'Close', tag: 'button' });
|
|
await driver.clickElement('[data-testid="home__activity-tab"]');
|
|
const swaptotal = await driver.waitForSelector({
|
|
css: '[class="transaction-list-item__primary-currency"]',
|
|
text: '-2 TESTETH',
|
|
});
|
|
assert.equal(await swaptotal.getText(), '-2 TESTETH');
|
|
const swaptotaltext = await driver.waitForSelector({
|
|
css: '[class="list-item__title"]',
|
|
text: 'Swap TESTETH to DAI',
|
|
});
|
|
assert.equal(await swaptotaltext.getText(), 'Swap TESTETH to DAI');
|
|
},
|
|
);
|
|
});
|
|
});
|