Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | 1x 1x 1x 1x 1x 1x 1x 1x 10x 10x 10x 7000x 30000x 820x | /*
* Copyright 2021 Harness Inc. All rights reserved.
* Use of this source code is governed by the PolyForm Shield 1.0.0 license
* that can be found in the licenses directory at the root of this repository, also available at
* https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt.
*/
import React from 'react'
import cx from 'classnames'
import { Heading, Text, Container, HarnessDocTooltip } from '@wings-software/uicore'
import { Color } from '@harness/design-system'
import { useStrings } from 'framework/strings'
import css from './BuildTests.module.scss'
interface TestsExecutionResultProps {
totalTests: number
failedTests: number
successfulTests: number
skippedTests: number
}
const NUMBER_OF_ITEMS_TO_FILL_THE_SPACE = 330
export function TestsExecutionResult({
totalTests,
failedTests,
successfulTests,
skippedTests
}: TestsExecutionResultProps): React.ReactElement {
const { getString } = useStrings()
const amountOfEmptyItemsToRender = NUMBER_OF_ITEMS_TO_FILL_THE_SPACE - totalTests
return (
<div className={cx(css.widgetWrapper, css.executionResult)}>
<Container flex={{ justifyContent: 'flex-start' }} margin={{ bottom: 'xsmall' }}>
<Heading
data-name="test-execution-result-label"
level={6}
style={{ fontWeight: 600, marginBottom: 'var(--spacing-3)' }}
color={Color.GREY_600}
>
{getString('pipeline.testsReports.resultLabel')}
<HarnessDocTooltip tooltipId="testExecutionResult" useStandAlone={true} />
</Heading>
</Container>
<Container className={css.widget} height="100%" padding="medium">
<Container flex margin={{ bottom: 'small' }}>
<Text font={{ weight: 'semi-bold' }} style={{ fontSize: 10 }}>
{getString('pipeline.testsReports.totalWithColon')} {totalTests} |{' '}
{getString('pipeline.testsReports.failedWithColon')} {failedTests} |{' '}
{getString('pipeline.testsReports.successWithColon')} {successfulTests}{' '}
{skippedTests ? `| ${getString('pipeline.testsReports.skippedWithColon')} ${skippedTests}` : null}
</Text>
<Container flex>
<Text
font={{ weight: 'semi-bold' }}
icon="stop"
iconProps={{ size: 16, style: { color: '#DA291D' } }}
margin={{ right: 'xsmall' }}
style={{ fontSize: 10 }}
>
{getString('failed')}
</Text>
<Text
font={{ weight: 'semi-bold' }}
icon="stop"
iconProps={{ size: 16, style: { color: '#6BD167' } }}
margin={{ right: 'xsmall' }}
style={{ fontSize: 10 }}
>
{getString('passed')}
</Text>
{skippedTests ? (
<Text
font={{ weight: 'semi-bold' }}
icon="stop"
iconProps={{ size: 16, color: Color.GREY_300 }}
style={{ fontSize: 10 }}
>
{getString('pipeline.testsReports.skipped')}
</Text>
) : null}
</Container>
</Container>
<Container className={css.graphContainer}>
<ul className={css.graph}>
{Array.from(Array(failedTests)).map((_, index) => (
<li key={index} data-status="failed"></li>
))}
{Array.from(Array(successfulTests)).map((_, index) => (
<li key={index}></li>
))}
{Array.from(Array(skippedTests)).map((_, index) => (
<li key={index} data-status="skipped"></li>
))}
{amountOfEmptyItemsToRender > -1 &&
// eslint-disable-next-line prefer-spread
Array.apply(null, Array(amountOfEmptyItemsToRender)).map((_item, index) => (
<li data-status={'empty'} key={index} />
))}
</ul>
</Container>
</Container>
</div>
)
}
|