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

Use enum for test snaps website URL (#14727)

* Use enum for test snaps website

* Fix confirm snap test
This commit is contained in:
Erik Marks 2022-05-17 01:39:55 -07:00 committed by GitHub
parent 7cfa454570
commit ca6835a86d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 10 deletions

3
test/e2e/snaps/enums.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = {
TEST_SNAPS_WEBSITE_URL: 'https://metamask.github.io/test-snaps/0.2.0',
};

View File

@ -1,5 +1,6 @@
const { strict: assert } = require('assert');
const { withFixtures } = require('../helpers');
const { TEST_SNAPS_WEBSITE_URL } = require('./enums');
describe('Test Snap bip-44', function () {
it('can pop up bip-44 snap and get private key result', async function () {
@ -29,7 +30,7 @@ describe('Test Snap bip-44', function () {
await driver.press('#password', driver.Key.ENTER);
// navigate to test snaps page and connect
await driver.driver.get('https://metamask.github.io/test-snaps/0.1.3/');
await driver.driver.get(TEST_SNAPS_WEBSITE_URL);
await driver.fill('.snapId3', 'npm:@metamask/test-snap-bip44');
await driver.clickElement({
text: 'Connect BIP-44 Snap',

View File

@ -1,5 +1,6 @@
const { strict: assert } = require('assert');
const { withFixtures } = require('../helpers');
const { TEST_SNAPS_WEBSITE_URL } = require('./enums');
describe('Test Snap Confirm', function () {
it('can pop up a snap confirm and get its result', async function () {
@ -29,8 +30,8 @@ describe('Test Snap Confirm', function () {
await driver.press('#password', driver.Key.ENTER);
// navigate to test snaps page and connect
await driver.driver.get('https://metamask.github.io/test-snaps/');
await driver.fill('.snapId', 'npm:@metamask/test-snap-confirm');
await driver.driver.get(TEST_SNAPS_WEBSITE_URL);
await driver.fill('.snapId1', 'npm:@metamask/test-snap-confirm');
await driver.clickElement({
text: 'Connect To Confirm Snap',
tag: 'button',
@ -69,10 +70,7 @@ describe('Test Snap Confirm', function () {
await driver.waitUntilXWindowHandles(1, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);
await driver.clickElement({
text: 'Send Inputs to Hello Snap',
tag: 'button',
});
await driver.clickElement('.sendConfirmButton');
// hit 'approve' on the custom confirm
await driver.waitUntilXWindowHandles(2, 5000, 10000);
@ -90,7 +88,7 @@ describe('Test Snap Confirm', function () {
await driver.waitUntilXWindowHandles(1, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);
const confirmResult = await driver.findElement('.sendResults');
const confirmResult = await driver.findElement('.confirmResult');
assert.equal(await confirmResult.getText(), 'true');
},
);

View File

@ -1,6 +1,7 @@
const { strict: assert } = require('assert');
const { withFixtures } = require('../helpers');
const { PAGES } = require('../webdriver/driver');
const { TEST_SNAPS_WEBSITE_URL } = require('./enums');
describe('Test Snap Error', function () {
it('can pop up a snap error and see the error', async function () {
@ -28,7 +29,7 @@ describe('Test Snap Error', function () {
await driver.press('#password', driver.Key.ENTER);
// navigate to test snaps page and connect
await driver.driver.get('https://metamask.github.io/test-snaps/');
await driver.driver.get(TEST_SNAPS_WEBSITE_URL);
await driver.fill('.snapId2', 'npm:@metamask/test-snap-error');
await driver.clickElement({
text: 'Connect Error Snap',

View File

@ -1,5 +1,6 @@
const { strict: assert } = require('assert');
const { withFixtures } = require('../helpers');
const { TEST_SNAPS_WEBSITE_URL } = require('./enums');
describe('Test Snap manageState', function () {
it('can pop up manageState snap and do update get and clear', async function () {
@ -29,7 +30,7 @@ describe('Test Snap manageState', function () {
await driver.press('#password', driver.Key.ENTER);
// navigate to test snaps page and connect
await driver.driver.get('https://metamask.github.io/test-snaps/0.2.0/');
await driver.driver.get(TEST_SNAPS_WEBSITE_URL);
await driver.fill('.snapId3', 'npm:@metamask/test-snap-managestate');
await driver.clickElement({
text: 'Connect manageState Snap',