Skip to content

Commit

Permalink
issue 57946 fix flaky endpoint policy list test
Browse files Browse the repository at this point in the history
  • Loading branch information
charlie-pichette committed Feb 24, 2020
1 parent 345bf1f commit 43e9f34
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 3 additions & 2 deletions x-pack/test/functional/apps/endpoint/policy_list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
const testSubjects = getService('testSubjects');

// FLAKY: https://github.com/elastic/kibana/issues/57946
describe.skip('Endpoint Policy List', function() {
describe('Endpoint Policy List', function() {
this.tags(['ciGroup7']);
before(async () => {
await pageObjects.common.navigateToUrlWithBrowserHistory('endpoint', '/policy');
await pageObjects.endpoint.waitForTableToHaveData('policyTable');
});

it('loads the Policy List Page', async () => {
Expand All @@ -26,7 +27,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
});
it('shows policy count total', async () => {
const policyTotal = await testSubjects.getVisibleText('policyTotalCount');
expect(policyTotal).to.equal('0 Policies');
expect(policyTotal).to.equal('100 Policies');
});
it('includes policy list table', async () => {
await testSubjects.existOrFail('policyTable');
Expand Down
9 changes: 9 additions & 0 deletions x-pack/test/functional/page_objects/endpoint_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { FtrProviderContext } from '../ftr_provider_context';

export function EndpointPageProvider({ getService }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
const retry = getService('retry');

return {
/**
Expand Down Expand Up @@ -58,5 +59,13 @@ export function EndpointPageProvider({ getService }: FtrProviderContext) {
)
);
},

async waitForTableToHaveData(dataTestSubj: string) {
await retry.waitForWithTimeout('table to have data', 2000, async () => {
const tableData = await this.getEndpointAppTableData(dataTestSubj);
if (tableData[1][0] === 'No items found') return false;
return true;
});
},
};
}

0 comments on commit 43e9f34

Please sign in to comment.