Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Change errored uploads and uploads list text #3429

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ describe('CommitCoverage', () => {
render(<CommitCoverage />, { wrapper: wrapper({ queryClient }) })

const erroredUploads = await screen.findByText(
/The following uploads failed to process:/
/No coverage data is available due to incomplete uploads on the first attempt./
)
expect(erroredUploads).toBeInTheDocument()
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,23 @@
import isEmpty from 'lodash/isEmpty'
import PropTypes from 'prop-types'

import A from 'ui/A'

function ErroredUploads({ erroredUploads }) {
return (
!isEmpty(erroredUploads) && (
<>
<p>The following uploads failed to process:</p>
{Object.entries(erroredUploads)?.map(([provider, uploads]) => {
return (
<div key={provider}>
<p className="font-semibold capitalize">{provider}</p>
{uploads?.map(({ buildCode, ciUrl, createdAt }) => {
return (
<div key={`${buildCode}-${createdAt}`} className="flex gap-1">
<p>{buildCode}</p>
{ciUrl && (
<A href={ciUrl} hook="ci job" isExternal={true}>
view CI build
</A>
)}
</div>
)
})}
</div>
)
})}
<div className="mt-4">
<p className="font-semibold">
No coverage data is available due to incomplete uploads on the first
attempt.
</p>
<p className="mb-5">
To receive coverage data, ensure your coverage data is accurate and
then open a new commit.
</p>
<p>
We recommend checking the Codecov step of this commit&apos;s CI Run to
make sure it uploaded properly and, if needed, run your CI again.
Note: this page will not reflect the latest results, even if you have
re-run all jobs successfully or have merged this commit.
</p>
</>
</div>
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,35 +37,17 @@ describe('ErroredUploads', () => {
render(<ErroredUploads erroredUploads={mockErroredUploads} />)

const message = screen.getByText(
/The following uploads failed to process:/
/No coverage data is available due to incomplete uploads on the first attempt./
)
expect(message).toBeInTheDocument()
})

it('all providers involved', () => {
render(<ErroredUploads erroredUploads={mockErroredUploads} />)

const circle = screen.getByText(/circleCI/)
expect(circle).toBeInTheDocument()

const ghActions = screen.getByText(/github actions/)
expect(ghActions).toBeInTheDocument()
})

it('build code', () => {
render(<ErroredUploads erroredUploads={mockErroredUploads} />)

const buildCode1 = screen.getByText(82364)
expect(buildCode1).toBeInTheDocument()

const buildCode2 = screen.getByText(20374)
expect(buildCode2).toBeInTheDocument()
})

it('recommendation text', () => {
render(<ErroredUploads erroredUploads={mockErroredUploads} />)

const recommendationText = screen.getByText(/We recommend checking/)
const recommendationText = screen.getByText(
/To receive coverage data, ensure your coverage data is accurate and then open a new commit./
)
expect(recommendationText).toBeInTheDocument()
})
})
Expand All @@ -75,7 +57,7 @@ describe('ErroredUploads', () => {
render(<ErroredUploads erroredUploads={{}} />)

const message = screen.queryByText(
/The following uploads failed to process:/
/No coverage data is available due to incomplete uploads on the first attempt./
)
expect(message).not.toBeInTheDocument()
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ describe('UploadsCard', () => {
it('renders the title', () => {
render(<UploadsCard />, { wrapper })

const uploads = screen.getByText(/Uploads/)
expect(uploads).toBeInTheDocument()
const covReportHistory = screen.getByText(/Coverage reports history/)
expect(covReportHistory).toBeInTheDocument()
})
it('renders different cis', () => {
render(<UploadsCard />, { wrapper })
Expand Down Expand Up @@ -237,7 +237,7 @@ describe('UploadsCard', () => {
it('renders the title', () => {
render(<UploadsCard />, { wrapper })

const uploads = screen.getByText(/Uploads/)
const uploads = screen.getByText(/Coverage reports history/)
expect(uploads).toBeInTheDocument()
})
it('renders different cis', () => {
Expand All @@ -264,7 +264,7 @@ describe('UploadsCard', () => {
it('renders the title', () => {
render(<UploadsCard />, { wrapper })

const uploads = screen.getByText(/Uploads/)
const uploads = screen.getByText(/Coverage reports history/)
expect(uploads).toBeInTheDocument()
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function UploadsCard() {
<Card className="overflow-x-hidden">
<Card.Header className="p-4">
<div className="flex justify-between">
<Card.Title size="base">Uploads</Card.Title>
<Card.Title size="base">Coverage reports history</Card.Title>
{/* @ts-expect-error */}
<A onClick={() => setShowYAMLModal(true)} hook="open yaml modal">
<span className="text-xs">view YAML file</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const CoverageMessage: React.FC = () => {
const comparison = data?.commit?.compareWithParent
const uploadErrorCount = data?.uploadErrorCount

if (uploadErrorCount && uploadErrorCount > 0) {
if (!!uploadErrorCount) {
if (uploadErrorCount === 1) {
return (
<>{uploadErrorCount} upload has failed to process &#x26A0;&#xFE0F;</>
Expand Down
Loading