@gravitee/ui-policy-studio-angular 17.3.0 → 17.4.0

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.
@@ -175,6 +175,28 @@ function fakeLlmFlow(modifier) {
175
175
  ...modifier,
176
176
  };
177
177
  }
178
+ function fakeA2aFlow(modifier) {
179
+ const httpSelector = {
180
+ type: 'HTTP',
181
+ path: '/path',
182
+ pathOperator: 'EQUALS',
183
+ methods: ['GET'],
184
+ };
185
+ const base = {
186
+ name: 'Flow name',
187
+ selectors: [httpSelector],
188
+ request: [],
189
+ response: [],
190
+ enabled: true,
191
+ };
192
+ if (isFunction(modifier)) {
193
+ return modifier(base);
194
+ }
195
+ return {
196
+ ...base,
197
+ ...modifier,
198
+ };
199
+ }
178
200
 
179
201
  /*
180
202
  * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
@@ -822,6 +844,23 @@ function fakeLlmProxyEndpoint(modifier) {
822
844
  ...modifier,
823
845
  };
824
846
  }
847
+ function fakeA2aProxyConnector(modifier) {
848
+ const base = {
849
+ type: 'a2a-proxy',
850
+ name: 'A2A Proxy',
851
+ supportedModes: ['REQUEST_RESPONSE'],
852
+ icon: 'gio:language',
853
+ };
854
+ if (isFunction(modifier)) {
855
+ return modifier(base);
856
+ }
857
+ return {
858
+ ...base,
859
+ ...modifier,
860
+ };
861
+ }
862
+ const fakeA2aProxyEntrypoint = fakeA2aProxyConnector;
863
+ const fakeA2aProxyEndpoint = fakeA2aProxyConnector;
825
864
 
826
865
  /*
827
866
  * Copyright (C) 2022 The Gravitee team (http://gravitee.io)
@@ -1860,6 +1899,99 @@ class GioPolicyStudioFlowLlmFormDialogHarness extends ComponentHarness {
1860
1899
  }
1861
1900
  }
1862
1901
 
1902
+ /*
1903
+ * Copyright (C) 2022 The Gravitee team (http://gravitee.io)
1904
+ *
1905
+ * Licensed under the Apache License, Version 2.0 (the "License");
1906
+ * you may not use this file except in compliance with the License.
1907
+ * You may obtain a copy of the License at
1908
+ *
1909
+ * http://www.apache.org/licenses/LICENSE-2.0
1910
+ *
1911
+ * Unless required by applicable law or agreed to in writing, software
1912
+ * distributed under the License is distributed on an "AS IS" BASIS,
1913
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1914
+ * See the License for the specific language governing permissions and
1915
+ * limitations under the License.
1916
+ */
1917
+ class GioPolicyStudioFlowA2aFormDialogHarness extends ComponentHarness {
1918
+ constructor() {
1919
+ super(...arguments);
1920
+ this.getSaveBtn = this.locatorFor(MatButtonHarness.with({ selector: '.actions__saveBtn' }));
1921
+ this.getCancelBtn = this.locatorFor(MatButtonHarness.with({ selector: '.actions__cancelBtn' }));
1922
+ this.nameInput = this.locatorFor(MatInputHarness.with({ selector: '[formControlName="name"]' }));
1923
+ this.pathOperatorInput = this.locatorFor(MatSelectHarness.with({ selector: '[formControlName="pathOperator"]' }));
1924
+ this.pathInput = this.locatorFor(MatInputHarness.with({ selector: '[formControlName="path"]' }));
1925
+ this.methodsInput = this.locatorFor(GioFormTagsInputHarness.with({ selector: '[formControlName="methods"]' }));
1926
+ this.conditionInput = this.locatorFor(MatInputHarness.with({ selector: '[formControlName="condition"]' }));
1927
+ }
1928
+ static { this.hostSelector = 'gio-ps-flow-a2a-form-dialog'; }
1929
+ async setFlowFormValues(flow) {
1930
+ if (flow.name) {
1931
+ const nameInput = await this.nameInput();
1932
+ await nameInput.setValue(flow.name);
1933
+ }
1934
+ if (flow.pathOperator) {
1935
+ const pathOperatorInput = await this.pathOperatorInput();
1936
+ await pathOperatorInput.open();
1937
+ // Unselect all options before selecting the new one
1938
+ for (const option of await pathOperatorInput.getOptions()) {
1939
+ if (await option.isSelected()) {
1940
+ await option.click();
1941
+ }
1942
+ }
1943
+ await pathOperatorInput.clickOptions({ text: new RegExp(flow.pathOperator, 'i') });
1944
+ }
1945
+ if (flow.path) {
1946
+ const input = await this.pathInput();
1947
+ await input.setValue(flow.path);
1948
+ }
1949
+ if (flow.methods) {
1950
+ const methodsInput = await this.methodsInput();
1951
+ await methodsInput.removeTag('ALL');
1952
+ for (const method of flow.methods) {
1953
+ await methodsInput.addTag(method);
1954
+ }
1955
+ }
1956
+ if (flow.condition) {
1957
+ const conditionInput = await this.conditionInput();
1958
+ await conditionInput.setValue(flow.condition);
1959
+ }
1960
+ }
1961
+ async getFlowFormValues() {
1962
+ return {
1963
+ name: await this.getFlowName(),
1964
+ pathOperator: await this.getPathOperator(),
1965
+ path: await this.getFlowPath(),
1966
+ methods: await this.getMethods(),
1967
+ condition: await this.getCondition(),
1968
+ };
1969
+ }
1970
+ async getFlowName() {
1971
+ return this.nameInput().then(input => input.getValue());
1972
+ }
1973
+ async getFlowPath() {
1974
+ return this.pathInput().then(input => input.getValue());
1975
+ }
1976
+ async getPathOperator() {
1977
+ return this.pathOperatorInput().then(input => input.getValueText());
1978
+ }
1979
+ async getMethods() {
1980
+ return this.methodsInput().then(input => input.getTags());
1981
+ }
1982
+ async getCondition() {
1983
+ return this.conditionInput().then(input => input.getValue());
1984
+ }
1985
+ async save() {
1986
+ const button = await this.getSaveBtn();
1987
+ await button.click();
1988
+ }
1989
+ async cancel() {
1990
+ const button = await this.getCancelBtn();
1991
+ await button.click();
1992
+ }
1993
+ }
1994
+
1863
1995
  /*
1864
1996
  * Copyright (C) 2022 The Gravitee team (http://gravitee.io)
1865
1997
  *
@@ -2025,12 +2157,19 @@ class GioPolicyStudioHarness extends ComponentHarness {
2025
2157
  return;
2026
2158
  }
2027
2159
  if (httpSelector) {
2028
- let flowFormNewDialog = await this.documentRootLocatorFactory().locatorForOptional(GioPolicyStudioFlowProxyFormDialogHarness)();
2029
- if (!flowFormNewDialog) {
2030
- flowFormNewDialog = await this.documentRootLocatorFactory().locatorForOptional(GioPolicyStudioFlowLlmFormDialogHarness)();
2160
+ const httpDialogHarnesses = [
2161
+ GioPolicyStudioFlowProxyFormDialogHarness,
2162
+ GioPolicyStudioFlowLlmFormDialogHarness,
2163
+ GioPolicyStudioFlowA2aFormDialogHarness,
2164
+ ];
2165
+ let flowFormNewDialog = null;
2166
+ for (const harness of httpDialogHarnesses) {
2167
+ flowFormNewDialog = await this.documentRootLocatorFactory().locatorForOptional(harness)();
2168
+ if (flowFormNewDialog)
2169
+ break;
2031
2170
  }
2032
2171
  if (!flowFormNewDialog) {
2033
- throw new Error('No Proxy or LLM flow form dialog found.');
2172
+ throw new Error('No Proxy, LLM or A2A flow form dialog found.');
2034
2173
  }
2035
2174
  await flowFormNewDialog.setFlowFormValues({
2036
2175
  name: flow.name,
@@ -2141,5 +2280,5 @@ class GioPolicyGroupStudioHarness extends ComponentHarness {
2141
2280
  * Generated bundle index. Do not edit.
2142
2281
  */
2143
2282
 
2144
- export { GioPolicyGroupStudioHarness, GioPolicyStudioHarness, POLICIES_V4_UNREGISTERED_ICON, fakeAllPolicies, fakeBestMatchFlowExecution, fakeChannelFlow, fakeConditionedChannelFlow, fakeConditionedHttpFlow, fakeDefaultFlowExecution, fakeHTTPGetMessageEntrypoint, fakeHTTPPostMessageEntrypoint, fakeHTTPProxyEndpoint, fakeHTTPProxyEntrypoint, fakeHttpFlow, fakeJsonToXmlStep, fakeKafkaMessageEndpoint, fakeKafkaNativeEndpoint, fakeKafkaNativeEntrypoint, fakeLlmFlow, fakeLlmProxyEndpoint, fakeLlmProxyEntrypoint, fakeMCPProxyEndpoint, fakeMCPProxyEntrypoint, fakeMcpFlow, fakeMockMessageEndpoint, fakeNativeFlow, fakePlan, fakeRateLimitStep, fakeSSEMessageEntrypoint, fakeSharedPolicyGroupPolicyStep, fakeTestPolicy, fakeTestPolicyStep, fakeWebhookMessageEntrypoint, fakeWebsocketMessageEntrypoint };
2283
+ export { GioPolicyGroupStudioHarness, GioPolicyStudioHarness, POLICIES_V4_UNREGISTERED_ICON, fakeA2aFlow, fakeA2aProxyConnector, fakeA2aProxyEndpoint, fakeA2aProxyEntrypoint, fakeAllPolicies, fakeBestMatchFlowExecution, fakeChannelFlow, fakeConditionedChannelFlow, fakeConditionedHttpFlow, fakeDefaultFlowExecution, fakeHTTPGetMessageEntrypoint, fakeHTTPPostMessageEntrypoint, fakeHTTPProxyEndpoint, fakeHTTPProxyEntrypoint, fakeHttpFlow, fakeJsonToXmlStep, fakeKafkaMessageEndpoint, fakeKafkaNativeEndpoint, fakeKafkaNativeEntrypoint, fakeLlmFlow, fakeLlmProxyEndpoint, fakeLlmProxyEntrypoint, fakeMCPProxyEndpoint, fakeMCPProxyEntrypoint, fakeMcpFlow, fakeMockMessageEndpoint, fakeNativeFlow, fakePlan, fakeRateLimitStep, fakeSSEMessageEntrypoint, fakeSharedPolicyGroupPolicyStep, fakeTestPolicy, fakeTestPolicyStep, fakeWebhookMessageEntrypoint, fakeWebsocketMessageEntrypoint };
2145
2284
  //# sourceMappingURL=gravitee-ui-policy-studio-angular-testing.mjs.map