-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RAM] Create serverless functional tests for rule details (#168101)
Serverless functional tests for rule details on Search. I did not copy all rule details tests to serverless. Some of them will be copied after soon rules changes: #168965 --------- Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
1659434
commit c2e4d40
Showing
4 changed files
with
795 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 123 additions & 0 deletions
123
x-pack/test_serverless/functional/page_objects/svl_rule_details_ui_page.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.