Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions cypress/support/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,21 @@ Cypress.Commands.add('login', (username: string, password: string) => {
// Check if auth is disabled (for a local development environment).
cy.visit('/'); // visits baseUrl which is set in plugins/index.js
cy.window().then((win: ConsoleWindowType) => {
if (win.SERVER_FLAGS?.authDisabled) {
return;
}
if (!win.SERVER_FLAGS?.authDisabled) {
// Make sure we clear the cookie in case a previous test failed to logout.
cy.clearCookie('openshift-session-token');

// Make sure we clear the cookie in case a previous test failed to logout.
cy.clearCookie('openshift-session-token');

cy.get('#inputUsername').type(username || KUBEADMIN_USERNAME);
cy.get('#inputPassword').type(password || Cypress.env('BRIDGE_KUBEADMIN_PASSWORD'));
cy.get('button[type=submit]').click();
cy.get('#inputUsername').type(username || KUBEADMIN_USERNAME);
cy.get('#inputPassword').type(password || Cypress.env('BRIDGE_KUBEADMIN_PASSWORD'));
cy.get('button[type=submit]').click();
}

cy.get(`[data-test="${loginUsername}"]`).should('be.visible');
cy.get('body').then(($body) => {
if ($body.find('[data-test="guided-tour-modal"]').length > 0) {
cy.get('[data-test="tour-step-footer-secondary"]').contains('Skip tour').click();
}
});
});
});

Expand Down
21 changes: 18 additions & 3 deletions cypress/tests/app.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,25 @@ describe('Cryostat OpenShift Console Plugin tests', () => {
});

it('should visit each page without errors', () => {
const pages = ['About', 'Dashboard', 'Topology', 'Automated Rules', 'Archives', 'Events', 'Security'];
cy.contains('[class="pf-v5-c-nav__link"]', 'Cryostat').click();
const pages = [
'Dashboard',
'Topology',
'Recordings',
'Archives',
'Events',
'Automated Rules',
'Reports',
'Instrumentation',
'Diagnostics',
'Analyze Thread Dumps',
'Analyze Heap Dumps',
'Certificates',
'Credentials',
'About',
];
cy.contains('[class="pf-v6-c-nav__link"]', 'Cryostat').click();
pages.forEach((page) => {
cy.get('[class="pf-v5-c-nav__link"]').get('[href^="/cryostat"]').contains(page).click();
cy.get('[class="pf-v6-c-nav__link"]').get('[href^="/cryostat"]').contains(page).click();
checkErrors();
});
});
Expand Down
24 changes: 12 additions & 12 deletions cypress/tests/dashboard-page.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,48 +33,48 @@ describe('Dashboard page tests', () => {
});

it('should have the url /cryostat/', () => {
cy.contains('[class="pf-v5-c-nav__link"]', 'Cryostat').click();
cy.contains('[class="pf-v6-c-nav__link"]', 'Cryostat').click();
cy.get('[data-test="nav"]').contains('Dashboard').click();
cy.url().should('include', '/cryostat/');
});

it('should refresh the metrics charts after 10 seconds', () => {
cy.contains('[class="pf-v5-c-nav__link"]', 'Cryostat').click();
cy.contains('[class="pf-v5-c-nav__link"]', 'Cryostat').get('[data-test="nav"]').contains('Dashboard').click();
cy.contains('[class="pf-v6-c-nav__link"]', 'Cryostat').click();
cy.contains('[class="pf-v6-c-nav__link"]', 'Cryostat').get('[data-test="nav"]').contains('Dashboard').click();

// select the first Cryostat instance, and first target available
cy.get('div[aria-label="cryostat-selector"]').find('button').click();
cy.get('div[aria-label="cryostat-selector-dropdown"]').find('button[tabindex="0"]').click();

// select the first Cryostat target available
cy.get('button[aria-label="Select Target"]').find('[class="pf-v5-c-menu-toggle__text"]').click();
cy.get('div[data-ouia-component-type="PF5/Dropdown"]')
cy.get('button[aria-label="Select Target"]').find('[class="pf-v6-c-menu-toggle__text"]').click();
cy.get('div[data-ouia-component-type="PF6/Dropdown"]')
.find('button[tabindex="0"]')
.find('span[class=pf-v5-c-menu__item-text]')
.find('span[class=pf-v6-c-menu__item-text]')
.click();

cy.wait(11000); // charts update every 10 seconds
cy.get('text[id="chart-axis-1-ChartLabel-0"]').find('tspan').first().should('not.contain.text', '5.0e-11');
});

it('should refresh the d-solo charts after 10 seconds', () => {
cy.contains('[class="pf-v5-c-nav__link"]', 'Cryostat').click();
cy.contains('[class="pf-v5-c-nav__link"]', 'Cryostat').get('[data-test="nav"]').contains('Dashboard').click();
cy.contains('[class="pf-v6-c-nav__link"]', 'Cryostat').click();
cy.contains('[class="pf-v6-c-nav__link"]', 'Cryostat').get('[data-test="nav"]').contains('Dashboard').click();

// select the first Cryostat instance, and first target available
cy.get('div[aria-label="cryostat-selector"]').find('button').click();
cy.get('div[aria-label="cryostat-selector-dropdown"]').find('button[tabindex="0"]').click();

// select the first Cryostat target available
cy.get('button[aria-label="Select Target"]').find('[class="pf-v5-c-menu-toggle__text"]').click();
cy.get('div[data-ouia-component-type="PF5/Dropdown"]')
cy.get('button[aria-label="Select Target"]').find('[class="pf-v6-c-menu-toggle__text"]').click();
cy.get('div[data-ouia-component-type="PF6/Dropdown"]')
.find('button[tabindex="0"]')
.find('span[class=pf-v5-c-menu__item-text]')
.find('span[class=pf-v6-c-menu__item-text]')
.click();

// view the dashboard solo page of the first available metric card
cy.get('button[aria-label="dashboard action toggle"]').first().click();
cy.get('div[data-ouia-component-type="PF5/Dropdown"]').find('button[tabindex="0"]').first().click();
cy.get('div[data-ouia-component-type="PF6/Dropdown"]').find('button[tabindex="0"]').first().click();

cy.url().should('include', '/cryostat/d-solo');

Expand Down
Loading