Skip to content

Commit 5da44fb

Browse files
authored
[Infra] Add tests for alerts section in the container views overview tab (elastic#186177)
Closes elastic#186124 ## Summary This PR adds tests for alerts section in the container views overview tab
1 parent c23a622 commit 5da44fb

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

x-pack/plugins/observability_solution/infra/public/components/asset_details/tabs/overview/alerts/alerts.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export const AlertsSummaryContent = ({
7777
<LinkToAlertsPage
7878
kuery={`${assetIdField}:"${assetId}"`}
7979
dateRange={dateRange}
80-
data-test-subj="nfraAssetDetailsAlertsTabAlertsShowAllButton"
80+
data-test-subj="infraAssetDetailsAlertsTabAlertsShowAllButton"
8181
/>
8282
</EuiFlexItem>
8383
</EuiFlexGroup>

x-pack/test/functional/apps/infra/home_page.ts

+7
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,13 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
316316
expect(containers.length).to.equal(chartsCount);
317317
});
318318
});
319+
320+
it('should show alerts', async () => {
321+
await pageObjects.header.waitUntilLoadingHasFinished();
322+
await pageObjects.assetDetails.overviewAlertsTitleExists();
323+
await pageObjects.assetDetails.overviewLinkToAlertsExist();
324+
await pageObjects.assetDetails.overviewOpenAlertsFlyoutExist();
325+
});
319326
});
320327

321328
describe('Metadata Tab', () => {

x-pack/test/functional/apps/infra/node_details.ts

+12
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,18 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
680680
});
681681
});
682682

683+
it('should show / hide alerts section with no alerts and show / hide closed section content', async () => {
684+
await pageObjects.assetDetails.alertsSectionCollapsibleExist();
685+
// Collapsed by default
686+
await pageObjects.assetDetails.alertsSectionClosedContentNoAlertsExist();
687+
// Expand
688+
await pageObjects.assetDetails.alertsSectionCollapsibleClick();
689+
await pageObjects.assetDetails.alertsSectionClosedContentNoAlertsMissing();
690+
// Check if buttons exist
691+
await pageObjects.assetDetails.overviewLinkToAlertsExist();
692+
await pageObjects.assetDetails.overviewOpenAlertsFlyoutExist();
693+
});
694+
683695
describe('Metadata Tab', () => {
684696
before(async () => {
685697
await pageObjects.assetDetails.clickMetadataTab();

x-pack/test/functional/page_objects/asset_details.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ export function AssetDetailsProvider({ getService }: FtrProviderContext) {
7171
return servicesWithIconsAndNames;
7272
},
7373

74-
async clickOverviewLinkToAlerts() {
75-
return testSubjects.click('infraAssetDetailsAlertsShowAllButton');
74+
async overviewLinkToAlertsExist() {
75+
return testSubjects.existOrFail('infraAssetDetailsAlertsTabAlertsShowAllButton');
7676
},
7777

78-
async clickOverviewOpenAlertsFlyout() {
79-
return testSubjects.click('infraAssetDetailsCreateAlertsRuleButton');
78+
async overviewOpenAlertsFlyoutExist() {
79+
return testSubjects.existOrFail('infraAssetDetailsAlertsTabCreateAlertsRuleButton');
8080
},
8181

8282
async clickShowAllMetadataOverviewTab() {

0 commit comments

Comments
 (0)