2021-05-26 22:36:17 +02:00
|
|
|
const { strict: assert } = require('assert');
|
2022-01-19 00:08:41 +01:00
|
|
|
const { convertToHexValue, withFixtures } = require('../helpers');
|
2021-05-26 22:36:17 +02:00
|
|
|
|
|
|
|
describe('Hide token', function () {
|
|
|
|
const ganacheOptions = {
|
|
|
|
accounts: [
|
|
|
|
{
|
|
|
|
secretKey:
|
|
|
|
'0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC',
|
2022-01-19 00:08:41 +01:00
|
|
|
balance: convertToHexValue(25000000000000000000),
|
2021-05-26 22:36:17 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
it('hides the token when clicked', async function () {
|
|
|
|
await withFixtures(
|
|
|
|
{
|
2022-11-15 16:00:02 +01:00
|
|
|
fixtures: 'custom-token',
|
2021-05-26 22:36:17 +02:00
|
|
|
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.waitForSelector({
|
|
|
|
css: '.asset-list-item__token-button',
|
|
|
|
text: '0 TST',
|
|
|
|
});
|
|
|
|
|
|
|
|
let assets = await driver.findElements('.asset-list-item');
|
|
|
|
assert.equal(assets.length, 2);
|
|
|
|
|
|
|
|
await driver.clickElement({ text: 'Assets', tag: 'button' });
|
|
|
|
|
|
|
|
await driver.clickElement({ text: 'TST', tag: 'span' });
|
|
|
|
|
|
|
|
await driver.clickElement('[data-testid="asset-options__button"]');
|
|
|
|
|
|
|
|
await driver.clickElement('[data-testid="asset-options__hide"]');
|
|
|
|
// wait for confirm hide modal to be visible
|
|
|
|
const confirmHideModal = await driver.findVisibleElement('span .modal');
|
|
|
|
|
|
|
|
await driver.clickElement(
|
|
|
|
'[data-testid="hide-token-confirmation__hide"]',
|
|
|
|
);
|
|
|
|
|
|
|
|
// wait for confirm hide modal to be removed from DOM.
|
|
|
|
await confirmHideModal.waitForElementState('hidden');
|
|
|
|
|
|
|
|
assets = await driver.findElements('.asset-list-item');
|
|
|
|
assert.equal(assets.length, 1);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
Refactor ESLint config (#13482)
We would like to insert TypeScript into the ESLint configuration, and
because of the way that the current config is organized, that is not
easy to do.
Most files are assumed to be files that are suited for running in a
browser context. This isn't correct, as we should expect most files to
work in a Node context instead. This is because all browser-based files
will be run through a transpiler that is able to make use of
Node-specific variables anyway.
There are a couple of important ways we can categories files which our
ESLint config should be capable of handling well:
* Is the file a script or a module? In other words, does the file run
procedurally or is the file intended to be brought into an existing
file?
* If the file is a module, does it use the CommonJS syntax (`require()`)
or does it use the ES syntax (`import`/`export`)?
When we introduce TypeScript, this set of questions will become:
* Is the file a script or a module?
* If the file is a module, is it a JavaScript module or a TypeScript
module?
* If the file is a JavaScript module, does it use the CommonJS syntax
(`require()`) or does it use the ES syntax (`import`/`export`)?
To represent these divisions, this commit removes global rules — so now
all of the rules are kept in `overrides` for explicitness — and sets up
rules for CommonJS- and ES-module-compatible files that intentionally do
not overlap with each other. This way TypeScript (which has its own set
of rules independent from JavaScript and therefore shouldn't overlap
with the other rules either) can be easily added later.
Finally, this commit splits up the ESLint config into separate files and
adds documentation to each section. This way sets of rules which are
connected to a particular plugin (`jsdoc`, `@babel`, etc.) can be easily
understood instead of being obscured.
2022-02-28 18:42:09 +01:00
|
|
|
/* eslint-disable-next-line mocha/max-top-level-suites */
|
2021-05-26 22:36:17 +02:00
|
|
|
describe('Add existing token using search', function () {
|
|
|
|
const ganacheOptions = {
|
|
|
|
accounts: [
|
|
|
|
{
|
|
|
|
secretKey:
|
|
|
|
'0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC',
|
2022-01-19 00:08:41 +01:00
|
|
|
balance: convertToHexValue(25000000000000000000),
|
2021-05-26 22:36:17 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
it('renders the balance for the chosen token', async function () {
|
|
|
|
await withFixtures(
|
|
|
|
{
|
2022-11-15 16:00:02 +01:00
|
|
|
fixtures: 'imported-account',
|
2021-05-26 22:36:17 +02:00
|
|
|
ganacheOptions,
|
|
|
|
title: this.test.title,
|
2022-11-15 16:00:02 +01:00
|
|
|
driverOptions: {
|
|
|
|
timeOut: 20000,
|
|
|
|
},
|
2021-05-26 22:36:17 +02:00
|
|
|
},
|
|
|
|
async ({ driver }) => {
|
|
|
|
await driver.navigate();
|
|
|
|
await driver.fill('#password', 'correct horse battery staple');
|
|
|
|
await driver.press('#password', driver.Key.ENTER);
|
|
|
|
|
2021-09-10 20:03:42 +02:00
|
|
|
await driver.clickElement({ text: 'import tokens', tag: 'a' });
|
2021-05-26 22:36:17 +02:00
|
|
|
await driver.fill('#search-tokens', 'BAT');
|
2022-07-18 16:43:30 +02:00
|
|
|
await driver.clickElement({
|
|
|
|
text: 'BAT',
|
|
|
|
tag: 'span',
|
|
|
|
});
|
2021-05-26 22:36:17 +02:00
|
|
|
await driver.clickElement({ text: 'Next', tag: 'button' });
|
2022-08-08 21:01:38 +02:00
|
|
|
await driver.clickElement({ text: 'Import tokens', tag: 'button' });
|
2021-05-26 22:36:17 +02:00
|
|
|
|
|
|
|
await driver.waitForSelector({
|
|
|
|
css: '.token-overview__primary-balance',
|
|
|
|
text: '0 BAT',
|
|
|
|
});
|
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|