-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into fix/change-notifications-event-names
- Loading branch information
Showing
1 changed file
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}); | ||
}, | ||
); | ||
}); | ||
}); |