File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,20 @@ export function addCmkDatasource(
4646 cy . contains ( 'Data source is working' ) . should ( 'be.visible' ) ;
4747}
4848
49+ export function rmCmkDatasource ( ) {
50+ // Remove the previously-created datasource as teardown process.
51+ // This makes sure the tests use the newly generated datasource in each execution.
52+ // Important especially when running the tests locally if docker images are up during multiple tests' executions.
53+
54+ cy . visit ( '/datasources/' ) ;
55+
56+ cy . get ( '[class="page-container page-body"]' ) . contains ( 'Checkmk' ) . click ( ) ;
57+ cy . contains ( 'Delete' ) . click ( ) ;
58+ cy . get ( 'button[aria-label="Confirm Modal Danger Button"]' ) . click ( ) ;
59+
60+ cy . contains ( 'No data sources defined' ) . should ( 'be.visible' ) ;
61+ }
62+
4963export function saveDashboard ( dashboardID : string ) {
5064 cy . get ( 'button[title="Apply changes and save dashboard"]' ) . contains ( 'Save' ) . click ( ) ;
5165 cy . get ( 'input[aria-label="Save dashboard title field"]' ) . type ( ' ' + dashboardID ) ;
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import {
2020 inputTemplateSelector ,
2121 loginGrafana ,
2222 panelContentSelector ,
23+ rmCmkDatasource ,
2324 saveDashboard ,
2425} from './helpers' ;
2526
@@ -174,6 +175,8 @@ describe('e2e tests', () => {
174175 } ) ;
175176
176177 after ( function ( ) {
178+ rmCmkDatasource ( ) ;
179+
177180 deleteCmkHost ( hostName0 ) ;
178181 deleteCmkHost ( hostName1 ) ;
179182
You can’t perform that action at this time.
0 commit comments