Skip to content

Commit

Permalink
new functions for data lake utils + fixes for delete-widget-test
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcelfrueh committed Aug 19, 2024
1 parent 0cdecb8 commit be4dd23
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 46 deletions.
26 changes: 26 additions & 0 deletions ui/cypress/support/utils/datalake/DataLakeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,20 @@ export class DataLakeUtils {
cy.dataCy('confirm-delete', { timeout: 10000 }).click();
}

public static cancelDeleteDashboard(dashboardName: string) {
cy.dataCy('delete-dashboard-' + dashboardName, {
timeout: 10000,
}).click();
cy.dataCy('cancel-delete', { timeout: 10000 }).click();
}

public static cancelDeleteDataView(dataViewName: string) {
cy.dataCy('delete-data-view-' + dataViewName, {
timeout: 10000,
}).click();
cy.dataCy('cancel-delete', { timeout: 10000 }).click();
}

public static editWidget(widgetName: string) {
cy.dataCy('edit-' + widgetName).click();
}
Expand Down Expand Up @@ -440,4 +454,16 @@ export class DataLakeUtils {
.invoke('text')
.then(text => text.trim());
}

public static checkRowsDashboardTable(amount: number) {
cy.dataCy('dashboard-table-overview', {
timeout: 10000,
}).should('have.length', amount);
}

public static checkRowsViewsTable(amount: number) {
cy.dataCy('data-views-table-overview', {
timeout: 10000,
}).should('have.length', amount);
}
}
47 changes: 12 additions & 35 deletions ui/cypress/tests/datalake/deleteViewAndDashboard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,48 +34,25 @@ describe('Test Deletion of Data View and Dashboard', () => {

DataLakeUtils.saveDashboardConfiguration();

cy.dataCy('dashboard-table-overview', { timeout: 10000 }).should(
'have.length',
1,
);
DataLakeUtils.checkRowsDashboardTable(1);

cy.dataCy('data-views-table-overview', { timeout: 10000 }).should(
'have.length',
1,
);
DataLakeUtils.checkRowsViewsTable(1);

// Click "Delete" but cancel action and check if dashboard and view are still displayed
cy.dataCy('delete-dashboard-TestDashboard', {
timeout: 10000,
}).click();
cy.dataCy('cancel-delete', { timeout: 10000 }).click();

cy.dataCy('dashboard-table-overview', { timeout: 10000 }).should(
'have.length',
1,
);

cy.dataCy('data-views-table-overview', { timeout: 10000 }).should(
'have.length',
1,
);

cy.dataCy('delete-data-view-TestView', {
timeout: 10000,
}).click();
cy.dataCy('cancel-delete', { timeout: 10000 }).click();
DataLakeUtils.cancelDeleteDashboard('TestDashboard');

DataLakeUtils.checkRowsDashboardTable(1);

DataLakeUtils.cancelDeleteDataView('TestView');

DataLakeUtils.checkRowsViewsTable(1);

DataLakeUtils.deleteDashboard('TestDashboard');

DataLakeUtils.deleteDataView('TestView');

cy.dataCy('dashboard-table-overview', { timeout: 10000 }).should(
'have.length',
0,
);
DataLakeUtils.checkRowsDashboardTable(0);

cy.dataCy('data-views-table-overview', { timeout: 10000 }).should(
'have.length',
0,
);
DataLakeUtils.checkRowsViewsTable(0);
});
});
14 changes: 3 additions & 11 deletions ui/cypress/tests/datalake/deleteWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,16 @@ describe('Test Table View in Data Explorer', () => {
DataLakeUtils.saveAndReEditDashboard('TestDashboard');

// Check that widget is gone
cy.dataCy('widget-datalake_configuration', { timeout: 10000 }).should(
'not.exist',
);
cy.dataCy('widget-TestView', { timeout: 10000 }).should('not.exist');

DataLakeUtils.goBackToOverview();

cy.dataCy('delete-dashboard-TestDashboard', { timeout: 10000 }).should(
'have.length',
1,
);
DataLakeUtils.checkRowsDashboardTable(1);

// Delete dashboard
DataLakeUtils.deleteDashboard('TestDashboard');

// Check that dashboard is gone
cy.dataCy('delete-dashboard-TestDashboard', { timeout: 10000 }).should(
'have.length',
0,
);
DataLakeUtils.checkRowsDashboardTable(0);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
<div
fxLayout="row"
class="data-view-preview-outer"
[attr.data-cy]="
'add-data-view-btn-' +
dataView.baseAppearanceConfig.widgetTitle.replaceAll(' ', '')
"
(click)="addDataViewEmitter.emit(dataView.elementId)"
>
<div fxFlex fxLayout="column">
Expand Down

0 comments on commit be4dd23

Please # to comment.