mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
E2e connected state (#14444)
* Update contract-interactions.spec.js * Update failing-contract.spec.js * Update send-eth.spec.js * Update navigate-transactions.spec.js
This commit is contained in:
parent
fb42b48d31
commit
dd0b34c050
@ -389,6 +389,35 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"PermissionsController": {
|
||||
"permissionsRequests": [],
|
||||
"permissionsDescriptions": {},
|
||||
"domains": {
|
||||
"http://127.0.0.1:8080": {
|
||||
"permissions": [
|
||||
{
|
||||
"@context": ["https://github.com/MetaMask/rpc-cap"],
|
||||
"parentCapability": "eth_accounts",
|
||||
"id": "f55a1c15-ea48-4088-968e-63be474d42fa",
|
||||
"date": 1594348332268,
|
||||
"invoker": "http://127.0.0.1:8080",
|
||||
"caveats": [
|
||||
{
|
||||
"type": "limitResponseLength",
|
||||
"value": 1,
|
||||
"name": "primaryAccountOnly"
|
||||
},
|
||||
{
|
||||
"type": "filterResponse",
|
||||
"value": ["0x5cfe73b6021e818b776b421b1c4db2474086a7e1"],
|
||||
"name": "exposedAccounts"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"config": {},
|
||||
"firstTimeInfo": {
|
||||
"date": 1575697234195,
|
||||
|
@ -1,9 +1,5 @@
|
||||
const { strict: assert } = require('assert');
|
||||
const {
|
||||
convertToHexValue,
|
||||
withFixtures,
|
||||
regularDelayMs,
|
||||
} = require('../helpers');
|
||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
||||
|
||||
describe('Deploy contract and call contract methods', function () {
|
||||
const ganacheOptions = {
|
||||
@ -19,7 +15,7 @@ describe('Deploy contract and call contract methods', function () {
|
||||
await withFixtures(
|
||||
{
|
||||
dapp: true,
|
||||
fixtures: 'imported-account',
|
||||
fixtures: 'connected-state',
|
||||
ganacheOptions,
|
||||
title: this.test.title,
|
||||
},
|
||||
@ -28,32 +24,17 @@ describe('Deploy contract and call contract methods', function () {
|
||||
await driver.fill('#password', 'correct horse battery staple');
|
||||
await driver.press('#password', driver.Key.ENTER);
|
||||
|
||||
// connects the dapp
|
||||
// deploy contract
|
||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
||||
await driver.clickElement({ text: 'Connect', tag: 'button' });
|
||||
await driver.clickElement('#deployButton');
|
||||
await driver.waitUntilXWindowHandles(3);
|
||||
await driver.delay(5000);
|
||||
let windowHandles = await driver.getAllWindowHandles();
|
||||
const extension = windowHandles[0];
|
||||
const dapp = await driver.switchToWindowWithTitle(
|
||||
'E2E Test Dapp',
|
||||
windowHandles,
|
||||
);
|
||||
const popup = windowHandles.find(
|
||||
(handle) => handle !== extension && handle !== dapp,
|
||||
);
|
||||
await driver.switchToWindow(popup);
|
||||
await driver.clickElement({ text: 'Next', tag: 'button' });
|
||||
await driver.clickElement({ text: 'Connect', tag: 'button' });
|
||||
await driver.waitUntilXWindowHandles(2);
|
||||
|
||||
// creates a deploy contract transaction
|
||||
await driver.switchToWindow(dapp);
|
||||
await driver.clickElement('#deployButton');
|
||||
|
||||
// displays the contract creation data
|
||||
await driver.waitUntilXWindowHandles(3);
|
||||
windowHandles = await driver.getAllWindowHandles();
|
||||
await driver.switchToWindowWithTitle(
|
||||
'MetaMask Notification',
|
||||
windowHandles,
|
||||
@ -87,13 +68,15 @@ describe('Deploy contract and call contract methods', function () {
|
||||
await driver.switchToWindow(dapp);
|
||||
await driver.clickElement('#depositButton');
|
||||
await driver.waitUntilXWindowHandles(3);
|
||||
await driver.delay(5000);
|
||||
windowHandles = await driver.getAllWindowHandles();
|
||||
await driver.switchToWindowWithTitle(
|
||||
'MetaMask Notification',
|
||||
windowHandles,
|
||||
);
|
||||
await driver.delay(regularDelayMs);
|
||||
await driver.waitForSelector({
|
||||
css: '.confirm-page-container-summary__action__name',
|
||||
text: 'Deposit',
|
||||
});
|
||||
await driver.clickElement({ text: 'Confirm', tag: 'button' });
|
||||
await driver.waitUntilXWindowHandles(2);
|
||||
await driver.switchToWindow(extension);
|
||||
@ -113,13 +96,15 @@ describe('Deploy contract and call contract methods', function () {
|
||||
await driver.switchToWindow(dapp);
|
||||
await driver.clickElement('#withdrawButton');
|
||||
await driver.waitUntilXWindowHandles(3);
|
||||
await driver.delay(5000);
|
||||
windowHandles = await driver.getAllWindowHandles();
|
||||
await driver.switchToWindowWithTitle(
|
||||
'MetaMask Notification',
|
||||
windowHandles,
|
||||
);
|
||||
await driver.delay(regularDelayMs);
|
||||
await driver.waitForSelector({
|
||||
css: '.confirm-page-container-summary__action__name',
|
||||
text: 'Withdraw',
|
||||
});
|
||||
await driver.clickElement({ text: 'Confirm', tag: 'button' });
|
||||
await driver.waitUntilXWindowHandles(2);
|
||||
await driver.switchToWindow(extension);
|
||||
|
@ -16,7 +16,7 @@ describe('Failing contract interaction ', function () {
|
||||
await withFixtures(
|
||||
{
|
||||
dapp: true,
|
||||
fixtures: 'imported-account',
|
||||
fixtures: 'connected-state',
|
||||
ganacheOptions,
|
||||
title: this.test.title,
|
||||
},
|
||||
@ -25,9 +25,9 @@ describe('Failing contract interaction ', function () {
|
||||
await driver.fill('#password', 'correct horse battery staple');
|
||||
await driver.press('#password', driver.Key.ENTER);
|
||||
|
||||
// connects the dapp
|
||||
// deploy contract
|
||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
||||
await driver.clickElement({ text: 'Connect', tag: 'button' });
|
||||
await driver.clickElement('#deployFailingButton');
|
||||
await driver.waitUntilXWindowHandles(3);
|
||||
let windowHandles = await driver.getAllWindowHandles();
|
||||
const extension = windowHandles[0];
|
||||
@ -35,19 +35,6 @@ describe('Failing contract interaction ', function () {
|
||||
'E2E Test Dapp',
|
||||
windowHandles,
|
||||
);
|
||||
const popup = windowHandles.find(
|
||||
(handle) => handle !== extension && handle !== dapp,
|
||||
);
|
||||
await driver.switchToWindow(popup);
|
||||
await driver.clickElement({ text: 'Next', tag: 'button' });
|
||||
await driver.clickElement({ text: 'Connect', tag: 'button' });
|
||||
await driver.waitUntilXWindowHandles(2);
|
||||
|
||||
// deploy contract
|
||||
await driver.switchToWindow(dapp);
|
||||
await driver.clickElement('#deployFailingButton');
|
||||
await driver.waitUntilXWindowHandles(3);
|
||||
windowHandles = await driver.getAllWindowHandles();
|
||||
await driver.switchToWindowWithTitle(
|
||||
'MetaMask Notification',
|
||||
windowHandles,
|
||||
|
@ -123,26 +123,12 @@ describe('Navigate transactions', function () {
|
||||
'second transaction in focus',
|
||||
);
|
||||
|
||||
// connects the dapp
|
||||
// add transaction
|
||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
||||
await driver.clickElement({ text: 'Connect', tag: 'button' });
|
||||
await driver.clickElement({ text: 'Send', tag: 'button' });
|
||||
await driver.waitUntilXWindowHandles(3);
|
||||
const windowHandles = await driver.getAllWindowHandles();
|
||||
const extension = windowHandles[0];
|
||||
const dapp = await driver.switchToWindowWithTitle(
|
||||
'E2E Test Dapp',
|
||||
windowHandles,
|
||||
);
|
||||
const popup = windowHandles.find(
|
||||
(handle) => handle !== extension && handle !== dapp,
|
||||
);
|
||||
await driver.switchToWindow(popup);
|
||||
await driver.clickElement({ text: 'Next', tag: 'button' });
|
||||
await driver.clickElement({ text: 'Connect', tag: 'button' });
|
||||
|
||||
// add transaction
|
||||
await driver.switchToWindow(dapp);
|
||||
await driver.clickElement({ text: 'Send', tag: 'button' });
|
||||
await driver.switchToWindow(extension);
|
||||
navigationElement = await driver.waitForSelector(
|
||||
{
|
||||
|
@ -1,9 +1,5 @@
|
||||
const { strict: assert } = require('assert');
|
||||
const {
|
||||
convertToHexValue,
|
||||
withFixtures,
|
||||
regularDelayMs,
|
||||
} = require('../helpers');
|
||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
||||
|
||||
describe('Send ETH from inside MetaMask using default gas', function () {
|
||||
const ganacheOptions = {
|
||||
@ -47,7 +43,12 @@ describe('Send ETH from inside MetaMask using default gas', function () {
|
||||
await inputAmount.press(driver.Key.BACK_SPACE);
|
||||
await inputAmount.press(driver.Key.BACK_SPACE);
|
||||
await inputAmount.press(driver.Key.BACK_SPACE);
|
||||
await driver.delay(regularDelayMs);
|
||||
await driver.wait(async () => {
|
||||
const sendDialogMsgs = await driver.findElements(
|
||||
'.send-v2__form div.dialog',
|
||||
);
|
||||
return sendDialogMsgs.length === 1;
|
||||
}, 10000);
|
||||
|
||||
await driver.assertElementNotPresent('.send-v2__error-amount');
|
||||
|
||||
@ -158,10 +159,6 @@ describe('Send ETH from inside MetaMask using advanced gas modal', function () {
|
||||
});
|
||||
|
||||
describe('Send ETH from dapp using advanced gas controls', function () {
|
||||
let windowHandles;
|
||||
let extension;
|
||||
let popup;
|
||||
let dapp;
|
||||
const ganacheOptions = {
|
||||
accounts: [
|
||||
{
|
||||
@ -176,7 +173,7 @@ describe('Send ETH from dapp using advanced gas controls', function () {
|
||||
await withFixtures(
|
||||
{
|
||||
dapp: true,
|
||||
fixtures: 'imported-account',
|
||||
fixtures: 'connected-state',
|
||||
ganacheOptions,
|
||||
title: this.test.title,
|
||||
},
|
||||
@ -200,52 +197,46 @@ describe('Send ETH from dapp using advanced gas controls', function () {
|
||||
await driver.clickElement(
|
||||
'[data-testid="advanced-setting-advanced-gas-inline"] .settings-page__content-item-col > label > div',
|
||||
);
|
||||
windowHandles = await driver.getAllWindowHandles();
|
||||
extension = windowHandles[0];
|
||||
await driver.closeAllWindowHandlesExcept([extension]);
|
||||
await driver.clickElement('.app-header__logo-container');
|
||||
|
||||
// connects the dapp
|
||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
||||
await driver.clickElement({ text: 'Connect', tag: 'button' });
|
||||
await driver.waitUntilXWindowHandles(3);
|
||||
windowHandles = await driver.getAllWindowHandles();
|
||||
extension = windowHandles[0];
|
||||
dapp = await driver.switchToWindowWithTitle(
|
||||
'E2E Test Dapp',
|
||||
windowHandles,
|
||||
);
|
||||
popup = windowHandles.find(
|
||||
(handle) => handle !== extension && handle !== dapp,
|
||||
);
|
||||
await driver.switchToWindow(popup);
|
||||
await driver.clickElement({ text: 'Next', tag: 'button' });
|
||||
await driver.clickElement({ text: 'Connect', tag: 'button' });
|
||||
await driver.waitUntilXWindowHandles(2);
|
||||
await driver.switchToWindow(dapp);
|
||||
|
||||
// initiates a send from the dapp
|
||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
||||
await driver.clickElement({ text: 'Send', tag: 'button' });
|
||||
await driver.delay(2000);
|
||||
windowHandles = await driver.getAllWindowHandles();
|
||||
await driver.waitUntilXWindowHandles(3);
|
||||
const windowHandles = await driver.getAllWindowHandles();
|
||||
const extension = windowHandles[0];
|
||||
await driver.switchToWindowWithTitle(
|
||||
'MetaMask Notification',
|
||||
windowHandles,
|
||||
);
|
||||
await driver.assertElementNotPresent({ text: 'Data', tag: 'li' });
|
||||
await driver.clickElement({ text: 'Edit', tag: 'button' });
|
||||
await driver.delay(1000);
|
||||
await driver.waitForSelector({
|
||||
css: '.transaction-total-banner',
|
||||
text: '0.00021 ETH',
|
||||
});
|
||||
await driver.clickElement(
|
||||
{ text: 'Edit suggested gas fee', tag: 'button' },
|
||||
10000,
|
||||
);
|
||||
await driver.delay(1000);
|
||||
await driver.waitForSelector({
|
||||
css: '.transaction-total-banner',
|
||||
text: '0.00021 ETH',
|
||||
});
|
||||
const inputs = await driver.findElements('input[type="number"]');
|
||||
const gasPriceInput = inputs[1];
|
||||
await gasPriceInput.press(driver.Key.BACK_SPACE);
|
||||
await gasPriceInput.press(driver.Key.BACK_SPACE);
|
||||
await gasPriceInput.fill('100');
|
||||
await driver.delay(1000);
|
||||
await driver.waitForSelector({
|
||||
css: '.transaction-total-banner',
|
||||
text: '0.0021 ETH',
|
||||
});
|
||||
await driver.clickElement({ text: 'Save', tag: 'button' });
|
||||
await driver.delay(1000);
|
||||
await driver.waitForSelector({
|
||||
css: '.transaction-detail-item:nth-of-type(1) h6:nth-of-type(2)',
|
||||
text: '0.0021 ETH',
|
||||
});
|
||||
await driver.clickElement({ text: 'Confirm', tag: 'button' });
|
||||
await driver.waitUntilXWindowHandles(2);
|
||||
await driver.switchToWindow(extension);
|
||||
|
Loading…
Reference in New Issue
Block a user