dappress 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/package.json +1 -1
- package/src/metamask-pages.js +8 -2
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
**MetaMask automation for Cypress.**
|
|
4
4
|
|
|
5
|
+
[](https://github.com/blassaut/dappress/blob/conformance-reports/MATRIX.md)
|
|
6
|
+
|
|
5
7
|
Dappress loads the MetaMask browser extension into the browser Cypress launches, imports a test wallet, and exposes `cy.*` commands that answer the requests a dapp sends to the wallet: connection, signatures, transactions, network changes.
|
|
6
8
|
|
|
7
9
|
- **Current MetaMask.** The extension version is a configuration value. Each release is verified by a conformance suite, with one test per command.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dappress",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "MetaMask automation for Cypress: load the real extension, import a test wallet, answer dapp requests with cy.* commands. Tracks the latest MetaMask release.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Benjamin Lassaut",
|
package/src/metamask-pages.js
CHANGED
|
@@ -41,8 +41,14 @@ async function findExtensionId(browser, timeout = 30000) {
|
|
|
41
41
|
async function isMetaMask(browser, extensionId) {
|
|
42
42
|
const [target] = pagesOf(browser, extensionId, HOME_PATH);
|
|
43
43
|
if (target) {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
// A page still loading or redirecting loses its execution context while its
|
|
45
|
+
// title is read; not MetaMask yet, findExtensionId looks again
|
|
46
|
+
try {
|
|
47
|
+
const page = await target.page();
|
|
48
|
+
return (await page.title()).startsWith('MetaMask');
|
|
49
|
+
} catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
46
52
|
}
|
|
47
53
|
const page = await browser.newPage();
|
|
48
54
|
try {
|