2022-07-19 17:22:38 +02:00
|
|
|
const { strict: assert } = require('assert');
|
|
|
|
const { convertToHexValue, withFixtures } = require('../helpers');
|
2022-08-18 10:26:14 +02:00
|
|
|
const { SMART_CONTRACTS } = require('../seeder/smart-contracts');
|
2022-10-28 10:42:12 +02:00
|
|
|
const FixtureBuilder = require('../fixture-builder');
|
2022-07-19 17:22:38 +02:00
|
|
|
|
|
|
|
describe('Send ERC20 token to contract address', function () {
|
2022-08-18 10:26:14 +02:00
|
|
|
const smartContract = SMART_CONTRACTS.HST;
|
2022-07-19 17:22:38 +02:00
|
|
|
const ganacheOptions = {
|
|
|
|
accounts: [
|
|
|
|
{
|
|
|
|
secretKey:
|
|
|
|
'0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC',
|
|
|
|
balance: convertToHexValue(25000000000000000000),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
it('should display the token contract warning to the user', async function () {
|
|
|
|
await withFixtures(
|
|
|
|
{
|
|
|
|
dapp: true,
|
2023-03-17 10:55:52 +01:00
|
|
|
fixtures: new FixtureBuilder().withTokensControllerERC20().build(),
|
2022-07-19 17:22:38 +02:00
|
|
|
ganacheOptions,
|
2022-08-18 10:26:14 +02:00
|
|
|
smartContract,
|
2022-07-19 17:22:38 +02:00
|
|
|
title: this.test.title,
|
|
|
|
failOnConsoleError: false,
|
|
|
|
},
|
2022-08-18 10:26:14 +02:00
|
|
|
async ({ driver, contractRegistry }) => {
|
|
|
|
const contractAddress = await contractRegistry.getContractAddress(
|
|
|
|
smartContract,
|
|
|
|
);
|
2022-07-19 17:22:38 +02:00
|
|
|
await driver.navigate();
|
|
|
|
await driver.fill('#password', 'correct horse battery staple');
|
|
|
|
await driver.press('#password', driver.Key.ENTER);
|
|
|
|
|
|
|
|
// Send TST
|
|
|
|
await driver.clickElement('[data-testid="home__asset-tab"]');
|
2023-06-01 23:14:38 +02:00
|
|
|
await driver.clickElement(
|
|
|
|
'[data-testid="multichain-token-list-button"]',
|
|
|
|
);
|
2022-07-19 17:22:38 +02:00
|
|
|
await driver.clickElement('[data-testid="eth-overview-send"]');
|
|
|
|
|
|
|
|
// Type contract address
|
|
|
|
await driver.fill(
|
2023-06-08 19:09:39 +02:00
|
|
|
'input[placeholder="Enter public address (0x) or ENS name"]',
|
2022-08-18 10:26:14 +02:00
|
|
|
contractAddress,
|
2022-07-19 17:22:38 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
// Verify warning
|
|
|
|
const warningText =
|
|
|
|
'Warning: you are about to send to a token contract which could result in a loss of funds. Learn more\nI understand';
|
|
|
|
const warning = await driver.findElement('.send__warning-container');
|
|
|
|
assert.equal(await warning.getText(), warningText);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|