Skip to content

Commit 2757cfd

Browse files
committed
Sui and Monad
1 parent fcc4a6f commit 2757cfd

File tree

8 files changed

+78
-62
lines changed

8 files changed

+78
-62
lines changed

.github/workflows/codeql.yml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
# name: CodeQL
1+
name: CodeQL
22

3-
# on:
4-
# push:
5-
# branches:
6-
# - dev
7-
# pull_request:
8-
# schedule:
9-
# - cron: '0 6 * * 3'
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
pull_request:
8+
schedule:
9+
- cron: '0 6 * * 3'
1010

11-
# jobs:
12-
# analyze:
13-
# runs-on: ubuntu-latest
14-
# permissions:
15-
# security-events: write
11+
jobs:
12+
analyze:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
security-events: write
1616

17-
# steps:
18-
# - name: Checkout
19-
# uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # [email protected]
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # [email protected]
2020

21-
# - name: Initialize CodeQL
22-
# uses: github/codeql-action/init@7e3036b9cd87fc26dd06747b7aa4b96c27aaef3a # [email protected]
23-
# with:
24-
# queries: security-and-quality
25-
# languages: javascript-typescript
21+
- name: Initialize CodeQL
22+
uses: github/codeql-action/init@7e3036b9cd87fc26dd06747b7aa4b96c27aaef3a # [email protected]
23+
with:
24+
queries: security-and-quality
25+
languages: javascript-typescript
2626

27-
# - name: Perform CodeQL Analysis
28-
# uses: github/codeql-action/analyze@7e3036b9cd87fc26dd06747b7aa4b96c27aaef3a # [email protected]
29-
# with:
30-
# category: "/language:javascript-typescript"
27+
- name: Perform CodeQL Analysis
28+
uses: github/codeql-action/analyze@7e3036b9cd87fc26dd06747b7aa4b96c27aaef3a # [email protected]
29+
with:
30+
category: "/language:javascript-typescript"

.github/workflows/lint.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
# name: 🎨 Lint
1+
name: 🎨 Lint
22

3-
# on:
4-
# push:
5-
# branches:
6-
# - dev
7-
# pull_request:
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
pull_request:
88

9-
# jobs:
10-
# style:
11-
# name: Check code style
12-
# runs-on: ubuntu-latest
13-
# steps:
14-
# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # [email protected]
9+
jobs:
10+
style:
11+
name: Check code style
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # [email protected]
1515

16-
# - name: Setup Node & Install dependencies
17-
# uses: ./.github/actions/setup
16+
- name: Setup Node & Install dependencies
17+
uses: ./.github/actions/setup
1818

19-
# - name: Check linter
20-
# run: pnpm run lint:check
19+
- name: Check linter
20+
run: pnpm run lint:check
2121

22-
# - name: Check order in package.json
23-
# if: success() || failure() # Run even if the previous step fails
24-
# run: pnpm run sort-package-json:check
22+
- name: Check order in package.json
23+
if: success() || failure() # Run even if the previous step fails
24+
run: pnpm run sort-package-json:check

.github/workflows/testjj2.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 🧑‍🔧 Test
1+
name: 🧑‍🔧 Test - Phantom
22

33
on:
44
push:

wallets/phantom/playwright.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ export default defineConfig({
4545

4646
// Collect all traces on CI, and only traces for failed tests when running locally.
4747
// See https://playwright.dev/docs/trace-viewer.
48-
trace: process.env.CI ? 'on' : 'retain-on-failure',
48+
// trace: process.env.CI ? 'on' : 'retain-on-failure',
49+
screenshot: 'only-on-failure',
50+
video: 'retain-on-failure',
4951
// Added for getting account address
5052
permissions: ['clipboard-read']
5153
},

wallets/phantom/src/playwright/fixtures/phantomFixtures.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { prepareExtensionPhantom } from '../../prepareExtensionPhantom'
1212
import { Phantom } from '../Phantom'
1313
import { getExtensionIdPhantom, unlockForFixturePhantom } from '../fixture-actions'
1414
import { persistLocalStorage } from '../fixture-actions/persistLocalStorage'
15+
import { closeSuiAndMonadIfPresent } from '../pages/HomePage/actions'
1516
import { waitForPhantomWindowToBeStable } from '../utils/waitFor'
1617

1718
type PhantomFixtures = {
@@ -90,6 +91,8 @@ export const phantomFixtures = (walletSetup: ReturnType<typeof defineWalletSetup
9091
await context.close()
9192
},
9293
phantomPage: async ({ context: _ }, use) => {
94+
await closeSuiAndMonadIfPresent(_phantomPage)
95+
9396
await use(_phantomPage)
9497
},
9598
extensionId: async ({ context }, use) => {
Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
1-
import type { Page } from '@playwright/test'
1+
import { type Page, expect } from '@playwright/test'
22

33
export async function closeSuiAndMonadIfPresent(page: Page) {
4-
const suiIsVisible = await page.getByRole('button', { name: 'Enable Sui' }).isVisible()
4+
// Wait for Phantom page to fully load
5+
const walletValueUsdRegExp = new RegExp('\\$[0-9].[0-9]{3,4}.*[0-9]{1,2}\\%')
6+
await expect(page.getByText(walletValueUsdRegExp), 'Wallet value should be visible').toBeVisible({ timeout: 10_000 })
57

6-
if (suiIsVisible) {
7-
await page.getByRole('button', { name: 'Not Now' }).click()
8-
}
8+
// Reload page to trigger Sui and/or Monad screens
9+
await page.reload()
910

10-
await page.waitForTimeout(2_000)
11+
// Loop until Sui/Monad screens have been closed and Phantompage is ready for testing
12+
// => 'ready for testing' = top 'fungible token' row is clickable
13+
await expect(async () => {
14+
const suiIsVisible = await page.getByRole('button', { name: 'Enable Sui' }).isVisible()
1115

12-
const monadIsVisible = await page.getByRole('button', { name: 'Enable Monad' }).isVisible()
16+
if (suiIsVisible) {
17+
await page.getByRole('button', { name: 'Not Now' }).click()
18+
}
1319

14-
if (monadIsVisible) {
15-
await page.getByRole('button', { name: 'Not Now' }).click()
16-
}
20+
const monadIsVisible = await page.getByRole('button', { name: 'Enable Monad' }).isVisible()
21+
22+
if (monadIsVisible) {
23+
await page.getByRole('button', { name: 'Not Now' }).click()
24+
}
25+
26+
await page.locator('[data-testid*="fungible-token-row-"]').first().click({ timeout: 3_000 })
27+
}).toPass()
1728
}

wallets/phantom/src/playwright/pages/HomePage/actions/importWalletFromPrivateKey.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { type Page, expect } from '@playwright/test'
22
import Selectors from '../../../../selectors/pages/HomePage'
33
import type { Networks } from '../../../../type/Networks'
44
import { waitFor } from '../../../utils/waitFor'
5-
import { closeSuiAndMonadIfPresent } from './closeSuiAndMonadScreen'
5+
// import { closeSuiAndMonadIfPresent } from './closeSuiAndMonadScreen'
66

77
export async function importWalletFromPrivateKey(
88
page: Page,
@@ -14,14 +14,14 @@ export async function importWalletFromPrivateKey(
1414

1515
await page.goto(extensionUrl.replace('onboarding', 'popup'))
1616

17-
await page.waitForTimeout(5_000)
18-
await closeSuiAndMonadIfPresent(page)
17+
// await page.waitForTimeout(5_000)
18+
// await closeSuiAndMonadIfPresent(page)
1919

2020
await expect(page.locator(Selectors.accountMenu.accountButton)).toBeVisible()
2121
await page.locator(Selectors.accountMenu.accountButton).click()
2222

23-
await page.waitForTimeout(3_000)
24-
await closeSuiAndMonadIfPresent(page)
23+
// await page.waitForTimeout(3_000)
24+
// await closeSuiAndMonadIfPresent(page)
2525

2626
await expect(page.locator(Selectors.accountMenu.addAccountMenu.addAccountButton)).toBeVisible()
2727

wallets/phantom/test/playwright/commonSteps/solanaSandboxSetup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { type Page, expect } from '@playwright/test'
22
import type { Phantom } from '../../../src/playwright'
33

44
export const solanaSandboxSetup = async (page: Page, phantom: Phantom) => {
5-
await phantom.page.waitForTimeout(1_000)
5+
// await phantom.page.waitForTimeout(1_000)
66
await phantom.importWalletFromPrivateKey(
77
'solana',
88
'XQaKFLLSKbzpVzmfJrj4yUjAyFy2Eu7JcNdbPdnLuod2Uw3yf3tjGd4ha1DBfFdjkZFX1PZg3knth2Tz2tvd8C4'

0 commit comments

Comments
 (0)