@@ -2,48 +2,24 @@ import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps';
2
2
import { detailsPage } from '@console/cypress-integration-tests/views/details-page' ;
3
3
import { listPage } from '@console/cypress-integration-tests/views/list-page' ;
4
4
import { modal } from '@console/cypress-integration-tests/views/modal' ;
5
+ import * as yamlView from '@console/cypress-integration-tests/views/yaml-editor' ;
5
6
import { devNavigationMenu } from '@console/dev-console/integration-tests/support/constants' ;
6
7
import {
7
8
navigateTo ,
8
- yamlEditor ,
9
9
createGitWorkloadIfNotExistsOnTopologyPage ,
10
10
topologyHelper ,
11
- gitPage ,
12
- devFilePage ,
13
11
topologyPage ,
12
+ app ,
14
13
} from '@console/dev-console/integration-tests/support/pages' ;
15
- import * as yamlView from '../../../../../integration-tests-cypress/views/yaml-editor' ;
16
- import { topologyPO } from '../../page-objects/topology-po' ;
17
14
18
- const deteleResourceQuota = ( resourceQuotaName : string ) => {
19
- listPage . filter . byName ( resourceQuotaName ) ;
20
- listPage . rows . clickRowByName ( resourceQuotaName ) ;
15
+ const deteleResourceQuota = ( ) => {
21
16
detailsPage . isLoaded ( ) ;
22
17
detailsPage . clickPageActionFromDropdown ( 'Delete ResourceQuota' ) ;
23
18
modal . shouldBeOpened ( ) ;
24
19
modal . submit ( ) ;
25
20
modal . shouldBeClosed ( ) ;
26
21
} ;
27
22
28
- Given ( 'user is at the Topology page' , ( ) => {
29
- navigateTo ( devNavigationMenu . Topology ) ;
30
- } ) ;
31
-
32
- Given ( 'user is at the Add page' , ( ) => {
33
- navigateTo ( devNavigationMenu . Add ) ;
34
- } ) ;
35
-
36
- When ( 'user right clicks on topology empty graph' , ( ) => {
37
- cy . get ( topologyPO . graph . emptyGraph ) . rightclick ( 1 , 1 ) ;
38
- } ) ;
39
-
40
- When ( 'user selects {string} option from Add to Project context menu' , ( option : string ) => {
41
- cy . get ( topologyPO . graph . contextMenuOptions . addToProject )
42
- . focus ( )
43
- . trigger ( 'mouseover' ) ;
44
- cy . byTestActionID ( option ) . click ( { force : true } ) ;
45
- } ) ;
46
-
47
23
Given ( 'user has created workload with resource type deployment' , ( ) => {
48
24
createGitWorkloadIfNotExistsOnTopologyPage (
49
25
'https://github.com/sclorg/nodejs-ex.git' ,
@@ -54,92 +30,41 @@ Given('user has created workload with resource type deployment', () => {
54
30
topologyHelper . verifyWorkloadInTopologyPage ( 'ex-node-js' ) ;
55
31
} ) ;
56
32
57
- When ( 'user enters Git Repo URL as {string} in Import from Git form ' , ( gitUrl : string ) => {
58
- gitPage . enterGitUrl ( gitUrl ) ;
59
- devFilePage . verifyValidatedMessage ( gitUrl ) ;
33
+ Given ( 'user has created two resource quotas using {string} file ' , ( yamlLocation ) => {
34
+ cy . exec ( `oc apply -f ${ yamlLocation } ` ) ;
35
+ app . waitForDocumentLoad ( ) ;
60
36
} ) ;
61
37
62
- When ( 'user enters workload name as {string}' , ( name : string ) => {
63
- gitPage . enterWorkloadName ( name ) ;
64
- } ) ;
65
-
66
- When ( 'user clicks Create button on Add page' , ( ) => {
67
- gitPage . clickCreate ( ) ;
68
- } ) ;
69
-
70
- Then ( 'user will be redirected to Topology page' , ( ) => {
38
+ When ( 'user navigates to Topology page' , ( ) => {
39
+ navigateTo ( devNavigationMenu . Topology ) ;
71
40
topologyPage . verifyTopologyPage ( ) ;
72
41
} ) ;
73
42
74
- Then ( 'user is able to see workload {string} in topology page' , ( workloadName : string ) => {
75
- topologyPage . verifyWorkloadInTopologyPage ( workloadName ) ;
76
- } ) ;
77
-
78
- Given ( 'user clicks on import YAML button' , ( ) => {
79
- cy . get ( '[data-test="import-yaml"]' ) . click ( ) ;
80
- cy . get ( '.yaml-editor' ) . should ( 'be.visible' ) ;
81
- } ) ;
82
-
83
- When ( 'user clicks on Create button' , ( ) => {
84
- cy . get ( '[data-test="save-changes"]' ) . click ( ) ;
85
- } ) ;
86
-
87
- When ( 'user enters the {string} file data to YAML Editor' , ( yamlFile : string ) => {
88
- yamlEditor . isLoaded ( ) ;
89
- yamlEditor . clearYAMLEditor ( ) ;
90
- yamlEditor . setEditorContent ( yamlFile ) ;
91
- } ) ;
92
-
93
43
When ( 'user clicks on link to view resource quota details' , ( ) => {
94
44
cy . byTestID ( 'resource-quota-warning' ) . click ( ) ;
95
45
} ) ;
96
46
97
47
Then ( 'user is redirected to resource quota details page' , ( ) => {
98
48
cy . get ( 'h2' ) . should ( 'contain.text' , 'ResourceQuota details' ) ;
49
+ deteleResourceQuota ( ) ;
99
50
} ) ;
100
51
101
52
Then ( 'user is redirected to resource quota list page' , ( ) => {
102
53
listPage . rows . shouldBeLoaded ( ) ;
103
54
} ) ;
104
55
105
- When ( 'user deletes resource quotas created' , ( ) => {
106
- deteleResourceQuota ( 'resourcequota1' ) ;
107
- deteleResourceQuota ( 'resourcequota2' ) ;
108
- } ) ;
109
-
110
- When ( 'user clicks on Delete application' , ( ) => {
111
- cy . get ( '.odc-topology-context-menu' )
112
- . contains ( 'Delete application' )
113
- . click ( ) ;
114
- } ) ;
115
-
116
- When (
117
- 'user enters the name {string} in the Delete application modal and clicks on Delete button' ,
118
- ( appName : string ) => {
119
- topologyPage . deleteApplication ( appName ) ;
120
- } ,
121
- ) ;
122
-
123
- When ( 'user right clicks on Application Grouping {string}' , ( appName : string ) => {
124
- topologyPage . rightClickOnApplicationGroupings ( appName ) ;
125
- } ) ;
126
-
127
56
When (
128
57
'user creates resource quota {string} by entering {string} file data' ,
129
58
( resourceQuotaName : string , yamlLocation : string ) => {
59
+ cy . get ( '[data-test="import-yaml"]' ) . click ( ) ;
60
+ cy . get ( '.yaml-editor' ) . should ( 'be.visible' ) ;
130
61
cy . readFile ( yamlLocation ) . then ( ( str ) => {
131
62
const myArray = str . split ( '---' ) ;
132
63
resourceQuotaName === 'resourcequota1'
133
64
? yamlView . setEditorContent ( myArray [ 0 ] )
134
65
: yamlView . setEditorContent ( myArray [ 1 ] ) ;
135
66
} ) ;
136
- } ,
137
- ) ;
138
-
139
- Then (
140
- 'user should not be able to see the resource quotas {string} and {string}' ,
141
- ( resourcequota1 : string , resourcequota2 : string ) => {
142
- listPage . rows . shouldNotExist ( resourcequota1 ) ;
143
- listPage . rows . shouldNotExist ( resourcequota2 ) ;
67
+ cy . get ( '[data-test="save-changes"]' ) . click ( ) ;
68
+ cy . get ( 'h2' ) . should ( 'contain.text' , 'ResourceQuota details' ) ;
144
69
} ,
145
70
) ;
0 commit comments