Skip to content

Commit

Permalink
fix e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
adonesky1 committed Jun 21, 2022
1 parent f40bc05 commit b806bbc
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
5 changes: 4 additions & 1 deletion test/e2e/tests/add-hide-token.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ describe('Add existing token using search', function () {
fixtures: 'imported-account',
ganacheOptions,
title: this.test.title,
driverOptions: {
timeOut: 20000,
},
},
async ({ driver }) => {
await driver.navigate();
Expand All @@ -81,7 +84,7 @@ describe('Add existing token using search', function () {
await driver.clickElement({ text: 'import tokens', tag: 'a' });
await driver.fill('#search-tokens', 'BAT');
await driver.clickElement({
text: 'Basic Attention Token (BAT)',
text: 'BAT',
tag: 'span',
});
await driver.clickElement({ text: 'Next', tag: 'button' });
Expand Down
1 change: 0 additions & 1 deletion test/e2e/tests/swap-eth.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ describe('Swap Eth for another Token', function () {
'[class="dropdown-search-list__closed-primary-label dropdown-search-list__select-default"]',
);
await driver.clickElement('[placeholder="Search for a token"]');
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"]',
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/webdriver/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ const Driver = require('./driver');
const ChromeDriver = require('./chrome');
const FirefoxDriver = require('./firefox');

async function buildWebDriver({ responsive, port, type } = {}) {
async function buildWebDriver({ responsive, port, type, timeOut } = {}) {
const browser = process.env.SELENIUM_BROWSER;

const {
driver: seleniumDriver,
extensionId,
extensionUrl,
} = await buildBrowserWebDriver(browser, { responsive, port, type });
const driver = new Driver(seleniumDriver, browser, extensionUrl);
const driver = new Driver(seleniumDriver, browser, extensionUrl, timeOut);

return {
driver,
Expand Down
2 changes: 1 addition & 1 deletion ui/pages/swaps/build-quote/build-quote.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ export default function BuildQuote({
const onToSelect = useCallback(
(token) => {
if (destinationTokenAddedForSwap && token.address !== toAddress) {
dispatch(ignoreTokens(toAddress));
dispatch(ignoreTokens(toAddress, true));
}
dispatch(setSwapToToken(token));
setVerificationClicked(false);
Expand Down
7 changes: 5 additions & 2 deletions ui/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1660,14 +1660,17 @@ export function addImportedTokens(tokensToImport) {
* To add ignored token addresses to state
*
* @param tokensToIgnore
* @param dontShowLoadingIndicator
*/
export function ignoreTokens(tokensToIgnore) {
export function ignoreTokens(tokensToIgnore, dontShowLoadingIndicator) {
const _tokensToIgnore = Array.isArray(tokensToIgnore)
? tokensToIgnore
: [tokensToIgnore];

return async (dispatch) => {
dispatch(showLoadingIndication());
if (!dontShowLoadingIndicator) {
dispatch(showLoadingIndication());
}
try {
await promisifiedBackground.ignoreTokens(_tokensToIgnore);
} catch (error) {
Expand Down

0 comments on commit b806bbc

Please sign in to comment.