import expect from '@kbn/expect' ; import path from 'path' ; import { FtrProviderContext } from '../../../ftr_provider_context' ; export default function ( { getService , getPageObjects } ) { const esArchiver = getService ( 'esArchiver' ) ; const kibanaServer = getService ( 'kibanaServer' ) ; const testSubjects = getService ( 'testSubjects' ) ; const dashboardPanelActions = getService ( 'dashboardPanelActions' ) ; const PageObjects = getPageObjects ( [ 'common' , 'settings' , 'header' , 'savedObjects' , 'dashboard' ] ) ; describe ( 'Export import saved objects between versions' , ( ) => { before ( async ( ) => { await esArchiver . loadIfNeeded ( 'x-pack/test/functional/es_archives/getting_started/shakespeare' ) ; await kibanaServer . uiSettings . replace ( { } ) ; await PageObjects . settings . navigateTo ( ) ; await PageObjects . settings . clickKibanaSavedObjects ( ) ; await PageObjects . savedObjects . importFile ( path . join ( __dirname , 'exports' , 'visualize_dashboard_migration_test_7_12_1.ndjson' ) ) ; } ) ; after ( async ( ) => { await esArchiver . unload ( 'x-pack/test/functional/es_archives/getting_started/shakespeare' ) ; await esArchiver . load ( 'x-pack/test/functional/es_archives/empty_kibana' ) ; } ) ; it ( 'should be able to import dashboard with various Visualize panels from 7.12.1' , async ( ) => { await PageObjects . savedObjects . checkImportSucceeded ( ) ; await PageObjects . savedObjects . clickImportDone ( ) ; } ) ; it ( 'should render all panels on the dashboard' , async ( ) => { await PageObjects . common . navigateToApp ( 'dashboard' ) ; await PageObjects . dashboard . loadSavedDashboard ( '[7.12.1] Visualize Test Dashboard' ) ; await PageObjects . dashboard . expectOnDashboard ( '[7.12.1] Visualize Test Dashboard' ) ; await PageObjects . dashboard . waitForRenderComplete ( ) ; const errorEmbeddables = await testSubjects . findAll ( 'embeddableStackError' ) ; expect ( errorEmbeddables . length ) . to . be ( 0 ) ; } ) ; it ( 'should show the edit action for all panels' , async ( ) => { await PageObjects . dashboard . switchToEditMode ( ) ; const panelTitles = await PageObjects . dashboard . getPanelTitles ( ) ; for ( const title of panelTitles ) { await dashboardPanelActions . expectExistsEditPanelAction ( title ) ; } } ) ; it ( 'should retain all panel drilldowns from 7.12.1' , async ( ) => { const totalPanels = await PageObjects . dashboard . getPanelCount ( ) ; let panelsWithDrilldowns = 0 ; for ( let panelIndex = 0 ; panelIndex < totalPanels ; panelIndex ++ ) { if ( ( await PageObjects . dashboard . getPanelDrilldownCount ( panelIndex ) ) === 1 ) { panelsWithDrilldowns ++ ; } } expect ( panelsWithDrilldowns ) . to . be ( 2 ) ; } ) ; } ) ; }