Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jennypavlova committed Feb 5, 2024
1 parent 87d718e commit 5e3a34f
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
45 changes: 45 additions & 0 deletions x-pack/test/functional/apps/infra/node_details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,15 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
await pageObjects.assetDetails.overviewAlertsTitleExists();
});

it('should show / hide alerts section with no alerts and show / hide closed section content', async () => {
await pageObjects.assetDetails.alertsSectionCollapsibleExist();
// Collapsed by default
await pageObjects.assetDetails.alertsSectionClosedContentNoAlertsExist();
// Expand
await pageObjects.assetDetails.alertsSectionCollapsibleClick();
await pageObjects.assetDetails.alertsSectionClosedContentNoAlertsMissing();
});

it('shows the CPU Profiling prompt if UI setting for Profiling integration is enabled', async () => {
await setInfrastructureProfilingIntegrationUiSetting(true);
await pageObjects.assetDetails.cpuProfilingPromptExists();
Expand All @@ -213,6 +222,42 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
await setInfrastructureProfilingIntegrationUiSetting(false);
await pageObjects.assetDetails.cpuProfilingPromptMissing();
});

describe('Alerts Section with alerts', () => {
before(async () => {
await navigateToNodeDetails('demo-stack-apache-01', 'demo-stack-apache-01');
await pageObjects.header.waitUntilLoadingHasFinished();

await pageObjects.timePicker.setAbsoluteRange(
START_HOST_ALERTS_DATE.format(DATE_PICKER_FORMAT),
END_HOST_ALERTS_DATE.format(DATE_PICKER_FORMAT)
);

await pageObjects.assetDetails.clickOverviewTab();
});

after(async () => {
await navigateToNodeDetails('Jennys-MBP.fritz.box', 'Jennys-MBP.fritz.box');
await pageObjects.header.waitUntilLoadingHasFinished();

await pageObjects.timePicker.setAbsoluteRange(
START_HOST_PROCESSES_DATE.format(DATE_PICKER_FORMAT),
END_HOST_PROCESSES_DATE.format(DATE_PICKER_FORMAT)
);
});

it('should show / hide alerts section with active alerts and show / hide closed section content', async () => {
await pageObjects.assetDetails.alertsSectionCollapsibleExist();
// Expanded by default
await pageObjects.assetDetails.alertsSectionClosedContentMissing();
// Collapse
await pageObjects.assetDetails.alertsSectionCollapsibleClick();
await pageObjects.assetDetails.alertsSectionClosedContentExist();
// Expand
await pageObjects.assetDetails.alertsSectionCollapsibleClick();
await pageObjects.assetDetails.alertsSectionClosedContentMissing();
});
});
});

describe('Metadata Tab', () => {
Expand Down
18 changes: 18 additions & 0 deletions x-pack/test/functional/page_objects/asset_details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,24 @@ export function AssetDetailsProvider({ getService }: FtrProviderContext) {
return await testSubjects.existOrFail('infraAssetDetailsMetricsCollapsible');
},

async alertsSectionCollapsibleClick() {
return await testSubjects.click('infraAssetDetailsAlertsCollapsible');
},

async alertsSectionClosedContentExist() {
return await testSubjects.existOrFail('infraAssetDetailsAlertsClosedContentWithAlerts');
},
async alertsSectionClosedContentMissing() {
return await testSubjects.missingOrFail('infraAssetDetailsAlertsClosedContentWithAlerts');
},

async alertsSectionClosedContentNoAlertsExist() {
return await testSubjects.existOrFail('infraAssetDetailsAlertsClosedContentNoAlerts');
},
async alertsSectionClosedContentNoAlertsMissing() {
return await testSubjects.missingOrFail('infraAssetDetailsAlertsClosedContentNoAlerts');
},

// Metadata
async clickMetadataTab() {
return testSubjects.click('infraAssetDetailsMetadataTab');
Expand Down

0 comments on commit 5e3a34f

Please sign in to comment.