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

[RAM] Create serverless functional tests for rule details #168101

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
760922b
first part rules list serverless tests
guskovaue Sep 8, 2023
87ca6b8
second part
guskovaue Sep 18, 2023
dc831d5
make tests prettier
guskovaue Sep 18, 2023
aae90b4
Merge branch 'main' into RAM-create-serverless-functional-tests-for-r…
guskovaue Sep 18, 2023
e579620
import new tests
guskovaue Sep 20, 2023
4a97969
Merge branch 'RAM-create-serverless-functional-tests-for-rules-list' …
guskovaue Sep 20, 2023
a7afc5e
Merge branch 'main' into RAM-create-serverless-functional-tests-for-r…
kibanamachine Sep 20, 2023
db8c143
add anomaly rule because inventory dissapeared from serverless oblt
guskovaue Sep 21, 2023
dbe7236
Merge branch 'main' into RAM-create-serverless-functional-tests-for-r…
kibanamachine Sep 21, 2023
64b7cf1
Merge branch 'main' into RAM-create-serverless-functional-tests-for-r…
kibanamachine Sep 22, 2023
b63b19f
temp use basic authentication not to break build in ci
guskovaue Sep 25, 2023
1f17fcc
Merge branch 'RAM-create-serverless-functional-tests-for-rules-list' …
guskovaue Sep 25, 2023
9a6c0bf
Merge branch 'main' into RAM-create-serverless-functional-tests-for-r…
kibanamachine Sep 25, 2023
6aed2e8
fix after rebase
guskovaue Sep 25, 2023
a9bac9c
temp
guskovaue Sep 25, 2023
7bc9d7b
temp skip tests with failed rules
guskovaue Sep 25, 2023
78000a4
Merge branch 'main' into RAM-create-serverless-functional-tests-for-r…
guskovaue Sep 25, 2023
70abfe6
Merge branch 'RAM-create-serverless-functional-tests-for-rules-list' …
guskovaue Sep 25, 2023
0836f24
first part of serverless tests for rule details page
guskovaue Sep 29, 2023
be91c33
more tests
guskovaue Oct 3, 2023
9bd01bb
last part of the tests
guskovaue Oct 5, 2023
dd55a0e
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Oct 5, 2023
403499f
Merge branch 'main' into RAM-create-serverless-functional-tests-for-r…
guskovaue Oct 9, 2023
2a17f1b
Merge branch 'RAM-create-serverless-functional-tests-for-rule-details…
guskovaue Oct 9, 2023
083522d
fixes
guskovaue Oct 9, 2023
5eec4e8
navigate to search not oblt
guskovaue Oct 10, 2023
a531c92
make tests more beautiful
guskovaue Oct 10, 2023
b2f199d
Merge branch 'main' into RAM-create-serverless-functional-tests-for-r…
guskovaue Oct 16, 2023
6845406
small fixes
guskovaue Oct 16, 2023
381071f
Merge branch 'RAM-create-serverless-functional-tests-for-rule-details…
guskovaue Oct 16, 2023
331091d
fix rules list tests
guskovaue Oct 16, 2023
b529ed8
Merge branch 'main' into RAM-create-serverless-functional-tests-for-r…
guskovaue Oct 17, 2023
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
2 changes: 2 additions & 0 deletions x-pack/test_serverless/functional/page_objects/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { SvlObltOverviewPageProvider } from './svl_oblt_overview_page';
import { SvlSearchLandingPageProvider } from './svl_search_landing_page';
import { SvlSecLandingPageProvider } from './svl_sec_landing_page';
import { SvlTriggersActionsPageProvider } from './svl_triggers_actions_ui_page';
import { SvlRuleDetailsPageProvider } from './svl_rule_details_ui_page';

export const pageObjects = {
...xpackFunctionalPageObjects,
Expand All @@ -30,4 +31,5 @@ export const pageObjects = {
svlSearchLandingPage: SvlSearchLandingPageProvider,
svlSecLandingPage: SvlSecLandingPageProvider,
svlTriggersActionsUI: SvlTriggersActionsPageProvider,
svlRuleDetailsUI: SvlRuleDetailsPageProvider,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../ftr_provider_context';

export function SvlRuleDetailsPageProvider({ getService }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
const find = getService('find');
const log = getService('log');
const retry = getService('retry');

return {
async getHeadingText() {
return await testSubjects.getVisibleText('ruleDetailsTitle');
},
async getRuleType() {
return await testSubjects.getVisibleText('ruleTypeLabel');
},
async getAPIKeyOwner() {
return await testSubjects.getVisibleText('apiKeyOwnerLabel');
},
async getAlertsList() {
const table = await find.byCssSelector(
'.euiBasicTable[data-test-subj="alertsList"]:not(.euiBasicTable-loading)'
);
const $ = await table.parseDomContent();
return $.findTestSubjects('alert-row')
.toArray()
.map((row) => {
return {
alert: $(row)
.findTestSubject('alertsTableCell-alert')
.find('.euiTableCellContent')
.text(),
status: $(row)
.findTestSubject('alertsTableCell-status')
.find('.euiTableCellContent')
.text(),
start: $(row)
.findTestSubject('alertsTableCell-start')
.find('.euiTableCellContent')
.text(),
duration: $(row)
.findTestSubject('alertsTableCell-duration')
.find('.euiTableCellContent')
.text(),
};
});
},
async getAlertDurationEpoch(): Promise<number> {
const alertDurationEpoch = await find.byCssSelector(
'input[data-test-subj="alertsDurationEpoch"]'
);
return parseInt(await alertDurationEpoch.getAttribute('value'), 10);
},
async clickAlertMuteButton(alert: string) {
const muteAlertButton = await testSubjects.find(`muteAlertButton_${alert}`);
await muteAlertButton.click();
},
async ensureAlertMuteState(alert: string, isMuted: boolean) {
await retry.try(async () => {
const muteAlertButton = await testSubjects.find(`muteAlertButton_${alert}`);
log.debug(`checked:${await muteAlertButton.getAttribute('aria-checked')}`);
expect(await muteAlertButton.getAttribute('aria-checked')).to.eql(
isMuted ? 'true' : 'false'
);
});
},
async ensureAlertExistence(alert: string, shouldExist: boolean) {
await retry.try(async () => {
const table = await find.byCssSelector(
'.euiBasicTable[data-test-subj="alertsList"]:not(.euiBasicTable-loading)'
);
const $ = await table.parseDomContent();
expect(
$.findTestSubjects('alert-row')
.toArray()
.filter(
(row) =>
$(row)
.findTestSubject('alertsTableCell-alert')
.find('.euiTableCellContent')
.text() === alert
)
).to.eql(shouldExist ? 1 : 0);
});
},
async clickPaginationNextPage() {
const nextButton = await testSubjects.find(`pagination-button-next`);
nextButton.click();
},
async isViewInAppDisabled() {
await retry.try(async () => {
const viewInAppButton = await testSubjects.find(`ruleDetails-viewInApp`);
expect(await viewInAppButton.getAttribute('disabled')).to.eql('true');
});
return true;
},
async isViewInAppEnabled() {
await retry.try(async () => {
const viewInAppButton = await testSubjects.find(`ruleDetails-viewInApp`);
await new Promise((resolve) => {});
expect(await viewInAppButton.getAttribute('disabled')).to.not.eql('true');
});
return true;
},
async clickViewInApp() {
return await testSubjects.click('ruleDetails-viewInApp');
},
async getNoOpAppTitle() {
await retry.try(async () => {
const title = await testSubjects.find('noop-title');
expect(title.isDisplayed()).to.eql(true);
});
return await testSubjects.getVisibleText('noop-title');
},
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ export default function ({ loadTestFile }: FtrProviderContext) {
loadTestFile(require.resolve('./empty_page'));
loadTestFile(require.resolve('./navigation'));
loadTestFile(require.resolve('./cases/attachment_framework'));

loadTestFile(require.resolve('./dashboards/build_dashboard'));
loadTestFile(require.resolve('./dashboards/import_dashboard'));
loadTestFile(require.resolve('./advanced_settings'));
loadTestFile(require.resolve('./rules/rule_details'));

loadTestFile(require.resolve('./ml'));
});
Expand Down
Loading
Loading