From 53d328b32533d04711ea951650bbcd8e6068ed2e Mon Sep 17 00:00:00 2001 From: bowensanders Date: Thu, 9 Mar 2023 13:24:25 -0800 Subject: [PATCH 1/3] initial commit --- test/e2e/snaps/test-snap-bip-32.spec.js | 24 +++-- test/e2e/snaps/test-snap-bip-44.spec.js | 26 +++-- test/e2e/snaps/test-snap-cronjob.spec.js | 96 ------------------- test/e2e/snaps/test-snap-dialog.spec.js | 22 +++-- test/e2e/snaps/test-snap-error.spec.js | 20 ++-- test/e2e/snaps/test-snap-installed.spec.js | 40 +++++--- test/e2e/snaps/test-snap-management.spec.js | 11 ++- test/e2e/snaps/test-snap-managestate.spec.js | 23 +++-- test/e2e/snaps/test-snap-notification.spec.js | 22 +++-- test/e2e/snaps/test-snap-rpc.spec.js | 15 ++- test/e2e/snaps/test-snap-txinsights.spec.js | 11 ++- test/e2e/snaps/test-snap-update.spec.js | 21 ++-- 12 files changed, 150 insertions(+), 181 deletions(-) delete mode 100644 test/e2e/snaps/test-snap-cronjob.spec.js diff --git a/test/e2e/snaps/test-snap-bip-32.spec.js b/test/e2e/snaps/test-snap-bip-32.spec.js index 2b05c8c4a7f6..5bb5afb07d55 100644 --- a/test/e2e/snaps/test-snap-bip-32.spec.js +++ b/test/e2e/snaps/test-snap-bip-32.spec.js @@ -48,10 +48,13 @@ describe('Test Snap bip-32', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement({ - text: 'Connect', - tag: 'button', - }); + await driver.clickElement( + { + text: 'Connect', + tag: 'button', + }, + 10000, + ); await driver.delay(2000); @@ -77,13 +80,16 @@ describe('Test Snap bip-32', function () { tag: 'button', }); - // delay for npm installation - await driver.delay(2000); - // switch back to test-snaps window windowHandles = await driver.waitUntilXWindowHandles(1, 1000, 10000); await driver.switchToWindowWithTitle('Test Snaps', windowHandles); + // wait for npm installation success + await driver.waitForSelector({ + css: '#connectBip32', + text: 'Reconnect to BIP-32 Snap', + }); + // scroll to and click get public key await driver.delay(1000); const snapButton2 = await driver.findElement('#bip32GetPublic'); @@ -122,7 +128,7 @@ describe('Test Snap bip-32', function () { // wait then run SECP256K1 test await driver.delay(1000); - await driver.fill('#bip32Message-secp256k1', 'foo bar'); + await driver.pasteIntoField('#bip32Message-secp256k1', 'foo bar'); await driver.clickElement('#sendBip32-secp256k1'); // hit 'approve' on the custom confirm @@ -157,7 +163,7 @@ describe('Test Snap bip-32', function () { // wait then run ed25519 test await driver.delay(1000); - await driver.fill('#bip32Message-ed25519', 'foo bar'); + await driver.pasteIntoField('#bip32Message-ed25519', 'foo bar'); await driver.clickElement('#sendBip32-ed25519'); // hit 'approve' on the custom confirm diff --git a/test/e2e/snaps/test-snap-bip-44.spec.js b/test/e2e/snaps/test-snap-bip-44.spec.js index 54cd9b142541..092f614fb7d0 100644 --- a/test/e2e/snaps/test-snap-bip-44.spec.js +++ b/test/e2e/snaps/test-snap-bip-44.spec.js @@ -47,10 +47,13 @@ describe('Test Snap bip-44', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement({ - text: 'Connect', - tag: 'button', - }); + await driver.clickElement( + { + text: 'Connect', + tag: 'button', + }, + 10000, + ); await driver.delay(2000); @@ -70,19 +73,22 @@ describe('Test Snap bip-44', function () { // deal with permissions popover await driver.delay(1000); await driver.clickElement('#key-access-bip44-1-0'); - await driver.delay(1000); + await driver.delay(1500); await driver.clickElement({ text: 'Confirm', tag: 'button', }); - // delay for npm installation - await driver.delay(2000); - // click send inputs on test snap page windowHandles = await driver.waitUntilXWindowHandles(1, 1000, 10000); await driver.switchToWindowWithTitle('Test Snaps', windowHandles); - await driver.delay(1000); + + // wait for npm installation success + await driver.waitForSelector({ + css: '#connectBip44Snap', + text: 'Reconnect to BIP-44 Snap', + }); + await driver.clickElement('#sendBip44Test'); // check the results of the public key test @@ -94,7 +100,7 @@ describe('Test Snap bip-44', function () { ); // enter a message to sign - await driver.fill('#bip44Message', '1234'); + await driver.pasteIntoField('#bip44Message', '1234'); await driver.delay(1000); const snapButton3 = await driver.findElement('#signBip44Message'); await driver.scrollToElement(snapButton3); diff --git a/test/e2e/snaps/test-snap-cronjob.spec.js b/test/e2e/snaps/test-snap-cronjob.spec.js deleted file mode 100644 index 5818c1d379ee..000000000000 --- a/test/e2e/snaps/test-snap-cronjob.spec.js +++ /dev/null @@ -1,96 +0,0 @@ -const { strict: assert } = require('assert'); -const { withFixtures } = require('../helpers'); -const FixtureBuilder = require('../fixture-builder'); -const { TEST_SNAPS_WEBSITE_URL } = require('./enums'); - -describe('Test Snap Cronjob', function () { - it('can trigger a cronjob to open a dialog every minute', async function () { - const ganacheOptions = { - accounts: [ - { - secretKey: - '0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC', - balance: 25000000000000000000, - }, - ], - }; - await withFixtures( - { - fixtures: new FixtureBuilder().build(), - ganacheOptions, - failOnConsoleError: false, - title: this.test.title, - }, - async ({ driver }) => { - await driver.navigate(); - - // enter pw into extension - await driver.fill('#password', 'correct horse battery staple'); - await driver.press('#password', driver.Key.ENTER); - - // navigate to test snaps page and connect - await driver.openNewPage(TEST_SNAPS_WEBSITE_URL); - await driver.delay(1000); - const snapButton = await driver.findElement('#connectCronjobSnap'); - await driver.scrollToElement(snapButton); - await driver.delay(1000); - await driver.clickElement('#connectCronjobSnap'); - await driver.delay(1000); - - // switch to metamask extension and click connect - let windowHandles = await driver.waitUntilXWindowHandles( - 3, - 1000, - 10000, - ); - await driver.switchToWindowWithTitle( - 'MetaMask Notification', - windowHandles, - ); - await driver.clickElement({ - text: 'Connect', - tag: 'button', - }); - - await driver.delay(2000); - - // approve install of snap - windowHandles = await driver.waitUntilXWindowHandles(3, 1000, 10000); - await driver.switchToWindowWithTitle( - 'MetaMask Notification', - windowHandles, - ); - await driver.clickElement({ - text: 'Approve & install', - tag: 'button', - }); - - // delay for npm installation - await driver.delay(2000); - - // click send inputs on test snap page - windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000); - await driver.switchToWindowWithTitle('Test Snaps', windowHandles); - - // switch to dialog popup, wait for a maximum of 65 seconds - windowHandles = await driver.waitUntilXWindowHandles(3, 1000, 65000); - await driver.switchToWindowWithTitle( - 'MetaMask Notification', - windowHandles, - ); - await driver.delay(1000); - - // look for the dialog popup to verify cronjob fired - const error = await driver.findElement('.snap-delineator__content'); - const text = await error.getText(); - assert.equal(text.includes(`Cronjob\nfired`), true); - - // try to click on the Ok button and pass test if it works - await driver.clickElement({ - text: 'Ok', - tag: 'button', - }); - }, - ); - }); -}); diff --git a/test/e2e/snaps/test-snap-dialog.spec.js b/test/e2e/snaps/test-snap-dialog.spec.js index f910a6b3b667..03bb45c9386d 100644 --- a/test/e2e/snaps/test-snap-dialog.spec.js +++ b/test/e2e/snaps/test-snap-dialog.spec.js @@ -47,10 +47,13 @@ describe('Test Snap Dialog', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement({ - text: 'Connect', - tag: 'button', - }); + await driver.clickElement( + { + text: 'Connect', + tag: 'button', + }, + 10000, + ); await driver.delay(2000); @@ -65,13 +68,16 @@ describe('Test Snap Dialog', function () { tag: 'button', }); - // delay for npm installation - await driver.delay(2000); - // switch to test snaps tab windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000); await driver.switchToWindowWithTitle('Test Snaps', windowHandles); + // wait for npm installation success + await driver.waitForSelector({ + css: '#connectDialogSnap', + text: 'Reconnect to Dialog Snap', + }); + // click on alert dialog await driver.clickElement('#sendAlertButton'); await driver.delay(1000); @@ -199,7 +205,7 @@ describe('Test Snap Dialog', function () { await driver.delay(1000); // fill '2323' in form field - await driver.fill('.MuiInput-input', '2323'); + await driver.pasteIntoField('.MuiInput-input', '2323'); // click submit button await driver.clickElement({ diff --git a/test/e2e/snaps/test-snap-error.spec.js b/test/e2e/snaps/test-snap-error.spec.js index 2efb31d89eb9..400734bac732 100644 --- a/test/e2e/snaps/test-snap-error.spec.js +++ b/test/e2e/snaps/test-snap-error.spec.js @@ -48,10 +48,13 @@ describe('Test Snap Error', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement({ - text: 'Connect', - tag: 'button', - }); + await driver.clickElement( + { + text: 'Connect', + tag: 'button', + }, + 10000, + ); await driver.delay(2000); @@ -66,14 +69,17 @@ describe('Test Snap Error', function () { tag: 'button', }); - // delay for npm installation - await driver.delay(2000); - // click send inputs on test snap page windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000); await driver.switchToWindowWithTitle('Test Snaps', windowHandles); await driver.delay(1000); + // wait for npm installation success + await driver.waitForSelector({ + css: '#connectErrorSnap', + text: 'Reconnect to Error Snap', + }); + // find and click on send error await driver.clickElement('#sendError'); diff --git a/test/e2e/snaps/test-snap-installed.spec.js b/test/e2e/snaps/test-snap-installed.spec.js index 08cabb6ecc93..4846b521f021 100644 --- a/test/e2e/snaps/test-snap-installed.spec.js +++ b/test/e2e/snaps/test-snap-installed.spec.js @@ -47,10 +47,13 @@ describe('Test Snap Installed', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement({ - text: 'Connect', - tag: 'button', - }); + await driver.clickElement( + { + text: 'Connect', + tag: 'button', + }, + 10000, + ); await driver.delay(2000); @@ -65,13 +68,16 @@ describe('Test Snap Installed', function () { tag: 'button', }); - // delay for npm installation - await driver.delay(2000); - // click send inputs on test snap page windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000); await driver.switchToWindowWithTitle('Test Snaps', windowHandles); + // wait for npm installation success + await driver.waitForSelector({ + css: '#connectDialogSnap', + text: 'Reconnect to Dialog Snap', + }); + const errorButton = await driver.findElement('#connectErrorSnap'); await driver.scrollToElement(errorButton); await driver.delay(1000); @@ -83,10 +89,13 @@ describe('Test Snap Installed', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement({ - text: 'Connect', - tag: 'button', - }); + await driver.clickElement( + { + text: 'Connect', + tag: 'button', + }, + 10000, + ); await driver.delay(2000); @@ -101,12 +110,15 @@ describe('Test Snap Installed', function () { tag: 'button', }); - // delay for npm installation - await driver.delay(2000); - windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000); await driver.switchToWindowWithTitle('Test Snaps', windowHandles); + // wait for npm installation success + await driver.waitForSelector({ + css: '#connectErrorSnap', + text: 'Reconnect to Error Snap', + }); + const result = await driver.findElement('#installedSnapsResult'); await driver.scrollToElement(result); await driver.delay(1000); diff --git a/test/e2e/snaps/test-snap-management.spec.js b/test/e2e/snaps/test-snap-management.spec.js index f66068b531d2..049cbd22f93a 100644 --- a/test/e2e/snaps/test-snap-management.spec.js +++ b/test/e2e/snaps/test-snap-management.spec.js @@ -49,10 +49,13 @@ describe('Test Snap Management', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement({ - text: 'Connect', - tag: 'button', - }); + await driver.clickElement( + { + text: 'Connect', + tag: 'button', + }, + 10000, + ); await driver.delay(1000); diff --git a/test/e2e/snaps/test-snap-managestate.spec.js b/test/e2e/snaps/test-snap-managestate.spec.js index 28892419d34c..510a821b8b72 100644 --- a/test/e2e/snaps/test-snap-managestate.spec.js +++ b/test/e2e/snaps/test-snap-managestate.spec.js @@ -50,10 +50,13 @@ describe('Test Snap manageState', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement({ - text: 'Connect', - tag: 'button', - }); + await driver.clickElement( + { + text: 'Connect', + tag: 'button', + }, + 10000, + ); await driver.delay(2000); // approve install of snap @@ -67,14 +70,18 @@ describe('Test Snap manageState', function () { tag: 'button', }); - // delay for npm installation - await driver.delay(2000); - // fill and click send inputs on test snap page windowHandles = await driver.waitUntilXWindowHandles(1, 1000, 10000); await driver.switchToWindowWithTitle('Test Snaps', windowHandles); + + // wait for npm installation success + await driver.waitForSelector({ + css: '#connectManageState', + text: 'Reconnect to Manage State Snap', + }); + await driver.delay(1000); - await driver.fill('#dataManageState', '23'); + await driver.pasteIntoField('#dataManageState', '23'); const snapButton2 = await driver.findElement( '#retrieveManageStateResult', ); diff --git a/test/e2e/snaps/test-snap-notification.spec.js b/test/e2e/snaps/test-snap-notification.spec.js index 81a4a130786b..5cd6f49a2c4b 100644 --- a/test/e2e/snaps/test-snap-notification.spec.js +++ b/test/e2e/snaps/test-snap-notification.spec.js @@ -50,10 +50,13 @@ describe('Test Snap Notification', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement({ - text: 'Connect', - tag: 'button', - }); + await driver.clickElement( + { + text: 'Connect', + tag: 'button', + }, + 10000, + ); await driver.delay(2000); // approve install of snap @@ -67,13 +70,16 @@ describe('Test Snap Notification', function () { tag: 'button', }); - // delay for npm installation - await driver.delay(2000); - // click send inputs on test snap page windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000); await driver.switchToWindowWithTitle('Test Snaps', windowHandles); - await driver.delay(1000); + + // wait for npm installation success + await driver.waitForSelector({ + css: '#connectNotification', + text: 'Reconnect to Notification Snap', + }); + await driver.clickElement('#sendInAppNotification'); // switch back to the extension page diff --git a/test/e2e/snaps/test-snap-rpc.spec.js b/test/e2e/snaps/test-snap-rpc.spec.js index 19715ec36058..166d0b265b52 100644 --- a/test/e2e/snaps/test-snap-rpc.spec.js +++ b/test/e2e/snaps/test-snap-rpc.spec.js @@ -4,7 +4,9 @@ const FixtureBuilder = require('../fixture-builder'); const { TEST_SNAPS_WEBSITE_URL } = require('./enums'); describe('Test Snap RPC', function () { - it('can use the cross-snap RPC endowment and produce a public key', async function () { + // TODO: Re-enable this test once `test-snaps` is fixed. + // eslint-disable-next-line mocha/no-skipped-tests + it.skip('can use the cross-snap RPC endowment and produce a public key', async function () { const ganacheOptions = { accounts: [ { @@ -47,10 +49,13 @@ describe('Test Snap RPC', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement({ - text: 'Connect', - tag: 'button', - }); + await driver.clickElement( + { + text: 'Connect', + tag: 'button', + }, + 10000, + ); await driver.delay(2000); diff --git a/test/e2e/snaps/test-snap-txinsights.spec.js b/test/e2e/snaps/test-snap-txinsights.spec.js index 4003501a638d..d81daa8f28c1 100644 --- a/test/e2e/snaps/test-snap-txinsights.spec.js +++ b/test/e2e/snaps/test-snap-txinsights.spec.js @@ -48,10 +48,13 @@ describe('Test Snap TxInsights', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement({ - text: 'Connect', - tag: 'button', - }); + await driver.clickElement( + { + text: 'Connect', + tag: 'button', + }, + 10000, + ); // delay for npm installation await driver.delay(2000); diff --git a/test/e2e/snaps/test-snap-update.spec.js b/test/e2e/snaps/test-snap-update.spec.js index 1120f20b8822..937b1857ae12 100644 --- a/test/e2e/snaps/test-snap-update.spec.js +++ b/test/e2e/snaps/test-snap-update.spec.js @@ -49,10 +49,13 @@ describe('Test Snap update', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement({ - text: 'Connect', - tag: 'button', - }); + await driver.clickElement( + { + text: 'Connect', + tag: 'button', + }, + 10000, + ); await driver.delay(2000); // approve install of snap @@ -75,13 +78,15 @@ describe('Test Snap update', function () { tag: 'button', }); - // delay for npm installation - await driver.delay(2000); - // navigate to test snap page windowHandles = await driver.waitUntilXWindowHandles(1, 1000, 10000); await driver.switchToWindowWithTitle('Test Snaps', windowHandles); - await driver.delay(1000); + + // wait for npm installation success + await driver.waitForSelector({ + css: '#connectUpdate', + text: 'Reconnect to Update Snap', + }); // find and scroll to the correct card and click first const snapButton2 = await driver.findElement('#connectUpdateNew'); From b0d600d2509dbc1104db43d336eb61fec92d29da Mon Sep 17 00:00:00 2001 From: bowensanders Date: Fri, 10 Mar 2023 10:42:06 -0800 Subject: [PATCH 2/3] requested changes 1 --- test/e2e/snaps/test-snap-bip-32.spec.js | 11 +-- test/e2e/snaps/test-snap-bip-44.spec.js | 11 +-- test/e2e/snaps/test-snap-cronjob.spec.js | 96 +++++++++++++++++++ test/e2e/snaps/test-snap-dialog.spec.js | 11 +-- test/e2e/snaps/test-snap-error.spec.js | 11 +-- test/e2e/snaps/test-snap-installed.spec.js | 22 ++--- test/e2e/snaps/test-snap-management.spec.js | 11 +-- test/e2e/snaps/test-snap-managestate.spec.js | 11 +-- test/e2e/snaps/test-snap-notification.spec.js | 11 +-- test/e2e/snaps/test-snap-rpc.spec.js | 13 +-- test/e2e/snaps/test-snap-txinsights.spec.js | 11 +-- test/e2e/snaps/test-snap-update.spec.js | 11 +-- 12 files changed, 145 insertions(+), 85 deletions(-) create mode 100644 test/e2e/snaps/test-snap-cronjob.spec.js diff --git a/test/e2e/snaps/test-snap-bip-32.spec.js b/test/e2e/snaps/test-snap-bip-32.spec.js index 5bb5afb07d55..b0f9649c1165 100644 --- a/test/e2e/snaps/test-snap-bip-32.spec.js +++ b/test/e2e/snaps/test-snap-bip-32.spec.js @@ -48,13 +48,10 @@ describe('Test Snap bip-32', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement( - { - text: 'Connect', - tag: 'button', - }, - 10000, - ); + await driver.clickElement({ + text: 'Connect', + tag: 'button', + }); await driver.delay(2000); diff --git a/test/e2e/snaps/test-snap-bip-44.spec.js b/test/e2e/snaps/test-snap-bip-44.spec.js index 092f614fb7d0..5cee4f687444 100644 --- a/test/e2e/snaps/test-snap-bip-44.spec.js +++ b/test/e2e/snaps/test-snap-bip-44.spec.js @@ -47,13 +47,10 @@ describe('Test Snap bip-44', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement( - { - text: 'Connect', - tag: 'button', - }, - 10000, - ); + await driver.clickElement({ + text: 'Connect', + tag: 'button', + }); await driver.delay(2000); diff --git a/test/e2e/snaps/test-snap-cronjob.spec.js b/test/e2e/snaps/test-snap-cronjob.spec.js new file mode 100644 index 000000000000..5818c1d379ee --- /dev/null +++ b/test/e2e/snaps/test-snap-cronjob.spec.js @@ -0,0 +1,96 @@ +const { strict: assert } = require('assert'); +const { withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); +const { TEST_SNAPS_WEBSITE_URL } = require('./enums'); + +describe('Test Snap Cronjob', function () { + it('can trigger a cronjob to open a dialog every minute', async function () { + const ganacheOptions = { + accounts: [ + { + secretKey: + '0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC', + balance: 25000000000000000000, + }, + ], + }; + await withFixtures( + { + fixtures: new FixtureBuilder().build(), + ganacheOptions, + failOnConsoleError: false, + title: this.test.title, + }, + async ({ driver }) => { + await driver.navigate(); + + // enter pw into extension + await driver.fill('#password', 'correct horse battery staple'); + await driver.press('#password', driver.Key.ENTER); + + // navigate to test snaps page and connect + await driver.openNewPage(TEST_SNAPS_WEBSITE_URL); + await driver.delay(1000); + const snapButton = await driver.findElement('#connectCronjobSnap'); + await driver.scrollToElement(snapButton); + await driver.delay(1000); + await driver.clickElement('#connectCronjobSnap'); + await driver.delay(1000); + + // switch to metamask extension and click connect + let windowHandles = await driver.waitUntilXWindowHandles( + 3, + 1000, + 10000, + ); + await driver.switchToWindowWithTitle( + 'MetaMask Notification', + windowHandles, + ); + await driver.clickElement({ + text: 'Connect', + tag: 'button', + }); + + await driver.delay(2000); + + // approve install of snap + windowHandles = await driver.waitUntilXWindowHandles(3, 1000, 10000); + await driver.switchToWindowWithTitle( + 'MetaMask Notification', + windowHandles, + ); + await driver.clickElement({ + text: 'Approve & install', + tag: 'button', + }); + + // delay for npm installation + await driver.delay(2000); + + // click send inputs on test snap page + windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000); + await driver.switchToWindowWithTitle('Test Snaps', windowHandles); + + // switch to dialog popup, wait for a maximum of 65 seconds + windowHandles = await driver.waitUntilXWindowHandles(3, 1000, 65000); + await driver.switchToWindowWithTitle( + 'MetaMask Notification', + windowHandles, + ); + await driver.delay(1000); + + // look for the dialog popup to verify cronjob fired + const error = await driver.findElement('.snap-delineator__content'); + const text = await error.getText(); + assert.equal(text.includes(`Cronjob\nfired`), true); + + // try to click on the Ok button and pass test if it works + await driver.clickElement({ + text: 'Ok', + tag: 'button', + }); + }, + ); + }); +}); diff --git a/test/e2e/snaps/test-snap-dialog.spec.js b/test/e2e/snaps/test-snap-dialog.spec.js index 03bb45c9386d..64f62864ce3a 100644 --- a/test/e2e/snaps/test-snap-dialog.spec.js +++ b/test/e2e/snaps/test-snap-dialog.spec.js @@ -47,13 +47,10 @@ describe('Test Snap Dialog', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement( - { - text: 'Connect', - tag: 'button', - }, - 10000, - ); + await driver.clickElement({ + text: 'Connect', + tag: 'button', + }); await driver.delay(2000); diff --git a/test/e2e/snaps/test-snap-error.spec.js b/test/e2e/snaps/test-snap-error.spec.js index 400734bac732..850e15c3c2b3 100644 --- a/test/e2e/snaps/test-snap-error.spec.js +++ b/test/e2e/snaps/test-snap-error.spec.js @@ -48,13 +48,10 @@ describe('Test Snap Error', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement( - { - text: 'Connect', - tag: 'button', - }, - 10000, - ); + await driver.clickElement({ + text: 'Connect', + tag: 'button', + }); await driver.delay(2000); diff --git a/test/e2e/snaps/test-snap-installed.spec.js b/test/e2e/snaps/test-snap-installed.spec.js index 4846b521f021..cdf53ab0303b 100644 --- a/test/e2e/snaps/test-snap-installed.spec.js +++ b/test/e2e/snaps/test-snap-installed.spec.js @@ -47,13 +47,10 @@ describe('Test Snap Installed', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement( - { - text: 'Connect', - tag: 'button', - }, - 10000, - ); + await driver.clickElement({ + text: 'Connect', + tag: 'button', + }); await driver.delay(2000); @@ -89,13 +86,10 @@ describe('Test Snap Installed', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement( - { - text: 'Connect', - tag: 'button', - }, - 10000, - ); + await driver.clickElement({ + text: 'Connect', + tag: 'button', + }); await driver.delay(2000); diff --git a/test/e2e/snaps/test-snap-management.spec.js b/test/e2e/snaps/test-snap-management.spec.js index 049cbd22f93a..f66068b531d2 100644 --- a/test/e2e/snaps/test-snap-management.spec.js +++ b/test/e2e/snaps/test-snap-management.spec.js @@ -49,13 +49,10 @@ describe('Test Snap Management', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement( - { - text: 'Connect', - tag: 'button', - }, - 10000, - ); + await driver.clickElement({ + text: 'Connect', + tag: 'button', + }); await driver.delay(1000); diff --git a/test/e2e/snaps/test-snap-managestate.spec.js b/test/e2e/snaps/test-snap-managestate.spec.js index 510a821b8b72..b2a4e8fda05d 100644 --- a/test/e2e/snaps/test-snap-managestate.spec.js +++ b/test/e2e/snaps/test-snap-managestate.spec.js @@ -50,13 +50,10 @@ describe('Test Snap manageState', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement( - { - text: 'Connect', - tag: 'button', - }, - 10000, - ); + await driver.clickElement({ + text: 'Connect', + tag: 'button', + }); await driver.delay(2000); // approve install of snap diff --git a/test/e2e/snaps/test-snap-notification.spec.js b/test/e2e/snaps/test-snap-notification.spec.js index 5cd6f49a2c4b..e900fae1883b 100644 --- a/test/e2e/snaps/test-snap-notification.spec.js +++ b/test/e2e/snaps/test-snap-notification.spec.js @@ -50,13 +50,10 @@ describe('Test Snap Notification', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement( - { - text: 'Connect', - tag: 'button', - }, - 10000, - ); + await driver.clickElement({ + text: 'Connect', + tag: 'button', + }); await driver.delay(2000); // approve install of snap diff --git a/test/e2e/snaps/test-snap-rpc.spec.js b/test/e2e/snaps/test-snap-rpc.spec.js index 166d0b265b52..99fb69b86494 100644 --- a/test/e2e/snaps/test-snap-rpc.spec.js +++ b/test/e2e/snaps/test-snap-rpc.spec.js @@ -6,7 +6,7 @@ const { TEST_SNAPS_WEBSITE_URL } = require('./enums'); describe('Test Snap RPC', function () { // TODO: Re-enable this test once `test-snaps` is fixed. // eslint-disable-next-line mocha/no-skipped-tests - it.skip('can use the cross-snap RPC endowment and produce a public key', async function () { + it('can use the cross-snap RPC endowment and produce a public key', async function () { const ganacheOptions = { accounts: [ { @@ -49,13 +49,10 @@ describe('Test Snap RPC', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement( - { - text: 'Connect', - tag: 'button', - }, - 10000, - ); + await driver.clickElement({ + text: 'Connect', + tag: 'button', + }); await driver.delay(2000); diff --git a/test/e2e/snaps/test-snap-txinsights.spec.js b/test/e2e/snaps/test-snap-txinsights.spec.js index d81daa8f28c1..4003501a638d 100644 --- a/test/e2e/snaps/test-snap-txinsights.spec.js +++ b/test/e2e/snaps/test-snap-txinsights.spec.js @@ -48,13 +48,10 @@ describe('Test Snap TxInsights', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement( - { - text: 'Connect', - tag: 'button', - }, - 10000, - ); + await driver.clickElement({ + text: 'Connect', + tag: 'button', + }); // delay for npm installation await driver.delay(2000); diff --git a/test/e2e/snaps/test-snap-update.spec.js b/test/e2e/snaps/test-snap-update.spec.js index 937b1857ae12..163aceb25593 100644 --- a/test/e2e/snaps/test-snap-update.spec.js +++ b/test/e2e/snaps/test-snap-update.spec.js @@ -49,13 +49,10 @@ describe('Test Snap update', function () { 'MetaMask Notification', windowHandles, ); - await driver.clickElement( - { - text: 'Connect', - tag: 'button', - }, - 10000, - ); + await driver.clickElement({ + text: 'Connect', + tag: 'button', + }); await driver.delay(2000); // approve install of snap From 2eb81e3df69a7ff823b67e412c67514610a09f16 Mon Sep 17 00:00:00 2001 From: bowensanders Date: Mon, 13 Mar 2023 10:53:18 -0700 Subject: [PATCH 3/3] requested changes part 2 --- test/e2e/snaps/test-snap-bip-32.spec.js | 1 - test/e2e/snaps/test-snap-bip-44.spec.js | 1 - test/e2e/snaps/test-snap-cronjob.spec.js | 10 ++++++---- test/e2e/snaps/test-snap-dialog.spec.js | 1 - test/e2e/snaps/test-snap-error.spec.js | 2 -- test/e2e/snaps/test-snap-installed.spec.js | 1 - test/e2e/snaps/test-snap-managestate.spec.js | 1 - test/e2e/snaps/test-snap-notification.spec.js | 1 - test/e2e/snaps/test-snap-rpc.spec.js | 3 --- test/e2e/snaps/test-snap-update.spec.js | 1 - 10 files changed, 6 insertions(+), 16 deletions(-) diff --git a/test/e2e/snaps/test-snap-bip-32.spec.js b/test/e2e/snaps/test-snap-bip-32.spec.js index b0f9649c1165..e69cdce346f8 100644 --- a/test/e2e/snaps/test-snap-bip-32.spec.js +++ b/test/e2e/snaps/test-snap-bip-32.spec.js @@ -78,7 +78,6 @@ describe('Test Snap bip-32', function () { }); // switch back to test-snaps window - windowHandles = await driver.waitUntilXWindowHandles(1, 1000, 10000); await driver.switchToWindowWithTitle('Test Snaps', windowHandles); // wait for npm installation success diff --git a/test/e2e/snaps/test-snap-bip-44.spec.js b/test/e2e/snaps/test-snap-bip-44.spec.js index 5cee4f687444..ad12ac0acc90 100644 --- a/test/e2e/snaps/test-snap-bip-44.spec.js +++ b/test/e2e/snaps/test-snap-bip-44.spec.js @@ -77,7 +77,6 @@ describe('Test Snap bip-44', function () { }); // click send inputs on test snap page - windowHandles = await driver.waitUntilXWindowHandles(1, 1000, 10000); await driver.switchToWindowWithTitle('Test Snaps', windowHandles); // wait for npm installation success diff --git a/test/e2e/snaps/test-snap-cronjob.spec.js b/test/e2e/snaps/test-snap-cronjob.spec.js index 5818c1d379ee..d94d692baa27 100644 --- a/test/e2e/snaps/test-snap-cronjob.spec.js +++ b/test/e2e/snaps/test-snap-cronjob.spec.js @@ -65,13 +65,15 @@ describe('Test Snap Cronjob', function () { tag: 'button', }); - // delay for npm installation - await driver.delay(2000); - // click send inputs on test snap page - windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000); await driver.switchToWindowWithTitle('Test Snaps', windowHandles); + // wait for npm installation success + await driver.waitForSelector({ + css: '#connectCronjobSnap', + text: 'Reconnect to Cronjob Snap', + }); + // switch to dialog popup, wait for a maximum of 65 seconds windowHandles = await driver.waitUntilXWindowHandles(3, 1000, 65000); await driver.switchToWindowWithTitle( diff --git a/test/e2e/snaps/test-snap-dialog.spec.js b/test/e2e/snaps/test-snap-dialog.spec.js index 64f62864ce3a..4ca53ae223d0 100644 --- a/test/e2e/snaps/test-snap-dialog.spec.js +++ b/test/e2e/snaps/test-snap-dialog.spec.js @@ -66,7 +66,6 @@ describe('Test Snap Dialog', function () { }); // switch to test snaps tab - windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000); await driver.switchToWindowWithTitle('Test Snaps', windowHandles); // wait for npm installation success diff --git a/test/e2e/snaps/test-snap-error.spec.js b/test/e2e/snaps/test-snap-error.spec.js index 850e15c3c2b3..2e72a9b92efa 100644 --- a/test/e2e/snaps/test-snap-error.spec.js +++ b/test/e2e/snaps/test-snap-error.spec.js @@ -67,9 +67,7 @@ describe('Test Snap Error', function () { }); // click send inputs on test snap page - windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000); await driver.switchToWindowWithTitle('Test Snaps', windowHandles); - await driver.delay(1000); // wait for npm installation success await driver.waitForSelector({ diff --git a/test/e2e/snaps/test-snap-installed.spec.js b/test/e2e/snaps/test-snap-installed.spec.js index cdf53ab0303b..2645c9b00415 100644 --- a/test/e2e/snaps/test-snap-installed.spec.js +++ b/test/e2e/snaps/test-snap-installed.spec.js @@ -66,7 +66,6 @@ describe('Test Snap Installed', function () { }); // click send inputs on test snap page - windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000); await driver.switchToWindowWithTitle('Test Snaps', windowHandles); // wait for npm installation success diff --git a/test/e2e/snaps/test-snap-managestate.spec.js b/test/e2e/snaps/test-snap-managestate.spec.js index b2a4e8fda05d..bbf2d5bcf323 100644 --- a/test/e2e/snaps/test-snap-managestate.spec.js +++ b/test/e2e/snaps/test-snap-managestate.spec.js @@ -68,7 +68,6 @@ describe('Test Snap manageState', function () { }); // fill and click send inputs on test snap page - windowHandles = await driver.waitUntilXWindowHandles(1, 1000, 10000); await driver.switchToWindowWithTitle('Test Snaps', windowHandles); // wait for npm installation success diff --git a/test/e2e/snaps/test-snap-notification.spec.js b/test/e2e/snaps/test-snap-notification.spec.js index e900fae1883b..bf4ad409a63f 100644 --- a/test/e2e/snaps/test-snap-notification.spec.js +++ b/test/e2e/snaps/test-snap-notification.spec.js @@ -68,7 +68,6 @@ describe('Test Snap Notification', function () { }); // click send inputs on test snap page - windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000); await driver.switchToWindowWithTitle('Test Snaps', windowHandles); // wait for npm installation success diff --git a/test/e2e/snaps/test-snap-rpc.spec.js b/test/e2e/snaps/test-snap-rpc.spec.js index 99fb69b86494..3f1716c5be20 100644 --- a/test/e2e/snaps/test-snap-rpc.spec.js +++ b/test/e2e/snaps/test-snap-rpc.spec.js @@ -4,8 +4,6 @@ const FixtureBuilder = require('../fixture-builder'); const { TEST_SNAPS_WEBSITE_URL } = require('./enums'); describe('Test Snap RPC', function () { - // TODO: Re-enable this test once `test-snaps` is fixed. - // eslint-disable-next-line mocha/no-skipped-tests it('can use the cross-snap RPC endowment and produce a public key', async function () { const ganacheOptions = { accounts: [ @@ -68,7 +66,6 @@ describe('Test Snap RPC', function () { }); // switch back to test snaps page - windowHandles = await driver.waitUntilXWindowHandles(1, 1000, 10000); await driver.switchToWindowWithTitle('Test Snaps', windowHandles); // wait for npm installation success diff --git a/test/e2e/snaps/test-snap-update.spec.js b/test/e2e/snaps/test-snap-update.spec.js index 163aceb25593..472b5a1def39 100644 --- a/test/e2e/snaps/test-snap-update.spec.js +++ b/test/e2e/snaps/test-snap-update.spec.js @@ -76,7 +76,6 @@ describe('Test Snap update', function () { }); // navigate to test snap page - windowHandles = await driver.waitUntilXWindowHandles(1, 1000, 10000); await driver.switchToWindowWithTitle('Test Snaps', windowHandles); // wait for npm installation success