mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
chore: refactor connect to dapp action in e2e (#19015)
* chore: refactor connect to dapp action in e2e * chore: refactor 2nd dapp connection * chore: rename to openDapp
This commit is contained in:
parent
69132e7785
commit
395ac34bed
@ -8,6 +8,7 @@ const {
|
|||||||
ACTION_QUEUE_METRICS_E2E_TEST,
|
ACTION_QUEUE_METRICS_E2E_TEST,
|
||||||
} = require('../../shared/constants/test-flags');
|
} = require('../../shared/constants/test-flags');
|
||||||
const { SMART_CONTRACTS } = require('./seeder/smart-contracts');
|
const { SMART_CONTRACTS } = require('./seeder/smart-contracts');
|
||||||
|
const { DAPP_URL } = require('./helpers');
|
||||||
|
|
||||||
function defaultFixture() {
|
function defaultFixture() {
|
||||||
return {
|
return {
|
||||||
@ -594,13 +595,13 @@ class FixtureBuilder {
|
|||||||
withPermissionControllerConnectedToTestDapp() {
|
withPermissionControllerConnectedToTestDapp() {
|
||||||
return this.withPermissionController({
|
return this.withPermissionController({
|
||||||
subjects: {
|
subjects: {
|
||||||
'http://127.0.0.1:8080': {
|
[DAPP_URL]: {
|
||||||
origin: 'http://127.0.0.1:8080',
|
origin: DAPP_URL,
|
||||||
permissions: {
|
permissions: {
|
||||||
eth_accounts: {
|
eth_accounts: {
|
||||||
id: 'ZaqPEWxyhNCJYACFw93jE',
|
id: 'ZaqPEWxyhNCJYACFw93jE',
|
||||||
parentCapability: 'eth_accounts',
|
parentCapability: 'eth_accounts',
|
||||||
invoker: 'http://127.0.0.1:8080',
|
invoker: DAPP_URL,
|
||||||
caveats: [
|
caveats: [
|
||||||
{
|
{
|
||||||
type: 'restrictReturnedAccounts',
|
type: 'restrictReturnedAccounts',
|
||||||
|
@ -383,7 +383,18 @@ const testSRPDropdownIterations = async (options, driver, iterations) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const DAPP_URL = 'http://127.0.0.1:8080';
|
||||||
|
const DAPP_ONE_URL = 'http://127.0.0.1:8081';
|
||||||
|
|
||||||
|
const openDapp = async (driver, contract = null, dappURL = DAPP_URL) => {
|
||||||
|
contract
|
||||||
|
? await driver.openNewPage(`${dappURL}/?contract=${contract}`)
|
||||||
|
: await driver.openNewPage(dappURL);
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
DAPP_URL,
|
||||||
|
DAPP_ONE_URL,
|
||||||
getWindowHandles,
|
getWindowHandles,
|
||||||
convertToHexValue,
|
convertToHexValue,
|
||||||
tinyDelayMs,
|
tinyDelayMs,
|
||||||
@ -398,4 +409,5 @@ module.exports = {
|
|||||||
createDownloadFolder,
|
createDownloadFolder,
|
||||||
importWrongSRPOnboardingFlow,
|
importWrongSRPOnboardingFlow,
|
||||||
testSRPDropdownIterations,
|
testSRPDropdownIterations,
|
||||||
|
openDapp,
|
||||||
};
|
};
|
||||||
|
@ -8,6 +8,7 @@ const {
|
|||||||
regularDelayMs,
|
regularDelayMs,
|
||||||
largeDelayMs,
|
largeDelayMs,
|
||||||
veryLargeDelayMs,
|
veryLargeDelayMs,
|
||||||
|
openDapp,
|
||||||
} = require('./helpers');
|
} = require('./helpers');
|
||||||
const { buildWebDriver } = require('./webdriver');
|
const { buildWebDriver } = require('./webdriver');
|
||||||
const Ganache = require('./ganache');
|
const Ganache = require('./ganache');
|
||||||
@ -177,7 +178,7 @@ describe('MetaMask', function () {
|
|||||||
let popup;
|
let popup;
|
||||||
let dapp;
|
let dapp;
|
||||||
it('connects the dapp', async function () {
|
it('connects the dapp', async function () {
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
await driver.delay(regularDelayMs);
|
await driver.delay(regularDelayMs);
|
||||||
|
|
||||||
await driver.clickElement({ text: 'Connect', tag: 'button' });
|
await driver.clickElement({ text: 'Connect', tag: 'button' });
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const { convertToHexValue, withFixtures, openDapp } = require('../helpers');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
|
|
||||||
describe('MV3 - Dapp interactions', function () {
|
describe('MV3 - Dapp interactions', function () {
|
||||||
@ -31,7 +31,7 @@ describe('MV3 - Dapp interactions', function () {
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
|
|
||||||
// Terminate Service Worker
|
// Terminate Service Worker
|
||||||
await driver.openNewPage('chrome://inspect/#service-workers/');
|
await driver.openNewPage('chrome://inspect/#service-workers/');
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const { convertToHexValue, withFixtures, openDapp } = require('../helpers');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
const {
|
const {
|
||||||
ACTION_QUEUE_METRICS_E2E_TEST,
|
ACTION_QUEUE_METRICS_E2E_TEST,
|
||||||
@ -142,7 +142,7 @@ describe('MV3 - Service worker restart', function () {
|
|||||||
await driver.press('#password', driver.Key.ENTER);
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
// initialize a transaction of send from dapp
|
// initialize a transaction of send from dapp
|
||||||
await driver.openNewPage('http://127.0.0.1:8080');
|
await openDapp(driver);
|
||||||
await driver.clickElement('#sendButton');
|
await driver.clickElement('#sendButton');
|
||||||
|
|
||||||
// A popup window is initialized
|
// A popup window is initialized
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const {
|
||||||
|
convertToHexValue,
|
||||||
|
withFixtures,
|
||||||
|
DAPP_URL,
|
||||||
|
openDapp,
|
||||||
|
} = require('../helpers');
|
||||||
const { SMART_CONTRACTS } = require('../seeder/smart-contracts');
|
const { SMART_CONTRACTS } = require('../seeder/smart-contracts');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
|
|
||||||
@ -34,7 +39,7 @@ describe('ERC1155 NFTs testdapp interaction', function () {
|
|||||||
await driver.press('#password', driver.Key.ENTER);
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
// Open Dapp and wait for deployed contract
|
// Open Dapp and wait for deployed contract
|
||||||
await driver.openNewPage(`http://127.0.0.1:8080/?contract=${contract}`);
|
await openDapp(driver, contract);
|
||||||
await driver.findClickableElement('#deployButton');
|
await driver.findClickableElement('#deployButton');
|
||||||
|
|
||||||
// Mint
|
// Mint
|
||||||
@ -91,7 +96,7 @@ describe('ERC1155 NFTs testdapp interaction', function () {
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage(`http://127.0.0.1:8080/?contract=${contract}`);
|
await openDapp(driver, contract);
|
||||||
|
|
||||||
await driver.fill('#batchTransferTokenIds', '1, 2, 3');
|
await driver.fill('#batchTransferTokenIds', '1, 2, 3');
|
||||||
await driver.fill('#batchTransferTokenAmounts', '1, 1, 1000000000000');
|
await driver.fill('#batchTransferTokenAmounts', '1, 1, 1000000000000');
|
||||||
@ -150,7 +155,7 @@ describe('ERC1155 NFTs testdapp interaction', function () {
|
|||||||
await driver.press('#password', driver.Key.ENTER);
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
// Create a set approval for all erc1155 token request in test dapp
|
// Create a set approval for all erc1155 token request in test dapp
|
||||||
await driver.openNewPage(`http://127.0.0.1:8080/?contract=${contract}`);
|
await openDapp(driver, contract);
|
||||||
await driver.clickElement('#setApprovalForAllERC1155Button');
|
await driver.clickElement('#setApprovalForAllERC1155Button');
|
||||||
|
|
||||||
// Wait for notification popup and check the displayed message
|
// Wait for notification popup and check the displayed message
|
||||||
@ -170,7 +175,7 @@ describe('ERC1155 NFTs testdapp interaction', function () {
|
|||||||
const displayedUrl = await driver.findElement(
|
const displayedUrl = await driver.findElement(
|
||||||
'.confirm-approve-content h6',
|
'.confirm-approve-content h6',
|
||||||
);
|
);
|
||||||
assert.equal(await displayedUrl.getText(), 'http://127.0.0.1:8080');
|
assert.equal(await displayedUrl.getText(), DAPP_URL);
|
||||||
const displayedDescription = await driver.findElement(
|
const displayedDescription = await driver.findElement(
|
||||||
'.confirm-approve-content__description',
|
'.confirm-approve-content__description',
|
||||||
);
|
);
|
||||||
@ -239,7 +244,7 @@ describe('ERC1155 NFTs testdapp interaction', function () {
|
|||||||
await driver.press('#password', driver.Key.ENTER);
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
// Create a revoke approval for all erc1155 token request in test dapp
|
// Create a revoke approval for all erc1155 token request in test dapp
|
||||||
await driver.openNewPage(`http://127.0.0.1:8080/?contract=${contract}`);
|
await openDapp(driver, contract);
|
||||||
await driver.clickElement('#revokeERC1155Button');
|
await driver.clickElement('#revokeERC1155Button');
|
||||||
|
|
||||||
// Wait for notification popup and check the displayed message
|
// Wait for notification popup and check the displayed message
|
||||||
@ -260,7 +265,7 @@ describe('ERC1155 NFTs testdapp interaction', function () {
|
|||||||
const displayedUrl = await driver.findElement(
|
const displayedUrl = await driver.findElement(
|
||||||
'.confirm-approve-content h6',
|
'.confirm-approve-content h6',
|
||||||
);
|
);
|
||||||
assert.equal(await displayedUrl.getText(), 'http://127.0.0.1:8080');
|
assert.equal(await displayedUrl.getText(), DAPP_URL);
|
||||||
const displayedDescription = await driver.findElement(
|
const displayedDescription = await driver.findElement(
|
||||||
'.confirm-approve-content__description',
|
'.confirm-approve-content__description',
|
||||||
);
|
);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const { convertToHexValue, withFixtures, openDapp } = require('../helpers');
|
||||||
const { SMART_CONTRACTS } = require('../seeder/smart-contracts');
|
const { SMART_CONTRACTS } = require('../seeder/smart-contracts');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ describe('ERC721 NFTs testdapp interaction', function () {
|
|||||||
await driver.press('#password', driver.Key.ENTER);
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
// Open Dapp and wait for deployed contract
|
// Open Dapp and wait for deployed contract
|
||||||
await driver.openNewPage(`http://127.0.0.1:8080/?contract=${contract}`);
|
await openDapp(driver, contract);
|
||||||
await driver.findClickableElement('#deployButton');
|
await driver.findClickableElement('#deployButton');
|
||||||
|
|
||||||
// Click Transer
|
// Click Transer
|
||||||
@ -86,7 +86,7 @@ describe('ERC721 NFTs testdapp interaction', function () {
|
|||||||
await driver.press('#password', driver.Key.ENTER);
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
// Open Dapp and wait for deployed contract
|
// Open Dapp and wait for deployed contract
|
||||||
await driver.openNewPage(`http://127.0.0.1:8080/?contract=${contract}`);
|
await openDapp(driver, contract);
|
||||||
await driver.findClickableElement('#deployButton');
|
await driver.findClickableElement('#deployButton');
|
||||||
|
|
||||||
// Click Approve
|
// Click Approve
|
||||||
@ -158,7 +158,7 @@ describe('ERC721 NFTs testdapp interaction', function () {
|
|||||||
await driver.press('#password', driver.Key.ENTER);
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
// Open Dapp and wait for deployed contract
|
// Open Dapp and wait for deployed contract
|
||||||
await driver.openNewPage(`http://127.0.0.1:8080/?contract=${contract}`);
|
await openDapp(driver, contract);
|
||||||
await driver.findClickableElement('#deployButton');
|
await driver.findClickableElement('#deployButton');
|
||||||
|
|
||||||
// Enable Set approval for all
|
// Enable Set approval for all
|
||||||
@ -229,7 +229,7 @@ describe('ERC721 NFTs testdapp interaction', function () {
|
|||||||
await driver.press('#password', driver.Key.ENTER);
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
// Open Dapp and wait for deployed contract
|
// Open Dapp and wait for deployed contract
|
||||||
await driver.openNewPage(`http://127.0.0.1:8080/?contract=${contract}`);
|
await openDapp(driver, contract);
|
||||||
await driver.findClickableElement('#deployButton');
|
await driver.findClickableElement('#deployButton');
|
||||||
|
|
||||||
// Disable Set approval for all
|
// Disable Set approval for all
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const { convertToHexValue, withFixtures, openDapp } = require('../helpers');
|
||||||
|
|
||||||
describe('Custom network', function () {
|
describe('Custom network', function () {
|
||||||
const chainID = '42161';
|
const chainID = '42161';
|
||||||
@ -33,7 +33,7 @@ describe('Custom network', function () {
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
await driver.executeScript(`
|
await driver.executeScript(`
|
||||||
var params = [{
|
var params = [{
|
||||||
chainId: "0x1",
|
chainId: "0x1",
|
||||||
@ -111,7 +111,7 @@ describe('Custom network', function () {
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
await driver.executeScript(`
|
await driver.executeScript(`
|
||||||
var params = [{
|
var params = [{
|
||||||
chainId: "0x123",
|
chainId: "0x123",
|
||||||
@ -176,7 +176,7 @@ describe('Custom network', function () {
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
await driver.executeScript(`
|
await driver.executeScript(`
|
||||||
var params = [{
|
var params = [{
|
||||||
chainId: "0x123",
|
chainId: "0x123",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const { convertToHexValue, withFixtures, openDapp } = require('../helpers');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
|
|
||||||
describe('Chain Interactions', function () {
|
describe('Chain Interactions', function () {
|
||||||
@ -29,7 +29,7 @@ describe('Chain Interactions', function () {
|
|||||||
await driver.press('#password', driver.Key.ENTER);
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
// trigger add chain confirmation
|
// trigger add chain confirmation
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
await driver.clickElement('#addEthereumChain');
|
await driver.clickElement('#addEthereumChain');
|
||||||
await driver.waitUntilXWindowHandles(3);
|
await driver.waitUntilXWindowHandles(3);
|
||||||
const windowHandles = await driver.getAllWindowHandles();
|
const windowHandles = await driver.getAllWindowHandles();
|
||||||
@ -81,7 +81,7 @@ describe('Chain Interactions', function () {
|
|||||||
await driver.press('#password', driver.Key.ENTER);
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
// trigger add chain confirmation
|
// trigger add chain confirmation
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
await driver.clickElement('#addEthereumChain');
|
await driver.clickElement('#addEthereumChain');
|
||||||
await driver.waitUntilXWindowHandles(3);
|
await driver.waitUntilXWindowHandles(3);
|
||||||
const windowHandles = await driver.getAllWindowHandles();
|
const windowHandles = await driver.getAllWindowHandles();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const { convertToHexValue, withFixtures, openDapp } = require('../helpers');
|
||||||
const { SMART_CONTRACTS } = require('../seeder/smart-contracts');
|
const { SMART_CONTRACTS } = require('../seeder/smart-contracts');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
|
|
||||||
@ -34,9 +34,7 @@ describe('Deploy contract and call contract methods', function () {
|
|||||||
await driver.press('#password', driver.Key.ENTER);
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
// deploy contract
|
// deploy contract
|
||||||
await driver.openNewPage(
|
await openDapp(driver, contractAddress);
|
||||||
`http://127.0.0.1:8080/?contract=${contractAddress}`,
|
|
||||||
);
|
|
||||||
|
|
||||||
// wait for deployed contract, calls and confirms a contract method where ETH is sent
|
// wait for deployed contract, calls and confirms a contract method where ETH is sent
|
||||||
await driver.findClickableElement('#deployButton');
|
await driver.findClickableElement('#deployButton');
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
|
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const { convertToHexValue, withFixtures, openDapp } = require('../helpers');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
const { SMART_CONTRACTS } = require('../seeder/smart-contracts');
|
const { SMART_CONTRACTS } = require('../seeder/smart-contracts');
|
||||||
|
|
||||||
@ -36,9 +36,7 @@ describe('Create token, approve token and approve token without gas', function (
|
|||||||
await driver.press('#password', driver.Key.ENTER);
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
// create token
|
// create token
|
||||||
await driver.openNewPage(
|
await openDapp(driver, contractAddress);
|
||||||
`http://127.0.0.1:8080/?contract=${contractAddress}`,
|
|
||||||
);
|
|
||||||
|
|
||||||
const windowHandles = await driver.getAllWindowHandles();
|
const windowHandles = await driver.getAllWindowHandles();
|
||||||
const extension = windowHandles[0];
|
const extension = windowHandles[0];
|
||||||
@ -100,9 +98,7 @@ describe('Create token, approve token and approve token without gas', function (
|
|||||||
await driver.press('#password', driver.Key.ENTER);
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
// create token
|
// create token
|
||||||
await driver.openNewPage(
|
await openDapp(driver, contractAddress);
|
||||||
`http://127.0.0.1:8080/?contract=${contractAddress}`,
|
|
||||||
);
|
|
||||||
|
|
||||||
let windowHandles = await driver.getAllWindowHandles();
|
let windowHandles = await driver.getAllWindowHandles();
|
||||||
const extension = windowHandles[0];
|
const extension = windowHandles[0];
|
||||||
@ -226,9 +222,7 @@ describe('Create token, approve token and approve token without gas', function (
|
|||||||
await driver.press('#password', driver.Key.ENTER);
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
// create token
|
// create token
|
||||||
await driver.openNewPage(
|
await openDapp(driver, contractAddress);
|
||||||
`http://127.0.0.1:8080/?contract=${contractAddress}`,
|
|
||||||
);
|
|
||||||
|
|
||||||
let windowHandles = await driver.getAllWindowHandles();
|
let windowHandles = await driver.getAllWindowHandles();
|
||||||
const extension = windowHandles[0];
|
const extension = windowHandles[0];
|
||||||
@ -372,10 +366,7 @@ describe('Create token, approve token and approve token without gas', function (
|
|||||||
await driver.press('#password', driver.Key.ENTER);
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
// create token
|
// create token
|
||||||
await driver.openNewPage(
|
await openDapp(driver, contractAddress);
|
||||||
`http://127.0.0.1:8080/?contract=${contractAddress}`,
|
|
||||||
);
|
|
||||||
|
|
||||||
const windowHandles = await driver.getAllWindowHandles();
|
const windowHandles = await driver.getAllWindowHandles();
|
||||||
const extension = windowHandles[0];
|
const extension = windowHandles[0];
|
||||||
|
|
||||||
@ -458,9 +449,7 @@ describe('Create token, approve token and approve token without gas', function (
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage(
|
await openDapp(driver, contractAddress);
|
||||||
`http://127.0.0.1:8080/?contract=${contractAddress}`,
|
|
||||||
);
|
|
||||||
const windowHandles = await driver.getAllWindowHandles();
|
const windowHandles = await driver.getAllWindowHandles();
|
||||||
const extension = windowHandles[0];
|
const extension = windowHandles[0];
|
||||||
|
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const {
|
||||||
|
convertToHexValue,
|
||||||
|
withFixtures,
|
||||||
|
openDapp,
|
||||||
|
DAPP_URL,
|
||||||
|
DAPP_ONE_URL,
|
||||||
|
} = require('../helpers');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
|
|
||||||
describe('Dapp interactions', function () {
|
describe('Dapp interactions', function () {
|
||||||
@ -31,7 +37,7 @@ describe('Dapp interactions', function () {
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
windowHandles = await driver.getAllWindowHandles();
|
windowHandles = await driver.getAllWindowHandles();
|
||||||
extension = windowHandles[0];
|
extension = windowHandles[0];
|
||||||
|
|
||||||
@ -76,7 +82,7 @@ describe('Dapp interactions', function () {
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
windowHandles = await driver.getAllWindowHandles();
|
windowHandles = await driver.getAllWindowHandles();
|
||||||
extension = windowHandles[0];
|
extension = windowHandles[0];
|
||||||
|
|
||||||
@ -86,7 +92,7 @@ describe('Dapp interactions', function () {
|
|||||||
await driver.clickElement({ text: 'Lock', tag: 'button' });
|
await driver.clickElement({ text: 'Lock', tag: 'button' });
|
||||||
|
|
||||||
// Connect to Dapp1
|
// Connect to Dapp1
|
||||||
await driver.openNewPage('http://127.0.0.1:8081/');
|
await openDapp(driver, null, DAPP_ONE_URL);
|
||||||
await driver.clickElement({ text: 'Connect', tag: 'button' });
|
await driver.clickElement({ text: 'Connect', tag: 'button' });
|
||||||
await driver.waitUntilXWindowHandles(4);
|
await driver.waitUntilXWindowHandles(4);
|
||||||
windowHandles = await driver.getAllWindowHandles();
|
windowHandles = await driver.getAllWindowHandles();
|
||||||
@ -111,11 +117,11 @@ describe('Dapp interactions', function () {
|
|||||||
);
|
);
|
||||||
await driver.clickElement({ text: 'Connected sites', tag: 'div' });
|
await driver.clickElement({ text: 'Connected sites', tag: 'div' });
|
||||||
const connectedDapp1 = await driver.isElementPresent({
|
const connectedDapp1 = await driver.isElementPresent({
|
||||||
text: 'http://127.0.0.1:8080',
|
text: DAPP_URL,
|
||||||
tag: 'bdi',
|
tag: 'bdi',
|
||||||
});
|
});
|
||||||
const connectedDapp2 = await driver.isElementPresent({
|
const connectedDapp2 = await driver.isElementPresent({
|
||||||
text: 'http://127.0.0.1:8081',
|
text: DAPP_ONE_URL,
|
||||||
tag: 'bdi',
|
tag: 'bdi',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const { convertToHexValue, withFixtures, openDapp } = require('../helpers');
|
||||||
const { SMART_CONTRACTS } = require('../seeder/smart-contracts');
|
const { SMART_CONTRACTS } = require('../seeder/smart-contracts');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
|
|
||||||
@ -34,10 +34,7 @@ describe('Editing confirmations of dapp initiated contract interactions', functi
|
|||||||
await driver.press('#password', driver.Key.ENTER);
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
// deploy contract
|
// deploy contract
|
||||||
await driver.openNewPage(
|
await openDapp(driver, contractAddress);
|
||||||
`http://127.0.0.1:8080/?contract=${contractAddress}`,
|
|
||||||
);
|
|
||||||
|
|
||||||
// wait for deployed contract, calls and confirms a contract method where ETH is sent
|
// wait for deployed contract, calls and confirms a contract method where ETH is sent
|
||||||
await driver.findClickableElement('#deployButton');
|
await driver.findClickableElement('#deployButton');
|
||||||
await driver.clickElement('#depositButton');
|
await driver.clickElement('#depositButton');
|
||||||
@ -80,7 +77,7 @@ describe('Editing confirmations of dapp initiated contract interactions', functi
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage(`http://127.0.0.1:8080/`);
|
await openDapp(driver);
|
||||||
await driver.clickElement('#sendButton');
|
await driver.clickElement('#sendButton');
|
||||||
await driver.waitUntilXWindowHandles(3);
|
await driver.waitUntilXWindowHandles(3);
|
||||||
const windowHandles = await driver.getAllWindowHandles();
|
const windowHandles = await driver.getAllWindowHandles();
|
||||||
|
@ -3,6 +3,7 @@ const {
|
|||||||
convertToHexValue,
|
convertToHexValue,
|
||||||
getWindowHandles,
|
getWindowHandles,
|
||||||
withFixtures,
|
withFixtures,
|
||||||
|
openDapp,
|
||||||
} = require('../helpers');
|
} = require('../helpers');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
|
|
||||||
@ -206,7 +207,7 @@ describe('Editing Confirm Transaction', function () {
|
|||||||
await driver.press('#password', driver.Key.ENTER);
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
// open dapp and connect
|
// open dapp and connect
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
await driver.clickElement({
|
await driver.clickElement({
|
||||||
text: 'Send EIP 1559 Transaction',
|
text: 'Send EIP 1559 Transaction',
|
||||||
tag: 'button',
|
tag: 'button',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const { convertToHexValue, withFixtures, openDapp } = require('../helpers');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
|
|
||||||
describe('Encrypt Decrypt', function () {
|
describe('Encrypt Decrypt', function () {
|
||||||
@ -28,7 +28,7 @@ describe('Encrypt Decrypt', function () {
|
|||||||
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);
|
||||||
await driver.openNewPage('http://127.0.0.1:8080');
|
await openDapp(driver);
|
||||||
|
|
||||||
// ------ Get Encryption key ------
|
// ------ Get Encryption key ------
|
||||||
await driver.clickElement('#getEncryptionKeyButton');
|
await driver.clickElement('#getEncryptionKeyButton');
|
||||||
@ -109,7 +109,7 @@ describe('Encrypt Decrypt', function () {
|
|||||||
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);
|
||||||
await driver.openNewPage('http://127.0.0.1:8080');
|
await openDapp(driver);
|
||||||
|
|
||||||
// ------ Get Encryption key and display ETH ------
|
// ------ Get Encryption key and display ETH ------
|
||||||
await driver.clickElement('#getEncryptionKeyButton');
|
await driver.clickElement('#getEncryptionKeyButton');
|
||||||
@ -153,7 +153,7 @@ describe('Encrypt Decrypt', function () {
|
|||||||
await driver.press('#password', driver.Key.ENTER);
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
await driver.clickElement('.account-menu__icon');
|
await driver.clickElement('.account-menu__icon');
|
||||||
await driver.openNewPage('http://127.0.0.1:8080');
|
await openDapp(driver);
|
||||||
|
|
||||||
// ------ Get Encryption key and display ETH ------
|
// ------ Get Encryption key and display ETH ------
|
||||||
await driver.clickElement('#getEncryptionKeyButton');
|
await driver.clickElement('#getEncryptionKeyButton');
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const {
|
||||||
|
convertToHexValue,
|
||||||
|
withFixtures,
|
||||||
|
openDapp,
|
||||||
|
DAPP_URL,
|
||||||
|
} = require('../helpers');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
|
|
||||||
const ganacheOptions = {
|
const ganacheOptions = {
|
||||||
@ -28,7 +33,7 @@ describe('Eth sign', function () {
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
await driver.clickElement('#ethSign');
|
await driver.clickElement('#ethSign');
|
||||||
|
|
||||||
await driver.delay(1000);
|
await driver.delay(1000);
|
||||||
@ -64,7 +69,7 @@ describe('Eth sign', function () {
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
await driver.clickElement('#ethSign');
|
await driver.clickElement('#ethSign');
|
||||||
|
|
||||||
// Wait for Signature request popup
|
// Wait for Signature request popup
|
||||||
@ -80,7 +85,7 @@ describe('Eth sign', function () {
|
|||||||
);
|
);
|
||||||
const origin = await driver.findElement('.request-signature__origin');
|
const origin = await driver.findElement('.request-signature__origin');
|
||||||
assert.equal(await title.getText(), 'Signature request');
|
assert.equal(await title.getText(), 'Signature request');
|
||||||
assert.equal(await origin.getText(), 'http://127.0.0.1:8080');
|
assert.equal(await origin.getText(), DAPP_URL);
|
||||||
|
|
||||||
const personalMessageRow = await driver.findElement(
|
const personalMessageRow = await driver.findElement(
|
||||||
'.request-signature__row-value',
|
'.request-signature__row-value',
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const {
|
||||||
|
convertToHexValue,
|
||||||
|
withFixtures,
|
||||||
|
openDapp,
|
||||||
|
DAPP_ONE_URL,
|
||||||
|
} = require('../helpers');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
|
|
||||||
describe('eth_subscribe', function () {
|
describe('eth_subscribe', function () {
|
||||||
@ -28,7 +33,7 @@ describe('eth_subscribe', function () {
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
|
|
||||||
const setupSubscriptionListener = `
|
const setupSubscriptionListener = `
|
||||||
const responseContainer = document.createElement('div');
|
const responseContainer = document.createElement('div');
|
||||||
@ -63,7 +68,7 @@ describe('eth_subscribe', function () {
|
|||||||
await driver.findElement('[data-testid="eth-subscribe-response"]');
|
await driver.findElement('[data-testid="eth-subscribe-response"]');
|
||||||
|
|
||||||
// Switch to the second dapp
|
// Switch to the second dapp
|
||||||
await driver.openNewPage('http://127.0.0.1:8081/');
|
await openDapp(driver, null, DAPP_ONE_URL);
|
||||||
|
|
||||||
// Setup the same subscription listener as on the first dapp, but without registering a new subscription
|
// Setup the same subscription listener as on the first dapp, but without registering a new subscription
|
||||||
await driver.executeScript(setupSubscriptionListener);
|
await driver.executeScript(setupSubscriptionListener);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const { convertToHexValue, withFixtures, openDapp } = require('../helpers');
|
||||||
const { SMART_CONTRACTS } = require('../seeder/smart-contracts');
|
const { SMART_CONTRACTS } = require('../seeder/smart-contracts');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
|
|
||||||
@ -34,9 +34,7 @@ describe('Failing contract interaction ', function () {
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage(
|
await openDapp(driver, contractAddress);
|
||||||
`http://127.0.0.1:8080/?contract=${contractAddress}`,
|
|
||||||
);
|
|
||||||
let windowHandles = await driver.getAllWindowHandles();
|
let windowHandles = await driver.getAllWindowHandles();
|
||||||
const extension = windowHandles[0];
|
const extension = windowHandles[0];
|
||||||
|
|
||||||
@ -114,9 +112,7 @@ describe('Failing contract interaction on non-EIP1559 network', function () {
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage(
|
await openDapp(driver, contractAddress);
|
||||||
`http://127.0.0.1:8080/?contract=${contractAddress}`,
|
|
||||||
);
|
|
||||||
let windowHandles = await driver.getAllWindowHandles();
|
let windowHandles = await driver.getAllWindowHandles();
|
||||||
const extension = windowHandles[0];
|
const extension = windowHandles[0];
|
||||||
// waits for deployed contract and calls failing contract method
|
// waits for deployed contract and calls failing contract method
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const { convertToHexValue, withFixtures, openDapp } = require('../helpers');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
|
|
||||||
describe('Incremental Security', function () {
|
describe('Incremental Security', function () {
|
||||||
@ -89,7 +89,7 @@ describe('Incremental Security', function () {
|
|||||||
const extension = windowHandles[0];
|
const extension = windowHandles[0];
|
||||||
|
|
||||||
// switched to Dapp
|
// switched to Dapp
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
|
|
||||||
// sends eth to the current account
|
// sends eth to the current account
|
||||||
await driver.fill('#address', publicAddress);
|
await driver.fill('#address', publicAddress);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const { convertToHexValue, withFixtures, openDapp } = require('../helpers');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
|
|
||||||
describe('Navigate transactions', function () {
|
describe('Navigate transactions', function () {
|
||||||
@ -130,7 +130,7 @@ describe('Navigate transactions', function () {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// add transaction
|
// add transaction
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
await driver.clickElement({ text: 'Send', tag: 'button' });
|
await driver.clickElement({ text: 'Send', tag: 'button' });
|
||||||
await driver.waitUntilXWindowHandles(3);
|
await driver.waitUntilXWindowHandles(3);
|
||||||
const windowHandles = await driver.getAllWindowHandles();
|
const windowHandles = await driver.getAllWindowHandles();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const { convertToHexValue, withFixtures, openDapp } = require('../helpers');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
|
|
||||||
describe('Permissions', function () {
|
describe('Permissions', function () {
|
||||||
@ -27,7 +27,7 @@ describe('Permissions', function () {
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
await driver.clickElement({
|
await driver.clickElement({
|
||||||
text: 'Connect',
|
text: 'Connect',
|
||||||
tag: 'button',
|
tag: 'button',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const { convertToHexValue, withFixtures, openDapp } = require('../helpers');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
|
|
||||||
describe('Personal sign', function () {
|
describe('Personal sign', function () {
|
||||||
@ -29,7 +29,7 @@ describe('Personal sign', function () {
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
await driver.clickElement('#personalSign');
|
await driver.clickElement('#personalSign');
|
||||||
|
|
||||||
await driver.waitUntilXWindowHandles(3);
|
await driver.waitUntilXWindowHandles(3);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const { convertToHexValue, withFixtures, openDapp } = require('../helpers');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
|
|
||||||
const STALELIST_URL =
|
const STALELIST_URL =
|
||||||
@ -107,7 +107,7 @@ describe('Phishing Detection', function () {
|
|||||||
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);
|
||||||
await driver.openNewPage('http://127.0.0.1:8080');
|
await openDapp(driver);
|
||||||
await driver.clickElement({
|
await driver.clickElement({
|
||||||
text: 'continue to the site.',
|
text: 'continue to the site.',
|
||||||
});
|
});
|
||||||
@ -208,7 +208,7 @@ describe('Phishing Detection', function () {
|
|||||||
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);
|
||||||
await driver.openNewPage('http://127.0.0.1:8080');
|
await openDapp(driver);
|
||||||
|
|
||||||
await driver.clickElement({ text: 'report a detection problem.' });
|
await driver.clickElement({ text: 'report a detection problem.' });
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ describe('Phishing Detection', function () {
|
|||||||
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);
|
||||||
await driver.openNewPage('http://127.0.0.1:8080');
|
await openDapp(driver);
|
||||||
|
|
||||||
await driver.clickElement({ text: 'report a detection problem.' });
|
await driver.clickElement({ text: 'report a detection problem.' });
|
||||||
|
|
||||||
@ -276,7 +276,7 @@ describe('Phishing Detection', function () {
|
|||||||
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);
|
||||||
await driver.openNewPage('http://127.0.0.1:8080');
|
await openDapp(driver);
|
||||||
|
|
||||||
await driver.clickElement({ text: 'report a detection problem.' });
|
await driver.clickElement({ text: 'report a detection problem.' });
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
const { errorCodes } = require('eth-rpc-errors');
|
const { errorCodes } = require('eth-rpc-errors');
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const { convertToHexValue, withFixtures, openDapp } = require('../helpers');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
|
|
||||||
describe('MetaMask', function () {
|
describe('MetaMask', function () {
|
||||||
@ -31,7 +31,7 @@ describe('MetaMask', function () {
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
const networkDiv = await driver.waitForSelector({
|
const networkDiv = await driver.waitForSelector({
|
||||||
css: '#network',
|
css: '#network',
|
||||||
text: '1337',
|
text: '1337',
|
||||||
@ -83,7 +83,7 @@ describe('MetaMask', function () {
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
for (const unsupportedMethod of ['eth_signTransaction']) {
|
for (const unsupportedMethod of ['eth_signTransaction']) {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
await driver.executeAsyncScript(`
|
await driver.executeAsyncScript(`
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const { convertToHexValue, withFixtures, openDapp } = require('../helpers');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
|
|
||||||
const OPENSEA_URL =
|
const OPENSEA_URL =
|
||||||
@ -94,7 +94,7 @@ describe('Transaction security provider', function () {
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
windowHandles = await driver.getAllWindowHandles();
|
windowHandles = await driver.getAllWindowHandles();
|
||||||
|
|
||||||
await driver.clickElement('#personalSign');
|
await driver.clickElement('#personalSign');
|
||||||
@ -134,7 +134,7 @@ describe('Transaction security provider', function () {
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
windowHandles = await driver.getAllWindowHandles();
|
windowHandles = await driver.getAllWindowHandles();
|
||||||
|
|
||||||
await driver.clickElement('#signTypedData');
|
await driver.clickElement('#signTypedData');
|
||||||
@ -174,7 +174,7 @@ describe('Transaction security provider', function () {
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
windowHandles = await driver.getAllWindowHandles();
|
windowHandles = await driver.getAllWindowHandles();
|
||||||
|
|
||||||
await driver.clickElement('#siwe');
|
await driver.clickElement('#siwe');
|
||||||
@ -214,7 +214,7 @@ describe('Transaction security provider', function () {
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
windowHandles = await driver.getAllWindowHandles();
|
windowHandles = await driver.getAllWindowHandles();
|
||||||
|
|
||||||
await driver.clickElement('#signTypedDataV4');
|
await driver.clickElement('#signTypedDataV4');
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
const { SMART_CONTRACTS } = require('../seeder/smart-contracts');
|
const { SMART_CONTRACTS } = require('../seeder/smart-contracts');
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const { convertToHexValue, withFixtures, openDapp } = require('../helpers');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
|
|
||||||
describe('Send ETH from inside MetaMask using default gas', function () {
|
describe('Send ETH from inside MetaMask using default gas', function () {
|
||||||
@ -232,7 +232,7 @@ describe('Send ETH from dapp using advanced gas controls', function () {
|
|||||||
await driver.press('#password', driver.Key.ENTER);
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
// initiates a send from the dapp
|
// initiates a send from the dapp
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
await driver.clickElement({ text: 'Send', tag: 'button' });
|
await driver.clickElement({ text: 'Send', tag: 'button' });
|
||||||
await driver.waitUntilXWindowHandles(3);
|
await driver.waitUntilXWindowHandles(3);
|
||||||
const windowHandles = await driver.getAllWindowHandles();
|
const windowHandles = await driver.getAllWindowHandles();
|
||||||
@ -311,7 +311,7 @@ describe('Send ETH from dapp using advanced gas controls', function () {
|
|||||||
await driver.press('#password', driver.Key.ENTER);
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
// initiates a transaction from the dapp
|
// initiates a transaction from the dapp
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
await driver.clickElement({ text: 'Create Token', tag: 'button' });
|
await driver.clickElement({ text: 'Create Token', tag: 'button' });
|
||||||
await driver.waitUntilXWindowHandles(3);
|
await driver.waitUntilXWindowHandles(3);
|
||||||
const windowHandles = await driver.getAllWindowHandles();
|
const windowHandles = await driver.getAllWindowHandles();
|
||||||
|
@ -3,6 +3,8 @@ const {
|
|||||||
convertToHexValue,
|
convertToHexValue,
|
||||||
withFixtures,
|
withFixtures,
|
||||||
regularDelayMs,
|
regularDelayMs,
|
||||||
|
openDapp,
|
||||||
|
DAPP_URL,
|
||||||
} = require('../helpers');
|
} = require('../helpers');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
|
|
||||||
@ -33,7 +35,7 @@ describe('Sign Typed Data V4 Signature Request', function () {
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
|
|
||||||
// creates a sign typed data signature request
|
// creates a sign typed data signature request
|
||||||
await driver.clickElement('#signTypedDataV4');
|
await driver.clickElement('#signTypedDataV4');
|
||||||
@ -57,7 +59,7 @@ describe('Sign Typed Data V4 Signature Request', function () {
|
|||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(await title.getText(), 'Signature request');
|
assert.equal(await title.getText(), 'Signature request');
|
||||||
assert.equal(await origin.getText(), 'http://127.0.0.1:8080');
|
assert.equal(await origin.getText(), DAPP_URL);
|
||||||
|
|
||||||
verifyContractDetailsButton.click();
|
verifyContractDetailsButton.click();
|
||||||
await driver.findElement({ text: 'Third-party details', tag: 'h5' });
|
await driver.findElement({ text: 'Third-party details', tag: 'h5' });
|
||||||
@ -114,7 +116,7 @@ describe('Sign Typed Data V3 Signature Request', function () {
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
|
|
||||||
// creates a sign typed data signature request
|
// creates a sign typed data signature request
|
||||||
await driver.clickElement('#signTypedDataV3');
|
await driver.clickElement('#signTypedDataV3');
|
||||||
@ -139,7 +141,7 @@ describe('Sign Typed Data V3 Signature Request', function () {
|
|||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(await title.getText(), 'Signature request');
|
assert.equal(await title.getText(), 'Signature request');
|
||||||
assert.equal(await origin.getText(), 'http://127.0.0.1:8080');
|
assert.equal(await origin.getText(), DAPP_URL);
|
||||||
|
|
||||||
verifyContractDetailsButton.click();
|
verifyContractDetailsButton.click();
|
||||||
await driver.findElement({ text: 'Third-party details', tag: 'h5' });
|
await driver.findElement({ text: 'Third-party details', tag: 'h5' });
|
||||||
@ -196,7 +198,7 @@ describe('Sign Typed Data Signature Request', function () {
|
|||||||
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);
|
||||||
|
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
|
|
||||||
// creates a sign typed data signature request
|
// creates a sign typed data signature request
|
||||||
await driver.clickElement('#signTypedData');
|
await driver.clickElement('#signTypedData');
|
||||||
@ -216,7 +218,7 @@ describe('Sign Typed Data Signature Request', function () {
|
|||||||
'.request-signature__row-value',
|
'.request-signature__row-value',
|
||||||
);
|
);
|
||||||
assert.equal(await title.getText(), 'Signature request');
|
assert.equal(await title.getText(), 'Signature request');
|
||||||
assert.equal(await origin.getText(), 'http://127.0.0.1:8080');
|
assert.equal(await origin.getText(), DAPP_URL);
|
||||||
assert.equal(await message[0].getText(), 'Hi, Alice!');
|
assert.equal(await message[0].getText(), 'Hi, Alice!');
|
||||||
assert.equal(await message[1].getText(), '1337');
|
assert.equal(await message[1].getText(), '1337');
|
||||||
|
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const {
|
||||||
|
convertToHexValue,
|
||||||
|
withFixtures,
|
||||||
|
openDapp,
|
||||||
|
DAPP_URL,
|
||||||
|
} = require('../helpers');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
|
|
||||||
describe('Sign in with ethereum', function () {
|
describe('Sign in with ethereum', function () {
|
||||||
@ -36,7 +41,7 @@ describe('Sign in with ethereum', function () {
|
|||||||
await driver.press('#password', driver.Key.ENTER);
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
// Create a signin with ethereum request in test dapp
|
// Create a signin with ethereum request in test dapp
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
await driver.clickElement('#siwe');
|
await driver.clickElement('#siwe');
|
||||||
|
|
||||||
// Wait for signature request popup and check the message title
|
// Wait for signature request popup and check the message title
|
||||||
@ -51,7 +56,7 @@ describe('Sign in with ethereum', function () {
|
|||||||
);
|
);
|
||||||
const origin = await driver.findElement('.site-origin');
|
const origin = await driver.findElement('.site-origin');
|
||||||
assert.equal(await title.getText(), 'Sign-in request');
|
assert.equal(await title.getText(), 'Sign-in request');
|
||||||
assert.equal(await origin.getText(), 'http://127.0.0.1:8080');
|
assert.equal(await origin.getText(), DAPP_URL);
|
||||||
|
|
||||||
const displayedMessageTitle = await driver.findElement(
|
const displayedMessageTitle = await driver.findElement(
|
||||||
'.permissions-connect-header__subtitle',
|
'.permissions-connect-header__subtitle',
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const { strict: assert } = require('assert');
|
const { strict: assert } = require('assert');
|
||||||
const FixtureBuilder = require('../fixture-builder');
|
const FixtureBuilder = require('../fixture-builder');
|
||||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
const { convertToHexValue, withFixtures, openDapp } = require('../helpers');
|
||||||
|
|
||||||
describe('Swtich ethereum chain', function () {
|
describe('Swtich ethereum chain', function () {
|
||||||
const ganacheOptions = {
|
const ganacheOptions = {
|
||||||
@ -33,7 +33,7 @@ describe('Swtich ethereum chain', function () {
|
|||||||
const windowHandles = await driver.getAllWindowHandles();
|
const windowHandles = await driver.getAllWindowHandles();
|
||||||
const extension = windowHandles[0];
|
const extension = windowHandles[0];
|
||||||
|
|
||||||
await driver.openNewPage('http://127.0.0.1:8080/');
|
await openDapp(driver);
|
||||||
|
|
||||||
await driver.clickElement({
|
await driver.clickElement({
|
||||||
tag: 'button',
|
tag: 'button',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user