Skip to content

Commit

Permalink
update get snaps to use fixturebuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterYinusa committed Oct 27, 2022
1 parent 09004ff commit 9e96ec2
Showing 1 changed file with 6 additions and 36 deletions.
42 changes: 6 additions & 36 deletions test/e2e/snaps/test-snap-get-snaps.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { strict: assert } = require('assert');
const { withFixtures } = require('../helpers');
const FixtureBuilder = require('../fixture-builder');
const { TEST_SNAPS_WEBSITE_URL } = require('./enums');

describe('Test Snap Confirm', function () {
Expand All @@ -15,7 +16,9 @@ describe('Test Snap Confirm', function () {
};
await withFixtures(
{
fixtures: 'imported-account',
fixtures: new FixtureBuilder()
.withPermissionControllerConnectedToSnapDapp()
.build(),
ganacheOptions,
title: this.test.title,
},
Expand All @@ -31,26 +34,9 @@ describe('Test Snap Confirm', function () {
await driver.fill('#snapId1', 'npm:@metamask/test-snap-confirm');
await driver.clickElement('#connectHello');

// switch to metamask extension and click connect
await driver.waitUntilXWindowHandles(2, 5000, 10000);
let windowHandles = await driver.getAllWindowHandles();
await driver.switchToWindowWithTitle(
'MetaMask Notification',
windowHandles,
);
await driver.clickElement(
{
text: 'Connect',
tag: 'button',
},
10000,
);

await driver.delay(2000);

// approve install of snap
await driver.waitUntilXWindowHandles(2, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
let windowHandles = await driver.getAllWindowHandles();
await driver.switchToWindowWithTitle(
'MetaMask Notification',
windowHandles,
Expand All @@ -71,24 +57,8 @@ describe('Test Snap Confirm', function () {
await driver.fill('#snapId2', 'npm:@metamask/test-snap-error');
await driver.clickElement('#connectError');

// switch to metamask extension and click connect
await driver.waitUntilXWindowHandles(2, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
await driver.switchToWindowWithTitle(
'MetaMask Notification',
windowHandles,
);
await driver.clickElement(
{
text: 'Connect',
tag: 'button',
},
10000,
);

await driver.delay(2000);

// approve install of snap
await driver.waitUntilXWindowHandles(2, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
await driver.switchToWindowWithTitle(
'MetaMask Notification',
Expand Down

0 comments on commit 9e96ec2

Please sign in to comment.