Skip to content

Commit

Permalink
chore: added extension to testing with chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed Mar 6, 2024
1 parent 02a7716 commit 22c40df
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ node_modules
.pnp.cjs
.pnp.loader.mjs
.env
static/dist
static/dist
metamask
16 changes: 14 additions & 2 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
import { defineConfig } from "cypress";
import path from "node:path";
import AdmZip from "adm-zip";

export default defineConfig({
e2e: {
setupNodeEvents() {
// implement node event listeners here
setupNodeEvents(on) {
on("before:browser:launch", (browser, launchOptions) => {
// absolute path to the unpacked extension's folder
// NOTE: extensions cannot be loaded in headless Chrome
const extensionPath = path.resolve(__dirname, "./cypress/fixtures");
const unzippedPath = `${extensionPath}/metamask`;
const zip = new AdmZip(`${extensionPath}/metamask-chrome.zip`);
zip.extractAllTo(unzippedPath);
launchOptions.extensions.push(unzippedPath);

return launchOptions;
});
},
experimentalStudio: true,
baseUrl: "http://localhost:8080",
Expand Down
Binary file added cypress/fixtures/metamask-chrome.zip
Binary file not shown.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"prepare": "husky install",
"postinstall": "git submodule update --init --recursive",
"cy:open": "cypress open",
"cy:run": "cypress run"
"cy:run": "cypress run --browser chrome --headed"
},
"keywords": [
"typescript",
Expand Down Expand Up @@ -48,9 +48,11 @@
"@cspell/dict-node": "^4.0.3",
"@cspell/dict-software-terms": "^3.3.18",
"@cspell/dict-typescript": "^3.1.2",
"@types/adm-zip": "0.5.5",
"@types/node": "^20.11.19",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/parser": "^7.0.1",
"adm-zip": "0.5.10",
"cspell": "^8.4.0",
"cypress": "13.6.6",
"esbuild": "^0.20.1",
Expand Down
14 changes: 13 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1551,6 +1551,13 @@
ignore "^5.1.8"
p-map "^4.0.0"

"@types/adm-zip@^0.5.5":
version "0.5.5"
resolved "https://registry.yarnpkg.com/@types/adm-zip/-/adm-zip-0.5.5.tgz#4588042726aa5f351d7ea88232e4a952f60e7c1a"
integrity sha512-YCGstVMjc4LTY5uK9/obvxBya93axZOVOyf2GSUulADzmLhYE45u2nAssCs/fWBs1Ifq5Vat75JTPwd5XZoPJw==
dependencies:
"@types/node" "*"

"@types/json-schema@^7.0.12":
version "7.0.15"
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841"
Expand Down Expand Up @@ -1753,6 +1760,11 @@ acorn@^8.9.0:
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a"
integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==

adm-zip@^0.5.10:
version "0.5.10"
resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.5.10.tgz#4a51d5ab544b1f5ce51e1b9043139b639afff45b"
integrity sha512-x0HvcHqVJNTPk/Bw8JbLWlWoo6Wwnsug0fnYYro1HBrjxZ3G7/AZk7Ahv8JwDe1uIcz8eBqvu86FuF1POiG7vQ==

[email protected]:
version "3.0.0"
resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d"
Expand Down Expand Up @@ -2500,7 +2512,7 @@ cspell@^8.4.0:
strip-ansi "^7.1.0"
vscode-uri "^3.0.8"

cypress@^13.6.6:
[email protected]:
version "13.6.6"
resolved "https://registry.yarnpkg.com/cypress/-/cypress-13.6.6.tgz#5133f231ed1c6e57dc8dcbf60aade220bcd6884b"
integrity sha512-S+2S9S94611hXimH9a3EAYt81QM913ZVA03pUmGDfLTFa5gyp85NJ8dJGSlEAEmyRsYkioS1TtnWtbv/Fzt11A==
Expand Down

0 comments on commit 22c40df

Please sign in to comment.