2021-06-16 22:59:10 +02:00
|
|
|
const { strict: assert } = require('assert');
|
2023-02-10 15:35:45 +01:00
|
|
|
const { SMART_CONTRACTS } = require('../seeder/smart-contracts');
|
2023-05-30 14:44:56 +02:00
|
|
|
const {
|
|
|
|
convertToHexValue,
|
|
|
|
withFixtures,
|
|
|
|
openDapp,
|
|
|
|
assertAccountBalanceForDOM,
|
|
|
|
} = require('../helpers');
|
2022-10-28 10:42:12 +02:00
|
|
|
const FixtureBuilder = require('../fixture-builder');
|
2021-06-16 22:59:10 +02:00
|
|
|
|
|
|
|
describe('Send ETH from inside MetaMask using default gas', function () {
|
|
|
|
const ganacheOptions = {
|
|
|
|
accounts: [
|
|
|
|
{
|
|
|
|
secretKey:
|
|
|
|
'0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC',
|
2022-01-19 00:08:41 +01:00
|
|
|
balance: convertToHexValue(25000000000000000000),
|
2021-06-16 22:59:10 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
it('finds the transaction in the transactions list', async function () {
|
|
|
|
await withFixtures(
|
|
|
|
{
|
2022-10-28 10:42:12 +02:00
|
|
|
fixtures: new FixtureBuilder().build(),
|
2021-06-16 22:59:10 +02:00
|
|
|
ganacheOptions,
|
|
|
|
title: this.test.title,
|
|
|
|
},
|
2023-05-30 14:44:56 +02:00
|
|
|
async ({ driver, ganacheServer }) => {
|
2021-06-16 22:59:10 +02:00
|
|
|
await driver.navigate();
|
|
|
|
await driver.fill('#password', 'correct horse battery staple');
|
|
|
|
await driver.press('#password', driver.Key.ENTER);
|
|
|
|
|
2023-05-30 14:44:56 +02:00
|
|
|
await assertAccountBalanceForDOM(driver, ganacheServer);
|
|
|
|
|
2021-06-16 22:59:10 +02:00
|
|
|
await driver.clickElement('[data-testid="eth-overview-send"]');
|
|
|
|
|
|
|
|
await driver.fill(
|
|
|
|
'input[placeholder="Search, public address (0x), or ENS"]',
|
|
|
|
'0x2f318C334780961FB129D2a6c30D0763d9a5C970',
|
|
|
|
);
|
|
|
|
|
|
|
|
const inputAmount = await driver.findElement('.unit-input__input');
|
|
|
|
await inputAmount.fill('1000');
|
|
|
|
|
|
|
|
const errorAmount = await driver.findElement('.send-v2__error-amount');
|
|
|
|
assert.equal(
|
|
|
|
await errorAmount.getText(),
|
2022-11-28 17:41:42 +01:00
|
|
|
'Insufficient funds for gas',
|
|
|
|
'send screen should render an insufficient fund for gas error message',
|
2021-06-16 22:59:10 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
await inputAmount.press(driver.Key.BACK_SPACE);
|
|
|
|
await inputAmount.press(driver.Key.BACK_SPACE);
|
|
|
|
await inputAmount.press(driver.Key.BACK_SPACE);
|
|
|
|
|
|
|
|
await driver.assertElementNotPresent('.send-v2__error-amount');
|
|
|
|
|
|
|
|
const amountMax = await driver.findClickableElement(
|
|
|
|
'.send-v2__amount-max',
|
|
|
|
);
|
|
|
|
await amountMax.click();
|
|
|
|
|
2021-12-02 19:28:24 +01:00
|
|
|
let inputValue = await inputAmount.getProperty('value');
|
2021-06-16 22:59:10 +02:00
|
|
|
|
|
|
|
assert(Number(inputValue) > 24);
|
|
|
|
|
|
|
|
await amountMax.click();
|
|
|
|
|
|
|
|
assert.equal(await inputAmount.isEnabled(), true);
|
|
|
|
|
|
|
|
await inputAmount.fill('1');
|
|
|
|
|
2021-12-02 19:28:24 +01:00
|
|
|
inputValue = await inputAmount.getProperty('value');
|
2021-06-16 22:59:10 +02:00
|
|
|
assert.equal(inputValue, '1');
|
|
|
|
|
|
|
|
// Continue to next screen
|
|
|
|
await driver.clickElement({ text: 'Next', tag: 'button' });
|
|
|
|
|
|
|
|
await driver.clickElement({ text: 'Confirm', tag: 'button' });
|
|
|
|
|
|
|
|
await driver.clickElement('[data-testid="home__activity-tab"]');
|
|
|
|
await driver.wait(async () => {
|
|
|
|
const confirmedTxes = await driver.findElements(
|
|
|
|
'.transaction-list__completed-transactions .transaction-list-item',
|
|
|
|
);
|
|
|
|
return confirmedTxes.length === 1;
|
|
|
|
}, 10000);
|
|
|
|
|
|
|
|
await driver.waitForSelector({
|
|
|
|
css: '.transaction-list-item__primary-currency',
|
|
|
|
text: '-1 ETH',
|
|
|
|
});
|
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-07-12 19:20:20 +02:00
|
|
|
describe('Send ETH non-contract address with data that matches ERC20 transfer data signature', function () {
|
|
|
|
const ganacheOptions = {
|
|
|
|
accounts: [
|
|
|
|
{
|
|
|
|
secretKey:
|
|
|
|
'0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC',
|
|
|
|
balance: convertToHexValue(25000000000000000000),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
it('renders the correct recipient on the confirmation screen', async function () {
|
|
|
|
await withFixtures(
|
|
|
|
{
|
2022-10-28 10:42:12 +02:00
|
|
|
fixtures: new FixtureBuilder()
|
|
|
|
.withPreferencesController({
|
|
|
|
featureFlags: {
|
|
|
|
sendHexData: true,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
.build(),
|
2022-07-12 19:20:20 +02:00
|
|
|
ganacheOptions,
|
|
|
|
title: this.test.title,
|
|
|
|
},
|
2023-06-02 13:54:54 +02:00
|
|
|
async ({ driver, ganacheServer }) => {
|
2022-07-12 19:20:20 +02:00
|
|
|
await driver.navigate();
|
|
|
|
await driver.fill('#password', 'correct horse battery staple');
|
|
|
|
await driver.press('#password', driver.Key.ENTER);
|
|
|
|
|
2023-06-02 13:54:54 +02:00
|
|
|
await assertAccountBalanceForDOM(driver, ganacheServer);
|
|
|
|
|
2022-07-12 19:20:20 +02:00
|
|
|
await driver.clickElement('[data-testid="eth-overview-send"]');
|
|
|
|
|
|
|
|
await driver.fill(
|
|
|
|
'input[placeholder="Search, public address (0x), or ENS"]',
|
|
|
|
'0xc427D562164062a23a5cFf596A4a3208e72Acd28',
|
|
|
|
);
|
|
|
|
|
|
|
|
await driver.fill(
|
|
|
|
'textarea[placeholder="Optional',
|
|
|
|
'0xa9059cbb0000000000000000000000002f318C334780961FB129D2a6c30D0763d9a5C970000000000000000000000000000000000000000000000000000000000000000a',
|
|
|
|
);
|
|
|
|
|
2023-06-02 13:54:54 +02:00
|
|
|
await driver.findClickableElement({ text: 'Next', tag: 'button' });
|
2022-07-12 19:20:20 +02:00
|
|
|
await driver.clickElement({ text: 'Next', tag: 'button' });
|
|
|
|
|
2023-06-02 13:54:54 +02:00
|
|
|
await driver.findClickableElement(
|
|
|
|
'[data-testid="sender-to-recipient__name"]',
|
|
|
|
);
|
|
|
|
await driver.clickElement('[data-testid="sender-to-recipient__name"]');
|
2022-07-12 19:20:20 +02:00
|
|
|
|
|
|
|
const recipientAddress = await driver.findElements({
|
|
|
|
text: '0xc427D562164062a23a5cFf596A4a3208e72Acd28',
|
|
|
|
});
|
|
|
|
|
|
|
|
assert.equal(recipientAddress.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-06-16 22:59:10 +02:00
|
|
|
describe('Send ETH from inside MetaMask using advanced gas modal', function () {
|
|
|
|
const ganacheOptions = {
|
|
|
|
accounts: [
|
|
|
|
{
|
|
|
|
secretKey:
|
|
|
|
'0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC',
|
2022-01-19 00:08:41 +01:00
|
|
|
balance: convertToHexValue(25000000000000000000),
|
2021-06-16 22:59:10 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
it('finds the transaction in the transactions list', async function () {
|
|
|
|
await withFixtures(
|
|
|
|
{
|
2022-10-28 10:42:12 +02:00
|
|
|
fixtures: new FixtureBuilder().build(),
|
2021-06-16 22:59:10 +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.clickElement('[data-testid="eth-overview-send"]');
|
|
|
|
|
|
|
|
await driver.fill(
|
|
|
|
'input[placeholder="Search, public address (0x), or ENS"]',
|
|
|
|
'0x2f318C334780961FB129D2a6c30D0763d9a5C970',
|
|
|
|
);
|
|
|
|
|
|
|
|
const inputAmount = await driver.findElement('.unit-input__input');
|
|
|
|
await inputAmount.fill('1');
|
|
|
|
|
2021-12-02 19:28:24 +01:00
|
|
|
const inputValue = await inputAmount.getProperty('value');
|
2021-06-16 22:59:10 +02:00
|
|
|
assert.equal(inputValue, '1');
|
|
|
|
|
|
|
|
// Continue to next screen
|
|
|
|
await driver.clickElement({ text: 'Next', tag: 'button' });
|
|
|
|
|
|
|
|
const transactionAmounts = await driver.findElements(
|
|
|
|
'.currency-display-component__text',
|
|
|
|
);
|
|
|
|
const transactionAmount = transactionAmounts[0];
|
|
|
|
assert.equal(await transactionAmount.getText(), '1');
|
|
|
|
|
|
|
|
await driver.clickElement({ text: 'Confirm', tag: 'button' });
|
|
|
|
|
|
|
|
await driver.wait(async () => {
|
|
|
|
const confirmedTxes = await driver.findElements(
|
|
|
|
'.transaction-list__completed-transactions .transaction-list-item',
|
|
|
|
);
|
|
|
|
return confirmedTxes.length === 1;
|
|
|
|
}, 10000);
|
|
|
|
|
2023-03-28 14:59:41 +02:00
|
|
|
await driver.waitForSelector({
|
|
|
|
css: '.transaction-list-item__primary-currency',
|
|
|
|
text: '-1 ETH',
|
|
|
|
});
|
2021-06-16 22:59:10 +02:00
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
2021-07-05 13:56:37 +02:00
|
|
|
|
|
|
|
describe('Send ETH from dapp using advanced gas controls', function () {
|
|
|
|
const ganacheOptions = {
|
|
|
|
accounts: [
|
|
|
|
{
|
|
|
|
secretKey:
|
|
|
|
'0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC',
|
2022-01-19 00:08:41 +01:00
|
|
|
balance: convertToHexValue(25000000000000000000),
|
2021-07-05 13:56:37 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
2021-07-31 03:29:21 +02:00
|
|
|
|
2022-12-08 19:37:06 +01:00
|
|
|
it('should display the correct gas price on the legacy transaction', async function () {
|
2021-07-05 13:56:37 +02:00
|
|
|
await withFixtures(
|
|
|
|
{
|
|
|
|
dapp: true,
|
2022-10-28 10:42:12 +02:00
|
|
|
fixtures: new FixtureBuilder()
|
|
|
|
.withPermissionControllerConnectedToTestDapp()
|
|
|
|
.build(),
|
2021-07-05 13:56:37 +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);
|
|
|
|
|
|
|
|
// initiates a send from the dapp
|
2023-05-05 15:56:08 +02:00
|
|
|
await openDapp(driver);
|
2022-02-04 16:39:48 +01:00
|
|
|
await driver.clickElement({ text: 'Send', tag: 'button' });
|
2022-04-20 10:37:34 +02:00
|
|
|
await driver.waitUntilXWindowHandles(3);
|
|
|
|
const windowHandles = await driver.getAllWindowHandles();
|
|
|
|
const extension = windowHandles[0];
|
2021-07-05 13:56:37 +02:00
|
|
|
await driver.switchToWindowWithTitle(
|
|
|
|
'MetaMask Notification',
|
|
|
|
windowHandles,
|
|
|
|
);
|
|
|
|
await driver.assertElementNotPresent({ text: 'Data', tag: 'li' });
|
2021-07-31 03:29:21 +02:00
|
|
|
await driver.clickElement({ text: 'Edit', tag: 'button' });
|
2022-04-20 10:37:34 +02:00
|
|
|
await driver.waitForSelector({
|
|
|
|
text: '0.00021 ETH',
|
|
|
|
});
|
2022-11-09 17:00:04 +01:00
|
|
|
await driver.clickElement({
|
|
|
|
text: 'Edit suggested gas fee',
|
|
|
|
tag: 'button',
|
|
|
|
});
|
2022-04-20 10:37:34 +02:00
|
|
|
await driver.waitForSelector({
|
|
|
|
text: '0.00021 ETH',
|
|
|
|
});
|
2021-07-31 03:29:21 +02:00
|
|
|
const inputs = await driver.findElements('input[type="number"]');
|
|
|
|
const gasPriceInput = inputs[1];
|
|
|
|
await gasPriceInput.fill('100');
|
2022-04-20 10:37:34 +02:00
|
|
|
await driver.waitForSelector({
|
|
|
|
text: '0.0021 ETH',
|
|
|
|
});
|
2022-02-04 16:39:48 +01:00
|
|
|
await driver.clickElement({ text: 'Save', tag: 'button' });
|
2022-04-20 10:37:34 +02:00
|
|
|
await driver.waitForSelector({
|
|
|
|
css: '.transaction-detail-item:nth-of-type(1) h6:nth-of-type(2)',
|
|
|
|
text: '0.0021 ETH',
|
|
|
|
});
|
2022-02-04 16:39:48 +01:00
|
|
|
await driver.clickElement({ text: 'Confirm', tag: 'button' });
|
2021-07-05 13:56:37 +02:00
|
|
|
await driver.waitUntilXWindowHandles(2);
|
|
|
|
await driver.switchToWindow(extension);
|
|
|
|
|
|
|
|
// finds the transaction in the transactions list
|
|
|
|
await driver.clickElement('[data-testid="home__activity-tab"]');
|
|
|
|
await driver.waitForSelector(
|
|
|
|
'.transaction-list__completed-transactions .transaction-list-item:nth-of-type(1)',
|
|
|
|
);
|
|
|
|
await driver.waitForSelector({
|
|
|
|
css: '.transaction-list-item__primary-currency',
|
2022-02-09 14:57:05 +01:00
|
|
|
text: '-0 ETH',
|
2021-07-05 13:56:37 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
// the transaction has the expected gas price
|
|
|
|
const txValue = await driver.findClickableElement(
|
|
|
|
'.transaction-list-item__primary-currency',
|
|
|
|
);
|
|
|
|
await txValue.click();
|
|
|
|
const gasPrice = await driver.waitForSelector({
|
|
|
|
css: '[data-testid="transaction-breakdown__gas-price"]',
|
2021-07-31 03:29:21 +02:00
|
|
|
text: '100',
|
2021-07-05 13:56:37 +02:00
|
|
|
});
|
2021-07-31 03:29:21 +02:00
|
|
|
assert.equal(await gasPrice.getText(), '100');
|
2021-07-05 13:56:37 +02:00
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
2022-12-08 19:37:06 +01:00
|
|
|
|
|
|
|
it('should display correct gas values for EIP-1559 transaction', async function () {
|
|
|
|
await withFixtures(
|
|
|
|
{
|
|
|
|
dapp: true,
|
|
|
|
fixtures: new FixtureBuilder()
|
|
|
|
.withPermissionControllerConnectedToTestDapp()
|
|
|
|
.build(),
|
NetworkController: Split `network` into `networkId` and `networkStatus` (#17556)
The `network` store of the network controller crams two types of data
into one place. It roughly tracks whether we have enough information to
make requests to the network and whether the network is capable of
receiving requests, but it also stores the ID of the network (as
obtained via `net_version`).
Generally we shouldn't be using the network ID for anything, as it has
been completely replaced by chain ID, which all custom RPC endpoints
have been required to support for over a year now. However, as the
network ID is used in various places within the extension codebase,
removing it entirely would be a non-trivial effort. So, minimally, this
commit splits `network` into two stores: `networkId` and
`networkStatus`. But it also expands the concept of network status.
Previously, the network was in one of two states: "loading" and
"not-loading". But now it can be in one of four states:
- `available`: The network is able to receive and respond to requests.
- `unavailable`: The network is not able to receive and respond to
requests for unknown reasons.
- `blocked`: The network is actively blocking requests based on the
user's geolocation. (This is specific to Infura.)
- `unknown`: We don't know whether the network can receive and respond
to requests, either because we haven't checked or we tried to check
and were unsuccessful.
This commit also changes how the network status is determined —
specifically, how many requests are used to determine that status, when
they occur, and whether they are awaited. Previously, the network
controller would make 2 to 3 requests during the course of running
`lookupNetwork`.
* First, if it was an Infura network, it would make a request for
`eth_blockNumber` to determine whether Infura was blocking requests or
not, then emit an appropriate event. This operation was not awaited.
* Then, regardless of the network, it would fetch the network ID via
`net_version`. This operation was awaited.
* Finally, regardless of the network, it would fetch the latest block
via `eth_getBlockByNumber`, then use the result to determine whether
the network supported EIP-1559. This operation was awaited.
Now:
* One fewer request is made, specifically `eth_blockNumber`, as we don't
need to make an extra request to determine whether Infura is blocking
requests; we can reuse `eth_getBlockByNumber`;
* All requests are awaited, which makes `lookupNetwork` run fully
in-band instead of partially out-of-band; and
* Both requests for `net_version` and `eth_getBlockByNumber` are
performed in parallel to make `lookupNetwork` run slightly faster.
2023-03-31 00:49:12 +02:00
|
|
|
ganacheOptions: {
|
|
|
|
...ganacheOptions,
|
|
|
|
hardfork: 'london',
|
|
|
|
},
|
2022-12-08 19:37:06 +01:00
|
|
|
title: this.test.title,
|
|
|
|
},
|
2023-06-08 15:21:21 +02:00
|
|
|
async ({ driver }) => {
|
2022-12-08 19:37:06 +01:00
|
|
|
await driver.navigate();
|
|
|
|
await driver.fill('#password', 'correct horse battery staple');
|
|
|
|
await driver.press('#password', driver.Key.ENTER);
|
|
|
|
|
|
|
|
// initiates a transaction from the dapp
|
2023-05-05 15:56:08 +02:00
|
|
|
await openDapp(driver);
|
2022-12-08 19:37:06 +01:00
|
|
|
await driver.clickElement({ text: 'Create Token', tag: 'button' });
|
|
|
|
await driver.waitUntilXWindowHandles(3);
|
|
|
|
const windowHandles = await driver.getAllWindowHandles();
|
|
|
|
const extension = windowHandles[0];
|
|
|
|
await driver.switchToWindowWithTitle(
|
|
|
|
'MetaMask Notification',
|
|
|
|
windowHandles,
|
|
|
|
);
|
|
|
|
await driver.assertElementNotPresent({ text: 'Data', tag: 'li' });
|
|
|
|
await driver.clickElement('[data-testid="edit-gas-fee-button"]');
|
|
|
|
await driver.clickElement('[data-testid="edit-gas-fee-item-custom"]');
|
|
|
|
|
|
|
|
const baseFeeInput = await driver.findElement(
|
|
|
|
'[data-testid="base-fee-input"]',
|
|
|
|
);
|
|
|
|
await baseFeeInput.fill('25');
|
|
|
|
const priorityFeeInput = await driver.findElement(
|
|
|
|
'[data-testid="priority-fee-input"]',
|
|
|
|
);
|
|
|
|
await priorityFeeInput.fill('1');
|
|
|
|
|
|
|
|
await driver.clickElement({ text: 'Save', tag: 'button' });
|
2023-04-19 14:36:24 +02:00
|
|
|
await driver.waitForSelector({
|
|
|
|
css: '.transaction-detail-item:nth-of-type(1) h6:nth-of-type(2)',
|
2023-04-27 13:01:17 +02:00
|
|
|
text: '0.04503836 ETH',
|
2023-04-19 14:36:24 +02:00
|
|
|
});
|
|
|
|
await driver.waitForSelector({
|
|
|
|
css: '.transaction-detail-item:nth-of-type(2) h6:nth-of-type(2)',
|
2023-04-27 13:01:17 +02:00
|
|
|
text: '0.04503836 ETH',
|
2023-04-19 14:36:24 +02:00
|
|
|
});
|
|
|
|
|
2023-06-02 13:54:54 +02:00
|
|
|
await driver.findClickableElement({ text: 'Confirm', tag: 'button' });
|
2022-12-08 19:37:06 +01:00
|
|
|
await driver.clickElement({ text: 'Confirm', tag: 'button' });
|
|
|
|
await driver.waitUntilXWindowHandles(2);
|
|
|
|
await driver.switchToWindow(extension);
|
|
|
|
|
2023-06-08 15:21:21 +02:00
|
|
|
// Identify the transaction in the transactions list
|
|
|
|
await driver.waitForSelector(
|
|
|
|
'[data-testid="eth-overview__primary-currency"]',
|
|
|
|
);
|
|
|
|
|
2022-12-08 19:37:06 +01:00
|
|
|
await driver.clickElement('[data-testid="home__activity-tab"]');
|
|
|
|
await driver.waitForSelector(
|
|
|
|
'.transaction-list__completed-transactions .transaction-list-item:nth-of-type(1)',
|
|
|
|
);
|
|
|
|
await driver.waitForSelector({
|
|
|
|
css: '.transaction-list-item__primary-currency',
|
|
|
|
text: '-0 ETH',
|
|
|
|
});
|
|
|
|
|
|
|
|
// the transaction has the expected gas value
|
|
|
|
const txValue = await driver.findClickableElement(
|
|
|
|
'.transaction-list-item__primary-currency',
|
|
|
|
);
|
|
|
|
await txValue.click();
|
2023-04-14 09:59:51 +02:00
|
|
|
const baseFeeValue = await driver.waitForSelector(
|
|
|
|
{
|
|
|
|
text: '0.000000025',
|
|
|
|
},
|
|
|
|
{ timeout: 15000 },
|
|
|
|
);
|
2022-12-08 19:37:06 +01:00
|
|
|
assert.equal(await baseFeeValue.getText(), '0.000000025');
|
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
2021-07-05 13:56:37 +02:00
|
|
|
});
|
2023-02-10 15:35:45 +01:00
|
|
|
|
|
|
|
describe('Send ETH from inside MetaMask to a Multisig Address', function () {
|
|
|
|
const smartContract = SMART_CONTRACTS.MULTISIG;
|
|
|
|
const ganacheOptions = {
|
|
|
|
accounts: [
|
|
|
|
{
|
|
|
|
secretKey:
|
|
|
|
'0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC',
|
|
|
|
balance: convertToHexValue(25000000000000000000),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
2023-06-02 13:54:54 +02:00
|
|
|
|
2023-02-10 15:35:45 +01:00
|
|
|
it('finds the transaction in the transactions list', async function () {
|
|
|
|
await withFixtures(
|
|
|
|
{
|
|
|
|
fixtures: new FixtureBuilder().build(),
|
|
|
|
ganacheOptions,
|
|
|
|
smartContract,
|
|
|
|
title: this.test.title,
|
|
|
|
},
|
2023-06-02 13:54:54 +02:00
|
|
|
async ({ driver, contractRegistry, ganacheServer }) => {
|
2023-02-10 15:35:45 +01:00
|
|
|
const contractAddress = await contractRegistry.getContractAddress(
|
|
|
|
smartContract,
|
|
|
|
);
|
|
|
|
await driver.navigate();
|
|
|
|
await driver.fill('#password', 'correct horse battery staple');
|
|
|
|
await driver.press('#password', driver.Key.ENTER);
|
|
|
|
|
|
|
|
await driver.clickElement('[data-testid="eth-overview-send"]');
|
|
|
|
|
|
|
|
await driver.fill(
|
|
|
|
'input[placeholder="Search, public address (0x), or ENS"]',
|
|
|
|
contractAddress,
|
|
|
|
);
|
|
|
|
|
|
|
|
const inputAmount = await driver.findElement('.unit-input__input');
|
|
|
|
await inputAmount.fill('1');
|
|
|
|
|
|
|
|
// Continue to next screen
|
2023-06-02 13:54:54 +02:00
|
|
|
await driver.findClickableElement({ text: 'Next', tag: 'button' });
|
2023-02-10 15:35:45 +01:00
|
|
|
await driver.clickElement({ text: 'Next', tag: 'button' });
|
|
|
|
|
2023-06-02 13:54:54 +02:00
|
|
|
await driver.findClickableElement({ text: 'Confirm', tag: 'button' });
|
2023-02-10 15:35:45 +01:00
|
|
|
await driver.clickElement({ text: 'Confirm', tag: 'button' });
|
|
|
|
|
2023-06-02 13:54:54 +02:00
|
|
|
// Go back to home screen to check txn
|
|
|
|
await assertAccountBalanceForDOM(driver, ganacheServer);
|
2023-02-10 15:35:45 +01:00
|
|
|
await driver.clickElement('[data-testid="home__activity-tab"]');
|
2023-06-02 13:54:54 +02:00
|
|
|
const txn = await driver.isElementPresent(
|
|
|
|
'.transaction-list__completed-transactions .transaction-list-item',
|
|
|
|
);
|
|
|
|
|
|
|
|
assert.equal(txn, true);
|
2023-02-10 15:35:45 +01:00
|
|
|
|
2023-06-02 13:54:54 +02:00
|
|
|
await driver.assertElementNotPresent(
|
2023-02-10 15:35:45 +01:00
|
|
|
'.transaction-status-label--failed',
|
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|