This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new 20bef9ee87 test(#4285): fix flaky cypress tests for indicator delta
toggle and csv import existing dataset flow (#4286)
20bef9ee87 is described below
commit 20bef9ee8718f581b65c3671a86cd07c0f7b780c
Author: Philipp Zehnder <[email protected]>
AuthorDate: Tue Mar 24 15:41:55 2026 +0100
test(#4285): fix flaky cypress tests for indicator delta toggle and csv
import existing dataset flow (#4286)
---
ui/cypress/support/utils/chart/ChartBtns.ts | 4 +-
ui/cypress/support/utils/dataset/DatasetBtns.ts | 19 +++++---
ui/cypress/support/utils/dataset/DatasetUtils.ts | 54 +++++++++-------------
.../tests/chart/chart-types/indicator.spec.ts | 4 +-
ui/cypress/tests/dataset/csvImport.spec.ts | 4 +-
5 files changed, 43 insertions(+), 42 deletions(-)
diff --git a/ui/cypress/support/utils/chart/ChartBtns.ts
b/ui/cypress/support/utils/chart/ChartBtns.ts
index ddd404bb03..7d40866f2a 100644
--- a/ui/cypress/support/utils/chart/ChartBtns.ts
+++ b/ui/cypress/support/utils/chart/ChartBtns.ts
@@ -179,7 +179,9 @@ export class ChartBtns {
}
public static indicatorChartDeltaCheckbox() {
- return cy.dataCy('data-explorer-select-delta-checkbox');
+ return cy
+ .dataCy('data-explorer-select-delta-checkbox')
+ .find('input[type="checkbox"]');
}
public static addNewWidgetBtn() {
diff --git a/ui/cypress/support/utils/dataset/DatasetBtns.ts
b/ui/cypress/support/utils/dataset/DatasetBtns.ts
index 670f5f34fb..a3ea274575 100644
--- a/ui/cypress/support/utils/dataset/DatasetBtns.ts
+++ b/ui/cypress/support/utils/dataset/DatasetBtns.ts
@@ -49,13 +49,6 @@ export class DatasetBtns {
return cy.dataCy('csv-import-existing-measurement', { timeout: 10000
});
}
- public static csvImportExistingMeasurementOption(measurementName: string) {
- return cy.dataCy(
- `csv-import-existing-measurement-option-${measurementName}`,
- { timeout: 10000 },
- );
- }
-
public static csvImportDelimiter() {
return cy.dataCy('csv-import-delimiter', { timeout: 10000 });
}
@@ -117,4 +110,16 @@ export class DatasetBtns {
timeout: 10000,
});
}
+
+ public static datasetTotalCountCell(name: string) {
+ return this.datasetRow(name).find(
+ '[data-cy="datalake-number-of-events"]',
+ );
+ }
+
+ public static datasetTotalCountButton(name: string) {
+ return this.datasetTotalCountCell(name).find(
+ '[data-cy="datalake-total-count-button"]',
+ );
+ }
}
diff --git a/ui/cypress/support/utils/dataset/DatasetUtils.ts
b/ui/cypress/support/utils/dataset/DatasetUtils.ts
index 5e83ceba21..8ff9ce4b71 100644
--- a/ui/cypress/support/utils/dataset/DatasetUtils.ts
+++ b/ui/cypress/support/utils/dataset/DatasetUtils.ts
@@ -65,8 +65,10 @@ export class DatasetUtils {
public static useExistingDatasetForCsvImport(datasetName: string) {
DatasetBtns.csvImportTargetMode().click();
DatasetBtns.csvImportTargetModeExisting().click();
- DatasetBtns.csvImportExistingMeasurement().click();
- DatasetBtns.csvImportExistingMeasurementOption(datasetName).click();
+ DatasetBtns.csvImportExistingMeasurement().click({ force: true });
+ cy.get('mat-option', { timeout: 10000 })
+ .contains(datasetName)
+ .click({ force: true });
}
public static selectCsvImportDelimiterComma() {
@@ -119,35 +121,25 @@ export class DatasetUtils {
datasetName: string,
expectedCount: string,
) {
- DatasetBtns.datasetRow(datasetName)
- .should('be.visible')
- .find('[data-cy="datalake-total-count-button"]')
- .then($button => {
- if ($button.length > 0) {
- cy.wrap($button).click({ force: true });
- }
- });
-
- DatasetBtns.datasetRow(datasetName)
- .find('[data-cy="datalake-number-of-events"]', {
- timeout: 10000,
- })
- .should($element => {
- const text = $element.text().trim();
- expect(text).to.equal(expectedCount);
- });
- }
-
- public static expectDatasetSevenDayEventCount(
- datasetName: string,
- expectedCount: string,
- ) {
- DatasetBtns.datasetRow(datasetName)
- .should('be.visible')
- .should($row => {
- const text = $row.children().eq(2).text().trim();
- expect(text).to.contain(expectedCount);
- });
+ this.loadDatasetTotalEventCount(datasetName);
+ DatasetBtns.datasetTotalCountCell(datasetName).should($element => {
+ const text = $element.text().trim();
+ expect(text).to.equal(expectedCount);
+ });
+ }
+
+ public static loadDatasetTotalEventCount(datasetName: string) {
+ DatasetBtns.datasetRow(datasetName).should('be.visible');
+ DatasetBtns.datasetTotalCountButton(datasetName).then($button => {
+ if ($button.length > 0) {
+ cy.wrap($button[0]).click({ force: true });
+ }
+ });
+
+ DatasetBtns.datasetTotalCountCell(datasetName).should($element => {
+ const text = $element.text().trim();
+ expect(text).not.to.equal('Click to load');
+ });
}
public static openDatasetPreview(datasetName: string) {
diff --git a/ui/cypress/tests/chart/chart-types/indicator.spec.ts
b/ui/cypress/tests/chart/chart-types/indicator.spec.ts
index 9c58af858e..81e9bcc5f3 100644
--- a/ui/cypress/tests/chart/chart-types/indicator.spec.ts
+++ b/ui/cypress/tests/chart/chart-types/indicator.spec.ts
@@ -33,7 +33,9 @@ describe('Test Indicator View in Charts', () => {
);
ChartUtils.openVisualizationConfig();
- ChartBtns.indicatorChartDeltaCheckbox().click();
+ ChartBtns.indicatorChartDeltaCheckbox()
+ .check({ force: true })
+ .should('be.checked');
ChartBtns.indicatorChartTitleInput().type('Current Metric');
ChartBtns.indicatorChartDescriptionInput().type(
'Live value compared to the previous event.',
diff --git a/ui/cypress/tests/dataset/csvImport.spec.ts
b/ui/cypress/tests/dataset/csvImport.spec.ts
index 1bc2984c70..f09d2d1a88 100644
--- a/ui/cypress/tests/dataset/csvImport.spec.ts
+++ b/ui/cypress/tests/dataset/csvImport.spec.ts
@@ -86,7 +86,7 @@ describe('CSV import happy path', () => {
DatasetUtils.selectCsvImportDelimiterComma();
DatasetUtils.selectCsvImportTimestampColumn(0);
DatasetUtils.uploadCsvImport();
- DatasetUtils.expectDatasetSevenDayEventCount(existingDatasetName, '7');
+ DatasetUtils.expectDatasetTotalEventCount(existingDatasetName, '7');
DatasetUtils.openCsvImportDialog();
DatasetUtils.uploadCsvImportFile(
@@ -97,7 +97,7 @@ describe('CSV import happy path', () => {
DatasetUtils.selectCsvImportDelimiterComma();
DatasetUtils.selectCsvImportTimestampColumn(0);
DatasetUtils.uploadCsvImport();
- DatasetUtils.expectDatasetSevenDayEventCount(existingDatasetName,
'14');
+ DatasetUtils.expectDatasetTotalEventCount(existingDatasetName, '14');
DatasetUtils.openCsvImportDialog();
DatasetUtils.uploadCsvImportFile(