import expect from '@kbn/expect' ; import { FtrProviderContext } from '../../ftr_provider_context' ; export function MachineLearningOverviewPageProvider ( { getService } ) { const testSubjects = getService ( 'testSubjects' ) ; return { async assertADCreateJobButtonExists ( ) { await testSubjects . existOrFail ( 'mlOverviewCreateADJobButton' ) ; } , async assertADCreateJobButtonEnabled ( expectedValue ) { const isEnabled = await testSubjects . isEnabled ( 'mlOverviewCreateADJobButton' ) ; expect ( isEnabled ) . to . eql ( expectedValue , `Expected AD "Create job" button to be '${ expectedValue ? 'enabled' : 'disabled' }' (got '${ isEnabled ? 'enabled' : 'disabled' }')` ) ; } , async assertDFACreateJobButtonExists ( ) { await testSubjects . existOrFail ( 'mlOverviewCreateDFAJobButton' ) ; } , async assertDFACreateJobButtonEnabled ( expectedValue ) { const isEnabled = await testSubjects . isEnabled ( 'mlOverviewCreateDFAJobButton' ) ; expect ( isEnabled ) . to . eql ( expectedValue , `Expected AD "Create job" button to be '${ expectedValue ? 'enabled' : 'disabled' }' (got '${ isEnabled ? 'enabled' : 'disabled' }')` ) ; } , async assertJobSyncRequiredWarningExists ( ) { await testSubjects . existOrFail ( 'mlJobSyncRequiredWarning' , { timeout : 5000 } ) ; } , async assertJobSyncRequiredWarningNotExists ( ) { await testSubjects . missingOrFail ( 'mlJobSyncRequiredWarning' , { timeout : 5000 } ) ; } , } ; }