mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Fix failing applications navigation test (#168302)
fix [#166677 ](https://github.com/elastic/kibana/issues/166677) - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
79e9f50dbc
commit
ac80b2af63
1 changed files with 23 additions and 7 deletions
|
@ -11,8 +11,7 @@ import expect from '@kbn/expect';
|
|||
import { PluginFunctionalProviderContext } from '../../services';
|
||||
|
||||
export default function ({ getService, getPageObjects }: PluginFunctionalProviderContext) {
|
||||
const PageObjects = getPageObjects(['common']);
|
||||
|
||||
const PageObjects = getPageObjects(['common', 'header']);
|
||||
const browser = getService('browser');
|
||||
const appsMenu = getService('appsMenu');
|
||||
const testSubjects = getService('testSubjects');
|
||||
|
@ -20,6 +19,11 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
|
|||
const retry = getService('retry');
|
||||
const deployment = getService('deployment');
|
||||
const esArchiver = getService('esArchiver');
|
||||
const log = getService('log');
|
||||
|
||||
function waitUntilLoadingIsDone() {
|
||||
return PageObjects.header.waitUntilLoadingHasFinished();
|
||||
}
|
||||
|
||||
const loadingScreenNotShown = async () =>
|
||||
expect(await testSubjects.exists('kbnLoadingMessage')).to.be(false);
|
||||
|
@ -38,19 +42,28 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
|
|||
search,
|
||||
});
|
||||
|
||||
async function navigateToAppFromAppsMenu(title: string) {
|
||||
await retry.try(async () => {
|
||||
await appsMenu.clickLink(title);
|
||||
await waitUntilLoadingIsDone();
|
||||
});
|
||||
}
|
||||
|
||||
/** Use retry logic to make URL assertions less flaky */
|
||||
const waitForUrlToBe = (pathname?: string, search?: string) => {
|
||||
const expectedUrl = getKibanaUrl(pathname, search);
|
||||
return retry.waitFor(`Url to be ${expectedUrl}`, async () => {
|
||||
return (await browser.getCurrentUrl()) === expectedUrl;
|
||||
const currentUrl = await browser.getCurrentUrl();
|
||||
if (currentUrl !== expectedUrl)
|
||||
log.debug(`expected url to be ${expectedUrl}, got ${currentUrl}`);
|
||||
return currentUrl === expectedUrl;
|
||||
});
|
||||
};
|
||||
|
||||
const navigateTo = async (path: string) =>
|
||||
await browser.navigateTo(`${deployment.getHostPort()}${path}`);
|
||||
|
||||
// Failing: See https://github.com/elastic/kibana/issues/166677
|
||||
describe.skip('ui applications', function describeIndexTests() {
|
||||
describe('ui applications', function describeIndexTests() {
|
||||
before(async () => {
|
||||
await esArchiver.emptyKibanaIndex();
|
||||
await PageObjects.common.navigateToApp('foo');
|
||||
|
@ -92,9 +105,12 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
|
|||
});
|
||||
|
||||
it('navigates to app root when navlink is clicked', async () => {
|
||||
await appsMenu.clickLink('Foo');
|
||||
await testSubjects.click('fooNavHome');
|
||||
|
||||
navigateToAppFromAppsMenu('Foo');
|
||||
|
||||
await waitForUrlToBe('/app/foo/home');
|
||||
// await loadingScreenNotShown();
|
||||
await loadingScreenNotShown();
|
||||
await testSubjects.existOrFail('fooAppHome');
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue