You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2021/10/21 06:16:19 UTC
[incubator-streampipes] branch dev updated: [hotfix] Add utils
method to select time range in e2e tests
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/incubator-streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new d2a5362 [hotfix] Add utils method to select time range in e2e tests
d2a5362 is described below
commit d2a53623c56ad9d12436d24d3780cc99881ae6ca
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Thu Oct 21 08:15:54 2021 +0200
[hotfix] Add utils method to select time range in e2e tests
---
ui/cypress/support/utils/DataLakeUtils.ts | 15 +++++++++++++++
ui/cypress/tests/datalake/testSpecialCharactersInName.ts | 7 +++----
ui/cypress/tests/datalake/widgetDataConfiguration.ts | 9 +++------
ui/cypress/tests/datalake/widgets/table.ts | 6 +++---
.../time-selector/timeRangeSelector.component.html | 2 ++
5 files changed, 26 insertions(+), 13 deletions(-)
diff --git a/ui/cypress/support/utils/DataLakeUtils.ts b/ui/cypress/support/utils/DataLakeUtils.ts
index adbc57d..0e8e52b 100644
--- a/ui/cypress/support/utils/DataLakeUtils.ts
+++ b/ui/cypress/support/utils/DataLakeUtils.ts
@@ -174,6 +174,21 @@ export class DataLakeUtils {
});
}
+ public static selectTimeRange(from: Date, to: Date) {
+ DataLakeUtils.setTimeInput('time-range-from', from);
+ DataLakeUtils.setTimeInput('time-range-to', to);
+ }
+
+ private static setTimeInput(selector: string, value: Date) {
+ cy.dataCy(selector)
+ .click();
+ cy.wait(500);
+ cy.get('.owl-dt-control-button-content').contains('Set').click({ 'force': true });
+ cy.dataCy(selector)
+ .clear()
+ .type(`${value.toLocaleString()}{enter}`);
+ }
+
private static resultEqual(actual: string, expected: string) {
const expectedResult = DataLakeUtils.parseCsv(expected);
const actualResult = DataLakeUtils.parseCsv(actual);
diff --git a/ui/cypress/tests/datalake/testSpecialCharactersInName.ts b/ui/cypress/tests/datalake/testSpecialCharactersInName.ts
index 06b7964..eaf88b9 100644
--- a/ui/cypress/tests/datalake/testSpecialCharactersInName.ts
+++ b/ui/cypress/tests/datalake/testSpecialCharactersInName.ts
@@ -74,12 +74,11 @@ describe('Test Table View in Data Explorer', () => {
DataLakeUtils.clickCreateButton();
- // TODO Set Time Range
- cy.dataCy('1_year')
- .click();
+ DataLakeUtils.selectTimeRange(
+ new Date(2020, 10, 20, 22, 44),
+ new Date(2021, 10, 20, 22, 44));
cy.dataCy('data-explorer-table-row', { timeout: 10000 }).should('have.length', 10);
- // Validate that X lines are available
});
diff --git a/ui/cypress/tests/datalake/widgetDataConfiguration.ts b/ui/cypress/tests/datalake/widgetDataConfiguration.ts
index 2004fa7..0647acc 100644
--- a/ui/cypress/tests/datalake/widgetDataConfiguration.ts
+++ b/ui/cypress/tests/datalake/widgetDataConfiguration.ts
@@ -32,13 +32,10 @@ describe('Test Table View in Data Explorer', () => {
DataLakeUtils.goToDatalake();
DataLakeUtils.createAndEditDataView();
- // Click edit button
- // cy.dataCy('edit-data-view')
- // .click();
- // TODO Set Time Range
- cy.dataCy('1_year')
- .click();
+ DataLakeUtils.selectTimeRange(
+ new Date(2020, 10, 20, 22, 44),
+ new Date(2021, 10, 20, 22, 44));
DataLakeUtils.addNewWidget();
diff --git a/ui/cypress/tests/datalake/widgets/table.ts b/ui/cypress/tests/datalake/widgets/table.ts
index 6892377..22ab275 100644
--- a/ui/cypress/tests/datalake/widgets/table.ts
+++ b/ui/cypress/tests/datalake/widgets/table.ts
@@ -48,9 +48,9 @@ describe('Test Table View in Data Explorer', () => {
DataLakeUtils.clickCreateButton();
- // TODO Set Time Range
- cy.dataCy('1_year')
- .click();
+ DataLakeUtils.selectTimeRange(
+ new Date(2020, 10, 20, 22, 44),
+ new Date(2021, 10, 20, 22, 44));
cy.dataCy('data-explorer-table-row', { timeout: 10000 }).should('have.length', 10);
// Validate that X lines are available
diff --git a/ui/src/app/data-explorer/components/time-selector/timeRangeSelector.component.html b/ui/src/app/data-explorer/components/time-selector/timeRangeSelector.component.html
index e549aa6..492a18d 100644
--- a/ui/src/app/data-explorer/components/time-selector/timeRangeSelector.component.html
+++ b/ui/src/app/data-explorer/components/time-selector/timeRangeSelector.component.html
@@ -33,6 +33,7 @@
color="accent">
<mat-label>From</mat-label>
<input matInput
+ data-cy="time-range-from"
[owlDateTime]="dt1"
[owlDateTimeTrigger]="dt1"
[(ngModel)]="startDate"
@@ -42,6 +43,7 @@
<mat-form-field appearance="standard" class="end-date form-field-margin form-field-size-smaller" color="accent">
<mat-label>To</mat-label>
<input matInput
+ data-cy="time-range-to"
[owlDateTime]="dt2"
[owlDateTimeTrigger]="dt2"
[(ngModel)]="endDate"