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

Bug 1873230: show message for retrying in conclusion if there are failed tasks #6465

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const QuickStartConclusion: React.FC<QuickStartConclusionProps> = ({
onQuickStartChange,
onTaskSelect,
}) => {
const hasFailedTask = allTaskStatuses.includes(QuickStartTaskStatus.FAILED);
return (
<>
{tasks.map((task, index) => (
Expand All @@ -34,8 +35,14 @@ const QuickStartConclusion: React.FC<QuickStartConclusionProps> = ({
onTaskSelect={onTaskSelect}
/>
))}
<SyncMarkdownView content={conclusion} />
{nextQuickStart && (
<SyncMarkdownView
content={
hasFailedTask
? 'One or more verifications did not pass during this quick start. Revisit the tasks or the help links, and then try again.'
: conclusion
}
/>
{nextQuickStart && !hasFailedTask && (
<Button variant="link" onClick={() => onQuickStartChange(nextQuickStart)} isInline>
{`Start ${nextQuickStart} quick start`}{' '}
<ArrowRightIcon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import { Button } from '@patternfly/react-core';
import { getQuickStartByName } from '../../utils/quick-start-utils';
import { QuickStartTaskStatus } from '../../utils/quick-start-types';
import QuickStartConclusion from '../QuickStartConclusion';
import { SyncMarkdownView } from '@console/internal/components/markdown-view';

type QuickStartConclusionProps = React.ComponentProps<typeof QuickStartConclusion>;
let wrapper: ShallowWrapper<QuickStartConclusionProps>;
const props: QuickStartConclusionProps = {
tasks: getQuickStartByName('explore-serverless').spec.tasks,
allTaskStatuses: [
QuickStartTaskStatus.INIT,
QuickStartTaskStatus.INIT,
QuickStartTaskStatus.INIT,
QuickStartTaskStatus.SUCCESS,
QuickStartTaskStatus.SUCCESS,
QuickStartTaskStatus.SUCCESS,
],
conclusion: 'conclusion',
onTaskSelect: jest.fn(),
Expand All @@ -24,11 +25,16 @@ describe('QuickStartConclusion', () => {
wrapper = shallow(<QuickStartConclusion {...props} />);
});

it('should not render link for next quick start if nextQuickStart props is available', () => {
expect(wrapper.find(Button).length).toBe(0);
it('should render conclusion if there are no failed tasks', () => {
expect(
wrapper
.find(SyncMarkdownView)
.first()
.props().content,
).toEqual('conclusion');
});

it('should render link for next quick start if nextQuickStart props is available', () => {
it('should render link for next quick start if nextQuickStart prop is available and there are no failed tasks', () => {
wrapper = shallow(<QuickStartConclusion {...props} nextQuickStart="Serverless Application" />);
expect(
wrapper
Expand All @@ -37,4 +43,31 @@ describe('QuickStartConclusion', () => {
.props().children[0],
).toEqual('Start Serverless Application quick start');
});

it('should not render link for next quick start if nextQuickStart props is not available', () => {
expect(wrapper.find(Button).length).toBe(0);
});

it('should not render conclusion, link for next quick start and should render message for retrying if there are failed tasks', () => {
wrapper = shallow(
<QuickStartConclusion
{...props}
nextQuickStart="Serverless Application"
allTaskStatuses={[
QuickStartTaskStatus.FAILED,
QuickStartTaskStatus.SUCCESS,
QuickStartTaskStatus.SUCCESS,
]}
/>,
);
expect(
wrapper
.find(SyncMarkdownView)
.first()
.props().content,
).toEqual(
'One or more verifications did not pass during this quick start. Revisit the tasks or the help links, and then try again.',
);
expect(wrapper.find(Button).length).toBe(0);
});
});