Add hosts selection and filtering test (#160123)

Closes #160106 
## Summary

This PR adds a test to the hosts table selection and filtering
This commit is contained in:
jennypavlova 2023-06-22 11:34:44 +02:00 committed by GitHub
parent 98adb208da
commit 33e07340bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 0 deletions

View file

@ -409,6 +409,34 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
.then((hostRowData) => expect(hostRowData).to.eql(tableEntries[position]));
});
});
it('should select and filter hosts inside the table', async () => {
const selectHostsButtonExistsOnLoad =
await pageObjects.infraHostsView.selectedHostsButtonExist();
expect(selectHostsButtonExistsOnLoad).to.be(false);
await pageObjects.infraHostsView.clickHostCheckbox('demo-stack-client-01', '-');
await pageObjects.infraHostsView.clickHostCheckbox('demo-stack-apache-01', '-');
const selectHostsButtonExistsOnSelection =
await pageObjects.infraHostsView.selectedHostsButtonExist();
expect(selectHostsButtonExistsOnSelection).to.be(true);
await pageObjects.infraHostsView.clickSelectedHostsButton();
await pageObjects.infraHostsView.clickSelectedHostsAddFilterButton();
await pageObjects.header.waitUntilLoadingHasFinished();
const hostRowsAfterFilter = await pageObjects.infraHostsView.getHostsTableData();
expect(hostRowsAfterFilter.length).to.equal(2);
const deleteFilterButton = await find.byCssSelector(
`[title="Delete host.name: demo-stack-client-01 OR host.name: demo-stack-apache-01"]`
);
await deleteFilterButton.click();
await pageObjects.header.waitUntilLoadingHasFinished();
const hostRowsAfterRemovingFilter = await pageObjects.infraHostsView.getHostsTableData();
expect(hostRowsAfterRemovingFilter.length).to.equal(6);
});
});
it('should render "N/A" when processes summary is not available in flyout', async () => {

View file

@ -24,6 +24,18 @@ export function InfraHostsViewProvider({ getService }: FtrProviderContext) {
return testSubjects.click('hostsView-flyout-button');
},
async clickHostCheckbox(id: string, os: string) {
return testSubjects.click(`checkboxSelectRow-${id}-${os}`);
},
async clickSelectedHostsButton() {
return testSubjects.click('infraUseHostsTableButton');
},
async clickSelectedHostsAddFilterButton() {
return testSubjects.click('infraHostsTableAddFilterButton');
},
async clickCloseFlyoutButton() {
return testSubjects.click('euiFlyoutCloseButton');
},
@ -80,6 +92,8 @@ export function InfraHostsViewProvider({ getService }: FtrProviderContext) {
return testSubjects.click('hostsView-enable-feature-button');
},
// Table
async getHostsTable() {
return testSubjects.find('hostsView-table');
},
@ -109,6 +123,10 @@ export function InfraHostsViewProvider({ getService }: FtrProviderContext) {
return cellContent.getVisibleText();
},
async selectedHostsButtonExist() {
return testSubjects.exists('infraUseHostsTableButton');
},
async getMetricsTrendContainer() {
return testSubjects.find('hostsViewKPIGrid');
},