|
| 1 | +import { TestIds } from '../../../src/test-ids'; |
| 2 | +import { commonTests } from './logs-common-test.cy.ts'; |
| 3 | +import { APP_NAMESPACE1,APP_NAMESPACE2,APP_MESSAGE } from './logs-common-test.cy.ts'; |
| 4 | + |
| 5 | +describe('Admin in AdminConsole AggregatedLogs', () => { |
| 6 | + before( function() { |
| 7 | + cy.uiLoginAsClusterAdmin("first_user"); |
| 8 | + cy.switchToAdmConsole(); |
| 9 | + cy.get('button[data-quickstart-id="qs-nav-workloads"]').click(); |
| 10 | + }); |
| 11 | + |
| 12 | + beforeEach( function() { |
| 13 | + //Hover on WorkLoad -> Pods page |
| 14 | + cy.get('[id="page-sidebar"]') |
| 15 | + .within(() => { |
| 16 | + cy.contains('a[data-test="nav"]', 'Pods').click(); |
| 17 | + }) |
| 18 | + }); |
| 19 | + |
| 20 | + after( function() { |
| 21 | + //cy.uiLogoutClusterAdmin("first_user"); |
| 22 | + }); |
| 23 | + |
| 24 | + it('Log Panel top elements', {tags:['distinct','aggr']} , () => { |
| 25 | + //load Aggregated Logs for the first pod in APP_NAMESPACE1 |
| 26 | + cy.get('[data-test-id="namespace-bar-dropdown"]') |
| 27 | + .find('button[aria-expanded="false"]') |
| 28 | + .click(); |
| 29 | + |
| 30 | + cy.get('[data-test="namespace-dropdown-menu"]') |
| 31 | + .within(() => { |
| 32 | + cy.contains('button', `${APP_NAMESPACE1}`).click(); |
| 33 | + }); |
| 34 | + |
| 35 | + cy.get('tr[data-test-rows="resource-row"]') |
| 36 | + .first() |
| 37 | + .find('td') |
| 38 | + .first() |
| 39 | + .find('a.co-resource-item__resource-name') |
| 40 | + .click(); |
| 41 | + cy.get('a[data-test-id="horizontal-link-Aggregated Logs"]').click(); |
| 42 | + |
| 43 | + cy.getByTestId(TestIds.ToggleHistogramButton).should('exist'); |
| 44 | + cy.getByTestId(TestIds.TimeRangeDropdown).should('exist'); |
| 45 | + cy.getByTestId(TestIds.RefreshIntervalDropdown).should('exist'); |
| 46 | + cy.getByTestId(TestIds.SyncButton).should('exist'); |
| 47 | + cy.getByTestId(TestIds.AvailableAttributes).should('exist'); |
| 48 | + cy.getByTestId(TestIds.SeverityDropdown).should('exist'); |
| 49 | + cy.getByTestId(TestIds.TenantToggle).should('not.exist'); |
| 50 | + cy.contains('button', 'Show Resources').should('exist'); |
| 51 | + cy.getByTestId(TestIds.ShowStatsToggle).should('exist'); |
| 52 | + cy.contains('button', 'Export as CSV').should('exist'); |
| 53 | + cy.getByTestId(TestIds.ExecuteVolumeButton).should('exist'); |
| 54 | + cy.getByTestId(TestIds.ExecuteQueryButton).should('exist'); |
| 55 | + cy.getByTestId(TestIds.ShowQueryToggle).should('exist'); |
| 56 | + cy.getByTestId(TestIds.LogsTable).should('exist'); |
| 57 | + if (String(Cypress.env('CLUSTERLOGGING_DATAMODE')) == "select" ) { |
| 58 | + cy.getByTestId(TestIds.SchemaToggle).should('exist'); |
| 59 | + } |
| 60 | + cy.getByTestId(TestIds.AttributeFilters).within(() => { |
| 61 | + cy.getByTestId(TestIds.AvailableAttributes).click(); |
| 62 | + cy.contains('li', 'Content'); |
| 63 | + cy.contains('li', 'Namespaces').should('not.exist'); |
| 64 | + cy.contains('li', 'Pod'); |
| 65 | + cy.contains('li', 'Containers'); |
| 66 | + }); |
| 67 | + }); |
| 68 | + |
| 69 | + it('admin can display applicatioins logs',{tags:['distinct', 'aggr']}, () => { |
| 70 | + //load Aggregated Logs for the first pod in APP_NAMESPACE1 |
| 71 | + cy.get('[data-test-id="namespace-bar-dropdown"]') |
| 72 | + .find('button[aria-expanded="false"]') |
| 73 | + .click(); |
| 74 | + |
| 75 | + cy.get('[data-test="namespace-dropdown-menu"]') |
| 76 | + .within(() => { |
| 77 | + cy.contains('button', `${APP_NAMESPACE1}`).click(); |
| 78 | + }); |
| 79 | + |
| 80 | + cy.get('section.pf-v6-c-page__main-section') |
| 81 | + .contains('h1','Pods'); |
| 82 | + cy.get('section[id="content-scrollable"]') |
| 83 | + .within(() => { |
| 84 | + cy.get('tr[data-test-rows="resource-row"]') |
| 85 | + .first() |
| 86 | + .find('td') |
| 87 | + .first() |
| 88 | + .find('a.co-resource-item__resource-name') |
| 89 | + .click(); |
| 90 | + }); |
| 91 | + cy.get('a[data-test-id="horizontal-link-Aggregated Logs"]').click(); |
| 92 | + cy.getByTestId(TestIds.LogsTable,{ timeout: 20000 }).should('be.visible'); |
| 93 | + cy.assertLogInLogsTable(); |
| 94 | + }); |
| 95 | + |
| 96 | + it('admin can display infra container logs',{tags:['distinct','aggr']}, () => { |
| 97 | + //load Aggregated Logs for pod in openshift-monitoring |
| 98 | + cy.get('[data-test-id="namespace-bar-dropdown"]') |
| 99 | + .find('button[aria-expanded="false"]') |
| 100 | + .click(); |
| 101 | + cy.get('input[data-test="dropdown-text-filter"]').type('openshift-monitoring'); |
| 102 | + cy.get('input[data-test="showSystemSwitch"]').then($el => { |
| 103 | + if ($el.attr('data-checked-state') === 'false') { |
| 104 | + cy.wrap($el).click(); |
| 105 | + } |
| 106 | + }); |
| 107 | + cy.get('[data-test="dropdown-menu-item-link"]',{ timeout: 6000 }) |
| 108 | + .contains('button', 'openshift-monitoring') |
| 109 | + .click(); |
| 110 | + cy.get('section.pf-v6-c-page__main-section') |
| 111 | + .contains('h1','Pods'); |
| 112 | + //Click the pod alertmanager-main-0 |
| 113 | + cy.get('tbody[role="rowgroup"]') |
| 114 | + .find('a[data-test-id="alertmanager-main-0"]') |
| 115 | + .click(); |
| 116 | + //click Aggregated Logs tab |
| 117 | + cy.get('a[data-test-id="horizontal-link-Aggregated Logs"]').click(); |
| 118 | + cy.getByTestId(TestIds.LogsTable,{ timeout: 20000 }).should('be.visible'); |
| 119 | + cy.assertLogInLogsTable(); |
| 120 | + }); |
| 121 | +}) |
0 commit comments