import expect from '@kbn/expect' ; import { FtrProviderContext } from '../../ftr_provider_context' ; export default ( { getPageObjects , getService } ) => { const testSubjects = getService ( 'testSubjects' ) ; const pageObjects = getPageObjects ( [ 'common' , 'indexManagement' , 'header' ] ) ; const log = getService ( 'log' ) ; const browser = getService ( 'browser' ) ; const retry = getService ( 'retry' ) ; const security = getService ( 'security' ) ; describe ( 'Home page' , function ( ) { before ( async ( ) => { await security . testUser . setRoles ( [ 'index_management_user' ] ) ; await pageObjects . common . navigateToApp ( 'indexManagement' ) ; } ) ; it ( 'Loads the app and renders the indices tab by default' , async ( ) => { await log . debug ( 'Checking for section heading to say Index Management.' ) ; const headingText = await pageObjects . indexManagement . sectionHeadingText ( ) ; expect ( headingText ) . to . be ( 'Index Management' ) ; const url = await browser . getCurrentUrl ( ) ; expect ( url ) . to . contain ( `/indices` ) ; const indicesList = await testSubjects . exists ( 'indicesList' ) ; expect ( indicesList ) . to . be ( true ) ; const reloadIndicesButton = await pageObjects . indexManagement . reloadIndicesButton ( ) ; expect ( await reloadIndicesButton . isDisplayed ( ) ) . to . be ( true ) ; } ) ; describe ( 'Data streams' , ( ) => { it ( 'renders the data streams tab' , async ( ) => { await pageObjects . indexManagement . changeTabs ( 'data_streamsTab' ) ; await pageObjects . header . waitUntilLoadingHasFinished ( ) ; const url = await browser . getCurrentUrl ( ) ; expect ( url ) . to . contain ( `/data_streams` ) ; await retry . waitFor ( 'Wait until dataStream Table is visible.' , async ( ) => { return await testSubjects . isDisplayed ( 'dataStreamTable' ) ; } ) ; } ) ; } ) ; describe ( 'Index templates' , ( ) => { it ( 'renders the index templates tab' , async ( ) => { await pageObjects . indexManagement . changeTabs ( 'templatesTab' ) ; await pageObjects . header . waitUntilLoadingHasFinished ( ) ; const url = await browser . getCurrentUrl ( ) ; expect ( url ) . to . contain ( `/templates` ) ; const templateList = await testSubjects . exists ( 'templateList' ) ; expect ( templateList ) . to . be ( true ) ; } ) ; } ) ; describe ( 'Component templates' , ( ) => { it ( 'renders the component templates tab' , async ( ) => { await pageObjects . indexManagement . changeTabs ( 'component_templatesTab' ) ; await pageObjects . header . waitUntilLoadingHasFinished ( ) ; const url = await browser . getCurrentUrl ( ) ; expect ( url ) . to . contain ( `/component_templates` ) ; const componentTemplateList = await testSubjects . exists ( 'componentTemplateList' ) ; expect ( componentTemplateList ) . to . be ( true ) ; } ) ; } ) ; } ) ; } ;