2022-12-22 14:16:09 +01:00
|
|
|
const { strict: assert } = require('assert');
|
|
|
|
const { convertToHexValue, withFixtures } = require('../helpers');
|
|
|
|
const FixtureBuilder = require('../fixture-builder');
|
|
|
|
|
2023-02-10 22:50:12 +01:00
|
|
|
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 () {
|
2022-12-22 14:16:09 +01:00
|
|
|
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"]');
|
2023-03-28 14:59:41 +02:00
|
|
|
await driver.waitForSelector({
|
|
|
|
css: '.list-item__title',
|
|
|
|
text: 'Send',
|
|
|
|
});
|
|
|
|
await driver.waitForSelector({
|
|
|
|
css: '.list-item__title',
|
|
|
|
text: 'Receive',
|
|
|
|
});
|
2022-12-22 14:16:09 +01:00
|
|
|
|
2023-02-10 22:50:12 +01:00
|
|
|
// Clear activity and nonce data
|
2022-12-22 14:16:09 +01:00
|
|
|
await driver.clickElement('.account-menu__icon');
|
|
|
|
await driver.clickElement({ text: 'Settings', tag: 'div' });
|
|
|
|
await driver.clickElement({
|
|
|
|
css: '.tab-bar__tab__content__title',
|
|
|
|
text: 'Advanced',
|
|
|
|
});
|
2023-02-10 22:50:12 +01:00
|
|
|
await driver.clickElement({
|
|
|
|
text: 'Clear activity tab data',
|
|
|
|
tag: 'button',
|
|
|
|
});
|
|
|
|
await driver.clickElement({ text: 'Clear', tag: 'button' });
|
2022-12-22 14:16:09 +01:00
|
|
|
await driver.navigate();
|
|
|
|
|
|
|
|
// Check send transaction history is cleared and receive transaction history is kept
|
|
|
|
const sendTransaction = await driver.isElementPresent({
|
|
|
|
css: '.list-item__title',
|
|
|
|
text: 'Send',
|
|
|
|
});
|
|
|
|
const receiveTransaction = await driver.isElementPresent({
|
|
|
|
css: '.list-item__title',
|
|
|
|
text: 'Receive',
|
|
|
|
});
|
|
|
|
assert.equal(sendTransaction, false);
|
|
|
|
assert.equal(receiveTransaction, true);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|