Skip to content

Commit

Permalink
add logs to test ci stateful
Browse files Browse the repository at this point in the history
  • Loading branch information
storywithoutend committed Feb 21, 2025
1 parent 3521d76 commit 36c32c1
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
- run: pnpm install --frozen-lockfile

- name: Build stateful and export
run: NEXT_PUBLIC_CHAIN_NAME=holesky && pnpm build && pnpm export
run: pnpm build && pnpm export

- name: Tar stateful files
run: tar -cvf stateful-build.tar out
Expand Down
3 changes: 2 additions & 1 deletion e2e/specs/stateful/profile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,10 @@ const profiles = [

test.describe('Profile', () => {
test('should allow user to connect', async ({ page, login }) => {
await page.goto('/?chain=holesky')
await page.goto('/')
await login.connect()

await page.pause()
await page.getByTestId('header-profile').click()
await expect(page.getByText('Profile')).toBeVisible()
await page.getByTestId('header-profile').click()
Expand Down
4 changes: 4 additions & 0 deletions playwright/fixtures/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ export class Login {
await expect(this.page.getByText('Confirm connection in the extension')).toBeVisible({
timeout: 15000,
})
// TODO: Checking if this helps
await expect(this.wallet.getPendingRequestCount(Web3RequestKind.RequestPermissions)).toBeGreaterThanOrEqual(1)
// this isn't actually what the user experiences, just a quirk in headless-web3-provider
await this.wallet.authorize(Web3RequestKind.RequestPermissions)
// TODO: Checking if this helps
await expect(this.wallet.getPendingRequestCount(Web3RequestKind.RequestPermissions)).toBeGreaterThanOrEqual(1)
await this.wallet.authorize(Web3RequestKind.RequestAccounts)
const pendingRequests = await this.wallet.getPendingRequestCount()
expect(this.wallet.getPendingRequestCount(Web3RequestKind.RequestAccounts)).toEqual(0)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useAccount } from 'wagmi'
import { useAccount, useConfig } from 'wagmi'

import { Button, Toast } from '@ensdomains/thorin'

Expand All @@ -19,11 +19,13 @@ export const NetworkNotifications = () => {
const { t } = useTranslation()
const account = useAccount()
const connectedChainId = useChainId()
const router = useRouter()
const [open, setOpen] = useState<boolean>(false)

const accountChainId = account?.chainId
const config = useConfig()
console.log('config', config)

console.log('account', account)
useEffect(() => {
setOpen(shouldOpenModal(connectedChainId, accountChainId))
}, [connectedChainId, accountChainId])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ export const handleSendTransaction = async (
if (!request) {
throw Error('No request object')
}

// TODO: Check if this is still needed
// Basically for headless-web3-wallet
if (!isLocalProvider) {
await switchChain(wagmiConfig, { chainId: request?.chainId })
Expand Down
7 changes: 4 additions & 3 deletions src/constants/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export type SupportedChain =
| typeof localhostWithEns

export const getChainsFromUrl = () => {
console.log('NEXT_PUBLIC_CHAIN_NAME', process.env.NEXT_PUBLIC_CHAIN_NAME)
if (typeof window === 'undefined') {
return [
...(isLocalProvider ? ([localhostWithEns] as const) : ([] as const)),
Expand All @@ -57,8 +58,7 @@ export const getChainsFromUrl = () => {
]
}

const { hostname, search } = window.location
const params = new URLSearchParams(search)
const { hostname } = window.location
const segments = hostname.split('.')


Expand All @@ -81,7 +81,8 @@ export const getChainsFromUrl = () => {
// Dev environment
if (hostname === 'localhost' || hostname === '127.0.0.1') {
if (isLocalProvider) return [localhostWithEns]
return [mainnetWithEns]
console.log('setting holesky')
return [holeskyWithEns]
}

return match(segments[0])
Expand Down

0 comments on commit 36c32c1

Please sign in to comment.