Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Automation] - Adding Cluster Events table tests #11233

Merged
merged 1 commit into from
Jun 14, 2024
Merged
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
15 changes: 15 additions & 0 deletions cypress/e2e/blueprints/explorer/cluster/events.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
// GET /v1/events - return empty events data
const eventsGetEmptyEventsSet = {
type: 'collection',
links: { self: `${ Cypress.env('api') }/v1/events` },
createTypes: { event: `${ Cypress.env('api') }/v1/events` },
actions: {},
resourceType: 'event',
revision: '95942',
data: []
};

// GET /v1/events - small set of events data
const eventsGetResponseSmallSet = {
type: 'collection',
Expand Down Expand Up @@ -3904,6 +3915,10 @@ function reply(statusCode: number, body: any) {
};
}

export function eventsNoDataset(): Cypress.Chainable<Response> {
return cy.intercept('GET', '/v1/events?*', reply(200, eventsGetEmptyEventsSet)).as('eventsNoData');
}

export function generateEventsDataSmall(): Cypress.Chainable<Response> {
return cy.intercept('GET', '/v1/events?*', reply(200, eventsGetResponseSmallSet)).as('eventsDataSmall');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { WorkloadsDeploymentsListPagePo } from '@/cypress/e2e/po/pages/explorer/
import { NodesPagePo } from '@/cypress/e2e/po/pages/explorer/nodes.po';
import { EventsPagePo } from '@/cypress/e2e/po/pages/explorer/events.po';
import * as path from 'path';
import { generateEventsDataLarge, generateEventsDataSmall } from '@/cypress/e2e/blueprints/explorer/cluster/events';
import { generateEventsDataLarge, generateEventsDataSmall, eventsNoDataset } from '@/cypress/e2e/blueprints/explorer/cluster/events';
import { groupByPayload } from '@/cypress/e2e/blueprints/user_preferences/group_by';
import HomePagePo from '@/cypress/e2e/po/pages/home.po';

Expand Down Expand Up @@ -367,6 +367,41 @@ describe('Cluster Dashboard', { testIsolation: 'off', tags: ['@explorer', '@admi
events.sortableTable().pagination().checkNotExists();
});
});
it('can view events table empty if no events', { tags: ['@vai'] }, () => {
const events = new EventsPagePo('local');

HomePagePo.goTo();

eventsNoDataset();
ClusterDashboardPagePo.navTo();
cy.wait('@eventsNoData');
clusterDashboard.waitForPage(undefined, 'cluster-events');

clusterDashboard.eventsList().resourceTable().sortableTable().checkRowCount(true, 1);

const expectedHeaders = ['Reason', 'Object', 'Message', 'Name', 'Date'];

clusterDashboard.eventsList().resourceTable().sortableTable().tableHeaderRow()
.find('.table-header-container .content')
.each((el, i) => {
expect(el.text().trim()).to.eq(expectedHeaders[i]);
});

clusterDashboard.fullEventsLink().click();
cy.wait('@eventsNoData');
events.waitForPage();

events.eventslist().resourceTable().sortableTable().checkRowCount(true, 1);

const expectedFullHeaders = ['State', 'Last Seen', 'Type', 'Reason', 'Object',
'Subobject', 'Source', 'Message', 'First Seen', 'Count', 'Name', 'Namespace'];

events.eventslist().resourceTable().sortableTable().tableHeaderRow()
.find('.table-header-container .content')
.each((el, i) => {
expect(el.text().trim()).to.eq(expectedFullHeaders[i]);
});
});

after(function() {
if (removePod) {
Expand Down
Loading