Skip to content

Commit 3764ff8

Browse files
committed
Add cypress test for diagnotics database tab.
1 parent 468591a commit 3764ff8

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/* eslint-disable no-undef */
2+
3+
// Menu options
4+
const SETTINGS_MENU_OPTION = 'Settings';
5+
const APP_SETTINGS_MENU_OPTION = 'Application Settings';
6+
7+
// Accordion items
8+
const DIAGNOSTICS_ACCORDION_ITEM = 'Diagnostics';
9+
const MANAGEIQ_REGION_ACCORDION_ITEM = /^ManageIQ Region:/;
10+
11+
// Tab names
12+
const DATABASE_TAB_LABEL = 'Database';
13+
14+
describe('Settings > Application Settings > Diagnostics', () => {
15+
beforeEach(() => {
16+
cy.login();
17+
cy.menu(SETTINGS_MENU_OPTION, APP_SETTINGS_MENU_OPTION);
18+
cy.accordion(DIAGNOSTICS_ACCORDION_ITEM);
19+
});
20+
21+
describe('ManageIQ Region', () => {
22+
beforeEach(() => {
23+
cy.selectAccordionItem([MANAGEIQ_REGION_ACCORDION_ITEM]);
24+
});
25+
26+
it('should navigate to the Database tab', () => {
27+
// Intercept the API call when clicking on the Database tab
28+
cy.interceptApi({
29+
alias: 'getDatabaseTabInfo',
30+
urlPattern: '/ops/change_tab?tab_id=diagnostics_database',
31+
triggerFn: () => cy.tabs({ tabLabel: DATABASE_TAB_LABEL }),
32+
});
33+
34+
// Verify the Database tab content is loaded
35+
cy.get(`@getDatabaseTabInfo`).then((getCall) => {
36+
expect(getCall.state).to.equal('Complete');
37+
});
38+
39+
// Verify we're on the Database tab
40+
cy.get('.tab-content').contains(DATABASE_TAB_LABEL).should('be.visible');
41+
});
42+
});
43+
});

0 commit comments

Comments
 (0)