1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

[FLASK] Improve Snaps E2E stability (#16597)

* Improve Snaps E2E stability

* Simplify

* Fix lint
This commit is contained in:
Frederik Bolding 2022-11-21 14:38:05 +01:00 committed by GitHub
parent ad4db57a4a
commit 8a529bca47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 68 additions and 69 deletions

View File

@ -38,8 +38,11 @@ describe('Test Snap bip-32', function () {
await driver.clickElement('#connectBip32');
// switch to metamask extension and click connect
await driver.waitUntilXWindowHandles(2, 5000, 10000);
let windowHandles = await driver.getAllWindowHandles();
let windowHandles = await driver.waitUntilXWindowHandles(
2,
1000,
10000,
);
await driver.switchToWindowWithTitle(
'MetaMask Notification',
windowHandles,
@ -55,8 +58,7 @@ describe('Test Snap bip-32', function () {
await driver.delay(2000);
// switch to metamask extension
await driver.waitUntilXWindowHandles(2, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000);
// approve install of snap
await driver.switchToWindowWithTitle(
@ -78,8 +80,7 @@ describe('Test Snap bip-32', function () {
});
// switch back to test-snaps window
await driver.waitUntilXWindowHandles(1, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(1, 1000, 10000);
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);
// scroll to and click get public key
@ -124,8 +125,7 @@ describe('Test Snap bip-32', function () {
await driver.clickElement('#sendBip32-secp256k1');
// hit 'approve' on the custom confirm
await driver.waitUntilXWindowHandles(2, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000);
await driver.switchToWindowWithTitle(
'MetaMask Notification',
windowHandles,
@ -135,8 +135,7 @@ describe('Test Snap bip-32', function () {
tag: 'button',
});
await driver.waitUntilXWindowHandles(1, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(1, 1000, 10000);
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);
// check result
@ -161,8 +160,7 @@ describe('Test Snap bip-32', function () {
await driver.clickElement('#sendBip32-ed25519');
// hit 'approve' on the custom confirm
await driver.waitUntilXWindowHandles(2, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000);
await driver.switchToWindowWithTitle(
'MetaMask Notification',
windowHandles,
@ -172,8 +170,7 @@ describe('Test Snap bip-32', function () {
tag: 'button',
});
await driver.waitUntilXWindowHandles(1, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(1, 1000, 10000);
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);
// check result

View File

@ -36,8 +36,11 @@ describe('Test Snap bip-44', function () {
await driver.clickElement('#connectBip44Snap');
// switch to metamask extension and click connect
await driver.waitUntilXWindowHandles(2, 5000, 10000);
let windowHandles = await driver.getAllWindowHandles();
let windowHandles = await driver.waitUntilXWindowHandles(
2,
1000,
10000,
);
await driver.switchToWindowWithTitle(
'MetaMask Notification',
windowHandles,
@ -53,8 +56,7 @@ describe('Test Snap bip-44', function () {
await driver.delay(2000);
// switch to metamask extension
await driver.waitUntilXWindowHandles(2, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000);
// approve install of snap
await driver.switchToWindowWithTitle(
@ -75,8 +77,7 @@ describe('Test Snap bip-44', function () {
});
// click send inputs on test snap page
await driver.waitUntilXWindowHandles(1, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(1, 1000, 10000);
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);
await driver.delay(1000);
await driver.clickElement('#sendBip44Test');
@ -98,8 +99,7 @@ describe('Test Snap bip-44', function () {
await driver.clickElement('#signBip44Message');
// Switch to approve signature message window and approve
await driver.waitUntilXWindowHandles(2, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000);
await driver.switchToWindowWithTitle(
'MetaMask Notification',
windowHandles,
@ -110,8 +110,7 @@ describe('Test Snap bip-44', function () {
});
// switch back to test-snaps page
await driver.waitUntilXWindowHandles(1, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(1, 1000, 10000);
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);
await driver.delay(1000);

View File

@ -36,8 +36,11 @@ describe('Test Snap Confirm', function () {
await driver.clickElement('#connectConfirmSnap');
// switch to metamask extension and click connect
await driver.waitUntilXWindowHandles(2, 5000, 10000);
let windowHandles = await driver.getAllWindowHandles();
let windowHandles = await driver.waitUntilXWindowHandles(
2,
1000,
10000,
);
await driver.switchToWindowWithTitle(
'MetaMask Notification',
windowHandles,
@ -53,8 +56,7 @@ describe('Test Snap Confirm', function () {
await driver.delay(2000);
// approve install of snap
await driver.waitUntilXWindowHandles(2, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000);
await driver.switchToWindowWithTitle(
'MetaMask Notification',
windowHandles,
@ -65,8 +67,7 @@ describe('Test Snap Confirm', function () {
});
// switch back to test snaps page
await driver.waitUntilXWindowHandles(1, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(1, 1000, 10000);
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);
// click send inputs on test snap page
@ -76,8 +77,7 @@ describe('Test Snap Confirm', function () {
await driver.clickElement('#sendConfirmButton');
// hit 'approve' on the custom confirm
await driver.waitUntilXWindowHandles(2, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000);
await driver.switchToWindowWithTitle(
'MetaMask Notification',
windowHandles,
@ -88,8 +88,7 @@ describe('Test Snap Confirm', function () {
});
// check the results of the custom confirm
await driver.waitUntilXWindowHandles(1, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(1, 1000, 10000);
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);
const confirmResult = await driver.findElement('#confirmResult');
assert.equal(await confirmResult.getText(), 'true');

View File

@ -36,8 +36,11 @@ describe('Test Snap Error', function () {
await driver.clickElement('#connectErrorSnap');
// switch to metamask extension and click connect
await driver.waitUntilXWindowHandles(3, 5000, 10000);
let windowHandles = await driver.getAllWindowHandles();
let windowHandles = await driver.waitUntilXWindowHandles(
3,
1000,
10000,
);
const extensionPage = windowHandles[0];
await driver.switchToWindowWithTitle(
'MetaMask Notification',
@ -54,6 +57,7 @@ describe('Test Snap Error', function () {
await driver.delay(2000);
// approve install of snap
windowHandles = await driver.waitUntilXWindowHandles(3, 1000, 10000);
await driver.switchToWindowWithTitle(
'MetaMask Notification',
windowHandles,
@ -64,8 +68,7 @@ describe('Test Snap Error', function () {
});
// click send inputs on test snap page
await driver.waitUntilXWindowHandles(2, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000);
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);
await driver.delay(1000);

View File

@ -36,8 +36,11 @@ describe('Test Snap Installed', function () {
await driver.clickElement('#connectConfirmSnap');
// switch to metamask extension and click connect
await driver.waitUntilXWindowHandles(3, 5000, 10000);
let windowHandles = await driver.getAllWindowHandles();
let windowHandles = await driver.waitUntilXWindowHandles(
3,
1000,
10000,
);
await driver.switchToWindowWithTitle(
'MetaMask Notification',
windowHandles,
@ -53,8 +56,7 @@ describe('Test Snap Installed', function () {
await driver.delay(2000);
// approve install of snap
await driver.waitUntilXWindowHandles(3, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(3, 1000, 10000);
await driver.switchToWindowWithTitle(
'MetaMask Notification',
windowHandles,
@ -65,8 +67,7 @@ describe('Test Snap Installed', function () {
});
// click send inputs on test snap page
await driver.waitUntilXWindowHandles(2, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000);
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);
const errorButton = await driver.findElement('#connectErrorSnap');
@ -75,8 +76,7 @@ describe('Test Snap Installed', function () {
await driver.clickElement('#connectErrorSnap');
// switch to metamask extension and click connect
await driver.waitUntilXWindowHandles(3, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(3, 1000, 10000);
await driver.switchToWindowWithTitle(
'MetaMask Notification',
windowHandles,
@ -102,8 +102,7 @@ describe('Test Snap Installed', function () {
tag: 'button',
});
await driver.waitUntilXWindowHandles(2, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000);
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);
const result = await driver.findElement('#installedSnapsResult');

View File

@ -40,8 +40,11 @@ describe('Test Snap manageState', function () {
await driver.clickElement('#connectManageState');
// switch to metamask extension and click connect
await driver.waitUntilXWindowHandles(3, 5000, 10000);
let windowHandles = await driver.getAllWindowHandles();
let windowHandles = await driver.waitUntilXWindowHandles(
3,
1000,
10000,
);
await driver.switchToWindowWithTitle(
'MetaMask Notification',
windowHandles,
@ -56,8 +59,7 @@ describe('Test Snap manageState', function () {
await driver.delay(2000);
// approve install of snap
await driver.waitUntilXWindowHandles(3, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(3, 1000, 10000);
await driver.switchToWindowWithTitle(
'MetaMask Notification',
windowHandles,
@ -68,8 +70,7 @@ describe('Test Snap manageState', function () {
});
// fill and click send inputs on test snap page
await driver.waitUntilXWindowHandles(2, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000);
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);
await driver.fill('#dataManageState', '23');
await driver.delay(1000);

View File

@ -39,8 +39,11 @@ describe('Test Snap Notification', function () {
await driver.clickElement('#connectNotification');
// switch to metamask extension and click connect
await driver.waitUntilXWindowHandles(3, 5000, 10000);
let windowHandles = await driver.getAllWindowHandles();
let windowHandles = await driver.waitUntilXWindowHandles(
3,
1000,
10000,
);
const extensionPage = windowHandles[0];
await driver.switchToWindowWithTitle(
'MetaMask Notification',
@ -56,8 +59,7 @@ describe('Test Snap Notification', function () {
await driver.delay(2000);
// approve install of snap
await driver.waitUntilXWindowHandles(3, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(3, 1000, 10000);
await driver.switchToWindowWithTitle(
'MetaMask Notification',
windowHandles,
@ -68,8 +70,7 @@ describe('Test Snap Notification', function () {
});
// click send inputs on test snap page
await driver.waitUntilXWindowHandles(2, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000);
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);
await driver.delay(1000);
await driver.clickElement('#sendInAppNotification');

View File

@ -40,8 +40,11 @@ describe('Test Snap update', function () {
await driver.delay(2000);
// switch to metamask extension and click connect
await driver.waitUntilXWindowHandles(3, 5000, 10000);
let windowHandles = await driver.getAllWindowHandles();
let windowHandles = await driver.waitUntilXWindowHandles(
3,
1000,
10000,
);
await driver.switchToWindowWithTitle(
'MetaMask Notification',
windowHandles,
@ -56,8 +59,7 @@ describe('Test Snap update', function () {
await driver.delay(2000);
// approve install of snap
await driver.waitUntilXWindowHandles(3, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(3, 1000, 10000);
await driver.switchToWindowWithTitle(
'MetaMask Notification',
windowHandles,
@ -68,8 +70,7 @@ describe('Test Snap update', function () {
});
// navigate to test snap page
await driver.waitUntilXWindowHandles(2, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000);
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);
await driver.delay(1000);
@ -80,7 +81,7 @@ describe('Test Snap update', function () {
await driver.clickElement('#connectUpdateNew');
// switch to metamask extension and click connect
await driver.waitUntilXWindowHandles(3, 5000, 10000);
await driver.waitUntilXWindowHandles(3, 1000, 10000);
await driver.delay(1000);
// approve update of snap
@ -95,8 +96,7 @@ describe('Test Snap update', function () {
});
// navigate to test snap page
await driver.waitUntilXWindowHandles(2, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000);
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);
// look for the correct version text