mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-25 20:02:58 +01:00
Send to Contract ganache refactor (#15605)
This commit is contained in:
parent
f074c243d8
commit
7aadddc81e
@ -1,7 +1,9 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const { convertToHexValue, withFixtures } = require('../helpers');
|
||||||
|
const { SMART_CONTRACTS } = require('../seeder/smart-contracts');
|
||||||
|
|
||||||
describe('Send ERC20 token to contract address', function () {
|
describe('Send ERC20 token to contract address', function () {
|
||||||
|
const smartContract = SMART_CONTRACTS.HST;
|
||||||
const ganacheOptions = {
|
const ganacheOptions = {
|
||||||
accounts: [
|
accounts: [
|
||||||
{
|
{
|
||||||
@ -17,39 +19,27 @@ describe('Send ERC20 token to contract address', function () {
|
|||||||
dapp: true,
|
dapp: true,
|
||||||
fixtures: 'connected-state',
|
fixtures: 'connected-state',
|
||||||
ganacheOptions,
|
ganacheOptions,
|
||||||
|
smartContract,
|
||||||
title: this.test.title,
|
title: this.test.title,
|
||||||
failOnConsoleError: false,
|
failOnConsoleError: false,
|
||||||
},
|
},
|
||||||
async ({ driver }) => {
|
async ({ driver, contractRegistry }) => {
|
||||||
|
const contractAddress = await contractRegistry.getContractAddress(
|
||||||
|
smartContract,
|
||||||
|
);
|
||||||
await driver.navigate();
|
await driver.navigate();
|
||||||
await driver.fill('#password', 'correct horse battery staple');
|
await driver.fill('#password', 'correct horse battery staple');
|
||||||
await driver.press('#password', driver.Key.ENTER);
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
// Create TST
|
// Create TST
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await driver.openNewPage(
|
||||||
await driver.clickElement('#createToken');
|
`http://127.0.0.1:8080/?contract=${contractAddress}`,
|
||||||
await driver.waitUntilXWindowHandles(3);
|
);
|
||||||
let windowHandles = await driver.getAllWindowHandles();
|
let windowHandles = await driver.getAllWindowHandles();
|
||||||
const extension = windowHandles[0];
|
const extension = windowHandles[0];
|
||||||
const dapp = await driver.switchToWindowWithTitle(
|
|
||||||
'E2E Test Dapp',
|
|
||||||
windowHandles,
|
|
||||||
);
|
|
||||||
await driver.switchToWindowWithTitle(
|
|
||||||
'MetaMask Notification',
|
|
||||||
windowHandles,
|
|
||||||
);
|
|
||||||
await driver.clickElement({ text: 'Confirm', tag: 'button' });
|
|
||||||
await driver.waitUntilXWindowHandles(2);
|
|
||||||
await driver.switchToWindow(dapp);
|
|
||||||
const tokenAddress = await driver.waitForSelector({
|
|
||||||
css: '#tokenAddress',
|
|
||||||
text: '0x',
|
|
||||||
});
|
|
||||||
const tokenAddressText = await tokenAddress.getText();
|
|
||||||
|
|
||||||
// Add token
|
// Add token
|
||||||
await driver.switchToWindow(dapp);
|
await driver.findClickableElement('#deployButton');
|
||||||
await driver.clickElement('#watchAsset');
|
await driver.clickElement('#watchAsset');
|
||||||
await driver.waitUntilXWindowHandles(3);
|
await driver.waitUntilXWindowHandles(3);
|
||||||
windowHandles = await driver.getAllWindowHandles();
|
windowHandles = await driver.getAllWindowHandles();
|
||||||
@ -69,7 +59,7 @@ describe('Send ERC20 token to contract address', function () {
|
|||||||
// Type contract address
|
// Type contract address
|
||||||
await driver.fill(
|
await driver.fill(
|
||||||
'input[placeholder="Search, public address (0x), or ENS"]',
|
'input[placeholder="Search, public address (0x), or ENS"]',
|
||||||
tokenAddressText,
|
contractAddress,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Verify warning
|
// Verify warning
|
||||||
|
Loading…
Reference in New Issue
Block a user