@gravitee/ui-policy-studio-angular 7.8.0 → 7.9.1-policy-studio-step-5-2d586ea
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/esm2020/lib/components/filter-pipe/gio-flter-connectors-by-mode.pipe.mjs +40 -0
- package/esm2020/lib/components/flow-details/gio-ps-flow-details.component.mjs +5 -4
- package/esm2020/lib/components/flow-details-info-bar/gio-ps-flow-details-info-bar.component.mjs +3 -3
- package/esm2020/lib/components/flow-details-phase/gio-ps-flow-details-phase.component.mjs +40 -8
- package/esm2020/lib/components/flow-details-phase-policy/gio-ps-flow-details-phase-policy.component.mjs +15 -5
- package/esm2020/lib/components/flow-execution-form-dialog/gio-ps-flow-execution-form-dialog-result.model.mjs +17 -0
- package/esm2020/lib/components/flow-execution-form-dialog/gio-ps-flow-execution-form-dialog.component.mjs +60 -0
- package/esm2020/lib/components/flow-form-dialog/flow-message-form-dialog/gio-ps-flow-message-form-dialog.component.mjs +3 -3
- package/esm2020/lib/components/flows-menu/gio-ps-flows-menu.component.mjs +28 -3
- package/esm2020/lib/gio-policy-studio.component.mjs +17 -8
- package/esm2020/lib/gio-policy-studio.module.mjs +20 -3
- package/esm2020/lib/models/ConnectorsInfo.mjs +1 -1
- package/esm2020/lib/models/SaveOutput.mjs +1 -1
- package/esm2020/testing/lib/components/flow-details-phase/gio-ps-flow-details-phase.harness.mjs +62 -0
- package/esm2020/testing/lib/components/flow-details-phase-policy/gio-ps-flow-details-phase-policy.harness.mjs +33 -0
- package/esm2020/testing/lib/components/flow-execution-form-dialog/gio-ps-flow-execution-form-dialog.harness.mjs +60 -0
- package/esm2020/testing/lib/components/flows-menu/gio-ps-flows-menu.harness.mjs +4 -1
- package/esm2020/testing/lib/gio-policy-studio.harness.mjs +42 -1
- package/esm2020/testing/lib/models/ConnectorsInfo.fixture.mjs +152 -0
- package/esm2020/testing/lib/models/ConnectorsInfo.mjs +1 -1
- package/esm2020/testing/lib/models/SaveOutput.mjs +1 -1
- package/esm2020/testing/lib/models/flow/FlowExecution.fixture.mjs +43 -0
- package/esm2020/testing/lib/models/flow/Step.fixture.mjs +70 -0
- package/esm2020/testing/lib/models/flow/index-testing.mjs +3 -1
- package/esm2020/testing/lib/models/index-testing.mjs +2 -1
- package/fesm2015/gravitee-ui-policy-studio-angular-testing.mjs +385 -3
- package/fesm2015/gravitee-ui-policy-studio-angular-testing.mjs.map +1 -1
- package/fesm2015/gravitee-ui-policy-studio-angular.mjs +225 -61
- package/fesm2015/gravitee-ui-policy-studio-angular.mjs.map +1 -1
- package/fesm2020/gravitee-ui-policy-studio-angular-testing.mjs +453 -3
- package/fesm2020/gravitee-ui-policy-studio-angular-testing.mjs.map +1 -1
- package/fesm2020/gravitee-ui-policy-studio-angular.mjs +224 -58
- package/fesm2020/gravitee-ui-policy-studio-angular.mjs.map +1 -1
- package/lib/components/filter-pipe/gio-flter-connectors-by-mode.pipe.d.ts +8 -0
- package/lib/components/flow-details/gio-ps-flow-details.component.d.ts +3 -3
- package/lib/components/flow-details-info-bar/gio-ps-flow-details-info-bar.component.d.ts +2 -2
- package/lib/components/flow-details-phase/gio-ps-flow-details-phase.component.d.ts +20 -5
- package/lib/components/flow-details-phase-policy/gio-ps-flow-details-phase-policy.component.d.ts +4 -1
- package/lib/components/flow-execution-form-dialog/gio-ps-flow-execution-form-dialog-result.model.d.ts +2 -0
- package/lib/components/flow-execution-form-dialog/gio-ps-flow-execution-form-dialog.component.d.ts +17 -0
- package/lib/components/flow-form-dialog/flow-message-form-dialog/gio-ps-flow-message-form-dialog.component.d.ts +3 -2
- package/lib/components/flows-menu/gio-ps-flows-menu.component.d.ts +6 -3
- package/lib/gio-policy-studio.component.d.ts +7 -5
- package/lib/gio-policy-studio.module.d.ts +20 -16
- package/lib/models/ConnectorsInfo.d.ts +4 -1
- package/lib/models/SaveOutput.d.ts +2 -1
- package/package.json +1 -1
- package/testing/lib/components/flow-details-phase/gio-ps-flow-details-phase.harness.d.ts +20 -0
- package/testing/lib/components/flow-details-phase-policy/gio-ps-flow-details-phase-policy.harness.d.ts +13 -0
- package/testing/lib/components/flow-execution-form-dialog/gio-ps-flow-execution-form-dialog.harness.d.ts +13 -0
- package/testing/lib/components/flows-menu/gio-ps-flows-menu.harness.d.ts +1 -0
- package/testing/lib/gio-policy-studio.harness.d.ts +31 -1
- package/testing/lib/models/ConnectorsInfo.d.ts +4 -1
- package/testing/lib/models/ConnectorsInfo.fixture.d.ts +10 -0
- package/testing/lib/models/SaveOutput.d.ts +2 -1
- package/testing/lib/models/flow/FlowExecution.fixture.d.ts +3 -0
- package/testing/lib/models/flow/Step.fixture.d.ts +4 -0
- package/testing/lib/models/flow/index-testing.d.ts +2 -0
- package/testing/lib/models/index-testing.d.ts +1 -0
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { isFunction } from 'lodash';
|
|
2
|
-
import { ComponentHarness, parallel } from '@angular/cdk/testing';
|
|
1
|
+
import { isFunction, isEmpty } from 'lodash';
|
|
2
|
+
import { ComponentHarness, parallel, HarnessPredicate } from '@angular/cdk/testing';
|
|
3
3
|
import { MatButtonHarness } from '@angular/material/button/testing';
|
|
4
|
+
import { MatTabGroupHarness } from '@angular/material/tabs/testing';
|
|
4
5
|
import { DivHarness, SpanHarness } from '@gravitee/ui-particles-angular/testing';
|
|
5
6
|
import { MatInputHarness } from '@angular/material/input/testing';
|
|
6
7
|
import { MatSelectHarness } from '@angular/material/select/testing';
|
|
7
8
|
import { GioFormTagsInputHarness } from '@gravitee/ui-particles-angular';
|
|
9
|
+
import { MatSlideToggleHarness } from '@angular/material/slide-toggle/testing';
|
|
8
10
|
|
|
9
11
|
/*
|
|
10
12
|
* Copyright (C) 2023 The Gravitee team (http://gravitee.io)
|
|
@@ -71,6 +73,117 @@ function fakeHttpFlow(modifier) {
|
|
|
71
73
|
};
|
|
72
74
|
}
|
|
73
75
|
|
|
76
|
+
/*
|
|
77
|
+
* Copyright (C) 2023 The Gravitee team (http://gravitee.io)
|
|
78
|
+
*
|
|
79
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
80
|
+
* you may not use this file except in compliance with the License.
|
|
81
|
+
* You may obtain a copy of the License at
|
|
82
|
+
*
|
|
83
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
84
|
+
*
|
|
85
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
86
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
87
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
88
|
+
* See the License for the specific language governing permissions and
|
|
89
|
+
* limitations under the License.
|
|
90
|
+
*/
|
|
91
|
+
function fakeBestMatchFlowExecution(modifier) {
|
|
92
|
+
const base = {
|
|
93
|
+
mode: 'BEST_MATCH',
|
|
94
|
+
matchRequired: false,
|
|
95
|
+
};
|
|
96
|
+
if (isFunction(modifier)) {
|
|
97
|
+
return modifier(base);
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
...base,
|
|
101
|
+
...modifier,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function fakeDefaultFlowExecution(modifier) {
|
|
105
|
+
const base = {
|
|
106
|
+
mode: 'DEFAULT',
|
|
107
|
+
matchRequired: false,
|
|
108
|
+
};
|
|
109
|
+
if (isFunction(modifier)) {
|
|
110
|
+
return modifier(base);
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
...base,
|
|
114
|
+
...modifier,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/*
|
|
119
|
+
* Copyright (C) 2023 The Gravitee team (http://gravitee.io)
|
|
120
|
+
*
|
|
121
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
122
|
+
* you may not use this file except in compliance with the License.
|
|
123
|
+
* You may obtain a copy of the License at
|
|
124
|
+
*
|
|
125
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
126
|
+
*
|
|
127
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
128
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
129
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
130
|
+
* See the License for the specific language governing permissions and
|
|
131
|
+
* limitations under the License.
|
|
132
|
+
*/
|
|
133
|
+
function fakeMockPolicyStep(modifier) {
|
|
134
|
+
const base = {
|
|
135
|
+
name: 'Mock Policy',
|
|
136
|
+
description: 'Mock Policy description',
|
|
137
|
+
enabled: true,
|
|
138
|
+
policy: 'mock',
|
|
139
|
+
};
|
|
140
|
+
if (isFunction(modifier)) {
|
|
141
|
+
return modifier(base);
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
...base,
|
|
145
|
+
...modifier,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function fakeRateLimitStep(modifier) {
|
|
149
|
+
const base = {
|
|
150
|
+
name: 'Rate Limit',
|
|
151
|
+
description: 'Step description',
|
|
152
|
+
enabled: true,
|
|
153
|
+
policy: 'rate-limit',
|
|
154
|
+
configuration: {
|
|
155
|
+
rate: {
|
|
156
|
+
limit: 10,
|
|
157
|
+
periodTime: 1,
|
|
158
|
+
periodTimeUnit: 'MINUTES',
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
if (isFunction(modifier)) {
|
|
163
|
+
return modifier(base);
|
|
164
|
+
}
|
|
165
|
+
return {
|
|
166
|
+
...base,
|
|
167
|
+
...modifier,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
function fakeXmlToJsonStep(modifier) {
|
|
171
|
+
const base = {
|
|
172
|
+
name: 'XML to JSON',
|
|
173
|
+
description: 'XML to JSON',
|
|
174
|
+
enabled: true,
|
|
175
|
+
policy: 'xml-json',
|
|
176
|
+
configuration: {},
|
|
177
|
+
};
|
|
178
|
+
if (isFunction(modifier)) {
|
|
179
|
+
return modifier(base);
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
...base,
|
|
183
|
+
...modifier,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
|
|
74
187
|
/*
|
|
75
188
|
* Copyright (C) 2022 The Gravitee team (http://gravitee.io)
|
|
76
189
|
*
|
|
@@ -133,6 +246,157 @@ function fakePlan(modifier) {
|
|
|
133
246
|
* limitations under the License.
|
|
134
247
|
*/
|
|
135
248
|
|
|
249
|
+
/*
|
|
250
|
+
* Copyright (C) 2023 The Gravitee team (http://gravitee.io)
|
|
251
|
+
*
|
|
252
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
253
|
+
* you may not use this file except in compliance with the License.
|
|
254
|
+
* You may obtain a copy of the License at
|
|
255
|
+
*
|
|
256
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
257
|
+
*
|
|
258
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
259
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
260
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
261
|
+
* See the License for the specific language governing permissions and
|
|
262
|
+
* limitations under the License.
|
|
263
|
+
*/
|
|
264
|
+
function fakeSSEMessageEntrypoint(modifier) {
|
|
265
|
+
const base = {
|
|
266
|
+
type: 'sse',
|
|
267
|
+
name: 'Server-Sent Events',
|
|
268
|
+
supportedModes: ['SUBSCRIBE'],
|
|
269
|
+
icon: 'gio:sse',
|
|
270
|
+
};
|
|
271
|
+
if (isFunction(modifier)) {
|
|
272
|
+
return modifier(base);
|
|
273
|
+
}
|
|
274
|
+
return {
|
|
275
|
+
...base,
|
|
276
|
+
...modifier,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
function fakeWebsocketMessageEntrypoint(modifier) {
|
|
280
|
+
const base = {
|
|
281
|
+
type: 'websocket',
|
|
282
|
+
name: 'Websocket',
|
|
283
|
+
supportedModes: ['PUBLISH', 'SUBSCRIBE'],
|
|
284
|
+
icon: 'gio:websocket',
|
|
285
|
+
};
|
|
286
|
+
if (isFunction(modifier)) {
|
|
287
|
+
return modifier(base);
|
|
288
|
+
}
|
|
289
|
+
return {
|
|
290
|
+
...base,
|
|
291
|
+
...modifier,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
function fakeHTTPPostMessageEntrypoint(modifier) {
|
|
295
|
+
const base = {
|
|
296
|
+
type: 'http-post',
|
|
297
|
+
name: 'HTTP POST',
|
|
298
|
+
supportedModes: ['PUBLISH'],
|
|
299
|
+
icon: 'gio:language',
|
|
300
|
+
};
|
|
301
|
+
if (isFunction(modifier)) {
|
|
302
|
+
return modifier(base);
|
|
303
|
+
}
|
|
304
|
+
return {
|
|
305
|
+
...base,
|
|
306
|
+
...modifier,
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
function fakeHTTPGetMessageEntrypoint(modifier) {
|
|
310
|
+
const base = {
|
|
311
|
+
type: 'http-get',
|
|
312
|
+
name: 'HTTP Get',
|
|
313
|
+
supportedModes: ['SUBSCRIBE'],
|
|
314
|
+
icon: 'gio:language',
|
|
315
|
+
};
|
|
316
|
+
if (isFunction(modifier)) {
|
|
317
|
+
return modifier(base);
|
|
318
|
+
}
|
|
319
|
+
return {
|
|
320
|
+
...base,
|
|
321
|
+
...modifier,
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
function fakeWebhookMessageEntrypoint(modifier) {
|
|
325
|
+
const base = {
|
|
326
|
+
type: 'webhook',
|
|
327
|
+
name: 'Webhook',
|
|
328
|
+
supportedModes: ['SUBSCRIBE'],
|
|
329
|
+
icon: 'gio:webhook',
|
|
330
|
+
};
|
|
331
|
+
if (isFunction(modifier)) {
|
|
332
|
+
return modifier(base);
|
|
333
|
+
}
|
|
334
|
+
return {
|
|
335
|
+
...base,
|
|
336
|
+
...modifier,
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
function fakeHTTPProxyEntrypoint(modifier) {
|
|
340
|
+
const base = {
|
|
341
|
+
type: 'http-proxy',
|
|
342
|
+
name: 'HTTP Proxy',
|
|
343
|
+
supportedModes: ['REQUEST_RESPONSE'],
|
|
344
|
+
icon: 'gio:language',
|
|
345
|
+
};
|
|
346
|
+
if (isFunction(modifier)) {
|
|
347
|
+
return modifier(base);
|
|
348
|
+
}
|
|
349
|
+
return {
|
|
350
|
+
...base,
|
|
351
|
+
...modifier,
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
function fakeMockMessageEndpoint(modifier) {
|
|
355
|
+
const base = {
|
|
356
|
+
type: 'mock',
|
|
357
|
+
name: 'Mock',
|
|
358
|
+
supportedModes: ['PUBLISH', 'SUBSCRIBE'],
|
|
359
|
+
icon: 'gio:language',
|
|
360
|
+
};
|
|
361
|
+
if (isFunction(modifier)) {
|
|
362
|
+
return modifier(base);
|
|
363
|
+
}
|
|
364
|
+
return {
|
|
365
|
+
...base,
|
|
366
|
+
...modifier,
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
function fakeKafkaMessageEndpoint(modifier) {
|
|
370
|
+
const base = {
|
|
371
|
+
type: 'kafka',
|
|
372
|
+
name: 'Kafka',
|
|
373
|
+
supportedModes: ['PUBLISH', 'SUBSCRIBE'],
|
|
374
|
+
icon: 'gio:kafka',
|
|
375
|
+
};
|
|
376
|
+
if (isFunction(modifier)) {
|
|
377
|
+
return modifier(base);
|
|
378
|
+
}
|
|
379
|
+
return {
|
|
380
|
+
...base,
|
|
381
|
+
...modifier,
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
function fakeHTTPProxyEndpoint(modifier) {
|
|
385
|
+
const base = {
|
|
386
|
+
type: 'http-proxy',
|
|
387
|
+
name: 'HTTP Proxy',
|
|
388
|
+
supportedModes: ['REQUEST_RESPONSE'],
|
|
389
|
+
icon: 'gio:language',
|
|
390
|
+
};
|
|
391
|
+
if (isFunction(modifier)) {
|
|
392
|
+
return modifier(base);
|
|
393
|
+
}
|
|
394
|
+
return {
|
|
395
|
+
...base,
|
|
396
|
+
...modifier,
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
|
|
136
400
|
/*
|
|
137
401
|
* Copyright (C) 2022 The Gravitee team (http://gravitee.io)
|
|
138
402
|
*
|
|
@@ -209,6 +473,9 @@ class GioPolicyStudioFlowsMenuHarness extends ComponentHarness {
|
|
|
209
473
|
await (await flowsGroups.childLocatorFor(MatButtonHarness.with({ ancestor: '.list__flowsGroup__header__addBtn' }))()).click();
|
|
210
474
|
}
|
|
211
475
|
}
|
|
476
|
+
async openFlowExecutionConfig() {
|
|
477
|
+
await (await this.locatorFor(MatButtonHarness.with({ selector: '.header__configBtn_edit' }))())?.click();
|
|
478
|
+
}
|
|
212
479
|
}
|
|
213
480
|
GioPolicyStudioFlowsMenuHarness.hostSelector = 'gio-ps-flows-menu';
|
|
214
481
|
|
|
@@ -500,6 +767,151 @@ class GioPolicyStudioFlowMessageFormDialogHarness extends ComponentHarness {
|
|
|
500
767
|
}
|
|
501
768
|
GioPolicyStudioFlowMessageFormDialogHarness.hostSelector = 'gio-ps-flow-message-form-dialog';
|
|
502
769
|
|
|
770
|
+
/*
|
|
771
|
+
* Copyright (C) 2022 The Gravitee team (http://gravitee.io)
|
|
772
|
+
*
|
|
773
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
774
|
+
* you may not use this file except in compliance with the License.
|
|
775
|
+
* You may obtain a copy of the License at
|
|
776
|
+
*
|
|
777
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
778
|
+
*
|
|
779
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
780
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
781
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
782
|
+
* See the License for the specific language governing permissions and
|
|
783
|
+
* limitations under the License.
|
|
784
|
+
*/
|
|
785
|
+
class GioPolicyStudioFlowExecutionFormDialogHarness extends ComponentHarness {
|
|
786
|
+
constructor() {
|
|
787
|
+
super(...arguments);
|
|
788
|
+
this.getSaveBtn = this.locatorFor(MatButtonHarness.with({ selector: '.actions__saveBtn' }));
|
|
789
|
+
this.getCancelBtn = this.locatorFor(MatButtonHarness.with({ selector: '.actions__cancelBtn' }));
|
|
790
|
+
}
|
|
791
|
+
async setFlowFormValues(flowExecution) {
|
|
792
|
+
const modeInput = await this.locatorFor(MatSelectHarness.with({ selector: '[formControlName="mode"]' }))();
|
|
793
|
+
const matchRequiredInput = await this.locatorFor(MatSlideToggleHarness.with({ selector: '[formControlName="matchRequired"]' }))();
|
|
794
|
+
if (flowExecution.mode) {
|
|
795
|
+
await modeInput.open();
|
|
796
|
+
// Unselect all options before selecting the new one
|
|
797
|
+
for (const option of await modeInput.getOptions()) {
|
|
798
|
+
if (await option.isSelected()) {
|
|
799
|
+
await option.click();
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
const flowModeToValue = {
|
|
803
|
+
BEST_MATCH: 'Best match',
|
|
804
|
+
DEFAULT: 'Default',
|
|
805
|
+
};
|
|
806
|
+
await modeInput.clickOptions({ text: new RegExp(flowModeToValue[flowExecution.mode], 'i') });
|
|
807
|
+
}
|
|
808
|
+
if (flowExecution.matchRequired) {
|
|
809
|
+
await matchRequiredInput.check();
|
|
810
|
+
}
|
|
811
|
+
else {
|
|
812
|
+
await matchRequiredInput.uncheck();
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
async save() {
|
|
816
|
+
const button = await this.getSaveBtn();
|
|
817
|
+
await button.click();
|
|
818
|
+
}
|
|
819
|
+
async cancel() {
|
|
820
|
+
const button = await this.getCancelBtn();
|
|
821
|
+
await button.click();
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
GioPolicyStudioFlowExecutionFormDialogHarness.hostSelector = 'gio-ps-flow-execution-form-dialog';
|
|
825
|
+
|
|
826
|
+
/*
|
|
827
|
+
* Copyright (C) 2022 The Gravitee team (http://gravitee.io)
|
|
828
|
+
*
|
|
829
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
830
|
+
* you may not use this file except in compliance with the License.
|
|
831
|
+
* You may obtain a copy of the License at
|
|
832
|
+
*
|
|
833
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
834
|
+
*
|
|
835
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
836
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
837
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
838
|
+
* See the License for the specific language governing permissions and
|
|
839
|
+
* limitations under the License.
|
|
840
|
+
*/
|
|
841
|
+
class GioPolicyStudioDetailsPhasePolicyHarness extends ComponentHarness {
|
|
842
|
+
/**
|
|
843
|
+
* Get Harness with the given filter.
|
|
844
|
+
*
|
|
845
|
+
* @param options Options for filtering which input instances are considered a match.
|
|
846
|
+
* @return a `HarnessPredicate` configured with the given options.
|
|
847
|
+
*/
|
|
848
|
+
static with(options = {}) {
|
|
849
|
+
return new HarnessPredicate(GioPolicyStudioDetailsPhasePolicyHarness, options);
|
|
850
|
+
}
|
|
851
|
+
async getName() {
|
|
852
|
+
return (await (await this.locatorFor(SpanHarness.with({ selector: '.info__primary__name' }))()).getText()) ?? '';
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
GioPolicyStudioDetailsPhasePolicyHarness.hostSelector = 'gio-ps-flow-details-phase-policy';
|
|
856
|
+
|
|
857
|
+
/*
|
|
858
|
+
* Copyright (C) 2022 The Gravitee team (http://gravitee.io)
|
|
859
|
+
*
|
|
860
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
861
|
+
* you may not use this file except in compliance with the License.
|
|
862
|
+
* You may obtain a copy of the License at
|
|
863
|
+
*
|
|
864
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
865
|
+
*
|
|
866
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
867
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
868
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
869
|
+
* See the License for the specific language governing permissions and
|
|
870
|
+
* limitations under the License.
|
|
871
|
+
*/
|
|
872
|
+
const TYPE_TO_TEXT = {
|
|
873
|
+
REQUEST: 'Request phase',
|
|
874
|
+
RESPONSE: 'Response phase',
|
|
875
|
+
PUBLISH: 'Publish phase',
|
|
876
|
+
SUBSCRIBE: 'Subscribe phase',
|
|
877
|
+
};
|
|
878
|
+
class GioPolicyStudioDetailsPhaseHarness extends ComponentHarness {
|
|
879
|
+
constructor() {
|
|
880
|
+
super(...arguments);
|
|
881
|
+
this.getHeaderName = () => this.locatorForOptional(SpanHarness.with({ selector: '.header__name' }))().then(async (span) => span?.getText() ?? null);
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* Get Harness with the given filter.
|
|
885
|
+
*
|
|
886
|
+
* @param options Options for filtering which input instances are considered a match.
|
|
887
|
+
* @return a `HarnessPredicate` configured with the given options.
|
|
888
|
+
*/
|
|
889
|
+
static with(options = {}) {
|
|
890
|
+
return new HarnessPredicate(GioPolicyStudioDetailsPhaseHarness, options).addOption('type', options.type, async (harness, type) => HarnessPredicate.stringMatches(harness.getHeaderName(), TYPE_TO_TEXT[type]));
|
|
891
|
+
}
|
|
892
|
+
async getSteps() {
|
|
893
|
+
const stepsDiv = await this.locatorForAll(DivHarness.with({ selector: '.content__step' }))();
|
|
894
|
+
if (isEmpty(stepsDiv)) {
|
|
895
|
+
// No step - the phase is disabled
|
|
896
|
+
return null;
|
|
897
|
+
}
|
|
898
|
+
return await parallel(() => stepsDiv.map(async (stepDiv) => {
|
|
899
|
+
const idConnector = !!(await stepDiv.getText({ childSelector: '.content__step__connectorBadge' }));
|
|
900
|
+
if (idConnector) {
|
|
901
|
+
return {
|
|
902
|
+
text: (await stepDiv.getText()) ?? '',
|
|
903
|
+
type: 'connector',
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
return {
|
|
907
|
+
text: await (await stepDiv.childLocatorFor(GioPolicyStudioDetailsPhasePolicyHarness)()).getName(),
|
|
908
|
+
type: idConnector ? 'connector' : 'policy',
|
|
909
|
+
};
|
|
910
|
+
}));
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
GioPolicyStudioDetailsPhaseHarness.hostSelector = 'gio-ps-flow-details-phase';
|
|
914
|
+
|
|
503
915
|
/*
|
|
504
916
|
* Copyright (C) 2022 The Gravitee team (http://gravitee.io)
|
|
505
917
|
*
|
|
@@ -520,6 +932,7 @@ class GioPolicyStudioHarness extends ComponentHarness {
|
|
|
520
932
|
super(...arguments);
|
|
521
933
|
this.menuHarness = this.locatorFor(GioPolicyStudioFlowsMenuHarness);
|
|
522
934
|
this.detailsHarness = this.locatorFor(GioPolicyStudioDetailsHarness);
|
|
935
|
+
this.phaseHarness = (phaseType) => this.locatorFor(GioPolicyStudioDetailsPhaseHarness.with({ type: phaseType }))();
|
|
523
936
|
}
|
|
524
937
|
/**
|
|
525
938
|
* Add a flow to a plan or to "Common flows"
|
|
@@ -542,19 +955,50 @@ class GioPolicyStudioHarness extends ComponentHarness {
|
|
|
542
955
|
await (await this.detailsHarness()).clickEditFlowBtn();
|
|
543
956
|
await this.setFlowFormDialog(flow);
|
|
544
957
|
}
|
|
958
|
+
/**
|
|
959
|
+
* Delete a flow
|
|
960
|
+
*
|
|
961
|
+
* @param flowName Flow name to delete
|
|
962
|
+
*/
|
|
545
963
|
async deleteFlow(flowName) {
|
|
546
964
|
(await this.menuHarness()).selectFlow(new RegExp(flowName, 'i'));
|
|
547
965
|
await (await this.detailsHarness()).clickDeleteFlowBtn();
|
|
548
966
|
}
|
|
967
|
+
/**
|
|
968
|
+
* Select a flow in the menu
|
|
969
|
+
*
|
|
970
|
+
* @param flowName Flow name to select
|
|
971
|
+
*/
|
|
549
972
|
async selectFlowInMenu(flowName) {
|
|
550
973
|
await (await this.menuHarness()).selectFlow(new RegExp(flowName, 'i'));
|
|
551
974
|
}
|
|
975
|
+
/**
|
|
976
|
+
* Get the list of flows in the menu
|
|
977
|
+
*/
|
|
552
978
|
async getFlowsMenu() {
|
|
553
979
|
return (await this.menuHarness()).getAllFlowsGroups();
|
|
554
980
|
}
|
|
981
|
+
/**
|
|
982
|
+
* Get selected flow infos
|
|
983
|
+
*/
|
|
555
984
|
async getSelectedFlowInfos() {
|
|
556
985
|
return await (await this.detailsHarness()).getFlowInfos();
|
|
557
986
|
}
|
|
987
|
+
/**
|
|
988
|
+
* Get selected flow steps phase
|
|
989
|
+
* @param tabLabel Select tabs before try to find phase. Useful to find Event phases for Message API
|
|
990
|
+
*/
|
|
991
|
+
async getSelectedFlowSteps(phaseType, tabLabel) {
|
|
992
|
+
if (tabLabel) {
|
|
993
|
+
const matTabsHarness = await this.locatorFor(MatTabGroupHarness.with({ selector: '.content__tabs' }))();
|
|
994
|
+
await matTabsHarness.selectTab({ label: tabLabel });
|
|
995
|
+
}
|
|
996
|
+
const steps = await (await this.phaseHarness(phaseType)).getSteps();
|
|
997
|
+
return steps ? steps : 'DISABLED';
|
|
998
|
+
}
|
|
999
|
+
/**
|
|
1000
|
+
* Click on the "Save" button
|
|
1001
|
+
*/
|
|
558
1002
|
async save() {
|
|
559
1003
|
await (await this.locatorFor(MatButtonHarness.with({ text: /Save/ }))()).click();
|
|
560
1004
|
}
|
|
@@ -596,6 +1040,12 @@ class GioPolicyStudioHarness extends ComponentHarness {
|
|
|
596
1040
|
}
|
|
597
1041
|
throw new Error('No selector found for this flow. Needed to select Message or Proxy flow form dialog.');
|
|
598
1042
|
}
|
|
1043
|
+
async setFlowExecutionConfig(flowExecution) {
|
|
1044
|
+
await (await this.menuHarness()).openFlowExecutionConfig();
|
|
1045
|
+
const flowExecutionDialog = await this.documentRootLocatorFactory().locatorFor(GioPolicyStudioFlowExecutionFormDialogHarness)();
|
|
1046
|
+
await flowExecutionDialog.setFlowFormValues(flowExecution);
|
|
1047
|
+
await flowExecutionDialog.save();
|
|
1048
|
+
}
|
|
599
1049
|
}
|
|
600
1050
|
GioPolicyStudioHarness.hostSelector = 'gio-policy-studio';
|
|
601
1051
|
|
|
@@ -619,5 +1069,5 @@ GioPolicyStudioHarness.hostSelector = 'gio-policy-studio';
|
|
|
619
1069
|
* Generated bundle index. Do not edit.
|
|
620
1070
|
*/
|
|
621
1071
|
|
|
622
|
-
export { GioPolicyStudioHarness, fakeChannelFlow, fakeHttpFlow, fakePlan };
|
|
1072
|
+
export { GioPolicyStudioHarness, fakeBestMatchFlowExecution, fakeChannelFlow, fakeDefaultFlowExecution, fakeHTTPGetMessageEntrypoint, fakeHTTPPostMessageEntrypoint, fakeHTTPProxyEndpoint, fakeHTTPProxyEntrypoint, fakeHttpFlow, fakeKafkaMessageEndpoint, fakeMockMessageEndpoint, fakeMockPolicyStep, fakePlan, fakeRateLimitStep, fakeSSEMessageEntrypoint, fakeWebhookMessageEntrypoint, fakeWebsocketMessageEntrypoint, fakeXmlToJsonStep };
|
|
623
1073
|
//# sourceMappingURL=gravitee-ui-policy-studio-angular-testing.mjs.map
|