-
Notifications
You must be signed in to change notification settings - Fork 596
/
workload-sidebar.ts
177 lines (154 loc) · 5.58 KB
/
workload-sidebar.ts
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps';
import { guidedTour } from '@console/cypress-integration-tests/views/guided-tour';
import {
devNavigationMenu,
switchPerspective,
} from '@console/dev-console/integration-tests/support/constants';
import {
app,
createGitWorkload,
navigateTo,
perspective,
projectNameSpace,
topologyActions,
} from '@console/dev-console/integration-tests/support/pages';
import {
topologyHelper,
topologyPage,
topologySidePane,
} from '@console/topology/integration-tests/support/pages/topology';
import { topologyPO } from '../../page-objects/topology-po';
import { checkPodsText } from '../../pages/functions/add-secret';
Given('user has scaled up the pod to 2 for workload {string}', (workloadName: string) => {
topologyPage.componentNode(workloadName).click({ force: true });
topologySidePane.selectTab('Details');
topologySidePane.scaleUpPodCount();
});
When('user scales up the pod', () => {
topologySidePane.scaleUpPodCount();
});
When('user scales down the pod number', () => {
topologySidePane.scaleDownPodCount();
});
Then(
'user is able to see pod Scaling to {string} for workload {string}',
(podText: string, workloadName: string) => {
topologySidePane.close();
cy.reload();
app.waitForDocumentLoad();
topologyPage.componentNode(workloadName).click({ force: true });
topologySidePane.selectTab('Details');
topologySidePane.verifyPodText(podText);
},
);
Given('user has created a deployment workload {string}', (componentName: string) => {
navigateTo(devNavigationMenu.Add);
createGitWorkload(
'https://github.com/sclorg/nodejs-ex.git',
componentName,
'Deployment',
'nodejs-ex-git-app',
);
});
Given('user is at Topology chart view', () => {
navigateTo(devNavigationMenu.Topology);
cy.get(topologyPO.switcher).should('have.attr', 'aria-label', 'List view');
});
When('user clicks on workload {string} to open sidebar', (workloadName: string) => {
topologyPage.componentNode(workloadName).click({ force: true });
});
When('user clicks on Action menu', () => {
topologySidePane.clickActionsDropDown();
});
When('user clicks {string} from action menu', (actionItem: string) => {
app.waitForLoad();
topologyActions.selectAction(actionItem);
});
When('user deletes the existing annotation for route', () => {
cy.get(topologyPO.deploymentStrategy.envRow)
.eq(1)
.within(() => {
cy.get('[data-test="delete-button"]').click();
});
});
When('user enters key as {string}', (annotationKey: string) => {
cy.get(topologyPO.graph.addNewAnnotations).click();
cy.get(topologyPO.deploymentStrategy.envName).last().clear().type(annotationKey);
});
When('user enters value as {string}', (annotationValue: string) => {
cy.get(topologyPO.deploymentStrategy.envValue).last().clear().type(annotationValue);
cy.get(topologyPO.graph.deleteWorkload).click();
cy.byLegacyTestID('modal-title').should('not.exist', { timeout: 20000 });
});
Then('user can see route decorator has been hidden for workload {string}', (appName: string) => {
cy.reload();
app.waitForDocumentLoad();
topologyHelper.search(appName);
cy.get(topologyPO.graph.reset).click();
cy.get(topologyPO.highlightNode)
.should('be.visible')
.within(() => {
cy.get(topologyPO.graph.routeDecorator).should('not.exist');
});
});
Then('user can see the new route href in route decorator be {string}', (value: string) => {
cy.reload();
app.waitForDocumentLoad();
topologyHelper.search('nodejs-ex-2');
cy.get(topologyPO.graph.reset).click();
cy.get(topologyPO.highlightNode)
.should('be.visible')
.within(() => {
cy.get(topologyPO.graph.routeDecorator, { timeout: 120000 }).should(
'have.attr',
'href',
value,
);
});
});
Given('user has selected namespace {string}', (projectName: string) => {
projectNameSpace.selectProject(projectName);
});
When('user clicks on knative workload {string}', (workloadName: string) => {
topologyPage.waitForLoad();
topologyPage.knativeNode(workloadName).click({ force: true });
});
When('user clicks on sidebar workload {string}', (workloadName: string) => {
topologyPage.waitForLoad();
topologyPage.componentNode(workloadName).click({ force: true });
});
When('user opens Details tab', () => {
topologyPage.waitForLoad();
topologyPage.componentNode('nodejs-ex-git-1').click({ force: true });
topologySidePane.selectTab('Details');
});
When('user can see pod count is 1', () => {
topologySidePane.close();
topologyPage.componentNode('nodejs-ex-git-1').click({ force: true });
checkPodsText();
});
When('user can see workload {string} is created', (workloadName: string) => {
navigateTo(devNavigationMenu.Topology);
topologyPage.componentNode(workloadName).should('be.visible');
});
When('user clicks on {string} from action menu', (actionItem: string) => {
topologyActions.selectAction(actionItem);
});
Then('user can see show waiting pods with errors', () => {
topologySidePane.selectTab('Resources');
cy.get(topologyPO.sidePane.resourcesTab.waitingPods).should('be.visible');
});
Then('user can see traffic details for pod', () => {
topologySidePane.selectTab('Resources');
topologySidePane.verifySection('Pods');
cy.wait(20000);
cy.reload(true);
app.waitForLoad();
guidedTour.close();
cy.get(topologyPO.sidePane.resourcesTab.waitingPods, { timeout: 100000 }).should('not.exist');
perspective.switchTo(switchPerspective.Administrator);
perspective.switchTo(switchPerspective.Developer);
cy.get(topologyPO.sidePane.resourcesTab.podTrafficStatus, { timeout: 100000 }).should(
'be.visible',
);
});