Fixing flaky CI tests for custom appRoutes (#55763)

This commit is contained in:
Eli Perelman 2020-02-07 01:43:27 -06:00 committed by GitHub
parent c001014f78
commit 5c3de3e16d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -62,8 +62,12 @@ export default function({ getService, getPageObjects }: PluginFunctionalProvider
return JSON.parse(document.querySelector('kbn-injected-metadata')!.getAttribute('data')!)
.legacyMetadata.uiSettings.user;
});
const exists = (selector: string) => testSubjects.exists(selector, { timeout: 2000 });
const exists = (selector: string) => testSubjects.exists(selector, { timeout: 5000 });
const findLoadingMessage = () => testSubjects.find('kbnLoadingMessage', 5000);
const getRenderingSession = () =>
browser.execute(() => {
return window.__RENDERING_SESSION__;
});
describe('rendering service', () => {
it('renders "core" application', async () => {
@ -136,8 +140,7 @@ export default function({ getService, getPageObjects }: PluginFunctionalProvider
expect(await exists('renderingHeader')).to.be(false);
});
// Flaky: https://github.com/elastic/kibana/issues/55750
it.skip('navigates between standard application and one with custom appRoute', async () => {
it('navigates between standard application and one with custom appRoute', async () => {
await navigateTo('/');
await find.waitForElementStale(await findLoadingMessage());
@ -153,15 +156,14 @@ export default function({ getService, getPageObjects }: PluginFunctionalProvider
expect(await exists('appStatusApp')).to.be(true);
expect(await exists('renderingHeader')).to.be(false);
expect(
await browser.execute(() => {
return window.__RENDERING_SESSION__;
})
).to.eql(['/app/app_status', '/render/core', '/app/app_status']);
expect(await getRenderingSession()).to.eql([
'/app/app_status',
'/render/core',
'/app/app_status',
]);
});
// Flaky: https://github.com/elastic/kibana/issues/55736
it.skip('navigates between applications with custom appRoutes', async () => {
it('navigates between applications with custom appRoutes', async () => {
await navigateTo('/');
await find.waitForElementStale(await findLoadingMessage());
@ -170,18 +172,18 @@ export default function({ getService, getPageObjects }: PluginFunctionalProvider
expect(await exists('customAppRouteHeader')).to.be(false);
await navigateToApp('Custom App Route');
expect(await exists('renderingHeader')).to.be(false);
expect(await exists('customAppRouteHeader')).to.be(true);
expect(await exists('renderingHeader')).to.be(false);
await navigateToApp('Rendering');
expect(await exists('renderingHeader')).to.be(true);
expect(await exists('customAppRouteHeader')).to.be(false);
expect(
await browser.execute(() => {
return window.__RENDERING_SESSION__;
})
).to.eql(['/render/core', '/custom/appRoute', '/render/core']);
expect(await getRenderingSession()).to.eql([
'/render/core',
'/custom/appRoute',
'/render/core',
]);
});
});
}