1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00
metamask-extension/test/e2e/tests/send-to-contract.spec.js
Nidhi Kumari a8e194a8f6
Send flow UI update (#19465)
* removed recents and added accounts in send flow

* updated add contact button and fixed full screen view

* updated ui for contacts

* fixed lint errors and test

* fixed lint errors

* fixed lint errors

* updated spec files

* fixed lint errors

* updated snapshot

* fixed edit in spec files

* removed unused console statement

* updated snapshot

* added userInput check

* updated snapshot and added hover
2023-06-08 22:39:39 +05:30

57 lines
2.0 KiB
JavaScript

const { strict: assert } = require('assert');
const { convertToHexValue, withFixtures } = require('../helpers');
const { SMART_CONTRACTS } = require('../seeder/smart-contracts');
const FixtureBuilder = require('../fixture-builder');
describe('Send ERC20 token to contract address', function () {
const smartContract = SMART_CONTRACTS.HST;
const ganacheOptions = {
accounts: [
{
secretKey:
'0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC',
balance: convertToHexValue(25000000000000000000),
},
],
};
it('should display the token contract warning to the user', async function () {
await withFixtures(
{
dapp: true,
fixtures: new FixtureBuilder().withTokensControllerERC20().build(),
ganacheOptions,
smartContract,
title: this.test.title,
failOnConsoleError: false,
},
async ({ driver, contractRegistry }) => {
const contractAddress = await contractRegistry.getContractAddress(
smartContract,
);
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"]');
await driver.clickElement(
'[data-testid="multichain-token-list-button"]',
);
await driver.clickElement('[data-testid="eth-overview-send"]');
// Type contract address
await driver.fill(
'input[placeholder="Enter public address (0x) or ENS name"]',
contractAddress,
);
// 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);
},
);
});
});