forked from blockscout/frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
71 additions
and
59 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { ChakraProvider } from '@chakra-ui/react'; | ||
import type { ColorMode } from '@chakra-ui/react'; | ||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; | ||
import React from 'react'; | ||
|
||
import theme from 'theme'; | ||
|
||
type Props = { | ||
children: React.ReactNode; | ||
colorMode?: ColorMode; | ||
} | ||
|
||
const TestApp = ({ children, colorMode = 'light' }: Props) => { | ||
const [ queryClient ] = React.useState(() => new QueryClient({ | ||
defaultOptions: { | ||
queries: { | ||
refetchOnWindowFocus: false, | ||
retry: 0, | ||
}, | ||
}, | ||
})); | ||
|
||
return ( | ||
<ChakraProvider theme={{ ...theme, config: { ...theme.config, initialColorMode: colorMode } }}> | ||
<QueryClientProvider client={ queryClient }> | ||
{ children } | ||
</QueryClientProvider> | ||
</ChakraProvider> | ||
); | ||
}; | ||
|
||
export default TestApp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
import { test, expect } from '@playwright/experimental-ct-react'; | ||
import React from 'react'; | ||
|
||
import RenderWithChakra from 'playwright/RenderWithChakra'; | ||
import TestApp from 'playwright/TestApp'; | ||
|
||
import AppError from './AppError'; | ||
|
||
test.use({ viewport: { width: 900, height: 400 } }); | ||
|
||
test('status code 404', async({ mount }) => { | ||
const component = await mount( | ||
<RenderWithChakra> | ||
<TestApp> | ||
<AppError statusCode={ 404 }/> | ||
</RenderWithChakra>, | ||
</TestApp>, | ||
); | ||
await expect(component).toHaveScreenshot(); | ||
}); | ||
|
||
test('status code 500', async({ mount }) => { | ||
const component = await mount( | ||
<RenderWithChakra> | ||
<TestApp> | ||
<AppError statusCode={ 500 }/> | ||
</RenderWithChakra>, | ||
</TestApp>, | ||
); | ||
await expect(component).toHaveScreenshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,44 @@ | ||
import { test, expect } from '@playwright/experimental-ct-react'; | ||
import React from 'react'; | ||
|
||
import RenderWithChakra from 'playwright/RenderWithChakra'; | ||
import TestApp from 'playwright/TestApp'; | ||
|
||
import Utilization from './Utilization'; | ||
|
||
test.use({ viewport: { width: 100, height: 50 } }); | ||
|
||
test('green color scheme in light mode', async({ mount }) => { | ||
const component = await mount( | ||
<RenderWithChakra> | ||
<TestApp> | ||
<Utilization value={ 0.423 }/> | ||
</RenderWithChakra>, | ||
</TestApp>, | ||
); | ||
await expect(component).toHaveScreenshot(); | ||
}); | ||
|
||
test('green color scheme in dark mode', async({ mount }) => { | ||
const component = await mount( | ||
<RenderWithChakra colorMode="dark"> | ||
<TestApp colorMode="dark"> | ||
<Utilization value={ 0.423 }/> | ||
</RenderWithChakra>, | ||
</TestApp>, | ||
); | ||
await expect(component).toHaveScreenshot(); | ||
}); | ||
|
||
test('gray color scheme in light mode', async({ mount }) => { | ||
const component = await mount( | ||
<RenderWithChakra> | ||
<TestApp> | ||
<Utilization value={ 0.423 } colorScheme="gray"/> | ||
</RenderWithChakra>, | ||
</TestApp>, | ||
); | ||
await expect(component).toHaveScreenshot(); | ||
}); | ||
|
||
test('gray color scheme in dark mode', async({ mount }) => { | ||
const component = await mount( | ||
<RenderWithChakra colorMode="dark"> | ||
<TestApp colorMode="dark"> | ||
<Utilization value={ 0.423 } colorScheme="gray"/> | ||
</RenderWithChakra>, | ||
</TestApp>, | ||
); | ||
await expect(component).toHaveScreenshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters