@@ -2,48 +2,40 @@ import Image from 'next/image'
2
2
import Table from '@/components/table'
3
3
import ComponentSwitcher from '@/components/switcher'
4
4
import StatsRow from '@/components/stats'
5
-
6
- import testData from '@/data/test-results.json'
5
+ import testData from '@/utils/data'
7
6
8
7
export default function Home ( ) {
9
- const tableComponents = createTableComponents ( testData )
8
+ // User can switch between two test suite tables: one with all non-empty suites,
9
+ // and another showing only suites with failed tests (and the failed cases in them)
10
+ const tableComponents = {
11
+ 'All suites' : < Table suites = { testData . nonEmptySuites } /> ,
12
+ 'Failed tests only' : < Table suites = { testData . suitesWithIssues } /> ,
13
+ }
10
14
11
15
return (
12
- < div className = "flex flex-col w-full items-center font-primary" >
16
+ < div className = "flex flex-col w-full items-center font-primary overflow-x-hidden " >
13
17
< Header />
14
18
< StatsRow testData = { testData } />
15
- < div className = "max-w-5xl w-full p-8" >
19
+ < div className = "max-w-5xl w-full py-4 px-0 md: p-8" >
16
20
< ComponentSwitcher components = { tableComponents } />
17
21
</ div >
18
22
</ div >
19
23
)
20
24
}
21
25
22
- // User can switch between two test suite tables: one with all non-empty suites,
23
- // and another showing only suites with failed tests (and the failed cases in them)
24
- function createTableComponents ( testData ) {
25
- testData . results . forEach ( ( suite ) => {
26
- suite . failedKnown =
27
- suite . testCases ?. filter ( ( t ) => t . status === 'failed' && t . reason ) . length || 0
28
- suite . failedUnknown = suite . failed - suite . failedKnown
29
- } )
30
- const nonEmptySuites = testData . results . filter ( ( suite ) => suite . testCases ?. length > 0 )
31
- const suitesWithIssues = nonEmptySuites . filter ( ( suite ) => suite . failed > 0 )
32
- suitesWithIssues . forEach ( ( suite ) => {
33
- suite . testCases = suite . testCases . filter ( ( t ) => t . status === 'failed' )
34
- } )
35
-
36
- return {
37
- 'All suites' : < Table suites = { nonEmptySuites } /> ,
38
- 'Failed tests only' : < Table suites = { suitesWithIssues } /> ,
39
- }
40
- }
41
-
42
26
function Header ( ) {
43
27
return (
44
- < div className = "flex w-full items-center gap-4 bg-primary text-base-100 p-4" >
45
- < Image alt = "netlify logo" src = "/logo.svg" width = { 97 } height = { 40 } />
46
- < span className = "text-lg font-bold uppercase" > Next.js E2E Tests on Netlify Runtime v5</ span >
28
+ < div className = "flex w-full items-center gap-4 bg-primary text-base-100 p-2 md:p-4 justify-center" >
29
+ < Image
30
+ alt = "netlify logo"
31
+ src = "/logo.svg"
32
+ width = { 97 }
33
+ height = { 40 }
34
+ className = "hidden md:block"
35
+ />
36
+ < span className = "md:text-lg font-bold uppercase" >
37
+ Next.js E2E Tests on Netlify Runtime v5
38
+ </ span >
47
39
</ div >
48
40
)
49
41
}
0 commit comments