-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[application_deep_links] Unify / improve navigation between apps #170228
Merged
gsoldevila
merged 1 commit into
elastic:main
from
gsoldevila:kbn-166893-unify-app-link-navigation
Nov 2, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,20 +8,24 @@ | |
|
||
import url from 'url'; | ||
import expect from '@kbn/expect'; | ||
import { PluginFunctionalProviderContext } from '../../services'; | ||
import type { PluginFunctionalProviderContext } from '../../services'; | ||
|
||
export default function ({ getService, getPageObjects }: PluginFunctionalProviderContext) { | ||
const PageObjects = getPageObjects(['common']); | ||
|
||
const browser = getService('browser'); | ||
const appsMenu = getService('appsMenu'); | ||
const testSubjects = getService('testSubjects'); | ||
const retry = getService('retry'); | ||
const esArchiver = getService('esArchiver'); | ||
const log = getService('log'); | ||
|
||
const loadingScreenNotShown = async () => | ||
expect(await testSubjects.exists('kbnLoadingMessage')).to.be(false); | ||
const clickAppLink = async (app: string) => { | ||
const appLink = `dlNav${app}`; | ||
if (!(await testSubjects.exists(appLink))) { | ||
log.debug(`App ${app} not found on side nav`); | ||
} | ||
await testSubjects.click(appLink); | ||
}; | ||
|
||
const getKibanaUrl = (pathname?: string, search?: string) => | ||
url.format({ | ||
|
@@ -42,65 +46,64 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide | |
}); | ||
}; | ||
|
||
const navigateToAppLinks = async (subject: string) => { | ||
if (!(await testSubjects.exists(subject))) { | ||
log.debug(`side nav in app not in DOM`); | ||
} | ||
await testSubjects.click(subject); | ||
const loadingScreenNotShown = async () => | ||
expect(await testSubjects.exists('kbnLoadingMessage')).to.be(false); | ||
|
||
const checkAppVisible = async (app: string) => { | ||
const appContainer = `dlApp${app}`; | ||
await testSubjects.existOrFail(appContainer); | ||
}; | ||
|
||
// FLAKY: https://github.com/elastic/kibana/issues/166893 | ||
describe.skip('application deep links navigation', function describeDeepLinksTests() { | ||
describe('application deep links navigation', function describeDeepLinksTests() { | ||
before(async () => { | ||
await esArchiver.emptyKibanaIndex(); | ||
await PageObjects.common.navigateToApp('dl'); | ||
}); | ||
|
||
it('should start on home page', async () => { | ||
await testSubjects.existOrFail('dlAppHome'); | ||
await checkAppVisible('Home'); | ||
}); | ||
|
||
it('should navigate to page A when navlink is clicked', async () => { | ||
await navigateToAppLinks('dlNavPageA'); | ||
await clickAppLink('PageA'); | ||
await waitForUrlToBe('/app/dl/page-a'); | ||
await loadingScreenNotShown(); | ||
await testSubjects.existOrFail('dlNavPageA'); | ||
await checkAppVisible('PageA'); | ||
}); | ||
|
||
it('should be able to use the back button to navigate back to previous deep link', async () => { | ||
await browser.goBack(); | ||
await waitForUrlToBe('/app/dl/home'); | ||
await loadingScreenNotShown(); | ||
await testSubjects.existOrFail('dlNavHome'); | ||
await checkAppVisible('Home'); | ||
}); | ||
|
||
it('should navigate to nested page B when navlink is clicked', async () => { | ||
await navigateToAppLinks('dlNavDeepPageB'); | ||
await clickAppLink('DeepPageB'); | ||
await waitForUrlToBe('/app/dl/page-b'); | ||
await loadingScreenNotShown(); | ||
await testSubjects.existOrFail('dlNavDeepPageB'); | ||
await checkAppVisible('PageB'); | ||
}); | ||
|
||
it('should navigate to Home when navlink is clicked inside the defined category group', async () => { | ||
await appsMenu.clickLink('DL Home', { category: 'securitySolution' }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the previous/old navigation logic that should have been removed. |
||
await navigateToAppLinks('dlAppHome'); | ||
await clickAppLink('Home'); | ||
await waitForUrlToBe('/app/dl/home'); | ||
await loadingScreenNotShown(); | ||
await testSubjects.existOrFail('dlAppHome'); | ||
await checkAppVisible('Home'); | ||
}); | ||
|
||
it('should navigate to nested page B using navigateToApp path', async () => { | ||
await testSubjects.click('dlNavDeepPageB'); | ||
await clickAppLink('DeepPageB'); | ||
await waitForUrlToBe('/app/dl/page-b'); | ||
await loadingScreenNotShown(); | ||
await testSubjects.existOrFail('dlNavDeepPageB'); | ||
await checkAppVisible('PageB'); | ||
}); | ||
|
||
it('should navigate to nested page A using navigateToApp deepLinkId', async () => { | ||
await testSubjects.click('dlNavDeepPageAById'); | ||
await clickAppLink('DeepPageAById'); | ||
await waitForUrlToBe('/app/dl/page-a'); | ||
await loadingScreenNotShown(); | ||
await testSubjects.existOrFail('dlNavPageA'); | ||
await checkAppVisible('PageA'); | ||
}); | ||
|
||
it('should not display hidden deep links', async () => { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super cool! I'd be great to have this in the helpers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is custom to the deep links apps (note the
dlNav
), but perhaps we can generalise it somehow.In fact, I have a few more improvements in the pipes for other tests in the
test_suites/core_plugins
. Stay tunned!