1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-25 20:02:58 +01:00
metamask-extension/test/e2e/tests/clear-activity.spec.js
vthomas13 4dcde1e216
Multichain Activity Screen (#19557)
* 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>
2023-07-17 13:48:15 -04:00

74 lines
3.0 KiB
JavaScript

const { strict: assert } = require('assert');
const { convertToHexValue, withFixtures } = require('../helpers');
const FixtureBuilder = require('../fixture-builder');
describe('Clear account activity', function () {
// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// When user get stuck with pending transactions, one can reset the account by clicking the 'Clear activity tab data' //
// button in settings, advanced tab. This functionality will clear all the send transactions history. //
// Note that the receive transactions history will be kept and it only only affects the current network. //
// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
it('User can clear account activity via the advanced setting tab, ', async function () {
const ganacheOptions = {
accounts: [
{
secretKey:
'0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC',
balance: convertToHexValue(25000000000000000000),
},
],
};
await withFixtures(
{
fixtures: new FixtureBuilder()
.withTransactionControllerCompletedTransaction()
.withIncomingTransactionsControllerOneTransaction()
.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);
// Check send transaction and receive transaction history are all displayed
await driver.clickElement('[data-testid="home__activity-tab"]');
await driver.waitForSelector({
css: '[data-testid="activity-list-item-action"]',
text: 'Send',
});
await driver.waitForSelector({
css: '[data-testid="activity-list-item-action"]',
text: 'Receive',
});
// Clear activity and nonce data
await driver.clickElement(
'[data-testid="account-options-menu-button"]',
);
await driver.clickElement({ text: 'Settings', tag: 'div' });
await driver.clickElement({ text: 'Advanced', tag: 'div' });
await driver.clickElement({
text: 'Clear activity tab data',
tag: 'button',
});
await driver.clickElement({ text: 'Clear', tag: 'button' });
await driver.navigate();
// Check send transaction history is cleared and receive transaction history is kept
const sendTransaction = await driver.isElementPresent({
css: '[data-testid="activity-list-item-action"]',
text: 'Send',
});
const receiveTransaction = await driver.isElementPresent({
css: '[data-testid="activity-list-item-action"]',
text: 'Receive',
});
assert.equal(sendTransaction, false);
assert.equal(receiveTransaction, true);
},
);
});
});