Skip to content

Commit 4f3a761

Browse files
authored
Add [data-testid] to items in the execution summary (#391)
1 parent ed7a4f7 commit 4f3a761

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
9+
### Added
10+
- Add [data-testid] to items in the execution summary ([#391](https://github.com/cucumber/react-components/pull/391))
911

1012
## [23.1.0] - 2025-06-15
1113
### Changed

src/components/app/ExecutionSummary.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ describe('<ExecutionSummary/>', () => {
5252
</EnvelopesProvider>
5353
)
5454

55-
expect(screen.getByTestId('setup.phrase')).to.contain.text(
55+
expect(screen.getByTestId('cucumber.summary.setup.phrase')).to.contain.text(
5656
5757
)
5858
})

src/components/app/ExecutionSummary.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ export const ExecutionSummary: FC = () => {
3737
<>
3838
{meta && (
3939
<HeaderSection>
40-
<HeaderItem>
40+
<HeaderItem testId="cucumber.summary.setup">
4141
<HeaderSubItem>
4242
<ImplementationIcon implementation={meta.implementation} />
4343
<RuntimeIcon runtime={meta.runtime} />
4444
<OSIcon os={meta.os} />
4545
</HeaderSubItem>
46-
<span data-testid="setup.phrase">
46+
<span data-testid="cucumber.summary.setup.phrase">
4747
<VersionedTool {...meta.implementation} fallback="unknown tool" />
4848
<em className={styles.conjunction}> with </em>
4949
<VersionedTool {...meta.runtime} fallback="unknown runtime" />
@@ -55,7 +55,7 @@ export const ExecutionSummary: FC = () => {
5555
</HeaderSection>
5656
)}
5757
<HeaderSection>
58-
<HeaderItem>
58+
<HeaderItem testId="cucumber.summary.status">
5959
<HeaderSubItem>
6060
<HealthChart />
6161
<span>
@@ -68,7 +68,7 @@ export const ExecutionSummary: FC = () => {
6868
</HeaderSubItem>
6969
</HeaderItem>
7070
{startDate && (
71-
<HeaderItem>
71+
<HeaderItem testId="cucumber.summary.timing">
7272
<HeaderSubItem>
7373
<FontAwesomeIcon aria-hidden="true" style={{ opacity: 0.75 }} icon={faStopwatch} />
7474
<span>
@@ -86,14 +86,14 @@ export const ExecutionSummary: FC = () => {
8686
</HeaderItem>
8787
)}
8888
{meta?.ci && (
89-
<HeaderItem>
89+
<HeaderItem testId="cucumber.summary.ci">
9090
<HeaderSubItem>
9191
<CIJobLink ci={meta.ci} />
9292
</HeaderSubItem>
9393
</HeaderItem>
9494
)}
9595
{meta?.ci?.git && (
96-
<HeaderItem>
96+
<HeaderItem testId="cucumber.summary.git">
9797
<HeaderSubItem>
9898
<CICommitLink ci={meta.ci} />
9999
</HeaderSubItem>

src/components/app/Header.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ export const HeaderSection: FC<PropsWithChildren> = ({ children }) => {
66
return <div className={styles.section}>{children}</div>
77
}
88

9-
export const HeaderItem: FC<PropsWithChildren> = ({ children }) => {
10-
return <div className={styles.item}>{children}</div>
9+
export const HeaderItem: FC<PropsWithChildren<{ testId?: string }>> = ({ testId, children }) => {
10+
return (
11+
<div data-testid={testId} className={styles.item}>
12+
{children}
13+
</div>
14+
)
1115
}
1216

1317
export const HeaderSubItem: FC<PropsWithChildren> = ({ children }) => {

0 commit comments

Comments
 (0)