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

Fix endpoint host list test #64104

Closed
wants to merge 48 commits into from
Closed
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
bd64187
endpoint-161-refactor-management-list-test
charlie-pichette Feb 20, 2020
3d5f573
Merge branch 'master' into endpoint-list-ui-tests
charlie-pichette Feb 20, 2020
f1142b4
Merge branch 'master' into endpoint-list-ui-tests
charlie-pichette Feb 21, 2020
16bf753
Merge branch 'charlie-pichette-endpoint-list-ui-tests'
charlie-pichette Feb 21, 2020
5a62211
Merge remote-tracking branch 'upstream/master'
charlie-pichette Feb 21, 2020
6e1c87f
fix location of es archive file
charlie-pichette Feb 21, 2020
e23f779
Merge remote-tracking branch 'upstream/master'
charlie-pichette Feb 21, 2020
e54ce10
Merge pull request #1 from charlie-pichette/endpoint-list-ui-tests
charlie-pichette Feb 24, 2020
345bf1f
Merge remote-tracking branch 'upstream/master'
charlie-pichette Feb 24, 2020
dfdc2c1
Merge remote-tracking branch 'upstream/master'
charlie-pichette Feb 27, 2020
60def68
Merge remote-tracking branch 'upstream/master'
charlie-pichette Feb 28, 2020
ad719dd
Merge remote-tracking branch 'upstream/master'
charlie-pichette Feb 28, 2020
4f4c246
Merge remote-tracking branch 'upstream/master'
charlie-pichette Feb 28, 2020
d6c63d9
Merge branch 'master' of https://github.com/charlie-pichette/kibana
charlie-pichette Feb 28, 2020
de21cd3
Merge remote-tracking branch 'upstream/master'
charlie-pichette Mar 2, 2020
7e637cc
Merge remote-tracking branch 'upstream/master'
charlie-pichette Mar 3, 2020
a860b21
Merge remote-tracking branch 'upstream/master'
charlie-pichette Mar 3, 2020
126f3fd
Merge remote-tracking branch 'upstream/master'
charlie-pichette Mar 4, 2020
dd2f50a
Merge remote-tracking branch 'upstream/master'
charlie-pichette Mar 6, 2020
59bd743
Merge remote-tracking branch 'upstream/master'
charlie-pichette Mar 17, 2020
0caa765
Merge remote-tracking branch 'upstream/master'
charlie-pichette Mar 17, 2020
428eb7d
Merge remote-tracking branch 'upstream/master'
charlie-pichette Mar 18, 2020
2f713d8
Merge remote-tracking branch 'upstream/master'
charlie-pichette Mar 26, 2020
22f533e
Merge remote-tracking branch 'upstream/master'
charlie-pichette Mar 27, 2020
f06176e
Merge remote-tracking branch 'upstream/master'
charlie-pichette Mar 30, 2020
a373677
Merge remote-tracking branch 'upstream/master'
charlie-pichette Mar 30, 2020
0c81316
Merge remote-tracking branch 'upstream/master'
charlie-pichette Mar 31, 2020
3fd4b7e
Merge remote-tracking branch 'upstream/master'
charlie-pichette Mar 31, 2020
02fa568
Merge remote-tracking branch 'upstream/master'
charlie-pichette Mar 31, 2020
a782bb4
Merge remote-tracking branch 'upstream/master'
charlie-pichette Apr 1, 2020
57aba9f
Merge 'upstream/master'
charlie-pichette Apr 2, 2020
6c308a3
Merge remote-tracking branch 'upstream/master'
charlie-pichette Apr 3, 2020
6e279e6
Merge remote-tracking branch 'upstream/master'
charlie-pichette Apr 9, 2020
b47dba0
Merge remote-tracking branch 'upstream/master'
charlie-pichette Apr 13, 2020
46486a7
Merge remote-tracking branch 'upstream/master'
charlie-pichette Apr 15, 2020
7d57e37
Merge upstream/master
charlie-pichette Apr 17, 2020
4318185
Merge remote-tracking branch 'upstream/master'
charlie-pichette Apr 20, 2020
a10a45c
Merge remote-tracking branch 'upstream/master'
charlie-pichette Apr 21, 2020
97ec7aa
Fix Endpoint App Host List Test Failure
charlie-pichette Apr 21, 2020
96bc8f3
remove comment
charlie-pichette Apr 21, 2020
dd3d7f4
reorganize the test script
charlie-pichette Apr 22, 2020
e3636df
Merge branch 'master' into 63621-Fix-Endpoint-Host-List-Test
elasticmachine Apr 25, 2020
f8a9509
Merge remote-tracking branch 'upstream/master'
charlie-pichette May 11, 2020
e35025a
Merge branch 'master' into 63621-Fix-Endpoint-Host-List-Test
charlie-pichette May 11, 2020
7086d20
Merge branch '63621-Fix-Endpoint-Host-List-Test' of https://github.co…
charlie-pichette May 11, 2020
aa69de4
Merge branch 'master' into 63621-Fix-Endpoint-Host-List-Test
elasticmachine May 12, 2020
a7b5e9d
Merge branch 'master' into 63621-Fix-Endpoint-Host-List-Test
elasticmachine May 14, 2020
b1abe1d
Merge branch 'master' into 63621-Fix-Endpoint-Host-List-Test
elasticmachine May 15, 2020
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
214 changes: 110 additions & 104 deletions x-pack/test/functional_endpoint/apps/endpoint/host_list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,134 +12,127 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
const esArchiver = getService('esArchiver');
const testSubjects = getService('testSubjects');

// FLAKY: https://github.com/elastic/kibana/issues/63621
describe.skip('host list', function() {
describe('host list', function() {
this.tags('ciGroup7');
const sleep = (ms = 100) => new Promise(resolve => setTimeout(resolve, ms));
before(async () => {
await esArchiver.load('endpoint/metadata/api_feature');
await pageObjects.common.navigateToUrlWithBrowserHistory('endpoint', '/hosts');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these two lines could be removed, since all subsequent test blocks (describe()) already do this navigation - unless: this is meant for the UI to run the "setup" where we call ingest to install the package (mabye?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was a concern from a timing perspective. If you feel it is not needed I can remove them @paul-tavares.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove the load. It was an oversight.

await pageObjects.header.waitUntilLoadingHasFinished();
});

it('finds title', async () => {
const title = await testSubjects.getVisibleText('hostListTitle');
expect(title).to.equal('Hosts');
});

it('displays table data', async () => {
const expectedData = [
[
'Hostname',
'Policy',
'Policy Status',
'Alerts',
'Operating System',
'IP Address',
'Sensor Version',
'Last Active',
],
[
'cadmann-4.example.com',
'Policy Name',
'Policy Status',
'0',
'windows 10.0',
'10.192.213.130, 10.70.28.129',
'version',
'xxxx',
],
[
'thurlow-9.example.com',
'Policy Name',
'Policy Status',
'0',
'windows 10.0',
'10.46.229.234',
'version',
'xxxx',
],
[
'rezzani-7.example.com',
'Policy Name',
'Policy Status',
'0',
'windows 10.0',
'10.101.149.26, 2606:a000:ffc0:39:11ef:37b9:3371:578c',
'version',
'xxxx',
],
];
const tableData = await pageObjects.endpoint.getEndpointAppTableData('hostListTable');
expect(tableData).to.eql(expectedData);
});

it('no details flyout when host page displayed', async () => {
await testSubjects.missingOrFail('hostDetailsFlyout');
});

it('display details flyout when the hostname is clicked on', async () => {
await (await testSubjects.find('hostnameCellLink')).click();
await testSubjects.existOrFail('hostDetailsUpperList');
await testSubjects.existOrFail('hostDetailsLowerList');
});

it('update details flyout when new hostname is clicked on', async () => {
// display flyout for the first host in the list
await (await testSubjects.findAll('hostnameCellLink'))[0].click();
await testSubjects.existOrFail('hostDetailsFlyoutTitle');
const hostDetailTitle0 = await testSubjects.getVisibleText('hostDetailsFlyoutTitle');
// select the 2nd host in the host list
await (await testSubjects.findAll('hostnameCellLink'))[1].click();
await pageObjects.endpoint.waitForVisibleTextToChange(
'hostDetailsFlyoutTitle',
hostDetailTitle0
);
const hostDetailTitle1 = await testSubjects.getVisibleText('hostDetailsFlyoutTitle');
expect(hostDetailTitle1).to.not.eql(hostDetailTitle0);
});

it('details flyout remains the same when current hostname is clicked on', async () => {
// display flyout for the first host in the list
await (await testSubjects.findAll('hostnameCellLink'))[1].click();
await testSubjects.existOrFail('hostDetailsFlyoutTitle');
const hostDetailTitleInitial = await testSubjects.getVisibleText('hostDetailsFlyoutTitle');
// select the same host in the host list
await (await testSubjects.findAll('hostnameCellLink'))[1].click();
await sleep(500); // give page time to refresh and verify it did not change
const hostDetailTitleNew = await testSubjects.getVisibleText('hostDetailsFlyoutTitle');
expect(hostDetailTitleNew).to.eql(hostDetailTitleInitial);
});

describe('no data', () => {
describe('with data', () => {
before(async () => {
// clear out the data and reload the page
await esArchiver.unload('endpoint/metadata/api_feature');
await esArchiver.load('endpoint/metadata/api_feature');
await pageObjects.common.navigateToUrlWithBrowserHistory('endpoint', '/hosts');
await pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.endpoint.waitForTableToHaveData('hostListTable');
});
after(async () => {
// reload the data so the other tests continue to pass
await esArchiver.load('endpoint/metadata/api_feature');
await esArchiver.unload('endpoint/metadata/api_feature');
});
it('displays no items found when empty', async () => {
// get the host list table data and verify message
const [, [noItemsFoundMessage]] = await pageObjects.endpoint.getEndpointAppTableData(
'hostListTable'
it('finds title', async () => {
const title = await testSubjects.getVisibleText('hostListTitle');
expect(title).to.equal('Hosts');
});

it('displays table data', async () => {
const expectedData = [
[
'Hostname',
'Policy',
'Policy Status',
'Alerts',
'Operating System',
'IP Address',
'Sensor Version',
'Last Active',
],
[
'cadmann-4.example.com',
'Policy Name',
'Policy Status',
'0',
'windows 10.0',
'10.192.213.130, 10.70.28.129',
'version',
'xxxx',
],
[
'thurlow-9.example.com',
'Policy Name',
'Policy Status',
'0',
'windows 10.0',
'10.46.229.234',
'version',
'xxxx',
],
[
'rezzani-7.example.com',
'Policy Name',
'Policy Status',
'0',
'windows 10.0',
'10.101.149.26, 2606:a000:ffc0:39:11ef:37b9:3371:578c',
'version',
'xxxx',
],
];
const tableData = await pageObjects.endpoint.getEndpointAppTableData('hostListTable');
expect(tableData).to.eql(expectedData);
});

it('no details flyout when host page displayed', async () => {
await testSubjects.missingOrFail('hostDetailsFlyout');
});

it('display details flyout when the hostname is clicked on', async () => {
await (await testSubjects.find('hostnameCellLink')).click();
await testSubjects.existOrFail('hostDetailsUpperList');
await testSubjects.existOrFail('hostDetailsLowerList');
});

it('update details flyout when new hostname is clicked on', async () => {
// display flyout for the first host in the list
await (await testSubjects.findAll('hostnameCellLink'))[0].click();
await testSubjects.existOrFail('hostDetailsFlyoutTitle');
const hostDetailTitle0 = await testSubjects.getVisibleText('hostDetailsFlyoutTitle');
// select the 2nd host in the host list
await (await testSubjects.findAll('hostnameCellLink'))[1].click();
await pageObjects.endpoint.waitForVisibleTextToChange(
'hostDetailsFlyoutTitle',
hostDetailTitle0
);
expect(noItemsFoundMessage).to.equal('No items found');
const hostDetailTitle1 = await testSubjects.getVisibleText('hostDetailsFlyoutTitle');
expect(hostDetailTitle1).to.not.eql(hostDetailTitle0);
});

it('details flyout remains the same when current hostname is clicked on', async () => {
// display flyout for the first host in the list
await (await testSubjects.findAll('hostnameCellLink'))[1].click();
await testSubjects.existOrFail('hostDetailsFlyoutTitle');
const hostDetailTitleInitial = await testSubjects.getVisibleText('hostDetailsFlyoutTitle');
// select the same host in the host list
await (await testSubjects.findAll('hostnameCellLink'))[1].click();
await sleep(500); // give page time to refresh and verify it did not change
const hostDetailTitleNew = await testSubjects.getVisibleText('hostDetailsFlyoutTitle');
expect(hostDetailTitleNew).to.eql(hostDetailTitleInitial);
});
});

describe('has a url with a host id', () => {
before(async () => {
await esArchiver.load('endpoint/metadata/api_feature');
await pageObjects.common.navigateToUrlWithBrowserHistory(
'endpoint',
'/hosts',
'selected_host=fc0ff548-feba-41b6-8367-65e8790d0eaf'
);
await pageObjects.header.waitUntilLoadingHasFinished();
});
after(async () => {
await esArchiver.unload('endpoint/metadata/api_feature');
});

it('shows a flyout', async () => {
await testSubjects.existOrFail('hostDetailsFlyout');
Expand Down Expand Up @@ -175,8 +168,21 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
]);
});
});
after(async () => {
await esArchiver.unload('endpoint/metadata/api_feature');

describe('no data', () => {
before(async () => {
// clear out the data and reload the page
await esArchiver.unload('endpoint/metadata/api_feature');
await pageObjects.common.navigateToUrlWithBrowserHistory('endpoint', '/hosts');
await pageObjects.header.waitUntilLoadingHasFinished();
});
it('displays no items found when empty', async () => {
// get the host list table data and verify message
const [, [noItemsFoundMessage]] = await pageObjects.endpoint.getEndpointAppTableData(
'hostListTable'
);
expect(noItemsFoundMessage).to.equal('No items found');
});
});
});
};