@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,11 +1,13 @@
|
|
|
1
|
-
import { isFunction } from 'lodash';
|
|
1
|
+
import { isFunction, isEmpty } from 'lodash';
|
|
2
2
|
import { __awaiter, __asyncValues } from 'tslib';
|
|
3
|
-
import { ComponentHarness, parallel } from '@angular/cdk/testing';
|
|
3
|
+
import { ComponentHarness, parallel, HarnessPredicate } from '@angular/cdk/testing';
|
|
4
4
|
import { MatButtonHarness } from '@angular/material/button/testing';
|
|
5
|
+
import { MatTabGroupHarness } from '@angular/material/tabs/testing';
|
|
5
6
|
import { DivHarness, SpanHarness } from '@gravitee/ui-particles-angular/testing';
|
|
6
7
|
import { MatInputHarness } from '@angular/material/input/testing';
|
|
7
8
|
import { MatSelectHarness } from '@angular/material/select/testing';
|
|
8
9
|
import { GioFormTagsInputHarness } from '@gravitee/ui-particles-angular';
|
|
10
|
+
import { MatSlideToggleHarness } from '@angular/material/slide-toggle/testing';
|
|
9
11
|
|
|
10
12
|
/*
|
|
11
13
|
* Copyright (C) 2023 The Gravitee team (http://gravitee.io)
|
|
@@ -66,6 +68,102 @@ function fakeHttpFlow(modifier) {
|
|
|
66
68
|
return Object.assign(Object.assign({}, base), modifier);
|
|
67
69
|
}
|
|
68
70
|
|
|
71
|
+
/*
|
|
72
|
+
* Copyright (C) 2023 The Gravitee team (http://gravitee.io)
|
|
73
|
+
*
|
|
74
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
75
|
+
* you may not use this file except in compliance with the License.
|
|
76
|
+
* You may obtain a copy of the License at
|
|
77
|
+
*
|
|
78
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
79
|
+
*
|
|
80
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
81
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
82
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
83
|
+
* See the License for the specific language governing permissions and
|
|
84
|
+
* limitations under the License.
|
|
85
|
+
*/
|
|
86
|
+
function fakeBestMatchFlowExecution(modifier) {
|
|
87
|
+
const base = {
|
|
88
|
+
mode: 'BEST_MATCH',
|
|
89
|
+
matchRequired: false,
|
|
90
|
+
};
|
|
91
|
+
if (isFunction(modifier)) {
|
|
92
|
+
return modifier(base);
|
|
93
|
+
}
|
|
94
|
+
return Object.assign(Object.assign({}, base), modifier);
|
|
95
|
+
}
|
|
96
|
+
function fakeDefaultFlowExecution(modifier) {
|
|
97
|
+
const base = {
|
|
98
|
+
mode: 'DEFAULT',
|
|
99
|
+
matchRequired: false,
|
|
100
|
+
};
|
|
101
|
+
if (isFunction(modifier)) {
|
|
102
|
+
return modifier(base);
|
|
103
|
+
}
|
|
104
|
+
return Object.assign(Object.assign({}, base), modifier);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/*
|
|
108
|
+
* Copyright (C) 2023 The Gravitee team (http://gravitee.io)
|
|
109
|
+
*
|
|
110
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
111
|
+
* you may not use this file except in compliance with the License.
|
|
112
|
+
* You may obtain a copy of the License at
|
|
113
|
+
*
|
|
114
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
115
|
+
*
|
|
116
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
117
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
118
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
119
|
+
* See the License for the specific language governing permissions and
|
|
120
|
+
* limitations under the License.
|
|
121
|
+
*/
|
|
122
|
+
function fakeMockPolicyStep(modifier) {
|
|
123
|
+
const base = {
|
|
124
|
+
name: 'Mock Policy',
|
|
125
|
+
description: 'Mock Policy description',
|
|
126
|
+
enabled: true,
|
|
127
|
+
policy: 'mock',
|
|
128
|
+
};
|
|
129
|
+
if (isFunction(modifier)) {
|
|
130
|
+
return modifier(base);
|
|
131
|
+
}
|
|
132
|
+
return Object.assign(Object.assign({}, base), modifier);
|
|
133
|
+
}
|
|
134
|
+
function fakeRateLimitStep(modifier) {
|
|
135
|
+
const base = {
|
|
136
|
+
name: 'Rate Limit',
|
|
137
|
+
description: 'Step description',
|
|
138
|
+
enabled: true,
|
|
139
|
+
policy: 'rate-limit',
|
|
140
|
+
configuration: {
|
|
141
|
+
rate: {
|
|
142
|
+
limit: 10,
|
|
143
|
+
periodTime: 1,
|
|
144
|
+
periodTimeUnit: 'MINUTES',
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
if (isFunction(modifier)) {
|
|
149
|
+
return modifier(base);
|
|
150
|
+
}
|
|
151
|
+
return Object.assign(Object.assign({}, base), modifier);
|
|
152
|
+
}
|
|
153
|
+
function fakeXmlToJsonStep(modifier) {
|
|
154
|
+
const base = {
|
|
155
|
+
name: 'XML to JSON',
|
|
156
|
+
description: 'XML to JSON',
|
|
157
|
+
enabled: true,
|
|
158
|
+
policy: 'xml-json',
|
|
159
|
+
configuration: {},
|
|
160
|
+
};
|
|
161
|
+
if (isFunction(modifier)) {
|
|
162
|
+
return modifier(base);
|
|
163
|
+
}
|
|
164
|
+
return Object.assign(Object.assign({}, base), modifier);
|
|
165
|
+
}
|
|
166
|
+
|
|
69
167
|
/*
|
|
70
168
|
* Copyright (C) 2022 The Gravitee team (http://gravitee.io)
|
|
71
169
|
*
|
|
@@ -125,6 +223,130 @@ function fakePlan(modifier) {
|
|
|
125
223
|
* limitations under the License.
|
|
126
224
|
*/
|
|
127
225
|
|
|
226
|
+
/*
|
|
227
|
+
* Copyright (C) 2023 The Gravitee team (http://gravitee.io)
|
|
228
|
+
*
|
|
229
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
230
|
+
* you may not use this file except in compliance with the License.
|
|
231
|
+
* You may obtain a copy of the License at
|
|
232
|
+
*
|
|
233
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
234
|
+
*
|
|
235
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
236
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
237
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
238
|
+
* See the License for the specific language governing permissions and
|
|
239
|
+
* limitations under the License.
|
|
240
|
+
*/
|
|
241
|
+
function fakeSSEMessageEntrypoint(modifier) {
|
|
242
|
+
const base = {
|
|
243
|
+
type: 'sse',
|
|
244
|
+
name: 'Server-Sent Events',
|
|
245
|
+
supportedModes: ['SUBSCRIBE'],
|
|
246
|
+
icon: 'gio:sse',
|
|
247
|
+
};
|
|
248
|
+
if (isFunction(modifier)) {
|
|
249
|
+
return modifier(base);
|
|
250
|
+
}
|
|
251
|
+
return Object.assign(Object.assign({}, base), modifier);
|
|
252
|
+
}
|
|
253
|
+
function fakeWebsocketMessageEntrypoint(modifier) {
|
|
254
|
+
const base = {
|
|
255
|
+
type: 'websocket',
|
|
256
|
+
name: 'Websocket',
|
|
257
|
+
supportedModes: ['PUBLISH', 'SUBSCRIBE'],
|
|
258
|
+
icon: 'gio:websocket',
|
|
259
|
+
};
|
|
260
|
+
if (isFunction(modifier)) {
|
|
261
|
+
return modifier(base);
|
|
262
|
+
}
|
|
263
|
+
return Object.assign(Object.assign({}, base), modifier);
|
|
264
|
+
}
|
|
265
|
+
function fakeHTTPPostMessageEntrypoint(modifier) {
|
|
266
|
+
const base = {
|
|
267
|
+
type: 'http-post',
|
|
268
|
+
name: 'HTTP POST',
|
|
269
|
+
supportedModes: ['PUBLISH'],
|
|
270
|
+
icon: 'gio:language',
|
|
271
|
+
};
|
|
272
|
+
if (isFunction(modifier)) {
|
|
273
|
+
return modifier(base);
|
|
274
|
+
}
|
|
275
|
+
return Object.assign(Object.assign({}, base), modifier);
|
|
276
|
+
}
|
|
277
|
+
function fakeHTTPGetMessageEntrypoint(modifier) {
|
|
278
|
+
const base = {
|
|
279
|
+
type: 'http-get',
|
|
280
|
+
name: 'HTTP Get',
|
|
281
|
+
supportedModes: ['SUBSCRIBE'],
|
|
282
|
+
icon: 'gio:language',
|
|
283
|
+
};
|
|
284
|
+
if (isFunction(modifier)) {
|
|
285
|
+
return modifier(base);
|
|
286
|
+
}
|
|
287
|
+
return Object.assign(Object.assign({}, base), modifier);
|
|
288
|
+
}
|
|
289
|
+
function fakeWebhookMessageEntrypoint(modifier) {
|
|
290
|
+
const base = {
|
|
291
|
+
type: 'webhook',
|
|
292
|
+
name: 'Webhook',
|
|
293
|
+
supportedModes: ['SUBSCRIBE'],
|
|
294
|
+
icon: 'gio:webhook',
|
|
295
|
+
};
|
|
296
|
+
if (isFunction(modifier)) {
|
|
297
|
+
return modifier(base);
|
|
298
|
+
}
|
|
299
|
+
return Object.assign(Object.assign({}, base), modifier);
|
|
300
|
+
}
|
|
301
|
+
function fakeHTTPProxyEntrypoint(modifier) {
|
|
302
|
+
const base = {
|
|
303
|
+
type: 'http-proxy',
|
|
304
|
+
name: 'HTTP Proxy',
|
|
305
|
+
supportedModes: ['REQUEST_RESPONSE'],
|
|
306
|
+
icon: 'gio:language',
|
|
307
|
+
};
|
|
308
|
+
if (isFunction(modifier)) {
|
|
309
|
+
return modifier(base);
|
|
310
|
+
}
|
|
311
|
+
return Object.assign(Object.assign({}, base), modifier);
|
|
312
|
+
}
|
|
313
|
+
function fakeMockMessageEndpoint(modifier) {
|
|
314
|
+
const base = {
|
|
315
|
+
type: 'mock',
|
|
316
|
+
name: 'Mock',
|
|
317
|
+
supportedModes: ['PUBLISH', 'SUBSCRIBE'],
|
|
318
|
+
icon: 'gio:language',
|
|
319
|
+
};
|
|
320
|
+
if (isFunction(modifier)) {
|
|
321
|
+
return modifier(base);
|
|
322
|
+
}
|
|
323
|
+
return Object.assign(Object.assign({}, base), modifier);
|
|
324
|
+
}
|
|
325
|
+
function fakeKafkaMessageEndpoint(modifier) {
|
|
326
|
+
const base = {
|
|
327
|
+
type: 'kafka',
|
|
328
|
+
name: 'Kafka',
|
|
329
|
+
supportedModes: ['PUBLISH', 'SUBSCRIBE'],
|
|
330
|
+
icon: 'gio:kafka',
|
|
331
|
+
};
|
|
332
|
+
if (isFunction(modifier)) {
|
|
333
|
+
return modifier(base);
|
|
334
|
+
}
|
|
335
|
+
return Object.assign(Object.assign({}, base), modifier);
|
|
336
|
+
}
|
|
337
|
+
function fakeHTTPProxyEndpoint(modifier) {
|
|
338
|
+
const base = {
|
|
339
|
+
type: 'http-proxy',
|
|
340
|
+
name: 'HTTP Proxy',
|
|
341
|
+
supportedModes: ['REQUEST_RESPONSE'],
|
|
342
|
+
icon: 'gio:language',
|
|
343
|
+
};
|
|
344
|
+
if (isFunction(modifier)) {
|
|
345
|
+
return modifier(base);
|
|
346
|
+
}
|
|
347
|
+
return Object.assign(Object.assign({}, base), modifier);
|
|
348
|
+
}
|
|
349
|
+
|
|
128
350
|
/*
|
|
129
351
|
* Copyright (C) 2022 The Gravitee team (http://gravitee.io)
|
|
130
352
|
*
|
|
@@ -194,6 +416,12 @@ class GioPolicyStudioFlowsMenuHarness extends ComponentHarness {
|
|
|
194
416
|
}
|
|
195
417
|
});
|
|
196
418
|
}
|
|
419
|
+
openFlowExecutionConfig() {
|
|
420
|
+
var _a;
|
|
421
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
422
|
+
yield ((_a = (yield this.locatorFor(MatButtonHarness.with({ selector: '.header__configBtn_edit' }))())) === null || _a === void 0 ? void 0 : _a.click());
|
|
423
|
+
});
|
|
424
|
+
}
|
|
197
425
|
}
|
|
198
426
|
GioPolicyStudioFlowsMenuHarness.hostSelector = 'gio-ps-flows-menu';
|
|
199
427
|
|
|
@@ -492,11 +720,124 @@ class GioPolicyStudioFlowMessageFormDialogHarness extends ComponentHarness {
|
|
|
492
720
|
}
|
|
493
721
|
GioPolicyStudioFlowMessageFormDialogHarness.hostSelector = 'gio-ps-flow-message-form-dialog';
|
|
494
722
|
|
|
723
|
+
class GioPolicyStudioFlowExecutionFormDialogHarness extends ComponentHarness {
|
|
724
|
+
constructor() {
|
|
725
|
+
super(...arguments);
|
|
726
|
+
this.getSaveBtn = this.locatorFor(MatButtonHarness.with({ selector: '.actions__saveBtn' }));
|
|
727
|
+
this.getCancelBtn = this.locatorFor(MatButtonHarness.with({ selector: '.actions__cancelBtn' }));
|
|
728
|
+
}
|
|
729
|
+
setFlowFormValues(flowExecution) {
|
|
730
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
731
|
+
const modeInput = yield this.locatorFor(MatSelectHarness.with({ selector: '[formControlName="mode"]' }))();
|
|
732
|
+
const matchRequiredInput = yield this.locatorFor(MatSlideToggleHarness.with({ selector: '[formControlName="matchRequired"]' }))();
|
|
733
|
+
if (flowExecution.mode) {
|
|
734
|
+
yield modeInput.open();
|
|
735
|
+
// Unselect all options before selecting the new one
|
|
736
|
+
for (const option of yield modeInput.getOptions()) {
|
|
737
|
+
if (yield option.isSelected()) {
|
|
738
|
+
yield option.click();
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
const flowModeToValue = {
|
|
742
|
+
BEST_MATCH: 'Best match',
|
|
743
|
+
DEFAULT: 'Default',
|
|
744
|
+
};
|
|
745
|
+
yield modeInput.clickOptions({ text: new RegExp(flowModeToValue[flowExecution.mode], 'i') });
|
|
746
|
+
}
|
|
747
|
+
if (flowExecution.matchRequired) {
|
|
748
|
+
yield matchRequiredInput.check();
|
|
749
|
+
}
|
|
750
|
+
else {
|
|
751
|
+
yield matchRequiredInput.uncheck();
|
|
752
|
+
}
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
save() {
|
|
756
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
757
|
+
const button = yield this.getSaveBtn();
|
|
758
|
+
yield button.click();
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
cancel() {
|
|
762
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
763
|
+
const button = yield this.getCancelBtn();
|
|
764
|
+
yield button.click();
|
|
765
|
+
});
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
GioPolicyStudioFlowExecutionFormDialogHarness.hostSelector = 'gio-ps-flow-execution-form-dialog';
|
|
769
|
+
|
|
770
|
+
class GioPolicyStudioDetailsPhasePolicyHarness extends ComponentHarness {
|
|
771
|
+
/**
|
|
772
|
+
* Get Harness with the given filter.
|
|
773
|
+
*
|
|
774
|
+
* @param options Options for filtering which input instances are considered a match.
|
|
775
|
+
* @return a `HarnessPredicate` configured with the given options.
|
|
776
|
+
*/
|
|
777
|
+
static with(options = {}) {
|
|
778
|
+
return new HarnessPredicate(GioPolicyStudioDetailsPhasePolicyHarness, options);
|
|
779
|
+
}
|
|
780
|
+
getName() {
|
|
781
|
+
var _a;
|
|
782
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
783
|
+
return (_a = (yield (yield this.locatorFor(SpanHarness.with({ selector: '.info__primary__name' }))()).getText())) !== null && _a !== void 0 ? _a : '';
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
GioPolicyStudioDetailsPhasePolicyHarness.hostSelector = 'gio-ps-flow-details-phase-policy';
|
|
788
|
+
|
|
789
|
+
const TYPE_TO_TEXT = {
|
|
790
|
+
REQUEST: 'Request phase',
|
|
791
|
+
RESPONSE: 'Response phase',
|
|
792
|
+
PUBLISH: 'Publish phase',
|
|
793
|
+
SUBSCRIBE: 'Subscribe phase',
|
|
794
|
+
};
|
|
795
|
+
class GioPolicyStudioDetailsPhaseHarness extends ComponentHarness {
|
|
796
|
+
constructor() {
|
|
797
|
+
super(...arguments);
|
|
798
|
+
this.getHeaderName = () => this.locatorForOptional(SpanHarness.with({ selector: '.header__name' }))().then((span) => __awaiter(this, void 0, void 0, function* () { var _a; return (_a = span === null || span === void 0 ? void 0 : span.getText()) !== null && _a !== void 0 ? _a : null; }));
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Get Harness with the given filter.
|
|
802
|
+
*
|
|
803
|
+
* @param options Options for filtering which input instances are considered a match.
|
|
804
|
+
* @return a `HarnessPredicate` configured with the given options.
|
|
805
|
+
*/
|
|
806
|
+
static with(options = {}) {
|
|
807
|
+
return new HarnessPredicate(GioPolicyStudioDetailsPhaseHarness, options).addOption('type', options.type, (harness, type) => __awaiter(this, void 0, void 0, function* () { return HarnessPredicate.stringMatches(harness.getHeaderName(), TYPE_TO_TEXT[type]); }));
|
|
808
|
+
}
|
|
809
|
+
getSteps() {
|
|
810
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
811
|
+
const stepsDiv = yield this.locatorForAll(DivHarness.with({ selector: '.content__step' }))();
|
|
812
|
+
if (isEmpty(stepsDiv)) {
|
|
813
|
+
// No step - the phase is disabled
|
|
814
|
+
return null;
|
|
815
|
+
}
|
|
816
|
+
return yield parallel(() => stepsDiv.map((stepDiv) => __awaiter(this, void 0, void 0, function* () {
|
|
817
|
+
var _a;
|
|
818
|
+
const idConnector = !!(yield stepDiv.getText({ childSelector: '.content__step__connectorBadge' }));
|
|
819
|
+
if (idConnector) {
|
|
820
|
+
return {
|
|
821
|
+
text: (_a = (yield stepDiv.getText())) !== null && _a !== void 0 ? _a : '',
|
|
822
|
+
type: 'connector',
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
return {
|
|
826
|
+
text: yield (yield stepDiv.childLocatorFor(GioPolicyStudioDetailsPhasePolicyHarness)()).getName(),
|
|
827
|
+
type: idConnector ? 'connector' : 'policy',
|
|
828
|
+
};
|
|
829
|
+
})));
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
GioPolicyStudioDetailsPhaseHarness.hostSelector = 'gio-ps-flow-details-phase';
|
|
834
|
+
|
|
495
835
|
class GioPolicyStudioHarness extends ComponentHarness {
|
|
496
836
|
constructor() {
|
|
497
837
|
super(...arguments);
|
|
498
838
|
this.menuHarness = this.locatorFor(GioPolicyStudioFlowsMenuHarness);
|
|
499
839
|
this.detailsHarness = this.locatorFor(GioPolicyStudioDetailsHarness);
|
|
840
|
+
this.phaseHarness = (phaseType) => this.locatorFor(GioPolicyStudioDetailsPhaseHarness.with({ type: phaseType }))();
|
|
500
841
|
}
|
|
501
842
|
/**
|
|
502
843
|
* Add a flow to a plan or to "Common flows"
|
|
@@ -523,27 +864,60 @@ class GioPolicyStudioHarness extends ComponentHarness {
|
|
|
523
864
|
yield this.setFlowFormDialog(flow);
|
|
524
865
|
});
|
|
525
866
|
}
|
|
867
|
+
/**
|
|
868
|
+
* Delete a flow
|
|
869
|
+
*
|
|
870
|
+
* @param flowName Flow name to delete
|
|
871
|
+
*/
|
|
526
872
|
deleteFlow(flowName) {
|
|
527
873
|
return __awaiter(this, void 0, void 0, function* () {
|
|
528
874
|
(yield this.menuHarness()).selectFlow(new RegExp(flowName, 'i'));
|
|
529
875
|
yield (yield this.detailsHarness()).clickDeleteFlowBtn();
|
|
530
876
|
});
|
|
531
877
|
}
|
|
878
|
+
/**
|
|
879
|
+
* Select a flow in the menu
|
|
880
|
+
*
|
|
881
|
+
* @param flowName Flow name to select
|
|
882
|
+
*/
|
|
532
883
|
selectFlowInMenu(flowName) {
|
|
533
884
|
return __awaiter(this, void 0, void 0, function* () {
|
|
534
885
|
yield (yield this.menuHarness()).selectFlow(new RegExp(flowName, 'i'));
|
|
535
886
|
});
|
|
536
887
|
}
|
|
888
|
+
/**
|
|
889
|
+
* Get the list of flows in the menu
|
|
890
|
+
*/
|
|
537
891
|
getFlowsMenu() {
|
|
538
892
|
return __awaiter(this, void 0, void 0, function* () {
|
|
539
893
|
return (yield this.menuHarness()).getAllFlowsGroups();
|
|
540
894
|
});
|
|
541
895
|
}
|
|
896
|
+
/**
|
|
897
|
+
* Get selected flow infos
|
|
898
|
+
*/
|
|
542
899
|
getSelectedFlowInfos() {
|
|
543
900
|
return __awaiter(this, void 0, void 0, function* () {
|
|
544
901
|
return yield (yield this.detailsHarness()).getFlowInfos();
|
|
545
902
|
});
|
|
546
903
|
}
|
|
904
|
+
/**
|
|
905
|
+
* Get selected flow steps phase
|
|
906
|
+
* @param tabLabel Select tabs before try to find phase. Useful to find Event phases for Message API
|
|
907
|
+
*/
|
|
908
|
+
getSelectedFlowSteps(phaseType, tabLabel) {
|
|
909
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
910
|
+
if (tabLabel) {
|
|
911
|
+
const matTabsHarness = yield this.locatorFor(MatTabGroupHarness.with({ selector: '.content__tabs' }))();
|
|
912
|
+
yield matTabsHarness.selectTab({ label: tabLabel });
|
|
913
|
+
}
|
|
914
|
+
const steps = yield (yield this.phaseHarness(phaseType)).getSteps();
|
|
915
|
+
return steps ? steps : 'DISABLED';
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* Click on the "Save" button
|
|
920
|
+
*/
|
|
547
921
|
save() {
|
|
548
922
|
return __awaiter(this, void 0, void 0, function* () {
|
|
549
923
|
yield (yield this.locatorFor(MatButtonHarness.with({ text: /Save/ }))()).click();
|
|
@@ -590,6 +964,14 @@ class GioPolicyStudioHarness extends ComponentHarness {
|
|
|
590
964
|
throw new Error('No selector found for this flow. Needed to select Message or Proxy flow form dialog.');
|
|
591
965
|
});
|
|
592
966
|
}
|
|
967
|
+
setFlowExecutionConfig(flowExecution) {
|
|
968
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
969
|
+
yield (yield this.menuHarness()).openFlowExecutionConfig();
|
|
970
|
+
const flowExecutionDialog = yield this.documentRootLocatorFactory().locatorFor(GioPolicyStudioFlowExecutionFormDialogHarness)();
|
|
971
|
+
yield flowExecutionDialog.setFlowFormValues(flowExecution);
|
|
972
|
+
yield flowExecutionDialog.save();
|
|
973
|
+
});
|
|
974
|
+
}
|
|
593
975
|
}
|
|
594
976
|
GioPolicyStudioHarness.hostSelector = 'gio-policy-studio';
|
|
595
977
|
|
|
@@ -613,5 +995,5 @@ GioPolicyStudioHarness.hostSelector = 'gio-policy-studio';
|
|
|
613
995
|
* Generated bundle index. Do not edit.
|
|
614
996
|
*/
|
|
615
997
|
|
|
616
|
-
export { GioPolicyStudioHarness, fakeChannelFlow, fakeHttpFlow, fakePlan };
|
|
998
|
+
export { GioPolicyStudioHarness, fakeBestMatchFlowExecution, fakeChannelFlow, fakeDefaultFlowExecution, fakeHTTPGetMessageEntrypoint, fakeHTTPPostMessageEntrypoint, fakeHTTPProxyEndpoint, fakeHTTPProxyEntrypoint, fakeHttpFlow, fakeKafkaMessageEndpoint, fakeMockMessageEndpoint, fakeMockPolicyStep, fakePlan, fakeRateLimitStep, fakeSSEMessageEntrypoint, fakeWebhookMessageEntrypoint, fakeWebsocketMessageEntrypoint, fakeXmlToJsonStep };
|
|
617
999
|
//# sourceMappingURL=gravitee-ui-policy-studio-angular-testing.mjs.map
|