1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +01:00

[FLASK] Snaps e2e test stability improvements (#18090)

* waitForSelector and pasteIntoField used now
This commit is contained in:
Bowen Sanders 2023-03-15 10:03:01 -07:00 committed by GitHub
parent bd23a49013
commit 7a421e05c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 69 additions and 50 deletions

View File

@ -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

View File

@ -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);

View File

@ -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(

View File

@ -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({

View File

@ -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');

View File

@ -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);

View File

@ -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',
);

View File

@ -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

View File

@ -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

View File

@ -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');