You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2025/10/06 12:35:15 UTC
(streampipes) 02/02: Fix cypress tests
This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch modify-data-table-actions
in repository https://gitbox.apache.org/repos/asf/streampipes.git
commit ffc8b9eb00c47cf6462d3cfee52936406905d442
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Mon Oct 6 14:34:53 2025 +0200
Fix cypress tests
---
ui/cypress.config.ts | 20 +++++++++++++++++++-
ui/cypress/support/utils/DataDownloadDialogUtils.ts | 2 ++
ui/cypress/support/utils/connect/ConnectBtns.ts | 6 ++++++
ui/cypress/support/utils/connect/ConnectUtils.ts | 19 +++++++++++++++----
ui/cypress/support/utils/datalake/DataLakeBtns.ts | 7 ++++++-
ui/cypress/support/utils/datalake/DataLakeUtils.ts | 1 +
ui/cypress/tests/connect/editAdapter.smoke.spec.ts | 4 +++-
.../editAdapterSettingsAndPipeline.smoke.spec.ts | 3 +++
.../editAdapterTransformationRulesAreKept.spec.ts | 1 +
.../tests/connect/editAdapterValuesAndFields.spec.ts | 2 ++
ui/cypress/tests/connect/fileStream.spec.ts | 4 +++-
.../tests/connect/machineDataSimulator.smoke.spec.ts | 2 +-
ui/cypress/tests/datalake/timeOrderDataView.spec.ts | 2 +-
13 files changed, 63 insertions(+), 10 deletions(-)
diff --git a/ui/cypress.config.ts b/ui/cypress.config.ts
index 822e9a8c0e..1c62181e9c 100644
--- a/ui/cypress.config.ts
+++ b/ui/cypress.config.ts
@@ -45,7 +45,25 @@ export default defineConfig({
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
- return require('./cypress/plugins/index.ts')(on, config);
+ const plugins = require('./cypress/plugins/index.ts')(on, config);
+
+ // Add language setting for Chromium & Firefox
+ on('before:browser:launch', (browser, launchOptions) => {
+ if (browser.family === 'chromium') {
+ // Chrome / Edge
+ launchOptions.args.push('--lang=en-US,en');
+ } else if (browser.family === 'firefox') {
+ // Firefox
+ // preferences is optional in the type, so guard + cast
+ launchOptions.preferences ??= {};
+ (launchOptions.preferences as Record<string, unknown>)[
+ 'intl.accept_languages'
+ ] = 'en-US';
+ }
+ return launchOptions;
+ });
+
+ return plugins;
},
specPattern: 'cypress/tests/**/*.{js,jsx,ts,tsx}',
baseUrl: 'http://localhost:80',
diff --git a/ui/cypress/support/utils/DataDownloadDialogUtils.ts b/ui/cypress/support/utils/DataDownloadDialogUtils.ts
index 3a3b2da6ed..b7cf5a148d 100644
--- a/ui/cypress/support/utils/DataDownloadDialogUtils.ts
+++ b/ui/cypress/support/utils/DataDownloadDialogUtils.ts
@@ -20,6 +20,7 @@ import { ExportConfig } from '../../../projects/streampipes/shared-ui/src/lib/di
import { DataLakeUtils } from './datalake/DataLakeUtils';
import { FileNameService } from '../../../projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/services/file-name.service';
import { CsvFormatExportConfig } from '../../../projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/format-export-config.model';
+import { GeneralUtils } from './GeneralUtils';
export class DataDownloadDialogUtils {
public static testDownload(
@@ -30,6 +31,7 @@ export class DataDownloadDialogUtils {
// const exportDate: Date;
DataLakeUtils.goToDatalake();
+ GeneralUtils.openMenuForRow(dataViewName);
// select data view in edit mode
DataLakeUtils.editDataView(dataViewName);
diff --git a/ui/cypress/support/utils/connect/ConnectBtns.ts b/ui/cypress/support/utils/connect/ConnectBtns.ts
index a6478b6af4..f0aa5f325b 100644
--- a/ui/cypress/support/utils/connect/ConnectBtns.ts
+++ b/ui/cypress/support/utils/connect/ConnectBtns.ts
@@ -15,6 +15,8 @@
* limitations under the License.
*
*/
+import { GeneralUtils } from '../GeneralUtils';
+
export class ConnectBtns {
public static detailsAdapter() {
return cy.dataCy('details-adapter', { timeout: 10000 });
@@ -42,6 +44,10 @@ export class ConnectBtns {
});
}
+ public static openActionsMenu(adapterName: string) {
+ GeneralUtils.openMenuForRow(adapterName);
+ }
+
public static refreshSchema() {
return cy.dataCy('refresh-schema');
}
diff --git a/ui/cypress/support/utils/connect/ConnectUtils.ts b/ui/cypress/support/utils/connect/ConnectUtils.ts
index 19e0f32874..91c5be1f44 100644
--- a/ui/cypress/support/utils/connect/ConnectUtils.ts
+++ b/ui/cypress/support/utils/connect/ConnectUtils.ts
@@ -24,6 +24,7 @@ import { ConnectBtns } from './ConnectBtns';
import { AdapterBuilder } from '../../builder/AdapterBuilder';
import { UserUtils } from '../UserUtils';
import { PipelineUtils } from '../pipeline/PipelineUtils';
+import { GeneralUtils } from '../GeneralUtils';
export class ConnectUtils {
public static testAdapter(
@@ -229,10 +230,11 @@ export class ConnectUtils {
cy.get('button').contains('Close').parent().click();
}
- public static deleteAdapter() {
+ public static deleteAdapter(adapterName: string) {
// Delete adapter
this.goToConnect();
+ GeneralUtils.openMenuForRow(adapterName);
cy.dataCy('delete-adapter').should('have.length', 1);
this.clickDelete();
cy.dataCy('adapter-deletion-in-progress', { timeout: 10000 }).should(
@@ -255,6 +257,7 @@ export class ConnectUtils {
public static deleteAdapterAndAssociatedPipelines(switchUserCheck = false) {
// Delete adapter and associated pipelines
this.goToConnect();
+ ConnectBtns.openActionsMenu('simulator');
cy.dataCy('delete-adapter').should('have.length', 1);
this.clickDelete();
cy.dataCy('delete-adapter-and-associated-pipelines-confirmation', {
@@ -279,6 +282,7 @@ export class ConnectUtils {
public static deleteAdapterAndAssociatedPipelinesPermissionDenied() {
// Associated pipelines not owned by the user (unless admin) should not be deleted during adapter deletion
this.goToConnect();
+ ConnectBtns.openActionsMenu('simulator');
cy.dataCy('delete-adapter').should('have.length', 1);
this.clickDelete();
cy.dataCy('delete-adapter-and-associated-pipelines-confirmation', {
@@ -363,12 +367,15 @@ export class ConnectUtils {
return adapterConfiguration;
}
- public static startAndValidateAdapter(amountOfProperties: number) {
+ public static startAndValidateAdapter(
+ adapterName: string,
+ amountOfProperties: number,
+ ) {
ConnectBtns.startAdapter().should('not.be.disabled');
ConnectBtns.startAdapter().click();
- ConnectUtils.validateEventsInPreview(amountOfProperties);
+ ConnectUtils.validateEventsInPreview(adapterName, amountOfProperties);
}
public static getLivePreviewValue(runtimeName: string) {
@@ -377,8 +384,12 @@ export class ConnectUtils {
});
}
- public static validateEventsInPreview(amountOfProperties: number) {
+ public static validateEventsInPreview(
+ adapterName: string,
+ amountOfProperties: number,
+ ) {
// View data
+ ConnectBtns.openActionsMenu(adapterName);
ConnectBtns.detailsAdapter().click();
// Validate resulting event
diff --git a/ui/cypress/support/utils/datalake/DataLakeBtns.ts b/ui/cypress/support/utils/datalake/DataLakeBtns.ts
index 9f456e2f70..35b3ca1b66 100644
--- a/ui/cypress/support/utils/datalake/DataLakeBtns.ts
+++ b/ui/cypress/support/utils/datalake/DataLakeBtns.ts
@@ -16,6 +16,8 @@
*
*/
+import { GeneralUtils } from '../GeneralUtils';
+
export class DataLakeBtns {
public static refreshDataLakeMeasures() {
return cy.dataCy('refresh-data-lake-measures');
@@ -26,6 +28,9 @@ export class DataLakeBtns {
}
public static editDataViewButton(widgetName: string) {
- return cy.dataCy('edit-data-view-' + widgetName).click();
+ GeneralUtils.openMenuForRow(widgetName);
+ return cy
+ .dataCy('edit-data-view-' + widgetName.replaceAll(' ', ''))
+ .click();
}
}
diff --git a/ui/cypress/support/utils/datalake/DataLakeUtils.ts b/ui/cypress/support/utils/datalake/DataLakeUtils.ts
index 4b95327321..4bf4ba5cc8 100644
--- a/ui/cypress/support/utils/datalake/DataLakeUtils.ts
+++ b/ui/cypress/support/utils/datalake/DataLakeUtils.ts
@@ -182,6 +182,7 @@ export class DataLakeUtils {
public static editDataView(dataViewName: string) {
// Click edit button
// following only works if single view is available
+ GeneralUtils.openMenuForRow(dataViewName);
cy.dataCy('edit-data-view-' + dataViewName).click();
}
diff --git a/ui/cypress/tests/connect/editAdapter.smoke.spec.ts b/ui/cypress/tests/connect/editAdapter.smoke.spec.ts
index 7187510bc9..de2efbe1e9 100644
--- a/ui/cypress/tests/connect/editAdapter.smoke.spec.ts
+++ b/ui/cypress/tests/connect/editAdapter.smoke.spec.ts
@@ -40,6 +40,7 @@ describe('Test Edit Adapter', () => {
// click edit adapter
ConnectBtns.adapterOperationInProgressSpinner().should('not.exist');
+ ConnectBtns.openActionsMenu('simulator');
ConnectBtns.editAdapter().should('not.be.disabled');
ConnectBtns.editAdapter().click();
@@ -68,7 +69,7 @@ describe('Test Edit Adapter', () => {
ConnectUtils.closeAdapterPreview();
- ConnectUtils.startAndValidateAdapter(3);
+ ConnectUtils.startAndValidateAdapter('Edited Adapter', 3);
ConnectUtils.goToConnect();
// Validate that name of adapter and data stream
@@ -82,6 +83,7 @@ describe('Test Edit Adapter', () => {
// stop adapter and edit adapter
ConnectBtns.stopAdapter().click();
+ ConnectBtns.openActionsMenu('simulator');
ConnectBtns.editAdapter().click();
// change data type of density to integer
diff --git a/ui/cypress/tests/connect/editAdapterSettingsAndPipeline.smoke.spec.ts b/ui/cypress/tests/connect/editAdapterSettingsAndPipeline.smoke.spec.ts
index 62b3f062f2..3b1e63e37c 100644
--- a/ui/cypress/tests/connect/editAdapterSettingsAndPipeline.smoke.spec.ts
+++ b/ui/cypress/tests/connect/editAdapterSettingsAndPipeline.smoke.spec.ts
@@ -24,6 +24,7 @@ import { PipelineBuilder } from '../../support/builder/PipelineBuilder';
import { AdapterBuilder } from '../../support/builder/AdapterBuilder';
import { DashboardUtils } from '../../support/utils/DashboardUtils';
import { DataLakeUtils } from '../../support/utils/datalake/DataLakeUtils';
+import { GeneralUtils } from '../../support/utils/GeneralUtils';
describe('Test Edit Adapter and Pipeline', () => {
beforeEach('Setup Test', () => {
@@ -52,6 +53,7 @@ describe('Test Edit Adapter and Pipeline', () => {
it('Edit adapter and test Pipeline behaviour', () => {
// Edit Apater and select pressure
ConnectUtils.goToConnect();
+ ConnectBtns.openActionsMenu('simulator');
ConnectBtns.editAdapter().should('not.be.disabled');
ConnectBtns.editAdapter().click();
const newUserConfiguration = AdapterBuilder.create(
@@ -86,6 +88,7 @@ describe('Test Edit Adapter and Pipeline', () => {
timeout: 60000,
}).should('be.visible');
+ GeneralUtils.openMenuForRow('Pipeline Test');
cy.dataCy('modify-pipeline-btn').click();
cy.dataCy('settings-pipeline-element-button').eq(0).click();
cy.dataCy('number-mapping').contains('pressure').click({ force: true });
diff --git a/ui/cypress/tests/connect/editAdapterTransformationRulesAreKept.spec.ts b/ui/cypress/tests/connect/editAdapterTransformationRulesAreKept.spec.ts
index 1885af9ea3..764f374b56 100644
--- a/ui/cypress/tests/connect/editAdapterTransformationRulesAreKept.spec.ts
+++ b/ui/cypress/tests/connect/editAdapterTransformationRulesAreKept.spec.ts
@@ -46,6 +46,7 @@ describe('Test Adapter Transformation Rules are properly stored', () => {
ConnectUtils.closeAdapterPreview();
// Edit adapter and check if given values and added property still provided
+ ConnectBtns.openActionsMenu('Test Adapter');
ConnectBtns.editAdapter().should('not.be.disabled');
ConnectBtns.editAdapter().click();
cy.contains('Next').click();
diff --git a/ui/cypress/tests/connect/editAdapterValuesAndFields.spec.ts b/ui/cypress/tests/connect/editAdapterValuesAndFields.spec.ts
index 15cba76846..ff9cf46ba0 100644
--- a/ui/cypress/tests/connect/editAdapterValuesAndFields.spec.ts
+++ b/ui/cypress/tests/connect/editAdapterValuesAndFields.spec.ts
@@ -70,6 +70,7 @@ describe('Test Edit Adapter', () => {
ConnectUtils.closeAdapterPreview();
// Edit adapter and check if given values and added property still provided
+ ConnectBtns.openActionsMenu('Test Adapter');
ConnectBtns.editAdapter().should('not.be.disabled');
ConnectBtns.editAdapter().click();
cy.contains('Next').click();
@@ -106,6 +107,7 @@ describe('Test Edit Adapter', () => {
ConnectUtils.closeAdapterPreview();
// Configure adapter with pressure instead of flowrate
+ ConnectBtns.openActionsMenu('Test Adapter');
ConnectBtns.editAdapter().click();
const newUserConfiguration = AdapterBuilder.create(
'Machine_Data_Simulator',
diff --git a/ui/cypress/tests/connect/fileStream.spec.ts b/ui/cypress/tests/connect/fileStream.spec.ts
index 16050b097f..f69c1c7eaa 100644
--- a/ui/cypress/tests/connect/fileStream.spec.ts
+++ b/ui/cypress/tests/connect/fileStream.spec.ts
@@ -47,7 +47,9 @@ describe(
.build();
ConnectUtils.testAdapter(adapterInput);
- ConnectUtils.deleteAdapter();
+ ConnectUtils.deleteAdapter(
+ adapterInput.adapterName.replaceAll(' ', ''),
+ );
});
it('File stream adapter should not allow add timestamp option in schema editor', () => {
diff --git a/ui/cypress/tests/connect/machineDataSimulator.smoke.spec.ts b/ui/cypress/tests/connect/machineDataSimulator.smoke.spec.ts
index 3875d5bb14..2f26342c5f 100644
--- a/ui/cypress/tests/connect/machineDataSimulator.smoke.spec.ts
+++ b/ui/cypress/tests/connect/machineDataSimulator.smoke.spec.ts
@@ -31,6 +31,6 @@ describe('Test Machine Data Simulator Adapter', () => {
.build();
ConnectUtils.testAdapter(adapterInput);
- ConnectUtils.deleteAdapter();
+ ConnectUtils.deleteAdapter(adapterInput.adapterName);
});
});
diff --git a/ui/cypress/tests/datalake/timeOrderDataView.spec.ts b/ui/cypress/tests/datalake/timeOrderDataView.spec.ts
index 28ec6d97ef..2144304754 100644
--- a/ui/cypress/tests/datalake/timeOrderDataView.spec.ts
+++ b/ui/cypress/tests/datalake/timeOrderDataView.spec.ts
@@ -53,7 +53,7 @@ describe('Test Time Order in Data Explorer', () => {
// Save and leave view, edit view again and check ascending order
DataLakeBtns.saveDataViewButton();
- DataLakeBtns.editDataViewButton('Newchart');
+ DataLakeBtns.editDataViewButton('New chart');
DataLakeUtils.clickOrderBy('ascending');
DataLakeUtils.openVisualizationConfig();
DataLakeUtils.selectVisualizationType(DataExplorerWidget.TABLE);