Skip to content

Commit

Permalink
chore: disable user profile feature for cypress
Browse files Browse the repository at this point in the history
  • Loading branch information
Alunara committed Jan 10, 2025
1 parent 4b74430 commit c7ad441
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/curve-common/src/widgets/Header/DesktopHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { useState } from 'react'
import { AppName } from 'curve-ui-kit/src/shared/routes'
import { t } from '@lingui/macro'
import GlobalBanner from 'ui/src/Banner'
import { isBeta } from 'curve-ui-kit/src/utils'
import { isBeta, isCypress } from 'curve-ui-kit/src/utils'

export const DESKTOP_HEADER_HEIGHT = '96px' // note: hardcoded height is tested in cypress

Expand Down Expand Up @@ -52,7 +52,7 @@ export const DesktopHeader = <TChainId extends number>({
<Box sx={{ flexGrow: 1 }} />

<Box display="flex" marginLeft={2} justifyContent="flex-end" gap={3} alignItems="center">
{isBeta ? (
{isBeta && !isCypress ? (
<UserProfileButton />
) : (
<>
Expand Down
2 changes: 2 additions & 0 deletions packages/curve-ui-kit/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ export * from './searchText'
export const isBeta =
typeof window !== 'undefined' &&
(window.localStorage.getItem('beta') !== null || !window.location.hostname.includes('curve.fi'))

export const isCypress = typeof window !== 'undefined' && (window as any).Cypress
3 changes: 1 addition & 2 deletions packages/ui/src/QueryProvider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { type QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { type Persister, PersistQueryClientProvider } from '@tanstack/react-query-persist-client'
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
import { ReactNode } from 'react'
import { isCypress } from 'curve-ui-kit/src/utils'

type QueryProviderWrapperProps = {
children: ReactNode
Expand All @@ -10,8 +11,6 @@ type QueryProviderWrapperProps = {
}

// Cypress runs in dev mode which means the devtools button is visible, which may break tests.
const isCypress = typeof window !== 'undefined' && (window as any).Cypress

export function QueryProvider({ children, persister, queryClient }: QueryProviderWrapperProps) {
children = (
<>
Expand Down

0 comments on commit c7ad441

Please sign in to comment.