Skip to content

Commit

Permalink
Fix App status flaky test (#72853)
Browse files Browse the repository at this point in the history
* wait for link to be updated

* await, please!

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
mshustov and elasticmachine committed Jul 28, 2020
1 parent 6187fa6 commit d4f5588
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
CoreStart,
AppMountParameters,
} from 'kibana/public';
import { renderApp } from './application';
import './types';

export class CoreAppStatusPlugin implements Plugin<{}, CoreAppStatusPluginStart> {
Expand All @@ -36,7 +37,6 @@ export class CoreAppStatusPlugin implements Plugin<{}, CoreAppStatusPluginStart>
id: 'app_status_start',
title: 'App Status Start Page',
async mount(params: AppMountParameters) {
const { renderApp } = await import('./application');
return renderApp('app_status_start', params);
},
});
Expand All @@ -47,7 +47,6 @@ export class CoreAppStatusPlugin implements Plugin<{}, CoreAppStatusPluginStart>
euiIconType: 'snowflake',
updater$: this.appUpdater,
async mount(params: AppMountParameters) {
const { renderApp } = await import('./application');
return renderApp('app_status', params);
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
const PageObjects = getPageObjects(['common']);
const browser = getService('browser');
const appsMenu = getService('appsMenu');
const retry = getService('retry');
const testSubjects = getService('testSubjects');

const setAppStatus = async (s: Partial<AppUpdatableFields>) => {
Expand All @@ -50,15 +51,14 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
}, s);
};

const navigateToApp = async (i: string) => {
const navigateToApp = async (id: string) => {
return await browser.executeAsync(async (appId, cb) => {
await window.__coreAppStatus.navigateToApp(appId);
cb();
}, i);
}, id);
};

// FLAKY: https://github.com/elastic/kibana/issues/65423
describe.skip('application status management', () => {
describe('application status management', () => {
beforeEach(async () => {
await PageObjects.common.navigateToApp('app_status_start');
});
Expand Down Expand Up @@ -101,15 +101,17 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
});

it('allows to change the defaultPath of an application', async () => {
let link = await appsMenu.getLink('App Status');
const link = await appsMenu.getLink('App Status');
expect(link!.href).to.eql(getKibanaUrl('/app/app_status'));

await setAppStatus({
defaultPath: '/arbitrary/path',
});

link = await appsMenu.getLink('App Status');
expect(link!.href).to.eql(getKibanaUrl('/app/app_status/arbitrary/path'));
await retry.waitFor('link url updated with "defaultPath"', async () => {
const updatedLink = await appsMenu.getLink('App Status');
return updatedLink?.href === getKibanaUrl('/app/app_status/arbitrary/path');
});

await navigateToApp('app_status');
expect(await testSubjects.exists('appStatusApp')).to.eql(true);
Expand Down

0 comments on commit d4f5588

Please sign in to comment.