import expect from '@kbn/expect' ; import { FtrProviderContext } from '../../ftr_provider_context' ; export default function canvasExpressionTest ( { getService , getPageObjects } ) { const testSubjects = getService ( 'testSubjects' ) ; const retry = getService ( 'retry' ) ; const PageObjects = getPageObjects ( [ 'canvas' , 'common' ] ) ; const find = getService ( 'find' ) ; const kibanaServer = getService ( 'kibanaServer' ) ; const archive = 'x-pack/test/functional/fixtures/kbn_archiver/canvas/default' ; describe . skip ( 'expression editor' , function ( ) { this . tags ( 'skipFirefox' ) ; before ( async ( ) => { await kibanaServer . importExport . load ( archive ) ; await PageObjects . common . navigateToApp ( 'canvas' , { hash : '/workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31/page/1' , } ) ; } ) ; after ( async ( ) => { await kibanaServer . importExport . unload ( archive ) ; } ) ; it ( 'updates when element is changed via side bar' , async ( ) => { await retry . try ( async ( ) => { const elements = await testSubjects . findAll ( 'canvasWorkpadPage > canvasWorkpadPageElementContent' ) ; expect ( elements ) . to . have . length ( 4 ) ; } ) ; await testSubjects . click ( 'canvasWorkpadPage > canvasWorkpadPageElementContent' , 20000 ) ; await PageObjects . canvas . openExpressionEditor ( ) ; const mdBox = await find . byCssSelector ( '.canvasSidebar__panel .canvasTextArea__code' ) ; const oldMd = await mdBox . getVisibleText ( ) ; await mdBox . clearValueWithKeyboard ( ) ; const newMd = `${ oldMd } and this is a test` ; await mdBox . type ( newMd ) ; await find . clickByCssSelector ( '.canvasArg--controls .euiButton' ) ; const editor = await find . byCssSelector ( '.monaco-editor .view-lines' ) ; const editorText = await editor . getVisibleText ( ) ; expect ( editorText ) . to . contain ( 'Orange: Timelion, Server function and this is a test' ) ; await mdBox . clearValueWithKeyboard ( ) ; await mdBox . type ( oldMd ) ; await find . clickByCssSelector ( '.canvasArg--controls .euiButton' ) ; } ) ; } ) ; }