diff --git a/test/e2e/snaps/test-snap-bip-32.spec.js b/test/e2e/snaps/test-snap-bip-32.spec.js index 2b05c8c4a7f6..e69cdce346f8 100644 --- a/test/e2e/snaps/test-snap-bip-32.spec.js +++ b/test/e2e/snaps/test-snap-bip-32.spec.js @@ -77,13 +77,15 @@ 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 +124,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 +159,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..ad12ac0acc90 100644 --- a/test/e2e/snaps/test-snap-bip-44.spec.js +++ b/test/e2e/snaps/test-snap-bip-44.spec.js @@ -70,19 +70,21 @@ 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 +96,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 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 f910a6b3b667..4ca53ae223d0 100644 --- a/test/e2e/snaps/test-snap-dialog.spec.js +++ b/test/e2e/snaps/test-snap-dialog.spec.js @@ -65,13 +65,15 @@ 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 +201,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..2e72a9b92efa 100644 --- a/test/e2e/snaps/test-snap-error.spec.js +++ b/test/e2e/snaps/test-snap-error.spec.js @@ -66,13 +66,14 @@ 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..2645c9b00415 100644 --- a/test/e2e/snaps/test-snap-installed.spec.js +++ b/test/e2e/snaps/test-snap-installed.spec.js @@ -65,13 +65,15 @@ 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); @@ -101,12 +103,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-managestate.spec.js b/test/e2e/snaps/test-snap-managestate.spec.js index 28892419d34c..bbf2d5bcf323 100644 --- a/test/e2e/snaps/test-snap-managestate.spec.js +++ b/test/e2e/snaps/test-snap-managestate.spec.js @@ -67,14 +67,17 @@ 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..bf4ad409a63f 100644 --- a/test/e2e/snaps/test-snap-notification.spec.js +++ b/test/e2e/snaps/test-snap-notification.spec.js @@ -67,13 +67,15 @@ 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..3f1716c5be20 100644 --- a/test/e2e/snaps/test-snap-rpc.spec.js +++ b/test/e2e/snaps/test-snap-rpc.spec.js @@ -66,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 1120f20b8822..472b5a1def39 100644 --- a/test/e2e/snaps/test-snap-update.spec.js +++ b/test/e2e/snaps/test-snap-update.spec.js @@ -75,13 +75,14 @@ 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');