From 1871ac58ec3e4f9f1d1d02a2de2afdc569760072 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Thu, 25 Jun 2020 18:36:21 +0100 Subject: [PATCH] screenshots: Use windowManager promises for save and specialChars We already use these for other dialog tests Change-Id: I24a9a6e5fe2c4cf711b8bc67c8d9bfe23d23041a --- build/screenshots-client/userGuide.js | 46 +++++++++++++++++---------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/build/screenshots-client/userGuide.js b/build/screenshots-client/userGuide.js index 0b1bffb5a7..9d3fb3da36 100644 --- a/build/screenshots-client/userGuide.js +++ b/build/screenshots-client/userGuide.js @@ -101,27 +101,39 @@ module.exports = { seleniumUtils.runMenuTask( arguments[ arguments.length - 1 ], ve.init.target.actionsToolbar.tools.categories, false, true ); }, save: function () { - var done = arguments[ arguments.length - 1 ]; + var done = arguments[ arguments.length - 1 ], + surface = ve.init.target.surface; + + surface.dialogs.once( 'opening', function ( win, opening ) { + opening.then( function () { + setTimeout( function () { + done( + seleniumUtils.getBoundingRect( [ + ve.init.target.surface.dialogs.currentWindow.$frame[ 0 ] + ] ) + ); + }, 500 ); + } ); + } ); ve.init.target.toolbarSaveButton.onSelect(); - setTimeout( function () { - done( - seleniumUtils.getBoundingRect( [ - ve.init.target.surface.dialogs.currentWindow.$frame[ 0 ] - ] ) - ); - }, 500 ); }, specialCharacters: function () { - var done = arguments[ arguments.length - 1 ]; + var done = arguments[ arguments.length - 1 ], + surface = ve.init.target.surface; + + surface.getToolbarDialogs().once( 'opening', function ( win, opening ) { + opening.then( function () { + setTimeout( function () { + done( + seleniumUtils.getBoundingRect( [ + ve.init.target.toolbar.tools.specialCharacter.$element[ 0 ], + ve.init.target.surface.toolbarDialogs.$element[ 0 ] + ] ) + ); + }, 500 ); + } ); + } ); ve.init.target.toolbar.tools.specialCharacter.onSelect(); - setTimeout( function () { - done( - seleniumUtils.getBoundingRect( [ - ve.init.target.toolbar.tools.specialCharacter.$element[ 0 ], - ve.init.target.surface.toolbarDialogs.$element[ 0 ] - ] ) - ); - }, 1000 ); }, formula: function () { var done = arguments[ arguments.length - 1 ],