mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 12:29:06 +01:00
4dcde1e216
* layout wip * Icon changes, add badgewrapped icons to smart tx * grouping by date wip * typo fix * group txs by date, button styling * removing queue/history division, adding datestamp for pending tx, minor styling changes * adding tests, updating snap * font size fix * e2e fixes * Remove unnecessary tabIndex and keypress handler * Fix typo for fontWeight * Fix nesting warning by removing unnecessary Text * Fix tests * Fix import and exports * Remove unused verbiage * Update E2E selectors * More E2E * More E2Es * More test fixes * awaiting find instead of click * adding regularDelayMs to flaky test * removing delay * increasing delay outside of wait * adding back first-child to selector * test fixes * using datatestid for primary currency * sorting date txgroups * wip alignment for big numbers * alignment issues fix * lintfix * adding tabindex, cursor pointer, updating snap * unit test fix * storybook additions * snaphot update * update snap --------- Co-authored-by: David Walsh <davidwalsh83@gmail.com>
146 lines
4.7 KiB
JavaScript
146 lines
4.7 KiB
JavaScript
const assert = require('assert');
|
|
const {
|
|
convertToHexValue,
|
|
withFixtures,
|
|
openDapp,
|
|
regularDelayMs,
|
|
} = require('../helpers');
|
|
const FixtureBuilder = require('../fixture-builder');
|
|
|
|
describe('Multiple transactions', function () {
|
|
const ganacheOptions = {
|
|
hardfork: 'london',
|
|
accounts: [
|
|
{
|
|
secretKey:
|
|
'0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC',
|
|
balance: convertToHexValue(25000000000000000000),
|
|
},
|
|
],
|
|
};
|
|
|
|
it('creates multiple queued transactions, then confirms', async function () {
|
|
await withFixtures(
|
|
{
|
|
dapp: true,
|
|
fixtures: new FixtureBuilder()
|
|
.withPermissionControllerConnectedToTestDapp()
|
|
.build(),
|
|
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 transaction from the dapp
|
|
await openDapp(driver);
|
|
// creates first transaction
|
|
await driver.clickElement({
|
|
text: 'Send EIP 1559 Transaction',
|
|
tag: 'button',
|
|
});
|
|
await driver.waitUntilXWindowHandles(3);
|
|
const windowHandles = await driver.getAllWindowHandles();
|
|
const extensionTab = windowHandles[0];
|
|
const dApp = windowHandles[1];
|
|
const confirmation = windowHandles[2];
|
|
|
|
await driver.switchToWindow(dApp);
|
|
|
|
// creates second transaction
|
|
await driver.clickElement({
|
|
text: 'Send EIP 1559 Transaction',
|
|
tag: 'button',
|
|
});
|
|
await driver.switchToWindow(confirmation);
|
|
|
|
// confirms second transaction
|
|
await driver.waitForSelector({
|
|
text: 'Reject 2 transactions',
|
|
tag: 'a',
|
|
});
|
|
await driver.clickElement({ text: 'Confirm', tag: 'button' });
|
|
await driver.waitForElementNotPresent('.loading-overlay__spinner');
|
|
// confirms first transaction
|
|
await driver.clickElement({ text: 'Confirm', tag: 'button' });
|
|
|
|
await driver.waitUntilXWindowHandles(2);
|
|
await driver.switchToWindow(extensionTab);
|
|
await driver.delay(regularDelayMs);
|
|
await driver.clickElement('[data-testid="home__activity-tab"]');
|
|
|
|
const confirmedTxes = await driver.findElements(
|
|
'.transaction-list__completed-transactions .activity-list-item',
|
|
);
|
|
|
|
assert.equal(confirmedTxes.length, 2);
|
|
},
|
|
);
|
|
});
|
|
|
|
it('creates multiple queued transactions, then rejects', async function () {
|
|
await withFixtures(
|
|
{
|
|
dapp: true,
|
|
fixtures: new FixtureBuilder()
|
|
.withPermissionControllerConnectedToTestDapp()
|
|
.build(),
|
|
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 transaction from the dapp
|
|
await openDapp(driver);
|
|
// creates first transaction
|
|
await driver.clickElement({
|
|
text: 'Send EIP 1559 Transaction',
|
|
tag: 'button',
|
|
});
|
|
await driver.waitUntilXWindowHandles(3);
|
|
const windowHandles = await driver.getAllWindowHandles();
|
|
const extension = windowHandles[0];
|
|
const confirmation = windowHandles[2];
|
|
await driver.switchToWindowWithTitle('E2E Test Dapp', windowHandles);
|
|
|
|
// creates second transaction
|
|
await driver.clickElement({
|
|
text: 'Send EIP 1559 Transaction',
|
|
tag: 'button',
|
|
});
|
|
await driver.switchToWindow(confirmation);
|
|
|
|
// rejects second transaction
|
|
await driver.waitForSelector({
|
|
text: 'Reject 2 transactions',
|
|
tag: 'a',
|
|
});
|
|
await driver.clickElement({ text: 'Reject', tag: 'button' });
|
|
await driver.waitForElementNotPresent('.loading-overlay__spinner');
|
|
// rejects first transaction
|
|
await driver.clickElement({ text: 'Reject', tag: 'button' });
|
|
|
|
await driver.waitUntilXWindowHandles(2);
|
|
await driver.switchToWindow(extension);
|
|
await driver.delay(regularDelayMs);
|
|
await driver.clickElement('[data-testid="home__activity-tab"]');
|
|
|
|
const isTransactionListEmpty = await driver.isElementPresentAndVisible(
|
|
'.transaction-list__empty-text',
|
|
);
|
|
assert.equal(isTransactionListEmpty, true);
|
|
|
|
// should not be present
|
|
await driver.assertElementNotPresent(
|
|
'.transaction-list__completed-transactions .activity-list-item',
|
|
);
|
|
},
|
|
);
|
|
});
|
|
});
|