Skip to content

Commit ffad825

Browse files
authored
Add new Report component (#410)
1 parent 6ee4923 commit ffad825

File tree

5 files changed

+64
-0
lines changed

5 files changed

+64
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1212
### Added
1313
- Include duration for each test step ([#396](https://github.com/cucumber/react-components/pull/396))
1414
- Include pass rate in execution summary ([#397](https://github.com/cucumber/react-components/pull/397))
15+
- Add new `<Report/>` component ([#410](https://github.com/cucumber/react-components/pull/410))
1516

1617
### Changed
1718
- Render a more test case-centric report ([#396](https://github.com/cucumber/react-components/pull/396))
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.layout {
2+
> section:not(:last-child) {
3+
margin-bottom: 1.5em;
4+
}
5+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { Envelope } from '@cucumber/messages'
2+
import { Story } from '@ladle/react'
3+
import React from 'react'
4+
5+
import examplesTablesSample from '../../../acceptance/examples-tables/examples-tables.js'
6+
import globalHooksSample from '../../../acceptance/global-hooks/global-hooks.js'
7+
import { EnvelopesProvider } from './EnvelopesProvider.js'
8+
import { InMemorySearchProvider } from './InMemorySearchProvider.js'
9+
import { Report } from './Report.js'
10+
11+
type TemplateArgs = {
12+
envelopes: readonly Envelope[]
13+
}
14+
15+
const Template: Story<TemplateArgs> = ({ envelopes }) => {
16+
return (
17+
<EnvelopesProvider envelopes={envelopes}>
18+
<InMemorySearchProvider>
19+
<Report />
20+
</InMemorySearchProvider>
21+
</EnvelopesProvider>
22+
)
23+
}
24+
25+
export default {
26+
title: 'App/Report',
27+
}
28+
29+
export const Default = Template.bind({})
30+
Default.args = {
31+
envelopes: examplesTablesSample,
32+
} as TemplateArgs
33+
34+
export const WithGlobalHooks = Template.bind({})
35+
WithGlobalHooks.args = {
36+
envelopes: globalHooksSample,
37+
} as TemplateArgs

src/components/app/Report.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React, { FC } from 'react'
2+
3+
import { ExecutionSummary } from './ExecutionSummary.js'
4+
import { FilteredDocuments } from './FilteredDocuments.js'
5+
import styles from './Report.module.scss'
6+
import { SearchBar } from './SearchBar.js'
7+
8+
export const Report: FC = () => {
9+
return (
10+
<article className={styles.layout}>
11+
<section>
12+
<ExecutionSummary />
13+
<SearchBar />
14+
</section>
15+
<section>
16+
<FilteredDocuments />
17+
</section>
18+
</article>
19+
)
20+
}

src/components/app/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export * from './HighLight.js'
88
export * from './InMemorySearchProvider.js'
99
export * from './NoMatchResult.js'
1010
export * from './QueriesProvider.js'
11+
export * from './Report.js'
1112
export * from './SearchBar.js'
1213
export * from './StatusesSummary.js'
1314
export * from './UrlSearchProvider.js'

0 commit comments

Comments
 (0)