1717 * under the License.
1818 */
1919
20+ import url from 'url' ;
2021import expect from '@kbn/expect' ;
2122import {
2223 AppNavLinkStatus ,
@@ -26,6 +27,15 @@ import {
2627import { PluginFunctionalProviderContext } from '../../services' ;
2728import '../../plugins/core_app_status/public/types' ;
2829
30+ const getKibanaUrl = ( pathname ?: string , search ?: string ) =>
31+ url . format ( {
32+ protocol : 'http:' ,
33+ hostname : process . env . TEST_KIBANA_HOST || 'localhost' ,
34+ port : process . env . TEST_KIBANA_PORT || '5620' ,
35+ pathname,
36+ search,
37+ } ) ;
38+
2939// eslint-disable-next-line import/no-default-export
3040export default function ( { getService, getPageObjects } : PluginFunctionalProviderContext ) {
3141 const PageObjects = getPageObjects ( [ 'common' ] ) ;
@@ -97,6 +107,22 @@ export default function({ getService, getPageObjects }: PluginFunctionalProvider
97107 expect ( await testSubjects . exists ( 'appStatusApp' ) ) . to . eql ( true ) ;
98108 } ) ;
99109
110+ it ( 'allows to change the defaultPath of an application' , async ( ) => {
111+ let link = await appsMenu . getLink ( 'App Status' ) ;
112+ expect ( link ! . href ) . to . eql ( getKibanaUrl ( '/app/app_status' ) ) ;
113+
114+ await setAppStatus ( {
115+ defaultPath : '/arbitrary/path' ,
116+ } ) ;
117+
118+ link = await appsMenu . getLink ( 'App Status' ) ;
119+ expect ( link ! . href ) . to . eql ( getKibanaUrl ( '/app/app_status/arbitrary/path' ) ) ;
120+
121+ await navigateToApp ( 'app_status' ) ;
122+ expect ( await testSubjects . exists ( 'appStatusApp' ) ) . to . eql ( true ) ;
123+ expect ( await browser . getCurrentUrl ( ) ) . to . eql ( getKibanaUrl ( '/app/app_status/arbitrary/path' ) ) ;
124+ } ) ;
125+
100126 it ( 'can change the state of the currently mounted app' , async ( ) => {
101127 await setAppStatus ( {
102128 status : AppStatus . accessible ,
0 commit comments