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 2023/05/30 18:49:25 UTC
[streampipes] 01/01: [hotfix] Add proper time selection to another cypress test
This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch fix-cypress-time-issue
in repository https://gitbox.apache.org/repos/asf/streampipes.git
commit 2b6d4642ff783b5b85cc08afeb4eb1d7f98606a0
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Tue May 30 20:49:07 2023 +0200
[hotfix] Add proper time selection to another cypress test
---
ui/cypress/support/utils/datalake/DataLakeUtils.ts | 40 ++++++++++++++++++----
ui/cypress/tests/datalake/widgets/table.ts | 2 +-
2 files changed, 35 insertions(+), 7 deletions(-)
diff --git a/ui/cypress/support/utils/datalake/DataLakeUtils.ts b/ui/cypress/support/utils/datalake/DataLakeUtils.ts
index 1dbf1ce89..bd74f5c6a 100644
--- a/ui/cypress/support/utils/datalake/DataLakeUtils.ts
+++ b/ui/cypress/support/utils/datalake/DataLakeUtils.ts
@@ -84,9 +84,10 @@ export class DataLakeUtils {
) {
DataLakeUtils.goToDatalake();
DataLakeUtils.createAndEditDataView(dataViewName);
+
DataLakeUtils.selectTimeRange(
- new Date(2020, 10, 20, 22, 44),
- new Date(2021, 10, 20, 22, 44),
+ new Date(2015, 10, 20, 22, 44),
+ DataLakeUtils.getFutureDate(),
);
// DataLakeUtils.addNewWidget();
DataLakeUtils.selectDataSet(dataSet);
@@ -304,9 +305,36 @@ export class DataLakeUtils {
}
public static selectTimeRange(from: Date, to: Date) {
- cy.dataCy('1_year').click();
- // TODO fix time range selection
- // DataLakeUtils.setTimeInput('time-range-from', from);
- // DataLakeUtils.setTimeInput('time-range-to', to);
+ DataLakeUtils.setTimeInput('time-range-from', from);
+ DataLakeUtils.clickSetTime();
+ DataLakeUtils.setTimeInput('time-range-to', to);
+ DataLakeUtils.clickSetTime();
+ }
+
+ public static setTimeInput(field: string, date: Date) {
+ cy.dataCy(field)
+ .clear({ force: true })
+ .type(DataLakeUtils.makeTimeString(date), { force: true });
+ }
+
+ public static clickSetTime() {
+ cy.get('.owl-dt-container-buttons > button:nth-child(2)').click();
+ }
+
+ public static makeTimeString(date: Date) {
+ return date.toLocaleString('en-US', {
+ month: 'numeric',
+ day: 'numeric',
+ year: 'numeric',
+ hour: 'numeric',
+ minute: 'numeric',
+ });
+ }
+
+ public static getFutureDate() {
+ const currentDate = new Date();
+ currentDate.setMonth(currentDate.getMonth() + 1);
+
+ return currentDate;
}
}
diff --git a/ui/cypress/tests/datalake/widgets/table.ts b/ui/cypress/tests/datalake/widgets/table.ts
index b567f4e54..12ab68ded 100644
--- a/ui/cypress/tests/datalake/widgets/table.ts
+++ b/ui/cypress/tests/datalake/widgets/table.ts
@@ -46,7 +46,7 @@ describe('Test Table View in Data Explorer', () => {
DataLakeUtils.selectTimeRange(
new Date(2020, 10, 20, 22, 44),
- new Date(2021, 10, 20, 22, 44),
+ DataLakeUtils.getFutureDate(),
);
cy.dataCy('data-explorer-table-row', { timeout: 10000 }).should(