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 functional tests #1

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions x-pack/test/functional/apps/infra/home_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});

[
{ metric: 'cpuUsage', value: '0.8%' },
{ metric: 'cpuUsage', value: 'N/A' },
{ metric: 'normalizedLoad1m', value: '1.4%' },
{ metric: 'memoryUsage', value: '18.0%' },
{ metric: 'diskUsage', value: '35.0%' },
].forEach(({ metric, value }) => {
it.skip(`${metric} tile should show ${value}`, async () => {
it(`${metric} tile should show ${value}`, async () => {
await retry.tryForTime(3 * 1000, async () => {
const tileValue = await pageObjects.assetDetails.getAssetDetailsKPITileValue(
metric
Expand Down
82 changes: 40 additions & 42 deletions x-pack/test/functional/apps/infra/hosts_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ const tableEntries = [
},
{
alertsCount: 0,
title: 'demo-stack-nginx-01',
title: 'demo-stack-client-01',
cpuUsage: '0%',
normalizedLoad: '1.4%',
memoryUsage: '18%',
memoryFree: '3.2 GB',
diskSpaceUsage: '35%',
normalizedLoad: '0.1%',
memoryUsage: '13.8%',
memoryFree: '3.3 GB',
diskSpaceUsage: '33.8%',
rx: '0 bit/s',
tx: '0 bit/s',
},
Expand All @@ -87,12 +87,12 @@ const tableEntries = [
},
{
alertsCount: 0,
title: 'demo-stack-client-01',
title: 'demo-stack-nginx-01',
cpuUsage: '0%',
normalizedLoad: '0.1%',
memoryUsage: '13.8%',
memoryFree: '3.3 GB',
diskSpaceUsage: '33.8%',
normalizedLoad: '1.4%',
memoryUsage: '18%',
memoryFree: '3.2 GB',
diskSpaceUsage: '35%',
rx: '0 bit/s',
tx: '0 bit/s',
},
Expand Down Expand Up @@ -476,12 +476,11 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
expect(hostRows.length).to.equal(6);
});

it.skip('should render the computed metrics for each host entry', async () => {
hostRows.forEach((row, position) => {
pageObjects.infraHostsView
.getHostsRowData(row)
.then((hostRowData) => expect(hostRowData).to.eql(tableEntries[position]));
});
it('should render the computed metrics for each host entry', async () => {
for (let i = 0; i < hostRows.length; i++) {
const hostRowData = await pageObjects.infraHostsView.getHostsRowData(hostRows[i]);
expect(hostRowData).to.eql(tableEntries[i]);
}
});

it('should select and filter hosts inside the table', async () => {
Expand Down Expand Up @@ -701,11 +700,10 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {

expect(hostRows.length).to.equal(3);

hostRows.forEach((row, position) => {
pageObjects.infraHostsView
.getHostsRowData(row)
.then((hostRowData) => expect(hostRowData).to.eql(filtererEntries[position]));
});
for (let i = 0; i < hostRows.length; i++) {
const hostRowData = await pageObjects.infraHostsView.getHostsRowData(hostRows[i]);
expect(hostRowData).to.eql(filtererEntries[i]);
}
});

it('should update the KPIs content on a search submit', async () => {
Expand Down Expand Up @@ -782,55 +780,55 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {

it('should show 5 rows on the first page', async () => {
const hostRows = await pageObjects.infraHostsView.getHostsTableData();
hostRows.forEach((row, position) => {
pageObjects.infraHostsView
.getHostsRowData(row)
.then((hostRowData) => expect(hostRowData).to.eql(tableEntries[position]));
});

for (let i = 0; i < hostRows.length; i++) {
const hostRowData = await pageObjects.infraHostsView.getHostsRowData(hostRows[i]);
expect(hostRowData).to.eql(tableEntries[i]);
}
});

it('should paginate to the last page', async () => {
await pageObjects.infraHostsView.paginateTo(2);
const hostRows = await pageObjects.infraHostsView.getHostsTableData();
hostRows.forEach((row) => {
pageObjects.infraHostsView
.getHostsRowData(row)
.then((hostRowData) => expect(hostRowData).to.eql(tableEntries[5]));
});

expect(hostRows.length).to.equal(1);

const hostRowData = await pageObjects.infraHostsView.getHostsRowData(hostRows[0]);
expect(hostRowData).to.eql(tableEntries[5]);
});

it('should show all hosts on the same page', async () => {
await pageObjects.infraHostsView.changePageSize(10);
const hostRows = await pageObjects.infraHostsView.getHostsTableData();
hostRows.forEach((row, position) => {
pageObjects.infraHostsView
.getHostsRowData(row)
.then((hostRowData) => expect(hostRowData).to.eql(tableEntries[position]));
});

for (let i = 0; i < hostRows.length; i++) {
const hostRowData = await pageObjects.infraHostsView.getHostsRowData(hostRows[i]);
expect(hostRowData).to.eql(tableEntries[i]);
}
});

it.skip('should sort by a numeric field asc', async () => {
await pageObjects.infraHostsView.sortByCpuUsage();
it('should sort by a numeric field asc', async () => {
await pageObjects.infraHostsView.sortByMemoryUsage();
let hostRows = await pageObjects.infraHostsView.getHostsTableData();
const hostDataFirtPage = await pageObjects.infraHostsView.getHostsRowData(hostRows[0]);
expect(hostDataFirtPage).to.eql(tableEntries[5]);
expect(hostDataFirtPage).to.eql(tableEntries[3]);

await pageObjects.infraHostsView.paginateTo(2);
hostRows = await pageObjects.infraHostsView.getHostsTableData();
const hostDataLastPage = await pageObjects.infraHostsView.getHostsRowData(hostRows[0]);
expect(hostDataLastPage).to.eql(tableEntries[0]);
});

it.skip('should sort by a numeric field desc', async () => {
await pageObjects.infraHostsView.sortByCpuUsage();
it('should sort by a numeric field desc', async () => {
await pageObjects.infraHostsView.sortByMemoryUsage();
let hostRows = await pageObjects.infraHostsView.getHostsTableData();
const hostDataFirtPage = await pageObjects.infraHostsView.getHostsRowData(hostRows[0]);
expect(hostDataFirtPage).to.eql(tableEntries[0]);

await pageObjects.infraHostsView.paginateTo(2);
hostRows = await pageObjects.infraHostsView.getHostsTableData();
const hostDataLastPage = await pageObjects.infraHostsView.getHostsRowData(hostRows[0]);
expect(hostDataLastPage).to.eql(tableEntries[5]);
expect(hostDataLastPage).to.eql(tableEntries[3]);
});

it('should sort by text field asc', async () => {
Expand Down
6 changes: 3 additions & 3 deletions x-pack/test/functional/apps/infra/node_details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
{ metric: 'memoryUsage', value: '94.9%' },
{ metric: 'diskUsage', value: 'N/A' },
].forEach(({ metric, value }) => {
it.skip(`${metric} tile should show ${value}`, async () => {
it(`${metric} tile should show ${value}`, async () => {
await retry.tryForTime(3 * 1000, async () => {
const tileValue = await pageObjects.assetDetails.getAssetDetailsKPITileValue(
metric
Expand Down Expand Up @@ -558,12 +558,12 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});

[
{ metric: 'cpuUsage', value: '99.6%' },
{ metric: 'cpuUsage', value: '100%' },
{ metric: 'normalizedLoad1m', value: '1,300.3%' },
{ metric: 'memoryUsage', value: '42.2%' },
{ metric: 'diskUsage', value: '36.0%' },
].forEach(({ metric, value }) => {
it.skip(`${metric} tile should show ${value}`, async () => {
it(`${metric} tile should show ${value}`, async () => {
await retry.tryForTime(3 * 1000, async () => {
const tileValue = await pageObjects.assetDetails.getAssetDetailsKPITileValue(
metric
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/functional/page_objects/infra_home_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export function InfraHomePageProvider({ getService, getPageObjects }: FtrProvide

async clickOnFirstNode() {
const firstNode = await this.getFirstNode();
firstNode.click();
return firstNode.click();
},

async clickOnGoToNodeDetails() {
Expand Down
10 changes: 5 additions & 5 deletions x-pack/test/functional/page_objects/infra_hosts_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,17 +247,17 @@ export function InfraHostsViewProvider({ getService }: FtrProviderContext) {
},

// Sorting
getCpuUsageHeader() {
return testSubjects.find('tableHeaderCell_cpu_3');
getMemoryHeader() {
return testSubjects.find('tableHeaderCell_memory_5');
},

getTitleHeader() {
return testSubjects.find('tableHeaderCell_title_2');
},

async sortByCpuUsage() {
const diskLatency = await this.getCpuUsageHeader();
const button = await testSubjects.findDescendant('tableHeaderSortButton', diskLatency);
async sortByMemoryUsage() {
const memory = await this.getMemoryHeader();
const button = await testSubjects.findDescendant('tableHeaderSortButton', memory);
await button.click();
},

Expand Down
Loading