This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch
3298-add-cypress-e2e-tests-for-compact-adapter-feature
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to
refs/heads/3298-add-cypress-e2e-tests-for-compact-adapter-feature by this push:
new 68467e9887 feat(#3298): Add test to validate code editor for compact
adapters in UI (#3299)
68467e9887 is described below
commit 68467e9887fdcd9b38d0e4cd7a864908ce4eda3f
Author: Philipp Zehnder <[email protected]>
AuthorDate: Mon Oct 21 11:25:26 2024 +0200
feat(#3298): Add test to validate code editor for compact adapters in UI
(#3299)
* feat(#3298): Add test to validate code editor for compact adapters in UI
* feat(#3298): Add test to validate success path of add compact adapters
(#3301)
* feat(#3298): Add test to validate success path of add compact adapters
* feat(#3298): Add header to yml file
---
.../connect/compact/machineDataSimulator.yml | 24 +++++++
.../support/builder/CompactAdapterBuilder.ts | 79 ++++++++++++++++++++
ui/cypress/support/utils/CompactUtils.ts | 27 +++++++
ui/cypress/support/utils/GeneralUtils.ts | 23 ++++++
.../support/utils/ProcessingElementTestUtils.ts | 2 +-
.../support/utils/ThirdPartyIntegrationUtils.ts | 2 +-
.../support/utils/connect/CompactAdapterUtils.ts | 46 ++++++++++++
ui/cypress/support/utils/connect/ConnectBtns.ts | 8 +++
ui/cypress/support/utils/connect/ConnectUtils.ts | 22 ++++--
ui/cypress/support/utils/pipeline/PipelineBtns.ts | 23 ++++++
.../support/utils/{ => pipeline}/PipelineUtils.ts | 48 ++++++-------
.../tests/connect/compact/addCompactAdapter.ts | 84 ++++++++++++++++++++++
.../tests/connect/compact/uiConfiguration.ts | 55 ++++++++++++++
.../deleteAdapterWithMultipleUsers.smoke.spec.ts | 2 +-
.../connect/editAdapterSettingsAndPipeline.spec.ts | 2 +-
.../tests/connect/persistInDataLake.smoke.spec.ts | 2 +-
.../tests/datalake/configuration.smoke.spec.ts | 2 +-
.../restartStreamPipes/restartStreamPipes1.ts | 2 +-
.../testJvmArchetype/testJvmArchetype.ts | 2 +-
.../tests/pipeline/pipelineTest.smoke.spec.ts | 2 +-
.../pipeline/updatePipelineTest.smoke.spec.ts | 2 +-
.../PipelineElementDocumentation.spec.ts | 2 +-
.../pipelineElementConfigurationTemplate.ts | 2 +-
.../userManagement/testGroupManagement.spec.ts | 2 +-
.../userManagement/testUserRolePipeline.spec.ts | 2 +-
.../basic-nav-tabs/basic-nav-tabs.component.html | 1 +
.../start-adapter-configuration.component.html | 1 +
.../configuration-code-panel.component.html | 2 +
28 files changed, 428 insertions(+), 43 deletions(-)
diff --git a/ui/cypress/fixtures/connect/compact/machineDataSimulator.yml
b/ui/cypress/fixtures/connect/compact/machineDataSimulator.yml
new file mode 100644
index 0000000000..128b249ca6
--- /dev/null
+++ b/ui/cypress/fixtures/connect/compact/machineDataSimulator.yml
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+id: sp:adapterdescription:4pxl2w
+name: Test
+appId: org.apache.streampipes.connect.iiot.adapters.simulator.machine
+configuration:
+ - wait-time-ms: '1000'
+ - selected-simulator-option: flowrate
+createOptions:
+ persist: false
+ start: false
diff --git a/ui/cypress/support/builder/CompactAdapterBuilder.ts
b/ui/cypress/support/builder/CompactAdapterBuilder.ts
new file mode 100644
index 0000000000..379f38fbf4
--- /dev/null
+++ b/ui/cypress/support/builder/CompactAdapterBuilder.ts
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import { CompactAdapter } from
'../../../projects/streampipes/platform-services/src/lib/model/gen/streampipes-model';
+
+export class CompactAdapterBuilder {
+ private compactAdapter: CompactAdapter;
+
+ constructor() {
+ this.compactAdapter = new CompactAdapter();
+ this.compactAdapter.configuration = [];
+ this.compactAdapter.createOptions = {
+ persist: false,
+ start: false,
+ };
+ }
+
+ public static create(appId: string) {
+ const builder = new CompactAdapterBuilder();
+ builder.compactAdapter.appId = appId;
+ return builder;
+ }
+
+ // Optional parameter, when not set a random id will be generated
+ public setId(id: string) {
+ this.compactAdapter.id = id;
+ return this;
+ }
+
+ public setName(name: string) {
+ this.compactAdapter.name = name;
+ return this;
+ }
+
+ public setDescription(description: string) {
+ this.compactAdapter.description = description;
+ return this;
+ }
+
+ public addConfiguration(key: string, value: string) {
+ const configuration = { [key]: value };
+ this.compactAdapter.configuration.push(configuration);
+ return this;
+ }
+
+ public setPersist() {
+ this.compactAdapter.createOptions.persist = true;
+ return this;
+ }
+
+ public setStart() {
+ this.compactAdapter.createOptions.start = true;
+ return this;
+ }
+
+ public build() {
+ if (!this.compactAdapter.id) {
+ this.compactAdapter.id =
+ 'sp:adapterdescription:' +
+ Math.random().toString(36).substring(7);
+ }
+ return this.compactAdapter;
+ }
+}
diff --git a/ui/cypress/support/utils/CompactUtils.ts
b/ui/cypress/support/utils/CompactUtils.ts
new file mode 100644
index 0000000000..38df176d86
--- /dev/null
+++ b/ui/cypress/support/utils/CompactUtils.ts
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+export class CompactUtils {
+ public static ymlConfiguration() {
+ return cy.dataCy('yaml-configuration', { timeout: 5000 });
+ }
+
+ public static jsonConfiguration() {
+ return cy.dataCy('json-configuration', { timeout: 5000 });
+ }
+}
diff --git a/ui/cypress/support/utils/GeneralUtils.ts
b/ui/cypress/support/utils/GeneralUtils.ts
new file mode 100644
index 0000000000..8db505e32b
--- /dev/null
+++ b/ui/cypress/support/utils/GeneralUtils.ts
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+export class GeneralUtils {
+ public static tab(identifier: string) {
+ return cy.dataCy(`tab-${identifier}`).click();
+ }
+}
diff --git a/ui/cypress/support/utils/ProcessingElementTestUtils.ts
b/ui/cypress/support/utils/ProcessingElementTestUtils.ts
index f2607a112b..6340635b48 100644
--- a/ui/cypress/support/utils/ProcessingElementTestUtils.ts
+++ b/ui/cypress/support/utils/ProcessingElementTestUtils.ts
@@ -18,7 +18,7 @@
import { FileManagementUtils } from './FileManagementUtils';
import { ConnectUtils } from './connect/ConnectUtils';
-import { PipelineUtils } from './PipelineUtils';
+import { PipelineUtils } from './pipeline/PipelineUtils';
import { DataLakeUtils } from './datalake/DataLakeUtils';
import { PipelineBuilder } from '../builder/PipelineBuilder';
import { PipelineElementBuilder } from '../builder/PipelineElementBuilder';
diff --git a/ui/cypress/support/utils/ThirdPartyIntegrationUtils.ts
b/ui/cypress/support/utils/ThirdPartyIntegrationUtils.ts
index a9229a9a05..09a871c6fb 100644
--- a/ui/cypress/support/utils/ThirdPartyIntegrationUtils.ts
+++ b/ui/cypress/support/utils/ThirdPartyIntegrationUtils.ts
@@ -18,7 +18,7 @@
import { ConnectUtils } from './connect/ConnectUtils';
import { PipelineBuilder } from '../builder/PipelineBuilder';
-import { PipelineUtils } from './PipelineUtils';
+import { PipelineUtils } from './pipeline/PipelineUtils';
import { PipelineElementInput } from '../model/PipelineElementInput';
import { AdapterInput } from '../model/AdapterInput';
import { AdapterBuilder } from '../builder/AdapterBuilder';
diff --git a/ui/cypress/support/utils/connect/CompactAdapterUtils.ts
b/ui/cypress/support/utils/connect/CompactAdapterUtils.ts
new file mode 100644
index 0000000000..db0c4ab444
--- /dev/null
+++ b/ui/cypress/support/utils/connect/CompactAdapterUtils.ts
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import { CompactAdapter } from
'../../../../projects/streampipes/platform-services/src/lib/model/gen/streampipes-model';
+
+export class CompactAdapterUtils {
+ public static storeCompactAdapter(compactAdapter: CompactAdapter) {
+ return this.postCompactAdapterRequest(
+ 'application/json',
+ compactAdapter,
+ );
+ }
+
+ public static storeCompactYmlAdapter(body: string) {
+ return this.postCompactAdapterRequest('application/yml', body);
+ }
+
+ private static postCompactAdapterRequest(contentType: string, body: any) {
+ const token = window.localStorage.getItem('auth-token');
+ return cy.request({
+ method: 'POST',
+ url: '/streampipes-backend/api/v2/connect/compact-adapters',
+ body: body,
+ headers: {
+ 'Accept': contentType,
+ 'Content-Type': contentType,
+ 'Authorization': `Bearer ${token}`,
+ },
+ });
+ }
+}
diff --git a/ui/cypress/support/utils/connect/ConnectBtns.ts
b/ui/cypress/support/utils/connect/ConnectBtns.ts
index 20bfd696c5..9256c2e1ad 100644
--- a/ui/cypress/support/utils/connect/ConnectBtns.ts
+++ b/ui/cypress/support/utils/connect/ConnectBtns.ts
@@ -20,6 +20,10 @@ export class ConnectBtns {
return cy.dataCy('details-adapter');
}
+ public static deleteAdapter() {
+ return cy.dataCy('delete-adapter', { timeout: 10000 });
+ }
+
public static editAdapter() {
return cy.dataCy('edit-adapter');
}
@@ -69,6 +73,10 @@ export class ConnectBtns {
return cy.dataCy('stop-all-adapters-btn');
}
+ public static showCodeCheckbox() {
+ return cy.dataCy('show-code-checkbox');
+ }
+
// ========================================================================
// ===================== Event Schema buttons ==========================
diff --git a/ui/cypress/support/utils/connect/ConnectUtils.ts
b/ui/cypress/support/utils/connect/ConnectUtils.ts
index aaeccff82c..660f54fa88 100644
--- a/ui/cypress/support/utils/connect/ConnectUtils.ts
+++ b/ui/cypress/support/utils/connect/ConnectUtils.ts
@@ -23,7 +23,7 @@ import { DataLakeUtils } from '../datalake/DataLakeUtils';
import { ConnectBtns } from './ConnectBtns';
import { AdapterBuilder } from '../../builder/AdapterBuilder';
import { UserUtils } from '../UserUtils';
-import { PipelineUtils } from '../PipelineUtils';
+import { PipelineUtils } from '../pipeline/PipelineUtils';
export class ConnectUtils {
public static testAdapter(
@@ -76,9 +76,11 @@ export class ConnectUtils {
);
}
- ConnectEventSchemaUtils.markPropertyAsTimestamp(
- adapterConfiguration.timestampProperty,
- );
+ if (adapterConfiguration.timestampProperty) {
+ ConnectEventSchemaUtils.markPropertyAsTimestamp(
+ adapterConfiguration.timestampProperty,
+ );
+ }
ConnectEventSchemaUtils.finishEventSchemaConfiguration();
}
@@ -403,4 +405,16 @@ export class ConnectUtils {
// Close dialog
cy.get('button').contains('Close').parent().click();
}
+
+ public static validateAdapterIsRunning() {
+ ConnectUtils.goToConnect();
+ ConnectBtns.startAdapter().should('have.length', 0);
+ ConnectBtns.stopAdapter().should('have.length', 1);
+ }
+
+ public static validateAdapterIsStopped() {
+ ConnectUtils.goToConnect();
+ ConnectBtns.startAdapter().should('have.length', 1);
+ ConnectBtns.stopAdapter().should('have.length', 0);
+ }
}
diff --git a/ui/cypress/support/utils/pipeline/PipelineBtns.ts
b/ui/cypress/support/utils/pipeline/PipelineBtns.ts
new file mode 100644
index 0000000000..6ace82220f
--- /dev/null
+++ b/ui/cypress/support/utils/pipeline/PipelineBtns.ts
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+export class PipelineBtns {
+ public static deletePipeline() {
+ return cy.dataCy('delete-pipeline', { timeout: 10000 });
+ }
+}
diff --git a/ui/cypress/support/utils/PipelineUtils.ts
b/ui/cypress/support/utils/pipeline/PipelineUtils.ts
similarity index 72%
rename from ui/cypress/support/utils/PipelineUtils.ts
rename to ui/cypress/support/utils/pipeline/PipelineUtils.ts
index b901e225de..0fa9ce4443 100644
--- a/ui/cypress/support/utils/PipelineUtils.ts
+++ b/ui/cypress/support/utils/pipeline/PipelineUtils.ts
@@ -1,25 +1,26 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
-import { PipelineInput } from '../model/PipelineInput';
-import { StaticPropertyUtils } from './userInput/StaticPropertyUtils';
-import { OutputStrategyUtils } from './OutputStrategyUtils';
-import { PipelineElementInput } from '../model/PipelineElementInput';
+import { PipelineInput } from '../../model/PipelineInput';
+import { StaticPropertyUtils } from '../userInput/StaticPropertyUtils';
+import { OutputStrategyUtils } from '../OutputStrategyUtils';
+import { PipelineElementInput } from '../../model/PipelineElementInput';
+import { PipelineBtns } from './PipelineBtns';
export class PipelineUtils {
public static addPipeline(pipelineInput: PipelineInput) {
@@ -131,21 +132,18 @@ export class PipelineUtils {
}
public static checkAmountOfPipelinesPipeline(amount: number) {
- cy.visit('#/pipelines');
- cy.dataCy('delete-pipeline').should('have.length', amount);
+ PipelineUtils.goToPipelines();
+ PipelineBtns.deletePipeline().should('have.length', amount);
}
public static deletePipeline() {
// Delete pipeline
- cy.visit('#/pipelines');
- cy.dataCy('delete-pipeline').should('have.length', 1);
- cy.dataCy('delete-pipeline').click({ force: true });
+ PipelineUtils.goToPipelines();
+ PipelineBtns.deletePipeline().should('have.length', 1);
+ PipelineBtns.deletePipeline().click({ force: true });
cy.dataCy('sp-pipeline-stop-and-delete').click();
- cy.dataCy('delete-pipeline', { timeout: 10000 }).should(
- 'have.length',
- 0,
- );
+ PipelineBtns.deletePipeline().should('have.length', 0);
}
}
diff --git a/ui/cypress/tests/connect/compact/addCompactAdapter.ts
b/ui/cypress/tests/connect/compact/addCompactAdapter.ts
new file mode 100644
index 0000000000..94feb782db
--- /dev/null
+++ b/ui/cypress/tests/connect/compact/addCompactAdapter.ts
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import { ConnectUtils } from '../../../support/utils/connect/ConnectUtils';
+import { CompactAdapterUtils } from
'../../../support/utils/connect/CompactAdapterUtils';
+import { CompactAdapterBuilder } from
'../../../support/builder/CompactAdapterBuilder';
+import { PipelineUtils } from '../../../support/utils/pipeline/PipelineUtils';
+
+describe('Add Compact Adapters', () => {
+ beforeEach('Setup Test', () => {
+ cy.initStreamPipesTest();
+ });
+
+ it('Add an adapter via the compact API. Do not start', () => {
+ const compactAdapter = getBasicCompactMachineDataSimulator().build();
+
+ CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(() => {
+ ConnectUtils.validateAdapterIsStopped();
+
+ PipelineUtils.checkAmountOfPipelinesPipeline(0);
+ });
+ });
+
+ it('Add an adapter via the compact API. Start Adapter', () => {
+ const compactAdapter = getBasicCompactMachineDataSimulator()
+ .setStart()
+ .build();
+
+ CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(() => {
+ ConnectUtils.validateAdapterIsRunning();
+
+ PipelineUtils.checkAmountOfPipelinesPipeline(0);
+ });
+ });
+
+ it('Add an adapter via the compact API. Start Adapter and start persist
pipeline', () => {
+ const compactAdapter = getBasicCompactMachineDataSimulator()
+ .setStart()
+ .setPersist()
+ .build();
+
+ CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(() => {
+ ConnectUtils.validateAdapterIsRunning();
+
+ PipelineUtils.checkAmountOfPipelinesPipeline(1);
+ });
+ });
+
+ it('Add an adapter via the compact API via yml API.', () => {
+ cy.readFile(
+ 'cypress/fixtures/connect/compact/machineDataSimulator.yml',
+ ).then(ymlDescription => {
+ CompactAdapterUtils.storeCompactYmlAdapter(ymlDescription).then(
+ () => {
+ ConnectUtils.validateAdapterIsStopped();
+ },
+ );
+ });
+ });
+
+ const getBasicCompactMachineDataSimulator = () => {
+ return CompactAdapterBuilder.create(
+ 'org.apache.streampipes.connect.iiot.adapters.simulator.machine',
+ )
+ .setName('Test')
+ .addConfiguration('wait-time-ms', '1000')
+ .addConfiguration('selected-simulator-option', 'flowrate');
+ };
+});
diff --git a/ui/cypress/tests/connect/compact/uiConfiguration.ts
b/ui/cypress/tests/connect/compact/uiConfiguration.ts
new file mode 100644
index 0000000000..798d8a8caf
--- /dev/null
+++ b/ui/cypress/tests/connect/compact/uiConfiguration.ts
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import { ConnectUtils } from '../../../support/utils/connect/ConnectUtils';
+import { AdapterBuilder } from '../../../support/builder/AdapterBuilder';
+import { ConnectBtns } from '../../../support/utils/connect/ConnectBtns';
+import { GeneralUtils } from '../../../support/utils/GeneralUtils';
+import { CompactUtils } from '../../../support/utils/CompactUtils';
+
+describe('Test Compact Adapters', () => {
+ beforeEach('Setup Test', () => {
+ cy.initStreamPipesTest();
+ });
+
+ it('Validate that code for existing adapter is displayed correctly', () =>
{
+ const adapterInput = AdapterBuilder.create('Machine_Data_Simulator')
+ .setName('Machine Data Simulator Test')
+ .addInput('input', 'wait-time-ms', '1000')
+ .build();
+
+ ConnectUtils.addAdapter(adapterInput);
+
+ // Validate code editor in start dialog
+ ConnectBtns.showCodeCheckbox().parent().click();
+ validateCodeEditor();
+
+ ConnectUtils.startAdapter(adapterInput);
+
+ // Validate code editor in adapter details
+ ConnectBtns.detailsAdapter().click();
+ GeneralUtils.tab('Code');
+ validateCodeEditor();
+ });
+
+ const validateCodeEditor = () => {
+ CompactUtils.ymlConfiguration().should('be.visible');
+ cy.contains('span', 'JSON').click();
+ CompactUtils.jsonConfiguration().should('be.visible');
+ };
+});
diff --git
a/ui/cypress/tests/connect/deleteAdapterWithMultipleUsers.smoke.spec.ts
b/ui/cypress/tests/connect/deleteAdapterWithMultipleUsers.smoke.spec.ts
index 29c854cb23..a11332ac9e 100644
--- a/ui/cypress/tests/connect/deleteAdapterWithMultipleUsers.smoke.spec.ts
+++ b/ui/cypress/tests/connect/deleteAdapterWithMultipleUsers.smoke.spec.ts
@@ -20,7 +20,7 @@ import { ConnectUtils } from
'../../support/utils/connect/ConnectUtils';
import { PipelineBuilder } from '../../support/builder/PipelineBuilder';
import { PipelineElementBuilder } from
'../../support/builder/PipelineElementBuilder';
import { UserUtils } from '../../support/utils/UserUtils';
-import { PipelineUtils } from '../../support/utils/PipelineUtils';
+import { PipelineUtils } from '../../support/utils/pipeline/PipelineUtils';
const adapterName = 'simulator';
diff --git a/ui/cypress/tests/connect/editAdapterSettingsAndPipeline.spec.ts
b/ui/cypress/tests/connect/editAdapterSettingsAndPipeline.spec.ts
index c30f355474..c3f14b7a29 100644
--- a/ui/cypress/tests/connect/editAdapterSettingsAndPipeline.spec.ts
+++ b/ui/cypress/tests/connect/editAdapterSettingsAndPipeline.spec.ts
@@ -18,7 +18,7 @@
import { ConnectUtils } from '../../support/utils/connect/ConnectUtils';
import { ConnectBtns } from '../../support/utils/connect/ConnectBtns';
-import { PipelineUtils } from '../../support/utils/PipelineUtils';
+import { PipelineUtils } from '../../support/utils/pipeline/PipelineUtils';
import { PipelineElementBuilder } from
'../../support/builder/PipelineElementBuilder';
import { PipelineBuilder } from '../../support/builder/PipelineBuilder';
import { AdapterBuilder } from '../../support/builder/AdapterBuilder';
diff --git a/ui/cypress/tests/connect/persistInDataLake.smoke.spec.ts
b/ui/cypress/tests/connect/persistInDataLake.smoke.spec.ts
index 39c672b6a7..939bf44312 100644
--- a/ui/cypress/tests/connect/persistInDataLake.smoke.spec.ts
+++ b/ui/cypress/tests/connect/persistInDataLake.smoke.spec.ts
@@ -17,7 +17,7 @@
*/
import { ConnectUtils } from '../../support/utils/connect/ConnectUtils';
-import { PipelineUtils } from '../../support/utils/PipelineUtils';
+import { PipelineUtils } from '../../support/utils/pipeline/PipelineUtils';
import { FileManagementUtils } from '../../support/utils/FileManagementUtils';
import { AdapterBuilder } from '../../support/builder/AdapterBuilder';
import { ConnectBtns } from '../../support/utils/connect/ConnectBtns';
diff --git a/ui/cypress/tests/datalake/configuration.smoke.spec.ts
b/ui/cypress/tests/datalake/configuration.smoke.spec.ts
index 3b5532e154..1b095ab07e 100644
--- a/ui/cypress/tests/datalake/configuration.smoke.spec.ts
+++ b/ui/cypress/tests/datalake/configuration.smoke.spec.ts
@@ -16,7 +16,7 @@
*
*/
-import { PipelineUtils } from '../../support/utils/PipelineUtils';
+import { PipelineUtils } from '../../support/utils/pipeline/PipelineUtils';
import { DataLakeUtils } from '../../support/utils/datalake/DataLakeUtils';
describe('Test Truncate data in datalake', () => {
diff --git
a/ui/cypress/tests/experimental/restartStreamPipes/restartStreamPipes1.ts
b/ui/cypress/tests/experimental/restartStreamPipes/restartStreamPipes1.ts
index 3f098de23a..d8eafe8bc1 100644
--- a/ui/cypress/tests/experimental/restartStreamPipes/restartStreamPipes1.ts
+++ b/ui/cypress/tests/experimental/restartStreamPipes/restartStreamPipes1.ts
@@ -17,7 +17,7 @@
*/
import { ConnectUtils } from '../../../support/utils/connect/ConnectUtils';
-import { PipelineUtils } from '../../../support/utils/PipelineUtils';
+import { PipelineUtils } from '../../../support/utils/pipeline/PipelineUtils';
import { PipelineElementBuilder } from
'../../../support/builder/PipelineElementBuilder';
import { PipelineBuilder } from '../../../support/builder/PipelineBuilder';
import { DashboardUtils } from '../../../support/utils/DashboardUtils';
diff --git a/ui/cypress/tests/experimental/testJvmArchetype/testJvmArchetype.ts
b/ui/cypress/tests/experimental/testJvmArchetype/testJvmArchetype.ts
index 2a41d84eec..c15490d2e4 100644
--- a/ui/cypress/tests/experimental/testJvmArchetype/testJvmArchetype.ts
+++ b/ui/cypress/tests/experimental/testJvmArchetype/testJvmArchetype.ts
@@ -17,7 +17,7 @@
*/
import { ConnectUtils } from '../../../support/utils/connect/ConnectUtils';
-import { PipelineUtils } from '../../../support/utils/PipelineUtils';
+import { PipelineUtils } from '../../../support/utils/pipeline/PipelineUtils';
import { PipelineElementBuilder } from
'../../../support/builder/PipelineElementBuilder';
import { PipelineBuilder } from '../../../support/builder/PipelineBuilder';
import { DashboardUtils } from '../../../support/utils/DashboardUtils';
diff --git a/ui/cypress/tests/pipeline/pipelineTest.smoke.spec.ts
b/ui/cypress/tests/pipeline/pipelineTest.smoke.spec.ts
index 1de708d27f..010f7695f9 100644
--- a/ui/cypress/tests/pipeline/pipelineTest.smoke.spec.ts
+++ b/ui/cypress/tests/pipeline/pipelineTest.smoke.spec.ts
@@ -17,7 +17,7 @@
*/
import { ConnectUtils } from '../../support/utils/connect/ConnectUtils';
-import { PipelineUtils } from '../../support/utils/PipelineUtils';
+import { PipelineUtils } from '../../support/utils/pipeline/PipelineUtils';
import { PipelineElementBuilder } from
'../../support/builder/PipelineElementBuilder';
import { PipelineBuilder } from '../../support/builder/PipelineBuilder';
diff --git a/ui/cypress/tests/pipeline/updatePipelineTest.smoke.spec.ts
b/ui/cypress/tests/pipeline/updatePipelineTest.smoke.spec.ts
index b2e69bd0b4..5de2359906 100644
--- a/ui/cypress/tests/pipeline/updatePipelineTest.smoke.spec.ts
+++ b/ui/cypress/tests/pipeline/updatePipelineTest.smoke.spec.ts
@@ -17,7 +17,7 @@
*/
import { ConnectUtils } from '../../support/utils/connect/ConnectUtils';
-import { PipelineUtils } from '../../support/utils/PipelineUtils';
+import { PipelineUtils } from '../../support/utils/pipeline/PipelineUtils';
import { PipelineElementBuilder } from
'../../support/builder/PipelineElementBuilder';
import { PipelineBuilder } from '../../support/builder/PipelineBuilder';
diff --git
a/ui/cypress/tests/pipelineElement/PipelineElementDocumentation.spec.ts
b/ui/cypress/tests/pipelineElement/PipelineElementDocumentation.spec.ts
index 726ed1c5e2..4387a2e5e6 100644
--- a/ui/cypress/tests/pipelineElement/PipelineElementDocumentation.spec.ts
+++ b/ui/cypress/tests/pipelineElement/PipelineElementDocumentation.spec.ts
@@ -16,7 +16,7 @@
*
*/
-import { PipelineUtils } from '../../support/utils/PipelineUtils';
+import { PipelineUtils } from '../../support/utils/pipeline/PipelineUtils';
describe('Validate that the markdown documentation for pipeline elements
works', () => {
beforeEach('Setup Test', () => {
diff --git
a/ui/cypress/tests/pipelineElementConfigurationTemplate/pipelineElementConfigurationTemplate.ts
b/ui/cypress/tests/pipelineElementConfigurationTemplate/pipelineElementConfigurationTemplate.ts
index 2b9fff9442..16ea5c3543 100644
---
a/ui/cypress/tests/pipelineElementConfigurationTemplate/pipelineElementConfigurationTemplate.ts
+++
b/ui/cypress/tests/pipelineElementConfigurationTemplate/pipelineElementConfigurationTemplate.ts
@@ -16,7 +16,7 @@
*
*/
-import { PipelineUtils } from '../../support/utils/PipelineUtils';
+import { PipelineUtils } from '../../support/utils/pipeline/PipelineUtils';
import { PipelineBuilder } from '../../support/builder/PipelineBuilder';
import { PipelineElementBuilder } from
'../../support/builder/PipelineElementBuilder';
import { ConnectUtils } from '../../support/utils/connect/ConnectUtils';
diff --git a/ui/cypress/tests/userManagement/testGroupManagement.spec.ts
b/ui/cypress/tests/userManagement/testGroupManagement.spec.ts
index 2f4de9e7bf..03d7159568 100644
--- a/ui/cypress/tests/userManagement/testGroupManagement.spec.ts
+++ b/ui/cypress/tests/userManagement/testGroupManagement.spec.ts
@@ -20,7 +20,7 @@ import { UserBuilder } from
'../../support/builder/UserBuilder';
import { UserRole } from '../../../src/app/_enums/user-role.enum';
import { UserUtils } from '../../support/utils/UserUtils';
import { ConnectUtils } from '../../support/utils/connect/ConnectUtils';
-import { PipelineUtils } from '../../support/utils/PipelineUtils';
+import { PipelineUtils } from '../../support/utils/pipeline/PipelineUtils';
import { PipelineElementBuilder } from
'../../support/builder/PipelineElementBuilder';
import { PipelineBuilder } from '../../support/builder/PipelineBuilder';
diff --git a/ui/cypress/tests/userManagement/testUserRolePipeline.spec.ts
b/ui/cypress/tests/userManagement/testUserRolePipeline.spec.ts
index a992334de8..94d83418ff 100644
--- a/ui/cypress/tests/userManagement/testUserRolePipeline.spec.ts
+++ b/ui/cypress/tests/userManagement/testUserRolePipeline.spec.ts
@@ -20,7 +20,7 @@ import { UserBuilder } from
'../../support/builder/UserBuilder';
import { UserRole } from '../../../src/app/_enums/user-role.enum';
import { UserUtils } from '../../support/utils/UserUtils';
import { ConnectUtils } from '../../support/utils/connect/ConnectUtils';
-import { PipelineUtils } from '../../support/utils/PipelineUtils';
+import { PipelineUtils } from '../../support/utils/pipeline/PipelineUtils';
import { PipelineElementBuilder } from
'../../support/builder/PipelineElementBuilder';
import { PipelineBuilder } from '../../support/builder/PipelineBuilder';
diff --git
a/ui/projects/streampipes/shared-ui/src/lib/components/basic-nav-tabs/basic-nav-tabs.component.html
b/ui/projects/streampipes/shared-ui/src/lib/components/basic-nav-tabs/basic-nav-tabs.component.html
index 68f9377e8f..c613d3cda3 100644
---
a/ui/projects/streampipes/shared-ui/src/lib/components/basic-nav-tabs/basic-nav-tabs.component.html
+++
b/ui/projects/streampipes/shared-ui/src/lib/components/basic-nav-tabs/basic-nav-tabs.component.html
@@ -42,6 +42,7 @@
*ngFor="let item of spNavigationItems"
(click)="navigateTo(item)"
[active]="activeLink === item.itemId"
+ [attr.data-cy]="'tab-' + item.itemTitle"
>
<span>{{ item.itemTitle }}</span>
</a>
diff --git
a/ui/src/app/connect/components/adapter-configuration/start-adapter-configuration/start-adapter-configuration.component.html
b/ui/src/app/connect/components/adapter-configuration/start-adapter-configuration/start-adapter-configuration.component.html
index f7ff5b8c7b..d4eecdd6a7 100644
---
a/ui/src/app/connect/components/adapter-configuration/start-adapter-configuration/start-adapter-configuration.component.html
+++
b/ui/src/app/connect/components/adapter-configuration/start-adapter-configuration/start-adapter-configuration.component.html
@@ -150,6 +150,7 @@
optionTitle="Show code"
optionDescription="Show code to programmatically deploy this
adapter over the API"
optionIcon="code"
+ dataCy="show-code-checkbox"
(optionSelectedEmitter)="showCode = $event"
>
@if (showCode) {
diff --git
a/ui/src/app/core-ui/configuration-code-panel/configuration-code-panel.component.html
b/ui/src/app/core-ui/configuration-code-panel/configuration-code-panel.component.html
index 083d9291c7..a6590ce049 100644
---
a/ui/src/app/core-ui/configuration-code-panel/configuration-code-panel.component.html
+++
b/ui/src/app/core-ui/configuration-code-panel/configuration-code-panel.component.html
@@ -22,6 +22,7 @@
[innerHTML]="configuration | yamlpretty"
class="preview-text"
[ngStyle]="{ maxHeight: maxHeight }"
+ data-cy="yaml-configuration"
></pre>
</mat-tab>
<mat-tab label="JSON">
@@ -29,6 +30,7 @@
[innerHTML]="configuration | jsonpretty"
class="preview-text"
[ngStyle]="{ maxHeight: maxHeight }"
+ data-cy="json-configuration"
></pre>
</mat-tab>
</mat-tab-group>