Skip to content

Commit

Permalink
chore: new setup for ui dev with reload
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias committed Oct 29, 2024
1 parent 447a1bb commit b523553
Show file tree
Hide file tree
Showing 13 changed files with 1,092 additions and 957 deletions.
6 changes: 3 additions & 3 deletions examples/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@
"preact": "^10.24.3",
"react-hook-form": "^7.53.1",
"react-toastify": "^10.0.5",
"viem": "^2.21.15",
"viem": "^2.21.36",
"wagmi": "^2.12.14",
"water.css": "^2.1.1"
},
"devDependencies": {
"@babel/core": "^7.25.9",
"@babel/core": "^7.26.0",
"@biomejs/biome": "^1.9.4",
"@hugomrdias/configs": "^0.1.9",
"@preact/preset-vite": "^2.9.1",
"@types/node": "^22.7.9",
"@types/node": "^22.8.2",
"tiny-git-rev-sync": "^0.1.0",
"typescript": "5.6.3",
"vite": "^5.4.10",
Expand Down
6 changes: 3 additions & 3 deletions examples/fil-forwarder-viem/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
"filsnap-adapter": "^2.0.0",
"iso-base": "^4.0.0",
"iso-filecoin": "^4.1.0",
"viem": "^2.21.15"
"viem": "^2.21.36"
},
"devDependencies": {
"@babel/core": "^7.25.9",
"@babel/core": "^7.26.0",
"@biomejs/biome": "^1.9.4",
"@hugomrdias/configs": "^0.1.9",
"@types/node": "^22.7.9",
"@types/node": "^22.8.2",
"typescript": "5.6.3",
"vite": "^5.4.10",
"wireit": "^0.14.8"
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"devDependencies": {
"@testing-library/react": "^16.0.1",
"@types/mocha": "^10.0.9",
"@types/node": "^22.7.9",
"@types/node": "^22.8.2",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"assert": "^2.1.0",
Expand Down
10 changes: 5 additions & 5 deletions packages/adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@
}
},
"dependencies": {
"@metamask/approval-controller": "^7.1.0",
"@metamask/approval-controller": "^7.1.1",
"@metamask/snaps-sdk": "^6.6.0",
"filsnap": "workspace:^",
"iso-filecoin": "^4.1.0",
"viem": "^2.21.15"
"viem": "^2.21.36"
},
"devDependencies": {
"@playwright/test": "^1.48.1",
"@types/node": "^22.7.9",
"metamask-testing-tools": "^2.1.0",
"@playwright/test": "^1.48.2",
"@types/node": "^22.8.2",
"metamask-testing-tools": "^2.2.2",
"typescript": "5.6.3"
},
"publishConfig": {
Expand Down
28 changes: 19 additions & 9 deletions packages/snap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@
],
"scripts": {
"lint": "tsc --build && biome check --no-errors-on-unmatched --files-ignore-unknown=true",
"test": "playwright test",
"test": "wireit",
"build": "wireit",
"serve": "wireit"
"serve": "wireit",
"watch": "pnpm run serve & pnpx onchange -i -k 'src/**/*.{ts,tsx}' 'test/**/*.{ts,tsx}' -- pnpm run test -- --headed"
},
"wireit": {
"build": {
Expand All @@ -61,15 +62,23 @@
"snap.config.ts"
],
"output": [
"dist/snap.js"
"dist/snap.js",
"snap.manifest.json"
],
"clean": false
},
"test": {
"command": "playwright test",
"dependencies": [
"build"
]
},
"serve": {
"command": "mm-snap serve --port 8081",
"command": "mm-snap serve",
"dependencies": [
{
"script": "build",
"cascade": false
"cascade": true
}
],
"service": true
Expand All @@ -83,15 +92,16 @@
"iso-base": "^4.0.0",
"iso-filecoin": "^4.1.0",
"merge-options": "^3.0.4",
"viem": "^2.21.15",
"viem": "^2.21.36",
"zod": "^3.22.4"
},
"devDependencies": {
"@metamask/snaps-cli": "6.3.3",
"@playwright/test": "^1.48.1",
"@metamask/snaps-cli": "6.5.1",
"@playwright/test": "^1.48.2",
"@types/react": "18.2.14",
"@types/react-dom": "18.2.4",
"metamask-testing-tools": "^2.1.0",
"metamask-testing-tools": "^2.2.2",
"onchange": "^7.1.0",
"playwright-test": "^14.1.6",
"type-fest": "^4.26.1",
"typescript": "5.6.3"
Expand Down
9 changes: 6 additions & 3 deletions packages/snap/playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@ export default defineConfig({
testDir: './test',
timeout: process.env.CI ? 60 * 1000 : 30 * 1000,
forbidOnly: Boolean(process.env.CI),
retries: process.env.CI ? 2 : 1,
retries: process.env.CI ? 2 : undefined,
// workers: process.env.CI ? 1 : undefined,
maxFailures: process.env.CI ? 0 : 1,
reporter: process.env.CI ? [['html'], ['list']] : 'list',
use: {
baseURL: 'http://example.org',
trace: 'on-first-retry',
colorScheme: 'dark',
browserName: 'chromium',
// viewport: { width: 500, height: 1280 },
},
webServer: {
command: 'pnpm run build && mm-snap serve --port 8081',
url: 'http://localhost:8081/dist/snap.js',
command: 'pnpm run build && pnpm exec mm-snap serve',
url: 'http://localhost:8080/dist/snap.js',
reuseExistingServer: !process.env.CI,
},
})
2 changes: 1 addition & 1 deletion packages/snap/test/configure.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { test, expect } = createFixture({
flask: true,
},
snap: {
id: 'local:http://localhost:8081',
id: 'local:http://localhost:8080',
},
})

Expand Down
2 changes: 1 addition & 1 deletion packages/snap/test/error.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { test, expect } = createFixture({
flask: true,
},
snap: {
id: 'local:http://localhost:8081',
id: 'local:http://localhost:8080',
version: '*',
},
})
Expand Down
2 changes: 1 addition & 1 deletion packages/snap/test/gas-estimate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const { test, expect } = createFixture({
flask: true,
},
snap: {
id: 'local:http://localhost:8081',
id: 'local:http://localhost:8080',
},
})
test.beforeAll(async ({ metamask, page }) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/snap/test/mainnet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { test, expect } = createFixture({
flask: true,
},
snap: {
id: 'local:http://localhost:8081',
id: 'local:http://localhost:8080',
version: '*',
},
})
Expand Down
2 changes: 1 addition & 1 deletion packages/snap/test/methods.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const { test, expect } = createFixture({
flask: true,
},
snap: {
id: 'local:http://localhost:8081',
id: 'local:http://localhost:8080',
},
})

Expand Down
25 changes: 25 additions & 0 deletions packages/snap/test/ui.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { createFixture } from 'metamask-testing-tools'

const fixture = createFixture({
isolated: true,
downloadOptions: {
flask: true,
},
snap: {
id: 'local:http://localhost:8080',
},
cacheUserDir: true,
devtools: false,
})

fixture.test.describe.skip('JSX UI', () => {
fixture.test.beforeEach(async ({ metamask }) => {
await metamask.page.getByTestId('confirmation-submit-button').click()
})

fixture.test('should get configure for testnet', async ({ metamask }) => {
await metamask.goToHomepage('local:http://localhost:8080')
// await metamask.goBack()
await metamask.page.waitForTimeout(6666666)
})
})
Loading

0 comments on commit b523553

Please sign in to comment.