Skip to content

Commit

Permalink
[Infra] Add tests for alerts section in the container views overview …
Browse files Browse the repository at this point in the history
…tab (elastic#186177)

Closes elastic#186124 

## Summary

This PR adds tests for alerts section in the container views overview
tab
  • Loading branch information
jennypavlova authored Jun 13, 2024
1 parent c23a622 commit 5da44fb
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const AlertsSummaryContent = ({
<LinkToAlertsPage
kuery={`${assetIdField}:"${assetId}"`}
dateRange={dateRange}
data-test-subj="nfraAssetDetailsAlertsTabAlertsShowAllButton"
data-test-subj="infraAssetDetailsAlertsTabAlertsShowAllButton"
/>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
7 changes: 7 additions & 0 deletions x-pack/test/functional/apps/infra/home_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,13 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
expect(containers.length).to.equal(chartsCount);
});
});

it('should show alerts', async () => {
await pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.assetDetails.overviewAlertsTitleExists();
await pageObjects.assetDetails.overviewLinkToAlertsExist();
await pageObjects.assetDetails.overviewOpenAlertsFlyoutExist();
});
});

describe('Metadata Tab', () => {
Expand Down
12 changes: 12 additions & 0 deletions x-pack/test/functional/apps/infra/node_details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,18 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});
});

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();
// Check if buttons exist
await pageObjects.assetDetails.overviewLinkToAlertsExist();
await pageObjects.assetDetails.overviewOpenAlertsFlyoutExist();
});

describe('Metadata Tab', () => {
before(async () => {
await pageObjects.assetDetails.clickMetadataTab();
Expand Down
8 changes: 4 additions & 4 deletions x-pack/test/functional/page_objects/asset_details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ export function AssetDetailsProvider({ getService }: FtrProviderContext) {
return servicesWithIconsAndNames;
},

async clickOverviewLinkToAlerts() {
return testSubjects.click('infraAssetDetailsAlertsShowAllButton');
async overviewLinkToAlertsExist() {
return testSubjects.existOrFail('infraAssetDetailsAlertsTabAlertsShowAllButton');
},

async clickOverviewOpenAlertsFlyout() {
return testSubjects.click('infraAssetDetailsCreateAlertsRuleButton');
async overviewOpenAlertsFlyoutExist() {
return testSubjects.existOrFail('infraAssetDetailsAlertsTabCreateAlertsRuleButton');
},

async clickShowAllMetadataOverviewTab() {
Expand Down

0 comments on commit 5da44fb

Please sign in to comment.