@patternfly/quickstarts 6.5.0-prerelease.4 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/patternfly-docs/quick-starts/design-guidelines/design-guidelines.md +1 -1
- package/package.json +3 -7
- package/src/ConsoleShared/src/components/markdown-extensions/__tests__/MarkdownCopyClipboard.spec.tsx +25 -11
- package/src/catalog/__tests__/QuickStartCatalog.spec.tsx +31 -26
- package/src/catalog/__tests__/QuickStartTile.spec.tsx +47 -28
- package/src/catalog/__tests__/QuickStartTileDescription.spec.tsx +33 -32
- package/src/controller/__tests__/QuickStartConclusion.spec.tsx +52 -54
- package/src/controller/__tests__/QuickStartContent.spec.tsx +48 -29
- package/src/controller/__tests__/QuickStartFooter.spec.tsx +54 -70
- package/src/controller/__tests__/QuickStartTaskHeader.spec.tsx +31 -27
- package/src/controller/__tests__/QuickStartTaskReview.spec.tsx +41 -26
- package/src/controller/__tests__/QuickStartTasks.spec.tsx +55 -53
|
@@ -50,7 +50,7 @@ Quick starts are usually surfaced within a catalog as [clickable cards.](/compon
|
|
|
50
50
|
1. **Icon:** An icon associated with the quick start topic. If no specific icon exists, use the rocket icon.
|
|
51
51
|
1. **Title:** The title (or display name) that briefly identifies the function that the quick start accomplishes. Avoid using the phrase “how to,” and instead begin the title with a gerund (verbs that end in ‘ing’).
|
|
52
52
|
- Example: “Creating a Jupyter notebook”
|
|
53
|
-
1. **Labels:** [Filled labels](/components/label#filled-labels) communicate
|
|
53
|
+
1. **Labels:** [Filled labels](/components/label#filled-labels) should be placed in a card to identify quick start experiences and communicate a few high-level details, like estimated completion time and completion status. To signify that a card is linked to a quick start, use a "Quick start" [nonstatus green label](/components/label/design-guidelines#nonstatus-labels).
|
|
54
54
|
1. **Description:** A description that summarizes the quick start outcome in 4 lines or fewer, without truncating. Begin the description with an action verb.
|
|
55
55
|
- Example: “Connect to Red Hat OpenShift Streams for Apache Kafka from a Jupyter notebook.”
|
|
56
56
|
1. **Prerequisites (optional):** A bulleted list of prerequisites, displayed in a popover, which outlines permissions needed to complete the tasks, and anything that must be pre-configured before starting the quick start. Avoid phrasing prerequisites as questions. The total number of prerequisites is listed in parentheses on the quick start card.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/quickstarts",
|
|
3
|
-
"version": "6.5.0
|
|
3
|
+
"version": "6.5.0",
|
|
4
4
|
"description": "PatternFly quick starts",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"react-dom": "^17 || ^18 || ^19"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"dompurify": "^3.2
|
|
54
|
+
"dompurify": "^3.3.2",
|
|
55
55
|
"history": "^5.0.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
@@ -66,10 +66,9 @@
|
|
|
66
66
|
"@rollup/plugin-commonjs": "^17.0.0",
|
|
67
67
|
"@rollup/plugin-json": "^4.1.0",
|
|
68
68
|
"@rollup/plugin-node-resolve": "^11.1.0",
|
|
69
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
69
70
|
"@testing-library/react": "^13.4.0",
|
|
70
71
|
"@types/dompurify": "^3.0.5",
|
|
71
|
-
"@types/enzyme": "^3.10.7",
|
|
72
|
-
"@types/enzyme-adapter-react-16": "^1.0.6",
|
|
73
72
|
"@types/history": "^4.7.8",
|
|
74
73
|
"@types/node": "^14.14.35",
|
|
75
74
|
"@types/react": "^18.2.79",
|
|
@@ -77,9 +76,6 @@
|
|
|
77
76
|
"clean-css-cli": "^4.3.0",
|
|
78
77
|
"concat-files": "^0.1.1",
|
|
79
78
|
"dart-sass": "^1.25.0",
|
|
80
|
-
"enzyme": "^3.7.0",
|
|
81
|
-
"enzyme-adapter-react-16": "^1.15.5",
|
|
82
|
-
"enzyme-to-json": "^3.6.1",
|
|
83
79
|
"monaco-editor": "0.34.1",
|
|
84
80
|
"node-sass-glob-importer": "^5.3.2",
|
|
85
81
|
"prettier": "^2.8.8",
|
|
@@ -1,24 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
import {
|
|
3
|
+
QuickStartContext,
|
|
4
|
+
QuickStartContextDefaults,
|
|
5
|
+
} from '@quickstarts/utils/quick-start-context';
|
|
6
|
+
import MarkdownCopyClipboard from '../MarkdownCopyClipboard';
|
|
7
|
+
import { MARKDOWN_COPY_BUTTON_ID } from '../const';
|
|
3
8
|
import { htmlDocumentForCopyClipboard } from './test-data';
|
|
4
9
|
|
|
10
|
+
const contextValues = {
|
|
11
|
+
...QuickStartContextDefaults,
|
|
12
|
+
getResource: (key: string) => key,
|
|
13
|
+
};
|
|
14
|
+
|
|
5
15
|
describe('MarkdownCopyClipboard', () => {
|
|
6
16
|
beforeAll(() => {
|
|
7
17
|
document.body.innerHTML = htmlDocumentForCopyClipboard;
|
|
8
18
|
});
|
|
19
|
+
|
|
9
20
|
it('should render null if no element is found', () => {
|
|
10
|
-
const
|
|
11
|
-
<
|
|
21
|
+
const { container } = render(
|
|
22
|
+
<QuickStartContext.Provider value={contextValues}>
|
|
23
|
+
<MarkdownCopyClipboard docContext={document} rootSelector="#copy-markdown-3" />
|
|
24
|
+
</QuickStartContext.Provider>,
|
|
12
25
|
);
|
|
13
|
-
expect(
|
|
14
|
-
expect(wrapper.find(CopyClipboard).exists()).toBe(false);
|
|
26
|
+
expect(container.firstChild).toBeNull();
|
|
15
27
|
});
|
|
16
28
|
|
|
17
|
-
it('should render
|
|
18
|
-
|
|
19
|
-
<
|
|
29
|
+
it('should render copy targets when rootSelector matches buttons in the document', () => {
|
|
30
|
+
render(
|
|
31
|
+
<QuickStartContext.Provider value={contextValues}>
|
|
32
|
+
<MarkdownCopyClipboard docContext={document} rootSelector="#copy-markdown-1" />
|
|
33
|
+
</QuickStartContext.Provider>,
|
|
20
34
|
);
|
|
21
|
-
|
|
22
|
-
expect(
|
|
35
|
+
const elements = document.querySelectorAll(`#copy-markdown-1 [${MARKDOWN_COPY_BUTTON_ID}]`);
|
|
36
|
+
expect(elements).toHaveLength(2);
|
|
23
37
|
});
|
|
24
38
|
});
|
|
@@ -1,34 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { shallow } from 'enzyme';
|
|
3
|
-
import { EmptyBox } from '@console/internal/components/utils';
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
4
2
|
import { getQuickStarts } from '../../data/test-utils';
|
|
5
|
-
import {
|
|
3
|
+
import { QuickStartContext, QuickStartContextDefaults } from '../../utils/quick-start-context';
|
|
6
4
|
import QuickStartCatalog from '../QuickStartCatalog';
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
const contextValues = {
|
|
7
|
+
...QuickStartContextDefaults,
|
|
8
|
+
activeQuickStartID: '',
|
|
9
|
+
allQuickStartStates: {},
|
|
10
|
+
getResource: (key: string) => key,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const renderWithContext = (props: any) =>
|
|
14
|
+
render(
|
|
15
|
+
<QuickStartContext.Provider value={contextValues}>
|
|
16
|
+
<QuickStartCatalog {...props} />
|
|
17
|
+
</QuickStartContext.Provider>,
|
|
18
|
+
);
|
|
15
19
|
|
|
16
20
|
describe('QuickStartCatalog', () => {
|
|
17
|
-
it('should
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
expect(
|
|
21
|
+
it('should render an empty state if no QS exist', () => {
|
|
22
|
+
renderWithContext({ quickStarts: [] });
|
|
23
|
+
// When no quickstarts, the catalog renders no cards
|
|
24
|
+
expect(screen.queryByRole('article')).not.toBeInTheDocument();
|
|
21
25
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
|
|
27
|
+
it('should load a gallery if QS exist', async () => {
|
|
28
|
+
const quickStarts = getQuickStarts();
|
|
29
|
+
renderWithContext({ quickStarts });
|
|
30
|
+
// Each tile exposes the quick start display name as the title control (link-styled button)
|
|
31
|
+
await waitFor(() => {
|
|
32
|
+
quickStarts.forEach((qs) => {
|
|
33
|
+
expect(
|
|
34
|
+
screen.getByRole('button', { name: qs.spec.displayName }),
|
|
35
|
+
).toBeInTheDocument();
|
|
36
|
+
});
|
|
37
|
+
});
|
|
33
38
|
});
|
|
34
39
|
});
|
|
@@ -1,37 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { shallow } from 'enzyme';
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
3
2
|
import { getQuickStarts } from '../../data/test-utils';
|
|
4
3
|
import { QuickStartStatus } from '../../utils/quick-start-types';
|
|
4
|
+
import { QuickStartContext, QuickStartContextDefaults } from '../../utils/quick-start-context';
|
|
5
5
|
import QuickStartTile from '../QuickStartTile';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const contextValues = {
|
|
8
|
+
...QuickStartContextDefaults,
|
|
9
|
+
activeQuickStartID: '',
|
|
10
|
+
setActiveQuickStart: jest.fn(),
|
|
11
|
+
getResource: (key: string) => key,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const quickstarts = getQuickStarts();
|
|
9
15
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
const renderWithContext = (props: any) =>
|
|
17
|
+
render(
|
|
18
|
+
<QuickStartContext.Provider value={contextValues}>
|
|
19
|
+
<QuickStartTile {...props} />
|
|
20
|
+
</QuickStartContext.Provider>,
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
describe('QuickStartTile', () => {
|
|
24
|
+
it('should load proper catalog tile without featured property', async () => {
|
|
25
|
+
const quickStart = quickstarts[0];
|
|
26
|
+
renderWithContext({
|
|
27
|
+
quickStart,
|
|
28
|
+
status: QuickStartStatus.NOT_STARTED,
|
|
29
|
+
onClick: jest.fn(),
|
|
30
|
+
isActive: false,
|
|
31
|
+
});
|
|
32
|
+
await waitFor(() => {
|
|
33
|
+
expect(
|
|
34
|
+
screen.getByRole('button', { name: quickStart.spec.displayName }),
|
|
35
|
+
).toBeInTheDocument();
|
|
36
|
+
});
|
|
37
|
+
// Status label is omitted for not-started tiles
|
|
38
|
+
expect(screen.queryByText('In progress')).not.toBeInTheDocument();
|
|
22
39
|
});
|
|
23
40
|
|
|
24
|
-
it('should load proper catalog tile with featured property', () => {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
41
|
+
it('should load proper catalog tile with featured property', async () => {
|
|
42
|
+
const quickStart = quickstarts[1];
|
|
43
|
+
renderWithContext({
|
|
44
|
+
quickStart,
|
|
45
|
+
status: QuickStartStatus.IN_PROGRESS,
|
|
46
|
+
onClick: jest.fn(),
|
|
47
|
+
isActive: true,
|
|
48
|
+
});
|
|
49
|
+
await waitFor(() => {
|
|
50
|
+
expect(
|
|
51
|
+
screen.getByRole('button', { name: quickStart.spec.displayName }),
|
|
52
|
+
).toBeInTheDocument();
|
|
53
|
+
});
|
|
54
|
+
expect(screen.getByText('In progress')).toBeInTheDocument();
|
|
36
55
|
});
|
|
37
56
|
});
|
|
@@ -1,43 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { shallow } from 'enzyme';
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
3
2
|
import { getQuickStarts } from '../../data/test-utils';
|
|
3
|
+
import { QuickStartContext, QuickStartContextDefaults } from '../../utils/quick-start-context';
|
|
4
4
|
import QuickStartTileDescription from '../QuickStartTileDescription';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
6
|
+
const contextValues = {
|
|
7
|
+
...QuickStartContextDefaults,
|
|
8
|
+
activeQuickStartID: '',
|
|
9
|
+
startQuickStart: jest.fn(),
|
|
10
|
+
restartQuickStart: jest.fn(),
|
|
11
|
+
getResource: (key: string) => key,
|
|
12
|
+
};
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
getResource: (key) => `quickstart~${key}`,
|
|
21
|
-
});
|
|
22
|
-
});
|
|
14
|
+
const renderWithContext = (props: any) =>
|
|
15
|
+
render(
|
|
16
|
+
<QuickStartContext.Provider value={contextValues}>
|
|
17
|
+
<QuickStartTileDescription {...props} />
|
|
18
|
+
</QuickStartContext.Provider>,
|
|
19
|
+
);
|
|
23
20
|
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
describe('QuickStartTileDescription', () => {
|
|
22
|
+
it('should show prerequisites only if provided', async () => {
|
|
26
23
|
const quickStart = getQuickStarts()[0].spec;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
renderWithContext({ description: quickStart.description });
|
|
25
|
+
await waitFor(() => {
|
|
26
|
+
expect(
|
|
27
|
+
screen.queryByRole('button', { name: 'Show prerequisites' }),
|
|
28
|
+
).not.toBeInTheDocument();
|
|
29
|
+
});
|
|
31
30
|
});
|
|
32
31
|
|
|
33
|
-
it('
|
|
32
|
+
it('should render prerequisites trigger when prerequisite list is non-empty', async () => {
|
|
34
33
|
const quickStart = getQuickStarts()[2].spec;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
renderWithContext({
|
|
35
|
+
description: quickStart.description,
|
|
36
|
+
prerequisites: quickStart.prerequisites,
|
|
37
|
+
});
|
|
38
|
+
await waitFor(() => {
|
|
39
|
+
expect(
|
|
40
|
+
screen.getByRole('button', { name: 'Show prerequisites' }),
|
|
41
|
+
).toBeInTheDocument();
|
|
42
|
+
});
|
|
42
43
|
});
|
|
43
44
|
});
|
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Button } from '@patternfly/react-core';
|
|
3
|
-
import { ShallowWrapper, shallow } from 'enzyme';
|
|
1
|
+
import { render, waitFor } from '@testing-library/react';
|
|
4
2
|
import { allQuickStarts } from '../../data/quick-start-test-data';
|
|
5
|
-
import QuickStartMarkdownView from '../../QuickStartMarkdownView';
|
|
6
3
|
import { QuickStartTaskStatus } from '../../utils/quick-start-types';
|
|
4
|
+
import { QuickStartContext, QuickStartContextDefaults } from '../../utils/quick-start-context';
|
|
7
5
|
import { getQuickStartByName } from '../../utils/quick-start-utils';
|
|
8
6
|
import QuickStartConclusion from '../QuickStartConclusion';
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const i18nNS = 'quickstart';
|
|
8
|
+
const contextValues = {
|
|
9
|
+
...QuickStartContextDefaults,
|
|
10
|
+
activeQuickStartID: '',
|
|
11
|
+
startQuickStart: jest.fn(),
|
|
12
|
+
restartQuickStart: jest.fn(),
|
|
13
|
+
getResource: (key: string) => key,
|
|
14
|
+
};
|
|
19
15
|
|
|
20
|
-
|
|
21
|
-
let wrapper: ShallowWrapper<QuickStartConclusionProps>;
|
|
22
|
-
const props: QuickStartConclusionProps = {
|
|
16
|
+
const defaultProps = {
|
|
23
17
|
tasks: getQuickStartByName('explore-pipelines', allQuickStarts).spec.tasks,
|
|
24
18
|
allTaskStatuses: [
|
|
25
19
|
QuickStartTaskStatus.SUCCESS,
|
|
@@ -31,52 +25,56 @@ const props: QuickStartConclusionProps = {
|
|
|
31
25
|
onQuickStartChange: jest.fn(),
|
|
32
26
|
};
|
|
33
27
|
|
|
34
|
-
|
|
28
|
+
const renderWithContext = (props = {}) =>
|
|
29
|
+
render(
|
|
30
|
+
<QuickStartContext.Provider value={contextValues}>
|
|
31
|
+
<QuickStartConclusion {...defaultProps} {...props} />
|
|
32
|
+
</QuickStartContext.Provider>,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
describe('QuickStartConclusion', () => {
|
|
35
36
|
beforeEach(() => {
|
|
36
|
-
|
|
37
|
-
activeQuickStartID: '',
|
|
38
|
-
startQuickStart: () => {},
|
|
39
|
-
restartQuickStart: () => {},
|
|
40
|
-
getResource: (key) => `quickstart~${key}`,
|
|
41
|
-
});
|
|
42
|
-
wrapper = shallow(<QuickStartConclusion {...props} />);
|
|
37
|
+
jest.clearAllMocks();
|
|
43
38
|
});
|
|
44
39
|
|
|
45
|
-
it('should render conclusion if there are no failed tasks', () => {
|
|
46
|
-
|
|
40
|
+
it('should render conclusion if there are no failed tasks', async () => {
|
|
41
|
+
renderWithContext();
|
|
42
|
+
await waitFor(() => {
|
|
43
|
+
expect(document.body.textContent).toMatch(/conclusion/);
|
|
44
|
+
});
|
|
47
45
|
});
|
|
48
46
|
|
|
49
|
-
it('should render link for next quick start if nextQuickStart prop is available and there are no failed tasks', () => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
);
|
|
47
|
+
it('should render link for next quick start if nextQuickStart prop is available and there are no failed tasks', async () => {
|
|
48
|
+
renderWithContext({
|
|
49
|
+
nextQuickStarts: [getQuickStartByName('explore-pipelines', allQuickStarts)],
|
|
50
|
+
});
|
|
51
|
+
await waitFor(() => {
|
|
52
|
+
expect(document.body.textContent).toMatch(
|
|
53
|
+
/Start Installing the Pipelines Operator quick start/,
|
|
54
|
+
);
|
|
55
|
+
});
|
|
59
56
|
});
|
|
60
57
|
|
|
61
|
-
it('should not render link for next quick start if nextQuickStart props is not available', () => {
|
|
62
|
-
|
|
58
|
+
it('should not render link for next quick start if nextQuickStart props is not available', async () => {
|
|
59
|
+
renderWithContext();
|
|
60
|
+
await waitFor(() => {
|
|
61
|
+
expect(document.body.textContent).toMatch(/conclusion/);
|
|
62
|
+
});
|
|
63
|
+
expect(document.body.textContent).not.toMatch(/Start .* quick start/);
|
|
63
64
|
});
|
|
64
65
|
|
|
65
|
-
it('should not render conclusion
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
);
|
|
77
|
-
expect(
|
|
78
|
-
`${i18nNS}~One or more verifications did not pass during this quick start. Revisit the tasks or the help links, and then try again.`,
|
|
79
|
-
);
|
|
80
|
-
expect(wrapper.find(Button).length).toBe(0);
|
|
66
|
+
it('should not render conclusion and should render message for retrying if there are failed tasks', async () => {
|
|
67
|
+
renderWithContext({
|
|
68
|
+
nextQuickStarts: [getQuickStartByName('explore-pipelines', allQuickStarts)],
|
|
69
|
+
allTaskStatuses: [
|
|
70
|
+
QuickStartTaskStatus.FAILED,
|
|
71
|
+
QuickStartTaskStatus.SUCCESS,
|
|
72
|
+
QuickStartTaskStatus.SUCCESS,
|
|
73
|
+
],
|
|
74
|
+
});
|
|
75
|
+
await waitFor(() => {
|
|
76
|
+
expect(document.body.textContent).toMatch(/One or more verifications did not pass/);
|
|
77
|
+
});
|
|
78
|
+
expect(document.body.textContent).not.toMatch(/Start .* quick start/);
|
|
81
79
|
});
|
|
82
80
|
});
|
|
@@ -1,52 +1,71 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ShallowWrapper, shallow } from 'enzyme';
|
|
1
|
+
import { render, waitFor } from '@testing-library/react';
|
|
3
2
|
import { allQuickStarts } from '../../data/quick-start-test-data';
|
|
4
3
|
import { QuickStartTaskStatus } from '../../utils/quick-start-types';
|
|
4
|
+
import { QuickStartContext, QuickStartContextDefaults } from '../../utils/quick-start-context';
|
|
5
5
|
import { getQuickStartByName } from '../../utils/quick-start-utils';
|
|
6
|
-
import QuickStartConclusion from '../QuickStartConclusion';
|
|
7
6
|
import QuickStartContent from '../QuickStartContent';
|
|
8
|
-
import QuickStartIntroduction from '../QuickStartIntroduction';
|
|
9
|
-
import QuickStartTasks from '../QuickStartTasks';
|
|
10
7
|
|
|
11
|
-
|
|
8
|
+
const contextValues = {
|
|
9
|
+
...QuickStartContextDefaults,
|
|
10
|
+
getResource: (key: string) => key,
|
|
11
|
+
};
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
const quickStart = getQuickStartByName('explore-serverless', allQuickStarts);
|
|
14
|
+
const totalTasks = quickStart.spec.tasks.length;
|
|
14
15
|
|
|
15
|
-
const
|
|
16
|
-
quickStart
|
|
17
|
-
allTaskStatuses: [
|
|
18
|
-
QuickStartTaskStatus.INIT,
|
|
19
|
-
QuickStartTaskStatus.INIT,
|
|
20
|
-
QuickStartTaskStatus.INIT,
|
|
21
|
-
],
|
|
16
|
+
const defaultProps = {
|
|
17
|
+
quickStart,
|
|
18
|
+
allTaskStatuses: [QuickStartTaskStatus.INIT, QuickStartTaskStatus.INIT],
|
|
22
19
|
taskNumber: -1,
|
|
23
20
|
onTaskReview: jest.fn(),
|
|
24
21
|
onTaskSelect: jest.fn(),
|
|
25
22
|
onQuickStartChange: jest.fn(),
|
|
26
23
|
};
|
|
27
24
|
|
|
25
|
+
const renderWithContext = (props = {}) =>
|
|
26
|
+
render(
|
|
27
|
+
<QuickStartContext.Provider value={contextValues}>
|
|
28
|
+
<QuickStartContent {...defaultProps} {...props} />
|
|
29
|
+
</QuickStartContext.Provider>,
|
|
30
|
+
);
|
|
31
|
+
|
|
28
32
|
describe('QuickStartContent', () => {
|
|
29
33
|
beforeEach(() => {
|
|
30
|
-
|
|
34
|
+
jest.clearAllMocks();
|
|
31
35
|
});
|
|
32
36
|
|
|
33
|
-
it('should render QuickStartIntroduction when the tour status is Not Started', () => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
it('should render QuickStartIntroduction when the tour status is Not Started', async () => {
|
|
38
|
+
renderWithContext();
|
|
39
|
+
await waitFor(() => {
|
|
40
|
+
expect(document.body.textContent).toMatch(
|
|
41
|
+
new RegExp(`In this quick start, you will complete ${totalTasks} task`),
|
|
42
|
+
);
|
|
43
|
+
});
|
|
44
|
+
expect(document.body.textContent).not.toMatch(/Your Serverless Operator is ready/);
|
|
37
45
|
});
|
|
38
46
|
|
|
39
|
-
it('should render QuickStartTasks when the tour is In Progress', () => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
it('should render QuickStartTasks when the tour is In Progress', async () => {
|
|
48
|
+
// taskNumber is 0-based index into spec.tasks; first task visible and active when non-INIT
|
|
49
|
+
renderWithContext({
|
|
50
|
+
taskNumber: 0,
|
|
51
|
+
allTaskStatuses: [QuickStartTaskStatus.VISITED, QuickStartTaskStatus.INIT],
|
|
52
|
+
});
|
|
53
|
+
await waitFor(() => {
|
|
54
|
+
expect(document.body.textContent).toMatch(/Install the OpenShift Serverless Operator/);
|
|
55
|
+
});
|
|
56
|
+
expect(document.body.textContent).not.toMatch(
|
|
57
|
+
new RegExp(`In this quick start, you will complete ${totalTasks} task`),
|
|
58
|
+
);
|
|
44
59
|
});
|
|
45
60
|
|
|
46
|
-
it('should render QuickStartConclusion when the tour is Complete', () => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
61
|
+
it('should render QuickStartConclusion when the tour is Complete', async () => {
|
|
62
|
+
renderWithContext({ taskNumber: totalTasks });
|
|
63
|
+
await waitFor(() => {
|
|
64
|
+
expect(document.body.textContent).toMatch(/Your Serverless Operator is ready/);
|
|
65
|
+
});
|
|
66
|
+
// Conclusion still lists task headers; intro copy is not shown
|
|
67
|
+
expect(document.body.textContent).not.toMatch(
|
|
68
|
+
/In this quick start, you will complete \d+ task/,
|
|
69
|
+
);
|
|
51
70
|
});
|
|
52
71
|
});
|
|
@@ -1,103 +1,87 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Button } from '@patternfly/react-core';
|
|
3
|
-
import { shallow } from 'enzyme';
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
4
2
|
import { QuickStartStatus } from '../../utils/quick-start-types';
|
|
3
|
+
import { QuickStartContext, QuickStartContextDefaults } from '../../utils/quick-start-context';
|
|
5
4
|
import QuickStartFooter from '../QuickStartFooter';
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
6
|
+
const contextValues = {
|
|
7
|
+
...QuickStartContextDefaults,
|
|
8
|
+
activeQuickStartID: '',
|
|
9
|
+
startQuickStart: jest.fn(),
|
|
10
|
+
restartQuickStart: jest.fn(),
|
|
11
|
+
getResource: (key: string) => key,
|
|
12
|
+
};
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
startQuickStart: () => {},
|
|
22
|
-
restartQuickStart: () => {},
|
|
23
|
-
getResource: (key) => `quickstart~${key}`,
|
|
24
|
-
});
|
|
25
|
-
});
|
|
14
|
+
const renderWithContext = (props: any) =>
|
|
15
|
+
render(
|
|
16
|
+
<QuickStartContext.Provider value={contextValues}>
|
|
17
|
+
<QuickStartFooter {...props} />
|
|
18
|
+
</QuickStartContext.Provider>,
|
|
19
|
+
);
|
|
26
20
|
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
describe('QuickStartFooter', () => {
|
|
22
|
+
it('should load Start button for not started tours', async () => {
|
|
23
|
+
renderWithContext({
|
|
29
24
|
status: QuickStartStatus.NOT_STARTED,
|
|
30
25
|
footerClass: 'test',
|
|
31
26
|
quickStartId: 'test-quickstart',
|
|
32
|
-
onNext: ()
|
|
33
|
-
onBack: ()
|
|
27
|
+
onNext: jest.fn(),
|
|
28
|
+
onBack: jest.fn(),
|
|
34
29
|
totalTasks: 4,
|
|
35
30
|
taskNumber: -1,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
expect(
|
|
41
|
-
expect(footerButtons.length).toEqual(1);
|
|
42
|
-
expect(footerButtons.at(0).childAt(0).text()).toBe('quickstart~Start');
|
|
31
|
+
});
|
|
32
|
+
await waitFor(() => {
|
|
33
|
+
expect(screen.getByRole('button', { name: 'Start' })).toBeInTheDocument();
|
|
34
|
+
});
|
|
35
|
+
expect(screen.queryByRole('button', { name: 'Back' })).not.toBeInTheDocument();
|
|
43
36
|
});
|
|
44
37
|
|
|
45
|
-
it('should load Continue and Restart buttons for in progress tours at
|
|
46
|
-
|
|
38
|
+
it('should load Continue and Restart buttons for in progress tours at intro page', async () => {
|
|
39
|
+
renderWithContext({
|
|
47
40
|
status: QuickStartStatus.IN_PROGRESS,
|
|
48
41
|
footerClass: 'test',
|
|
49
42
|
quickStartId: 'test-quickstart',
|
|
50
|
-
onNext: ()
|
|
51
|
-
onBack: ()
|
|
43
|
+
onNext: jest.fn(),
|
|
44
|
+
onBack: jest.fn(),
|
|
52
45
|
totalTasks: 4,
|
|
53
46
|
taskNumber: -1,
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
expect(
|
|
59
|
-
expect(footerButtons.length).toEqual(2);
|
|
60
|
-
expect(footerButtons.at(0).childAt(0).text()).toBe('quickstart~Continue');
|
|
61
|
-
expect(footerButtons.at(1).childAt(0).text()).toBe('quickstart~Restart');
|
|
47
|
+
});
|
|
48
|
+
await waitFor(() => {
|
|
49
|
+
expect(screen.getByRole('button', { name: 'Continue' })).toBeInTheDocument();
|
|
50
|
+
});
|
|
51
|
+
expect(screen.getByRole('button', { name: 'Restart' })).toBeInTheDocument();
|
|
62
52
|
});
|
|
63
53
|
|
|
64
|
-
it('should load Next
|
|
65
|
-
|
|
54
|
+
it('should load Next, Back, and Restart buttons for in progress tours in task page', async () => {
|
|
55
|
+
renderWithContext({
|
|
66
56
|
status: QuickStartStatus.IN_PROGRESS,
|
|
67
57
|
footerClass: 'test',
|
|
68
58
|
quickStartId: 'test-quickstart',
|
|
69
|
-
onNext: ()
|
|
70
|
-
onBack: ()
|
|
59
|
+
onNext: jest.fn(),
|
|
60
|
+
onBack: jest.fn(),
|
|
71
61
|
totalTasks: 4,
|
|
72
62
|
taskNumber: 2,
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
expect(
|
|
78
|
-
expect(
|
|
79
|
-
expect(footerButtons.at(0).childAt(0).text()).toBe('quickstart~Next');
|
|
80
|
-
expect(footerButtons.at(1).childAt(0).text()).toBe('quickstart~Back');
|
|
81
|
-
expect(footerButtons.at(2).childAt(0).text()).toBe('quickstart~Restart');
|
|
63
|
+
});
|
|
64
|
+
await waitFor(() => {
|
|
65
|
+
expect(screen.getByRole('button', { name: 'Next' })).toBeInTheDocument();
|
|
66
|
+
});
|
|
67
|
+
expect(screen.getByRole('button', { name: 'Back' })).toBeInTheDocument();
|
|
68
|
+
expect(screen.getByRole('button', { name: 'Restart' })).toBeInTheDocument();
|
|
82
69
|
});
|
|
83
70
|
|
|
84
|
-
it('should load Close, Back and Restart buttons for completed tours in conclusion page', () => {
|
|
85
|
-
|
|
71
|
+
it('should load Close, Back and Restart buttons for completed tours in conclusion page', async () => {
|
|
72
|
+
renderWithContext({
|
|
86
73
|
status: QuickStartStatus.COMPLETE,
|
|
87
74
|
footerClass: 'test',
|
|
88
75
|
quickStartId: 'test-quickstart',
|
|
89
|
-
onNext: ()
|
|
90
|
-
onBack: ()
|
|
76
|
+
onNext: jest.fn(),
|
|
77
|
+
onBack: jest.fn(),
|
|
91
78
|
totalTasks: 4,
|
|
92
79
|
taskNumber: 4,
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
expect(
|
|
98
|
-
expect(
|
|
99
|
-
expect(footerButtons.at(0).childAt(0).text()).toBe('quickstart~Close');
|
|
100
|
-
expect(footerButtons.at(1).childAt(0).text()).toBe('quickstart~Back');
|
|
101
|
-
expect(footerButtons.at(2).childAt(0).text()).toBe('quickstart~Restart');
|
|
80
|
+
});
|
|
81
|
+
await waitFor(() => {
|
|
82
|
+
expect(screen.getByRole('button', { name: 'Close' })).toBeInTheDocument();
|
|
83
|
+
});
|
|
84
|
+
expect(screen.getByRole('button', { name: 'Back' })).toBeInTheDocument();
|
|
85
|
+
expect(screen.getByRole('button', { name: 'Restart' })).toBeInTheDocument();
|
|
102
86
|
});
|
|
103
87
|
});
|
|
@@ -1,43 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Title, WizardNavItem } from '@patternfly/react-core';
|
|
3
|
-
import { ShallowWrapper, shallow } from 'enzyme';
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
4
2
|
import { QuickStartTaskStatus } from '../../utils/quick-start-types';
|
|
3
|
+
import { QuickStartContext, QuickStartContextDefaults } from '../../utils/quick-start-context';
|
|
5
4
|
import QuickStartTaskHeader from '../QuickStartTaskHeader';
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const contextValues = {
|
|
7
|
+
...QuickStartContextDefaults,
|
|
8
|
+
getResource: (key: string) => key,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const defaultProps = {
|
|
10
12
|
title: 'title',
|
|
11
13
|
taskIndex: 1,
|
|
12
14
|
subtitle: 'subtitle',
|
|
13
15
|
taskStatus: QuickStartTaskStatus.INIT,
|
|
14
|
-
size: 'lg',
|
|
16
|
+
size: 'lg' as const,
|
|
15
17
|
isActiveTask: true,
|
|
16
18
|
onTaskSelect: jest.fn(),
|
|
17
19
|
};
|
|
18
20
|
|
|
21
|
+
const renderWithContext = (props = {}) =>
|
|
22
|
+
render(
|
|
23
|
+
<QuickStartContext.Provider value={contextValues}>
|
|
24
|
+
<QuickStartTaskHeader {...defaultProps} {...props} />
|
|
25
|
+
</QuickStartContext.Provider>,
|
|
26
|
+
);
|
|
27
|
+
|
|
19
28
|
describe('QuickStartTaskHeader', () => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
29
|
+
it('should render subtitle for active task', async () => {
|
|
30
|
+
renderWithContext();
|
|
31
|
+
await waitFor(() => {
|
|
32
|
+
expect(
|
|
33
|
+
screen.getByRole('button', {
|
|
34
|
+
name: new RegExp(`${defaultProps.title}.*${defaultProps.subtitle}`),
|
|
35
|
+
}),
|
|
36
|
+
).toBeInTheDocument();
|
|
37
|
+
});
|
|
23
38
|
});
|
|
24
39
|
|
|
25
|
-
it('should render subtitle
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
32
|
-
it('should not render subtitle if task is not active', () => {
|
|
33
|
-
wrapper = shallow(<QuickStartTaskHeader {...props} isActiveTask={false} />);
|
|
34
|
-
expect(wrapper.find(WizardNavItem).dive().find(Title).length).toBe(1);
|
|
35
|
-
expect(
|
|
36
|
-
wrapper
|
|
37
|
-
.find(WizardNavItem)
|
|
38
|
-
.dive()
|
|
39
|
-
.find('[data-test-id="quick-start-task-subtitle"]')
|
|
40
|
-
.exists(),
|
|
41
|
-
).toBe(false);
|
|
40
|
+
it('should not render subtitle if task is not active', async () => {
|
|
41
|
+
renderWithContext({ isActiveTask: false });
|
|
42
|
+
await waitFor(() => {
|
|
43
|
+
expect(screen.getByRole('button', { name: defaultProps.title })).toBeInTheDocument();
|
|
44
|
+
});
|
|
45
|
+
expect(screen.queryByText(defaultProps.subtitle)).not.toBeInTheDocument();
|
|
42
46
|
});
|
|
43
47
|
});
|
|
@@ -1,42 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ShallowWrapper, shallow } from 'enzyme';
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
3
2
|
import { allQuickStarts } from '../../data/quick-start-test-data';
|
|
4
|
-
import QuickStartMarkdownView from '../../QuickStartMarkdownView';
|
|
5
3
|
import { QuickStartTaskStatus } from '../../utils/quick-start-types';
|
|
4
|
+
import { QuickStartContext, QuickStartContextDefaults } from '../../utils/quick-start-context';
|
|
6
5
|
import { getQuickStartByName } from '../../utils/quick-start-utils';
|
|
7
6
|
import QuickStartTaskReview from '../QuickStartTaskReview';
|
|
8
|
-
import { ComponentProps } from 'react';
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
const contextValues = {
|
|
9
|
+
...QuickStartContextDefaults,
|
|
10
|
+
getResource: (key: string) => key,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const review = getQuickStartByName('explore-serverless', allQuickStarts).spec.tasks[0].review;
|
|
14
|
+
|
|
15
|
+
const defaultProps = {
|
|
16
|
+
review,
|
|
14
17
|
taskStatus: QuickStartTaskStatus.REVIEW,
|
|
15
18
|
onTaskReview: jest.fn(),
|
|
16
19
|
};
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const renderWithContext = (props = {}) =>
|
|
22
|
+
render(
|
|
23
|
+
<QuickStartContext.Provider value={contextValues}>
|
|
24
|
+
<QuickStartTaskReview {...defaultProps} {...props} />
|
|
25
|
+
</QuickStartContext.Provider>,
|
|
26
|
+
);
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
describe('QuickStartTaskReview', () => {
|
|
29
|
+
it('should render review prompt with yes/no while task is in review', async () => {
|
|
30
|
+
renderWithContext();
|
|
31
|
+
await waitFor(() => {
|
|
32
|
+
expect(screen.getByRole('alert')).toBeInTheDocument();
|
|
33
|
+
});
|
|
34
|
+
expect(screen.getByText('Check your work')).toBeInTheDocument();
|
|
35
|
+
expect(screen.getByRole('radio', { name: 'Yes' })).not.toBeChecked();
|
|
36
|
+
expect(screen.getByRole('radio', { name: 'No' })).not.toBeChecked();
|
|
28
37
|
});
|
|
29
38
|
|
|
30
|
-
it('should
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
39
|
+
it('should mark Yes selected when task status is success', async () => {
|
|
40
|
+
renderWithContext({ taskStatus: QuickStartTaskStatus.SUCCESS });
|
|
41
|
+
await waitFor(() => {
|
|
42
|
+
expect(screen.getByRole('radio', { name: 'Yes' })).toBeChecked();
|
|
43
|
+
});
|
|
44
|
+
expect(screen.getByRole('radio', { name: 'No' })).not.toBeChecked();
|
|
34
45
|
});
|
|
35
46
|
|
|
36
|
-
it('should
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
);
|
|
47
|
+
it('should mark No selected and show failed-task help when task status is failed', async () => {
|
|
48
|
+
renderWithContext({ taskStatus: QuickStartTaskStatus.FAILED });
|
|
49
|
+
await waitFor(() => {
|
|
50
|
+
expect(screen.getByRole('radio', { name: 'No' })).toBeChecked();
|
|
51
|
+
});
|
|
52
|
+
expect(screen.getByRole('radio', { name: 'Yes' })).not.toBeChecked();
|
|
53
|
+
await waitFor(() => {
|
|
54
|
+
expect(document.body.textContent).toMatch(/This task is incomplete/);
|
|
55
|
+
});
|
|
41
56
|
});
|
|
42
57
|
});
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ShallowWrapper, shallow } from 'enzyme';
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
3
2
|
import { allQuickStarts } from '../../data/quick-start-test-data';
|
|
4
|
-
import QuickStartMarkdownView from '../../QuickStartMarkdownView';
|
|
5
3
|
import { QuickStartTaskStatus } from '../../utils/quick-start-types';
|
|
4
|
+
import { QuickStartContext, QuickStartContextDefaults } from '../../utils/quick-start-context';
|
|
6
5
|
import { getQuickStartByName } from '../../utils/quick-start-utils';
|
|
7
|
-
import
|
|
8
|
-
import QuickStartTaskReview from '../QuickStartTaskReview';
|
|
9
|
-
import QuickStartTask from '../QuickStartTasks';
|
|
6
|
+
import QuickStartTasks from '../QuickStartTasks';
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
8
|
+
const contextValues = {
|
|
9
|
+
...QuickStartContextDefaults,
|
|
10
|
+
activeQuickStartID: '',
|
|
11
|
+
startQuickStart: jest.fn(),
|
|
12
|
+
restartQuickStart: jest.fn(),
|
|
13
|
+
getResource: (key: string) => key,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const tasks = getQuickStartByName('monitor-sampleapp', allQuickStarts).spec.tasks;
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const props: QuickStartTaskProps = {
|
|
22
|
-
tasks: getQuickStartByName('monitor-sampleapp', allQuickStarts).spec.tasks,
|
|
18
|
+
const defaultProps = {
|
|
19
|
+
tasks,
|
|
23
20
|
allTaskStatuses: [
|
|
24
21
|
QuickStartTaskStatus.SUCCESS,
|
|
25
22
|
QuickStartTaskStatus.INIT,
|
|
@@ -30,49 +27,54 @@ const props: QuickStartTaskProps = {
|
|
|
30
27
|
onTaskSelect: jest.fn(),
|
|
31
28
|
};
|
|
32
29
|
|
|
30
|
+
const renderWithContext = (props = {}) =>
|
|
31
|
+
render(
|
|
32
|
+
<QuickStartContext.Provider value={contextValues}>
|
|
33
|
+
<QuickStartTasks {...defaultProps} {...props} />
|
|
34
|
+
</QuickStartContext.Provider>,
|
|
35
|
+
);
|
|
36
|
+
|
|
33
37
|
describe('QuickStartTasks', () => {
|
|
34
38
|
beforeEach(() => {
|
|
35
|
-
|
|
36
|
-
activeQuickStartID: '',
|
|
37
|
-
startQuickStart: () => {},
|
|
38
|
-
restartQuickStart: () => {},
|
|
39
|
-
getResource: (key) => `quickstart~${key}`,
|
|
40
|
-
});
|
|
41
|
-
wrapper = shallow(<QuickStartTask {...props} />);
|
|
39
|
+
jest.clearAllMocks();
|
|
42
40
|
});
|
|
43
41
|
|
|
44
|
-
it('should render correct number of tasks based on currentTaskIndex', () => {
|
|
45
|
-
|
|
42
|
+
it('should render correct number of tasks based on currentTaskIndex', async () => {
|
|
43
|
+
renderWithContext();
|
|
44
|
+
await waitFor(() => {
|
|
45
|
+
// Only non-INIT tasks are rendered; first task is SUCCESS so it shows
|
|
46
|
+
const taskHeaders = screen.getAllByRole('listitem');
|
|
47
|
+
expect(taskHeaders).toHaveLength(1);
|
|
48
|
+
});
|
|
46
49
|
});
|
|
47
50
|
|
|
48
|
-
it('should render
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
);
|
|
51
|
+
it('should render description if a task is active', async () => {
|
|
52
|
+
renderWithContext({
|
|
53
|
+
allTaskStatuses: [
|
|
54
|
+
QuickStartTaskStatus.SUCCESS,
|
|
55
|
+
QuickStartTaskStatus.FAILED,
|
|
56
|
+
QuickStartTaskStatus.VISITED,
|
|
57
|
+
],
|
|
58
|
+
taskNumber: 2,
|
|
59
|
+
});
|
|
60
|
+
await waitFor(() => {
|
|
61
|
+
// All 3 tasks are non-INIT, so all render
|
|
62
|
+
const taskHeaders = screen.getAllByRole('listitem');
|
|
63
|
+
expect(taskHeaders).toHaveLength(3);
|
|
64
|
+
});
|
|
63
65
|
});
|
|
64
66
|
|
|
65
|
-
it('should render review when task is active and in Review state', () => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
it('should render review when task is active and in Review state', async () => {
|
|
68
|
+
renderWithContext({
|
|
69
|
+
allTaskStatuses: [
|
|
70
|
+
QuickStartTaskStatus.SUCCESS,
|
|
71
|
+
QuickStartTaskStatus.REVIEW,
|
|
72
|
+
QuickStartTaskStatus.INIT,
|
|
73
|
+
],
|
|
74
|
+
});
|
|
75
|
+
await waitFor(() => {
|
|
76
|
+
// "Check your work" is the alert title for QuickStartTaskReview
|
|
77
|
+
expect(screen.getByText('Check your work')).toBeInTheDocument();
|
|
78
|
+
});
|
|
77
79
|
});
|
|
78
80
|
});
|