-
Notifications
You must be signed in to change notification settings - Fork 61
/
workflow-executions-with-new-search.spec.js
222 lines (177 loc) · 7.21 KB
/
workflow-executions-with-new-search.spec.js
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
/// <reference types="cypress" />
import workflowsFixture from '../fixtures/workflows.json';
const workflowRunningFixture = workflowsFixture.executions[0];
const { workflowId, runId } = workflowRunningFixture.execution;
describe('Workflow Executions List With Search', () => {
beforeEach(() => {
cy.interceptApi();
cy.intercept(Cypress.env('VITE_API_HOST') + '/api/v1/cluster*', {
fixture: 'cluster-with-elasticsearch.json',
}).as('cluster-api-elasticsearch');
cy.visit('/namespaces/default/workflows');
cy.wait('@cluster-api-elasticsearch');
cy.wait('@namespaces-api');
cy.wait('@workflows-api');
});
it('should default to All for the time range', () => {
cy.get('#time-range-filter').should('have.value', '');
});
describe('Workflow Manual Search', () => {
it('should change url on manual search and update filters and show results count', () => {
cy.get('#manual-search').type('WorkflowType="ImportantWorkflowType"');
cy.get('[data-cy="manual-search-button"]').click();
const result = encodeURIComponent('WorkflowType="ImportantWorkflowType"');
cy.url().should('contain', result);
cy.get('[data-cy="workflow-type-filter-button"]').click();
cy.get('#workflowType').should('have.value', 'ImportantWorkflowType');
cy.get('[data-cy="workflow-count"]').should(
'have.text',
'Results 15 of 15 workflows',
);
});
});
describe('Workflow Filters', () => {
it('should send the correct query for Workflow Type, autocomplete manual search and be clearable', () => {
cy.get('[data-cy="workflow-type-filter-button"]').click();
cy.get('#workflowType').type('ImportantWorkflowType');
const result = encodeURIComponent('WorkflowType="ImportantWorkflowType"');
cy.url().should('contain', result);
cy.get('#manual-search').should(
'have.value',
'WorkflowType="ImportantWorkflowType"',
);
cy.get('[data-cy="workflow-count"]').should(
'have.text',
'Results 15 of 15 workflows',
);
cy.get(
'.px-2 > .input-container > [data-cy="clear-input"] > svg',
).click();
cy.url().should('not.contain', result);
});
it('should send the correct query for Workflow ID, autocomplete manual search and be clearable', () => {
cy.get('[data-cy="workflow-id-filter-button"]').click();
cy.get('#workflowId').type('002c98_Running');
const result = encodeURIComponent('WorkflowId="002c98_Running"');
cy.url().should('contain', result);
cy.get('#manual-search').should(
'have.value',
'WorkflowId="002c98_Running"',
);
cy.get('[data-cy="workflow-count"]').should(
'have.text',
'Results 15 of 15 workflows',
);
cy.get(
'.px-2 > .input-container > [data-cy="clear-input"] > svg',
).click();
cy.url().should('not.contain', result);
});
it('should change url on single Execution Status change', () => {
cy.get('[data-cy="execution-status-filter-button"]').click();
cy.get('[data-cy="Running"]').click();
const result = encodeURIComponent('ExecutionStatus="Running"');
cy.url().should('contain', result);
cy.get('#manual-search').should(
'have.value',
'ExecutionStatus="Running"',
);
cy.get('[data-cy="workflow-count"]').should(
'have.text',
'Results 15 of 15 workflows',
);
});
it('should change url on multiple Execution Status change', () => {
cy.get('[data-cy="execution-status-filter-button"]').click();
cy.get('[data-cy="Running"]').click();
cy.get('[data-cy="Failed"]').click();
const result =
'%28ExecutionStatus%3D%22Running%22+OR+ExecutionStatus%3D%22Failed%22%29';
cy.url().should('contain', result);
cy.get('#manual-search').should(
'have.value',
'(ExecutionStatus="Running" OR ExecutionStatus="Failed")',
);
});
it('should clear Execution Status on All', () => {
cy.get('[data-cy="execution-status-filter-button"]').click();
cy.get('[data-cy="Running"]').click();
cy.get('[data-cy="Failed"]').click();
const result =
'%28ExecutionStatus%3D%22Running%22+OR+ExecutionStatus%3D%22Failed%22%29';
cy.url().should('contain', result);
cy.get('[data-cy="All"]').click();
cy.url().should('contain.not', result);
});
it('should combine all three filters', () => {
cy.get('[data-cy="execution-status-filter-button"]').click();
cy.get('[data-cy="Running"]').click();
cy.get('[data-cy="workflow-id-filter-button"]').click();
cy.get('#workflowId').type('002c98_Running');
cy.get('[data-cy="workflow-type-filter-button"]').click();
cy.get('#workflowType').type('ImportantWorkflowType');
const result =
'ExecutionStatus%3D%22Running%22+AND+WorkflowId%3D%22002c98_Running%22+AND+WorkflowType%3D%22ImportantWorkflowType%22';
cy.url().should('contain', result);
cy.get('#manual-search').should(
'have.value',
'ExecutionStatus="Running" AND WorkflowId="002c98_Running" AND WorkflowType="ImportantWorkflowType"',
);
});
it('should send the correct query for StartTime', () => {
cy.get('#time-range-filter').click();
cy.contains('15 minutes').click();
cy.url().should('contain', 'StartTime+BETWEEN');
cy.get('[data-cy="workflow-count"]').should(
'have.text',
'Results 15 of 15 workflows',
);
});
it('should send the correct query for CloseTime', () => {
cy.get('#time-range-filter').click();
cy.contains('3 hours').click();
cy.contains('End Time').click();
cy.url().should('contain', 'CloseTime+BETWEEN');
cy.get('[data-cy="workflow-count"]').should(
'have.text',
'Results 15 of 15 workflows',
);
});
describe('Workflow Filters with Navigation ', () => {
beforeEach(() => {
cy.interceptApi();
cy.intercept(
Cypress.env('VITE_API_HOST') +
`/api/v1/namespaces/default/workflows/*/runs/*/events/reverse*`,
{ fixture: 'event-history-completed.json' },
).as('event-history-api');
cy.intercept(
Cypress.env('VITE_API_HOST') +
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}?`,
{ fixture: 'workflow-completed.json' },
).as('workflow-api');
});
it('should keep single workflow filter after navigating away and back to workflow list', () => {
cy.get('[data-cy="execution-status-filter-button"]').click();
cy.get('[data-cy="Running"]').click();
cy.url().should(
'contain',
encodeURIComponent(`ExecutionStatus="Running"`),
);
cy.get('.workflow-summary-row').first().click();
cy.wait('@workflow-api');
cy.wait('@event-history-api');
cy.url().should('contain', '/feed');
cy.get('[data-cy="back-to-workflows"]').click();
cy.url().should(
'contain',
encodeURIComponent(`ExecutionStatus="Running"`),
);
cy.get('[data-cy="workflow-count"]').should(
'have.text',
'Results 15 of 15 workflows',
);
});
});
});
});