mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
Fix snaps E2Es to be compatible with new monorepo-based test-snaps (#20005)
* initial fixes to E2Es * changed test website * final E2E fixes * fixed getentropy test * missing scroll fix * scrollfix for bip44 firefox * added new function and edited tests
This commit is contained in:
parent
e1722d773a
commit
b4668fa402
@ -1,5 +1,6 @@
|
||||
module.exports = {
|
||||
TEST_SNAPS_WEBSITE_URL: 'https://metamask.github.io/test-snaps/5.5.0/',
|
||||
TEST_SNAPS_WEBSITE_URL:
|
||||
'https://metamask.github.io/snaps/test-snaps/0.37.3-flask.1/',
|
||||
TEST_SNAPS_SIMPLE_KEYRING_WEBSITE_URL:
|
||||
'https://metamask.github.io/snap-simple-keyring/latest/',
|
||||
};
|
||||
|
@ -31,10 +31,10 @@ describe('Test Snap bip-32', function () {
|
||||
await driver.delay(1000);
|
||||
|
||||
// find and scroll to the bip32 test and connect
|
||||
const snapButton1 = await driver.findElement('#connectBip32');
|
||||
const snapButton1 = await driver.findElement('#connectbip32');
|
||||
await driver.scrollToElement(snapButton1);
|
||||
await driver.delay(1000);
|
||||
await driver.clickElement('#connectBip32');
|
||||
await driver.clickElement('#connectbip32');
|
||||
await driver.delay(1000);
|
||||
|
||||
// switch to metamask extension and click connect
|
||||
@ -84,7 +84,7 @@ describe('Test Snap bip-32', function () {
|
||||
|
||||
// wait for npm installation success
|
||||
await driver.waitForSelector({
|
||||
css: '#connectBip32',
|
||||
css: '#connectbip32',
|
||||
text: 'Reconnect to BIP-32 Snap',
|
||||
});
|
||||
|
||||
|
@ -32,10 +32,10 @@ describe('Test Snap bip-44', function () {
|
||||
await driver.delay(1000);
|
||||
|
||||
// find and scroll to the bip44 test and connect
|
||||
const snapButton1 = await driver.findElement('#connectBip44Snap');
|
||||
const snapButton1 = await driver.findElement('#connectbip44');
|
||||
await driver.scrollToElement(snapButton1);
|
||||
await driver.delay(1000);
|
||||
await driver.clickElement('#connectBip44Snap');
|
||||
await driver.clickElement('#connectbip44');
|
||||
await driver.delay(1000);
|
||||
|
||||
// switch to metamask extension and click connect and approve
|
||||
@ -53,6 +53,9 @@ describe('Test Snap bip-44', function () {
|
||||
tag: 'button',
|
||||
});
|
||||
await driver.waitForSelector({ text: 'Install' });
|
||||
|
||||
await driver.clickElementSafe('[data-testid="snap-install-scroll"]');
|
||||
|
||||
await driver.clickElement({
|
||||
text: 'Install',
|
||||
tag: 'button',
|
||||
@ -61,6 +64,7 @@ describe('Test Snap bip-44', function () {
|
||||
// deal with permissions popover
|
||||
await driver.delay(500);
|
||||
await driver.clickElement('#key-access-bip44-1-0');
|
||||
await driver.clickElement('#key-access-bip44-3-1');
|
||||
await driver.clickElement({
|
||||
text: 'Confirm',
|
||||
tag: 'button',
|
||||
@ -76,7 +80,7 @@ describe('Test Snap bip-44', function () {
|
||||
|
||||
// wait for npm installation success
|
||||
await driver.waitForSelector({
|
||||
css: '#connectBip44Snap',
|
||||
css: '#connectbip44',
|
||||
text: 'Reconnect to BIP-44 Snap',
|
||||
});
|
||||
|
||||
|
@ -31,10 +31,10 @@ describe('Test Snap Cronjob', function () {
|
||||
// navigate to test snaps page and connect
|
||||
await driver.openNewPage(TEST_SNAPS_WEBSITE_URL);
|
||||
await driver.delay(1000);
|
||||
const snapButton = await driver.findElement('#connectCronjobSnap');
|
||||
const snapButton = await driver.findElement('#connectcronjobs');
|
||||
await driver.scrollToElement(snapButton);
|
||||
await driver.delay(1000);
|
||||
await driver.clickElement('#connectCronjobSnap');
|
||||
await driver.clickElement('#connectcronjobs');
|
||||
await driver.delay(1000);
|
||||
|
||||
// switch to metamask extension and click connect
|
||||
@ -71,8 +71,8 @@ describe('Test Snap Cronjob', function () {
|
||||
|
||||
// wait for npm installation success
|
||||
await driver.waitForSelector({
|
||||
css: '#connectCronjobSnap',
|
||||
text: 'Reconnect to Cronjob Snap',
|
||||
css: '#connectcronjobs',
|
||||
text: 'Reconnect to Cronjobs Snap',
|
||||
});
|
||||
|
||||
// switch to dialog popup, wait for a maximum of 65 seconds
|
||||
@ -86,7 +86,10 @@ describe('Test Snap Cronjob', function () {
|
||||
// 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);
|
||||
assert.equal(
|
||||
text.includes(`Cronjob\nThis dialog was triggered by a cronjob.`),
|
||||
true,
|
||||
);
|
||||
|
||||
// try to click on the Ok button and pass test if it works
|
||||
await driver.clickElement({
|
||||
|
@ -31,10 +31,10 @@ describe('Test Snap Dialog', function () {
|
||||
// navigate to test snaps page and connect to dialog snap
|
||||
await driver.openNewPage(TEST_SNAPS_WEBSITE_URL);
|
||||
await driver.delay(1000);
|
||||
const dialogButton = await driver.findElement('#connectDialogSnap');
|
||||
const dialogButton = await driver.findElement('#connectdialogs');
|
||||
await driver.scrollToElement(dialogButton);
|
||||
await driver.delay(1000);
|
||||
await driver.clickElement('#connectDialogSnap');
|
||||
await driver.clickElement('#connectdialogs');
|
||||
await driver.delay(1000);
|
||||
|
||||
// switch to metamask extension and click connect
|
||||
@ -71,8 +71,8 @@ describe('Test Snap Dialog', function () {
|
||||
|
||||
// wait for npm installation success
|
||||
await driver.waitForSelector({
|
||||
css: '#connectDialogSnap',
|
||||
text: 'Reconnect to Dialog Snap',
|
||||
css: '#connectdialogs',
|
||||
text: 'Reconnect to Dialogs Snap',
|
||||
});
|
||||
|
||||
// click on alert dialog
|
||||
@ -91,7 +91,10 @@ describe('Test Snap Dialog', function () {
|
||||
let result = await driver.findElement('.snap-ui-renderer__panel');
|
||||
await driver.scrollToElement(result);
|
||||
await driver.delay(500);
|
||||
assert.equal(await result.getText(), 'Alert Dialog\nText here');
|
||||
assert.equal(
|
||||
await result.getText(),
|
||||
'Alert Dialog\nThis is an alert dialog. It has a single button: "OK".',
|
||||
);
|
||||
|
||||
// click ok button
|
||||
await driver.clickElement({
|
||||
@ -109,7 +112,7 @@ describe('Test Snap Dialog', function () {
|
||||
assert.equal(await result.getText(), 'null');
|
||||
|
||||
// click conf button
|
||||
await driver.clickElement('#sendConfButton');
|
||||
await driver.clickElement('#sendConfirmationButton');
|
||||
await driver.delay(500);
|
||||
|
||||
// switch to dialog popup
|
||||
@ -136,7 +139,7 @@ describe('Test Snap Dialog', function () {
|
||||
assert.equal(await result.getText(), 'false');
|
||||
|
||||
// click conf button again
|
||||
await driver.clickElement('#sendConfButton');
|
||||
await driver.clickElement('#sendConfirmationButton');
|
||||
await driver.delay(500);
|
||||
|
||||
// switch to dialog popup
|
||||
|
@ -31,10 +31,10 @@ describe('Test Snap Error', function () {
|
||||
// navigate to test snaps page and connect
|
||||
await driver.openNewPage(TEST_SNAPS_WEBSITE_URL);
|
||||
await driver.delay(1000);
|
||||
const snapButton = await driver.findElement('#connectErrorSnap');
|
||||
const snapButton = await driver.findElement('#connecterrors');
|
||||
await driver.scrollToElement(snapButton);
|
||||
await driver.delay(1000);
|
||||
await driver.clickElement('#connectErrorSnap');
|
||||
await driver.clickElement('#connecterrors');
|
||||
await driver.delay(1000);
|
||||
|
||||
// switch to metamask extension and click connect
|
||||
@ -72,8 +72,8 @@ describe('Test Snap Error', function () {
|
||||
|
||||
// wait for npm installation success
|
||||
await driver.waitForSelector({
|
||||
css: '#connectErrorSnap',
|
||||
text: 'Reconnect to Error Snap',
|
||||
css: '#connecterrors',
|
||||
text: 'Reconnect to Errors Snap',
|
||||
});
|
||||
|
||||
// find and click on send error
|
||||
@ -90,7 +90,7 @@ describe('Test Snap Error', function () {
|
||||
const text = await error.getText();
|
||||
assert.equal(
|
||||
text.includes(
|
||||
"Snap Error: 'random error inside'. Error Code: '-32603'",
|
||||
"Snap Error: 'Random error inside a promise.'. Error Code: '-32603'",
|
||||
),
|
||||
true,
|
||||
);
|
||||
|
@ -30,10 +30,12 @@ describe('Test Snap ethereum_provider', function () {
|
||||
// navigate to test snaps page and connect
|
||||
await driver.driver.get(TEST_SNAPS_WEBSITE_URL);
|
||||
await driver.delay(1000);
|
||||
const snapButton = await driver.findElement('#connectEthproviderSnap');
|
||||
const snapButton = await driver.findElement(
|
||||
'#connectethereum-provider',
|
||||
);
|
||||
await driver.scrollToElement(snapButton);
|
||||
await driver.delay(1000);
|
||||
await driver.clickElement('#connectEthproviderSnap');
|
||||
await driver.clickElement('#connectethereum-provider');
|
||||
await driver.delay(1000);
|
||||
|
||||
// switch to metamask extension and click connect
|
||||
@ -65,16 +67,16 @@ describe('Test Snap ethereum_provider', function () {
|
||||
tag: 'button',
|
||||
});
|
||||
|
||||
// click send inputs on test snap page
|
||||
// switch to test snap page
|
||||
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);
|
||||
|
||||
// wait for npm installation success
|
||||
await driver.waitForSelector({
|
||||
css: '#connectEthproviderSnap',
|
||||
text: 'Reconnect to ethereum-provider Snap',
|
||||
css: '#connectethereum-provider',
|
||||
text: 'Reconnect to Ethereum Provider Snap',
|
||||
});
|
||||
|
||||
// find and click on send test
|
||||
// find and click on send get version
|
||||
const snapButton2 = await driver.findElement('#sendEthprovider');
|
||||
await driver.scrollToElement(snapButton2);
|
||||
await driver.delay(500);
|
||||
@ -83,7 +85,44 @@ describe('Test Snap ethereum_provider', function () {
|
||||
// check the results of the message signature using waitForSelector
|
||||
await driver.waitForSelector({
|
||||
css: '#ethproviderResult',
|
||||
text: 'true',
|
||||
text: '"1337"',
|
||||
});
|
||||
|
||||
// find and click on send get version
|
||||
const snapButton3 = await driver.findElement(
|
||||
'#sendEthproviderAccounts',
|
||||
);
|
||||
await driver.scrollToElement(snapButton3);
|
||||
await driver.delay(500);
|
||||
await driver.clickElement('#sendEthproviderAccounts');
|
||||
|
||||
// switch to metamask window and click through confirmations
|
||||
const windowHandles2 = await driver.waitUntilXWindowHandles(
|
||||
2,
|
||||
1000,
|
||||
10000,
|
||||
);
|
||||
await driver.switchToWindowWithTitle(
|
||||
'MetaMask Notification',
|
||||
windowHandles2,
|
||||
);
|
||||
await driver.clickElement({
|
||||
text: 'Next',
|
||||
tag: 'button',
|
||||
});
|
||||
await driver.delay(500);
|
||||
await driver.clickElement({
|
||||
text: 'Connect',
|
||||
tag: 'button',
|
||||
});
|
||||
|
||||
// switch to test snap page
|
||||
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);
|
||||
|
||||
// check the results of the message signature using waitForSelector
|
||||
await driver.waitForSelector({
|
||||
css: '#ethproviderResult',
|
||||
text: '"0x5cfe73b6021e818b776b421b1c4db2474086a7e1"',
|
||||
});
|
||||
},
|
||||
);
|
||||
|
@ -53,6 +53,8 @@ describe('Test Snap getEntropy', function () {
|
||||
|
||||
await driver.waitForSelector({ text: 'Install' });
|
||||
|
||||
await driver.clickElementSafe('[data-testid="snap-install-scroll"]');
|
||||
|
||||
await driver.clickElement({
|
||||
text: 'Install',
|
||||
tag: 'button',
|
||||
@ -71,7 +73,7 @@ describe('Test Snap getEntropy', function () {
|
||||
// wait for npm installation success
|
||||
await driver.waitForSelector({
|
||||
css: '#connectGetEntropySnap',
|
||||
text: 'Reconnect to getEntropy Snap',
|
||||
text: 'Reconnect to Get Entropy Snap',
|
||||
});
|
||||
|
||||
// find and click on send test
|
||||
@ -100,7 +102,7 @@ describe('Test Snap getEntropy', function () {
|
||||
// check the results of the message signature using waitForSelector
|
||||
await driver.waitForSelector({
|
||||
css: '#entropySignResult',
|
||||
text: '"0xb9c20d675976e12c8bb53c3fd8fdff2dee11ad2b132eb453b5a8f35b0553c52d3bcac0fd3324d22ff0c53b3445ef48c119ba6435bc9bfb03234806719599aa6f6245593238c734bcf9d94d2873cacdd65a3176be3ae7e5b84f95fdd4487a395f"',
|
||||
text: '"0x9341785782b512c86235612365f1076b16731ed9473beb4d0804c30b7fcc3a055aa7103b02dc64014d923220712dfbef023ddcf6327b313ea2dfd4d83dc5a53e1c5e7f4e10bce49830eded302294054df8a7a46e5b6cb3e50eec564ecba17941"',
|
||||
});
|
||||
},
|
||||
);
|
||||
|
@ -30,10 +30,10 @@ describe('Test Snap Installed', function () {
|
||||
// navigate to test snaps page and connect
|
||||
await driver.openNewPage(TEST_SNAPS_WEBSITE_URL);
|
||||
await driver.delay(1000);
|
||||
const confirmButton = await driver.findElement('#connectDialogSnap');
|
||||
const confirmButton = await driver.findElement('#connectdialogs');
|
||||
await driver.scrollToElement(confirmButton);
|
||||
await driver.delay(500);
|
||||
await driver.clickElement('#connectDialogSnap');
|
||||
await driver.clickElement('#connectdialogs');
|
||||
await driver.delay(500);
|
||||
|
||||
// switch to metamask extension and click connect
|
||||
@ -70,14 +70,14 @@ describe('Test Snap Installed', function () {
|
||||
|
||||
// wait for npm installation success
|
||||
await driver.waitForSelector({
|
||||
css: '#connectDialogSnap',
|
||||
text: 'Reconnect to Dialog Snap',
|
||||
css: '#connectdialogs',
|
||||
text: 'Reconnect to Dialogs Snap',
|
||||
});
|
||||
|
||||
const errorButton = await driver.findElement('#connectErrorSnap');
|
||||
const errorButton = await driver.findElement('#connecterrors');
|
||||
await driver.scrollToElement(errorButton);
|
||||
await driver.delay(500);
|
||||
await driver.clickElement('#connectErrorSnap');
|
||||
await driver.clickElement('#connecterrors');
|
||||
|
||||
// switch to metamask extension and click connect
|
||||
windowHandles = await driver.waitUntilXWindowHandles(3, 1000, 10000);
|
||||
@ -109,7 +109,7 @@ describe('Test Snap Installed', function () {
|
||||
// wait for npm installation success
|
||||
await driver.waitForSelector({
|
||||
css: '#installedSnapsResult',
|
||||
text: 'npm:@metamask/test-snap-dialog, npm:@metamask/test-snap-error',
|
||||
text: 'npm:@metamask/dialog-example-snap, npm:@metamask/error-example-snap',
|
||||
});
|
||||
},
|
||||
);
|
||||
|
@ -52,11 +52,7 @@ describe('Test Snap Account', function () {
|
||||
tag: 'button',
|
||||
});
|
||||
|
||||
try {
|
||||
await driver.clickElement('[data-testid="snap-install-scroll"]');
|
||||
} catch (_) {
|
||||
console.log('Missing scroll');
|
||||
}
|
||||
await driver.clickElementSafe('[data-testid="snap-install-scroll"]');
|
||||
|
||||
await driver.waitForSelector({ text: 'Install' });
|
||||
|
||||
|
@ -33,10 +33,10 @@ describe('Test Snap Management', function () {
|
||||
await driver.delay(1000);
|
||||
|
||||
// find and scroll to the correct card and click first
|
||||
const snapButton = await driver.findElement('#connectNotification');
|
||||
const snapButton = await driver.findElement('#connectnotifications');
|
||||
await driver.scrollToElement(snapButton);
|
||||
await driver.delay(1000);
|
||||
await driver.clickElement('#connectNotification');
|
||||
await driver.clickElement('#connectnotifications');
|
||||
await driver.delay(1000);
|
||||
|
||||
// switch to metamask extension and click connect
|
||||
@ -91,7 +91,7 @@ describe('Test Snap Management', function () {
|
||||
|
||||
// try to disable the snap
|
||||
await driver.clickElement({
|
||||
text: 'Notification Test Snap',
|
||||
text: 'Notifications Example Snap',
|
||||
tag: 'p',
|
||||
});
|
||||
await driver.clickElement('.toggle-button > div');
|
||||
@ -138,7 +138,7 @@ describe('Test Snap Management', function () {
|
||||
|
||||
// try to remove snap
|
||||
await driver.clickElement({
|
||||
text: 'Remove Notification Test Snap',
|
||||
text: 'Remove Notifications Example Snap',
|
||||
tag: 'p',
|
||||
});
|
||||
await driver.delay(1000);
|
||||
|
@ -34,10 +34,10 @@ describe('Test Snap manageState', function () {
|
||||
await driver.delay(1000);
|
||||
|
||||
// find and scroll to the connect button and click it
|
||||
const snapButton1 = await driver.findElement('#connectManageState');
|
||||
const snapButton1 = await driver.findElement('#connectmanage-state');
|
||||
await driver.scrollToElement(snapButton1);
|
||||
await driver.delay(1000);
|
||||
await driver.clickElement('#connectManageState');
|
||||
await driver.clickElement('#connectmanage-state');
|
||||
await driver.delay(1000);
|
||||
|
||||
// switch to metamask extension and click connect
|
||||
@ -74,7 +74,7 @@ describe('Test Snap manageState', function () {
|
||||
|
||||
// wait for npm installation success
|
||||
await driver.waitForSelector({
|
||||
css: '#connectManageState',
|
||||
css: '#connectmanage-state',
|
||||
text: 'Reconnect to Manage State Snap',
|
||||
});
|
||||
|
||||
@ -101,7 +101,7 @@ describe('Test Snap manageState', function () {
|
||||
);
|
||||
assert.equal(
|
||||
await retrieveManageStateResult.getText(),
|
||||
'{ "testState": [ "23" ] }',
|
||||
'{ "items": [ "23" ] }',
|
||||
);
|
||||
|
||||
// click clear results
|
||||
@ -121,7 +121,7 @@ describe('Test Snap manageState', function () {
|
||||
);
|
||||
assert.equal(
|
||||
await retrieveManageStateResult2.getText(),
|
||||
'{ "testState": [] }',
|
||||
'{ "items": [] }',
|
||||
);
|
||||
},
|
||||
);
|
||||
|
@ -1,4 +1,3 @@
|
||||
const { strict: assert } = require('assert');
|
||||
const { withFixtures } = require('../helpers');
|
||||
const FixtureBuilder = require('../fixture-builder');
|
||||
const { TEST_SNAPS_WEBSITE_URL } = require('./enums');
|
||||
@ -31,16 +30,14 @@ describe('Test Snap networkAccess', function () {
|
||||
// navigate to test snaps page and connect to dialog snap
|
||||
await driver.openNewPage(TEST_SNAPS_WEBSITE_URL);
|
||||
await driver.delay(1000);
|
||||
const dialogButton = await driver.findElement(
|
||||
'#connectNetworkAccessSnap',
|
||||
);
|
||||
const dialogButton = await driver.findElement('#connectnetwork-access');
|
||||
await driver.scrollToElement(dialogButton);
|
||||
await driver.delay(1000);
|
||||
await driver.clickElement('#connectNetworkAccessSnap');
|
||||
await driver.clickElement('#connectnetwork-access');
|
||||
await driver.delay(1000);
|
||||
|
||||
// switch to metamask extension and click connect
|
||||
let windowHandles = await driver.waitUntilXWindowHandles(
|
||||
const windowHandles = await driver.waitUntilXWindowHandles(
|
||||
3,
|
||||
1000,
|
||||
10000,
|
||||
@ -73,32 +70,18 @@ describe('Test Snap networkAccess', function () {
|
||||
|
||||
// wait for npm installation success
|
||||
await driver.waitForSelector({
|
||||
css: '#connectNetworkAccessSnap',
|
||||
text: 'Reconnect to networkAccess Snap',
|
||||
css: '#connectnetwork-access',
|
||||
text: 'Reconnect to Network Access Snap',
|
||||
});
|
||||
|
||||
// click on alert dialog
|
||||
await driver.clickElement('#sendNetworkAccessTest');
|
||||
await driver.delay(500);
|
||||
|
||||
// switch to dialog popup
|
||||
windowHandles = await driver.waitUntilXWindowHandles(3, 1000, 10000);
|
||||
await driver.switchToWindowWithTitle(
|
||||
'MetaMask Notification',
|
||||
windowHandles,
|
||||
);
|
||||
await driver.delay(500);
|
||||
|
||||
// check dialog contents
|
||||
const result = await driver.findElement('.snap-ui-renderer__panel');
|
||||
await driver.scrollToElement(result);
|
||||
await driver.delay(500);
|
||||
assert.equal(await result.getText(), 'FETCHED_SUCCESSFULLY');
|
||||
|
||||
// click ok button
|
||||
await driver.clickElement({
|
||||
text: 'OK',
|
||||
tag: 'button',
|
||||
// check for result correctness
|
||||
await driver.waitForSelector({
|
||||
css: '#networkAccessResult',
|
||||
text: '"hello": "world"',
|
||||
});
|
||||
},
|
||||
);
|
||||
|
@ -33,10 +33,10 @@ describe('Test Snap Notification', function () {
|
||||
await driver.delay(1000);
|
||||
|
||||
// find and scroll down to snapId5 and connect
|
||||
const snapButton = await driver.findElement('#connectNotification');
|
||||
const snapButton = await driver.findElement('#connectnotifications');
|
||||
await driver.scrollToElement(snapButton);
|
||||
await driver.delay(1000);
|
||||
await driver.clickElement('#connectNotification');
|
||||
await driver.clickElement('#connectnotifications');
|
||||
await driver.delay(1000);
|
||||
|
||||
// switch to metamask extension and click connect
|
||||
@ -74,8 +74,8 @@ describe('Test Snap Notification', function () {
|
||||
|
||||
// wait for npm installation success
|
||||
await driver.waitForSelector({
|
||||
css: '#connectNotification',
|
||||
text: 'Reconnect to Notification Snap',
|
||||
css: '#connectnotifications',
|
||||
text: 'Reconnect to Notifications Snap',
|
||||
});
|
||||
|
||||
await driver.clickElement('#sendInAppNotification');
|
||||
@ -113,7 +113,7 @@ describe('Test Snap Notification', function () {
|
||||
);
|
||||
assert.equal(
|
||||
await notificationResultMessage.getText(),
|
||||
'TEST INAPP NOTIFICATION',
|
||||
'Hello from within MetaMask!',
|
||||
);
|
||||
},
|
||||
);
|
||||
|
@ -32,10 +32,10 @@ describe('Test Snap RPC', function () {
|
||||
await driver.delay(1000);
|
||||
|
||||
// find and scroll to the bip32 test and connect
|
||||
const snapButton1 = await driver.findElement('#connectBip32');
|
||||
const snapButton1 = await driver.findElement('#connectbip32');
|
||||
await driver.scrollToElement(snapButton1);
|
||||
await driver.delay(1000);
|
||||
await driver.clickElement('#connectBip32');
|
||||
await driver.clickElement('#connectbip32');
|
||||
await driver.delay(1000);
|
||||
|
||||
// switch to metamask extension and click connect
|
||||
@ -84,10 +84,10 @@ describe('Test Snap RPC', function () {
|
||||
// switch back to test-snaps window
|
||||
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);
|
||||
|
||||
const snapButton2 = await driver.findElement('#connectRpcSnap');
|
||||
const snapButton2 = await driver.findElement('#connectjson-rpc');
|
||||
await driver.scrollToElement(snapButton2);
|
||||
await driver.delay(1000);
|
||||
await driver.clickElement('#connectRpcSnap');
|
||||
await driver.clickElement('#connectjson-rpc');
|
||||
await driver.delay(1000);
|
||||
|
||||
windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000);
|
||||
@ -118,8 +118,8 @@ describe('Test Snap RPC', function () {
|
||||
|
||||
// wait for npm installation success
|
||||
await driver.waitForSelector({
|
||||
css: '#connectRpcSnap',
|
||||
text: 'Reconnect to RPC Snap',
|
||||
css: '#connectjson-rpc',
|
||||
text: 'Reconnect to JSON-RPC Snap',
|
||||
});
|
||||
|
||||
// click send inputs on test snap page
|
||||
|
@ -32,10 +32,12 @@ describe('Test Snap TxInsights', function () {
|
||||
await driver.delay(1000);
|
||||
|
||||
// find and scroll to the bip32 test and connect
|
||||
const snapButton1 = await driver.findElement('#connectInsightsSnap');
|
||||
const snapButton1 = await driver.findElement(
|
||||
'#connecttransaction-insights',
|
||||
);
|
||||
await driver.scrollToElement(snapButton1);
|
||||
await driver.delay(1000);
|
||||
await driver.clickElement('#connectInsightsSnap');
|
||||
await driver.clickElement('#connecttransaction-insights');
|
||||
await driver.delay(1000);
|
||||
|
||||
// switch to metamask extension and click connect
|
||||
@ -100,18 +102,16 @@ describe('Test Snap TxInsights', function () {
|
||||
'MetaMask Notification',
|
||||
windowHandles,
|
||||
);
|
||||
await driver.delay(1000);
|
||||
await driver.clickElement({
|
||||
text: 'TxInsightsTest',
|
||||
tag: 'button',
|
||||
});
|
||||
|
||||
// check that txinsightstest tab contains the right info
|
||||
await driver.delay(1000);
|
||||
const txInsightsResult = await driver.findElement(
|
||||
'.snap-ui-renderer__content',
|
||||
);
|
||||
assert.equal(await txInsightsResult.getText(), 'Test: Successful');
|
||||
assert.equal(
|
||||
await txInsightsResult.getText(),
|
||||
'Transaction type:\nERC-20',
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
@ -127,7 +127,7 @@ describe('Test Snap update', function () {
|
||||
// look for the correct version text
|
||||
await driver.waitForSelector({
|
||||
css: '#updateSnapVersion',
|
||||
text: '"5.1.2"',
|
||||
text: '"0.35.2-flask.1"',
|
||||
});
|
||||
},
|
||||
);
|
||||
|
@ -30,10 +30,10 @@ describe('Test Snap WASM', function () {
|
||||
// navigate to test snaps page and connect
|
||||
await driver.openNewPage(TEST_SNAPS_WEBSITE_URL);
|
||||
await driver.delay(1000);
|
||||
const snapButton = await driver.findElement('#connectWasmSnap');
|
||||
const snapButton = await driver.findElement('#connectwasm');
|
||||
await driver.scrollToElement(snapButton);
|
||||
await driver.delay(1000);
|
||||
await driver.clickElement('#connectWasmSnap');
|
||||
await driver.clickElement('#connectwasm');
|
||||
await driver.delay(1000);
|
||||
|
||||
// switch to metamask extension and click connect
|
||||
@ -71,7 +71,7 @@ describe('Test Snap WASM', function () {
|
||||
|
||||
// wait for npm installation success
|
||||
await driver.waitForSelector({
|
||||
css: '#connectWasmSnap',
|
||||
css: '#connectwasm',
|
||||
text: 'Reconnect to WebAssembly Snap',
|
||||
});
|
||||
|
||||
|
@ -249,6 +249,18 @@ class Driver {
|
||||
await element.click();
|
||||
}
|
||||
|
||||
async clickElementSafe(rawLocator) {
|
||||
// for instances where an element such as a scroll button does not
|
||||
// show up because of render differences, proceed to the next step
|
||||
// without causing a test failure, but provide a console log of why.
|
||||
try {
|
||||
const element = await this.findClickableElement(rawLocator);
|
||||
await element.click();
|
||||
} catch (e) {
|
||||
console.log(`Element ${rawLocator} not found (${e})`);
|
||||
}
|
||||
}
|
||||
|
||||
async clickPoint(rawLocator, x, y) {
|
||||
const element = await this.findElement(rawLocator);
|
||||
await this.driver
|
||||
|
Loading…
Reference in New Issue
Block a user