Skip to content

Commit

Permalink
Merge branch 'develop' into fix/change-notifications-event-names
Browse files Browse the repository at this point in the history
  • Loading branch information
Prithpal-Sooriya authored Jul 26, 2024
2 parents d7c77cd + 3d93d82 commit 5a7ea8e
Showing 1 changed file with 97 additions and 0 deletions.
97 changes: 97 additions & 0 deletions test/e2e/snaps/test-snap-jsx.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
const {
defaultGanacheOptions,
withFixtures,
unlockWallet,
switchToNotificationWindow,
WINDOW_TITLES,
} = require('../helpers');
const FixtureBuilder = require('../fixture-builder');
const { TEST_SNAPS_WEBSITE_URL } = require('./enums');

describe('Test Snap JSX', function () {
it('can use JSX for snap dialog', async function () {
await withFixtures(
{
fixtures: new FixtureBuilder().build(),
ganacheOptions: defaultGanacheOptions,
title: this.test.fullTitle(),
},
async ({ driver }) => {
await unlockWallet(driver);

// navigate to test snaps page and connect to wasm snap
await driver.driver.get(TEST_SNAPS_WEBSITE_URL);

// wait for page to load
await driver.waitForSelector({
text: 'Installed Snaps',
tag: 'h2',
});

// find and scroll to the jsx test and connect
const snapButton = await driver.findElement('#connectjsx');
await driver.scrollToElement(snapButton);
await driver.delay(1000);
await driver.waitForSelector('#connectjsx');
await driver.clickElement('#connectjsx');

// switch to metamask extension and click connect
await switchToNotificationWindow(driver, 2);
await driver.waitForSelector({
text: 'Connect',
tag: 'button',
});
await driver.clickElement({
text: 'Connect',
tag: 'button',
});

await driver.waitForSelector({ text: 'Confirm' });

await driver.clickElementSafe('[data-testid="snap-install-scroll"]');

await driver.clickElement({
text: 'Confirm',
tag: 'button',
});

await driver.waitForSelector({ text: 'OK' });

await driver.clickElement({
text: 'OK',
tag: 'button',
});

// click send inputs on test snap page
await driver.switchToWindowWithTitle(WINDOW_TITLES.TestSnaps);

// wait for npm installation success
await driver.waitForSelector({
css: '#connectjsx',
text: 'Reconnect to JSX Snap',
});

// click on show jsx dialog
await driver.clickElement('#displayJsx');

// switch to dialog window
await switchToNotificationWindow(driver, 2);

// check for count zero
await driver.waitForSelector({
text: '0',
tag: 'b',
});

// click increment twice
await driver.clickElement('#increment');

// wait for count to be 1
await driver.waitForSelector({
text: '1',
tag: 'b',
});
},
);
});
});

0 comments on commit 5a7ea8e

Please sign in to comment.