Skip to content

Commit adb4bc0

Browse files
committed
merge: Merge branch 'ESAS/implement_search_in_scenario_selector_PROD-13594'
2 parents 16bfac0 + 0a4a91a commit adb4bc0

File tree

5 files changed

+192
-16
lines changed

5 files changed

+192
-16
lines changed

cypress/commons/actions/generic/ScenarioManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function writeInFilter(searchStr) {
4242
}
4343

4444
function getScenarioAccordions() {
45-
return cy.get(GENERIC_SELECTORS.scenario.manager.scenarioAccordions);
45+
return cy.get(GENERIC_SELECTORS.scenario.manager.scenarioAccordions, { timeout: 10000 });
4646
}
4747

4848
function getScenarioAccordion(scenarioId) {
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
// Copyright (c) Cosmo Tech.
2+
// Licensed under the MIT license.
3+
import { USERS_LIST } from '../../../tests/samples';
4+
import { Login, ScenarioManager } from '../../commons/actions';
5+
import { stub } from '../../commons/services/stubbing';
6+
import { setup } from '../../commons/utils';
7+
import { SCENARIOS } from '../../fixtures/stubbing/ScenarioManager-SearchBar/scenarios';
8+
9+
const getFirstCharacters = (string) => string.substring(0, 3);
10+
11+
describe('Search bar in scenario manager view', () => {
12+
before(() => {
13+
setup.initCypressAndStubbing();
14+
stub.start();
15+
stub.setScenarios(SCENARIOS);
16+
});
17+
18+
beforeEach(() => {
19+
Login.login();
20+
});
21+
22+
after(() => {
23+
stub.stop();
24+
});
25+
it('can search scenarios by run status and ownerName', () => {
26+
ScenarioManager.switchToScenarioManager();
27+
ScenarioManager.getScenarioAccordions().should('have.length', SCENARIOS.length);
28+
ScenarioManager.writeInFilter('Successful');
29+
ScenarioManager.getScenarioAccordions().should(
30+
'have.length',
31+
SCENARIOS.filter((scenario) => scenario.state === 'Successful')?.length
32+
);
33+
ScenarioManager.writeInFilter(getFirstCharacters('Failed'));
34+
ScenarioManager.getScenarioAccordions().should(
35+
'have.length',
36+
SCENARIOS.filter((scenario) => scenario.state === 'Failed')?.length
37+
);
38+
ScenarioManager.writeInFilter(getFirstCharacters(USERS_LIST[1].name));
39+
ScenarioManager.getScenarioAccordions().should(
40+
'have.length',
41+
SCENARIOS.filter((scenario) => scenario.ownerName === USERS_LIST[1].name)?.length
42+
);
43+
ScenarioManager.writeInFilter('zero filter results');
44+
ScenarioManager.getScenarioAccordions().should('have.length', 0);
45+
});
46+
it('can search scenarios by validation status', () => {
47+
ScenarioManager.switchToScenarioManager();
48+
ScenarioManager.writeInFilter(getFirstCharacters('Validated'));
49+
ScenarioManager.getScenarioAccordions().should(
50+
'have.length',
51+
SCENARIOS.filter((scenario) => scenario.validationStatus === 'Validated')?.length
52+
);
53+
ScenarioManager.writeInFilter(getFirstCharacters('Rejected'));
54+
ScenarioManager.getScenarioAccordions().should(
55+
'have.length',
56+
SCENARIOS.filter((scenario) => scenario.validationStatus === 'Rejected')?.length
57+
);
58+
});
59+
it('can search scenarios by tags and description', () => {
60+
ScenarioManager.switchToScenarioManager();
61+
ScenarioManager.writeInFilter(getFirstCharacters('supply'));
62+
ScenarioManager.getScenarioAccordions().should(
63+
'have.length',
64+
SCENARIOS.filter((scenario) => scenario.tags?.includes('supply') || scenario.description?.includes('supply'))
65+
?.length
66+
);
67+
ScenarioManager.writeInFilter(getFirstCharacters('global'));
68+
ScenarioManager.getScenarioAccordions().should(
69+
'have.length',
70+
SCENARIOS.filter(
71+
(scenario) =>
72+
scenario.name.includes('global') ||
73+
scenario.tags?.includes('global') ||
74+
scenario.description?.includes('global')
75+
)?.length
76+
);
77+
});
78+
it('can search scenarios by name, tags and description', () => {
79+
ScenarioManager.switchToScenarioManager();
80+
ScenarioManager.writeInFilter(getFirstCharacters('unique'));
81+
ScenarioManager.getScenarioAccordions().should(
82+
'have.length',
83+
SCENARIOS.filter((scenario) => scenario.tags?.includes('unique'))?.length
84+
);
85+
ScenarioManager.writeInFilter('supply chain');
86+
ScenarioManager.getScenarioAccordions().should(
87+
'have.length',
88+
SCENARIOS.filter((scenario) => scenario.description?.includes('supply chain'))?.length
89+
);
90+
ScenarioManager.writeInFilter(getFirstCharacters('Simple'));
91+
ScenarioManager.getScenarioAccordions().should(
92+
'have.length',
93+
SCENARIOS.filter((scenario) => scenario.name.toLowerCase().includes('simple'))?.length
94+
);
95+
});
96+
});
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
// Copyright (c) Cosmo Tech.
2+
// Licensed under the MIT license.
3+
import { SCENARIO_EXAMPLE, USERS_LIST } from '../default';
4+
5+
export const SCENARIOS = [
6+
{
7+
...SCENARIO_EXAMPLE,
8+
id: 's-stubbedscnr01',
9+
name: 'Simple Scenario 1',
10+
tags: ['brewery', 'tag', 'global'],
11+
description: 'A short description of a scenario to easily keep track of its purpose',
12+
ownerName: USERS_LIST[1].name,
13+
validationStatus: 'Rejected',
14+
state: 'Created',
15+
security: {
16+
default: 'admin',
17+
},
18+
},
19+
{
20+
...SCENARIO_EXAMPLE,
21+
id: 's-stubbedscnr02',
22+
name: 'Scenario 2024',
23+
description: 'A short description of a supply chain scenario to easily keep track of its purpose',
24+
ownerName: USERS_LIST[1].name,
25+
validationStatus: 'Rejected',
26+
state: 'Successful',
27+
security: {
28+
default: 'admin',
29+
},
30+
},
31+
{
32+
...SCENARIO_EXAMPLE,
33+
id: 's-stubbedscnr03',
34+
name: 'Scenario august',
35+
tags: ['supply', 'cypress'],
36+
description: 'A short description of a global scenario to easily keep track of its purpose',
37+
ownerName: USERS_LIST[2].name,
38+
validationStatus: 'Validated',
39+
state: 'Created',
40+
security: {
41+
default: 'admin',
42+
},
43+
},
44+
{
45+
...SCENARIO_EXAMPLE,
46+
id: 's-stubbedscnr04',
47+
name: 'Simple Scenario 2',
48+
description: 'A short description of a scenario to easily keep track of its purpose',
49+
ownerName: USERS_LIST[1].name,
50+
validationStatus: 'Rejected',
51+
state: 'Successful',
52+
security: {
53+
default: 'admin',
54+
},
55+
},
56+
{
57+
...SCENARIO_EXAMPLE,
58+
id: 's-stubbedscnr05',
59+
name: 'Simple Scenario 3',
60+
tags: ['tag', 'unique', 'supply'],
61+
validationStatus: 'Validated',
62+
state: 'Failed',
63+
security: {
64+
default: 'admin',
65+
},
66+
},
67+
{
68+
...SCENARIO_EXAMPLE,
69+
id: 's-stubbedscnr06',
70+
name: 'global scenario',
71+
tags: ['tag', 'cypress'],
72+
description: 'A short description of a supply chain scenario to easily keep track of its purpose',
73+
ownerName: USERS_LIST[1].name,
74+
validationStatus: 'Rejected',
75+
state: 'Successful',
76+
security: {
77+
default: 'admin',
78+
},
79+
},
80+
];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"@cosmotech/api-ts": "^3.2.9",
77
"@cosmotech/azure": "^2.0.0",
88
"@cosmotech/core": "^1.17.0",
9-
"@cosmotech/ui": "^9.2.1",
9+
"@cosmotech/ui": "^9.3.0",
1010
"@emotion/react": "^11.13.0",
1111
"@emotion/styled": "^11.13.0",
1212
"@microsoft/applicationinsights-web": "^3.3.0",

yarn.lock

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,18 +1793,18 @@ __metadata:
17931793
languageName: node
17941794
linkType: hard
17951795

1796-
"@cosmotech/ui@npm:^9.2.1":
1797-
version: 9.2.1
1798-
resolution: "@cosmotech/ui@npm:9.2.1"
1796+
"@cosmotech/ui@npm:^9.3.0":
1797+
version: 9.3.0
1798+
resolution: "@cosmotech/ui@npm:9.3.0"
17991799
dependencies:
1800-
"@emotion/react": "npm:^11.11.4"
1801-
"@emotion/styled": "npm:^11.11.5"
1800+
"@emotion/react": "npm:^11.13.0"
1801+
"@emotion/styled": "npm:^11.13.0"
18021802
"@mui/x-date-pickers": "npm:^5.0.20"
18031803
"@nosferatu500/react-sortable-tree": "npm:^3.0.6"
18041804
ag-grid-community: "npm:~32.0.2"
18051805
ag-grid-react: "npm:~32.0.2"
18061806
clsx: "npm:^2.1.1"
1807-
cytoscape: "npm:^3.30.0"
1807+
cytoscape: "npm:^3.30.1"
18081808
cytoscape-bubblesets: "npm:^3.2.2"
18091809
cytoscape-dagre: "npm:^2.5.0"
18101810
cytoscape-layers: "npm:^2.4.5"
@@ -1824,7 +1824,7 @@ __metadata:
18241824
react: ^17.0.1
18251825
react-dom: ^17.0.1
18261826
react-i18next: ^11.8.13
1827-
checksum: 10c0/48ac9904905ffc37fc72b80c8203c5fa319b0499e4e98a0d24224238744e30e75f940aa3b90f7c51eb6426f7d6fbbb566874ca4a121da77619d2ecc93ee18ed2
1827+
checksum: 10c0/d1dfdf0346dc0d36349b70e08b7a0aaca881318c254a0c8fefdfa8ce2d3f67dcbd4c8b14ca49109c5932d2a42a52f021760a677856e47e923792e30e63d995a4
18281828
languageName: node
18291829
linkType: hard
18301830

@@ -2155,7 +2155,7 @@ __metadata:
21552155
languageName: node
21562156
linkType: hard
21572157

2158-
"@emotion/react@npm:^11.11.4, @emotion/react@npm:^11.13.0":
2158+
"@emotion/react@npm:^11.13.0":
21592159
version: 11.13.0
21602160
resolution: "@emotion/react@npm:11.13.0"
21612161
dependencies:
@@ -2196,7 +2196,7 @@ __metadata:
21962196
languageName: node
21972197
linkType: hard
21982198

2199-
"@emotion/styled@npm:^11.11.5, @emotion/styled@npm:^11.13.0":
2199+
"@emotion/styled@npm:^11.13.0":
22002200
version: 11.13.0
22012201
resolution: "@emotion/styled@npm:11.13.0"
22022202
dependencies:
@@ -5653,7 +5653,7 @@ __metadata:
56535653
"@cosmotech/api-ts": "npm:^3.2.9"
56545654
"@cosmotech/azure": "npm:^2.0.0"
56555655
"@cosmotech/core": "npm:^1.17.0"
5656-
"@cosmotech/ui": "npm:^9.2.1"
5656+
"@cosmotech/ui": "npm:^9.3.0"
56575657
"@emotion/react": "npm:^11.13.0"
56585658
"@emotion/styled": "npm:^11.13.0"
56595659
"@microsoft/applicationinsights-web": "npm:^3.3.0"
@@ -7617,10 +7617,10 @@ __metadata:
76177617
languageName: node
76187618
linkType: hard
76197619

7620-
"cytoscape@npm:^3.30.0":
7621-
version: 3.30.0
7622-
resolution: "cytoscape@npm:3.30.0"
7623-
checksum: 10c0/ffd463f27975b7d979c6f1a8c3472d95cbe2d75dc820aac27ad3e253eaa877da4c7ed4632a341394d911ba1804c5786a292a56387bbb34fcf0c9db69286e123e
7620+
"cytoscape@npm:^3.30.1":
7621+
version: 3.30.2
7622+
resolution: "cytoscape@npm:3.30.2"
7623+
checksum: 10c0/a8b095969900600b58fff823db73d69ec3f22fc9993c10f0739d8551c1dad881d67e1f7771e33b80f72b40f717861e5fa917846ed304f0a31eb3c8aef8dd433f
76247624
languageName: node
76257625
linkType: hard
76267626

0 commit comments

Comments
 (0)