Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLASK] Snaps e2e test stability improvements #18090

Merged
merged 3 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions test/e2e/snaps/test-snap-bip-32.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
FrederikBolding marked this conversation as resolved.
Show resolved Hide resolved
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');
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
16 changes: 9 additions & 7 deletions test/e2e/snaps/test-snap-bip-44.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down
10 changes: 6 additions & 4 deletions test/e2e/snaps/test-snap-cronjob.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
12 changes: 7 additions & 5 deletions test/e2e/snaps/test-snap-dialog.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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({
Expand Down
11 changes: 6 additions & 5 deletions test/e2e/snaps/test-snap-error.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
19 changes: 12 additions & 7 deletions test/e2e/snaps/test-snap-installed.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
13 changes: 8 additions & 5 deletions test/e2e/snaps/test-snap-managestate.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
);
Expand Down
12 changes: 7 additions & 5 deletions test/e2e/snaps/test-snap-notification.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion test/e2e/snaps/test-snap-rpc.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions test/e2e/snaps/test-snap-update.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down