mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
Merge "Run all screenshots in a single test"
This commit is contained in:
commit
e455654fa5
|
@ -39,7 +39,7 @@ module.exports = {
|
|||
citoidInspectorManual: function () {
|
||||
var done = arguments[ arguments.length - 1 ],
|
||||
surface = ve.init.target.surface;
|
||||
ve.init.target.surface.context.inspectors.currentWindow.setModePanel( 'manual' );
|
||||
surface.context.inspectors.currentWindow.setModePanel( 'manual' );
|
||||
setTimeout( function () {
|
||||
done(
|
||||
seleniumUtils.getBoundingRect( [
|
||||
|
@ -52,7 +52,7 @@ module.exports = {
|
|||
citoidInspectorReuse: function () {
|
||||
var done = arguments[ arguments.length - 1 ],
|
||||
surface = ve.init.target.surface;
|
||||
ve.init.target.surface.context.inspectors.currentWindow.setModePanel( 'reuse' );
|
||||
surface.context.inspectors.currentWindow.setModePanel( 'reuse' );
|
||||
setTimeout( function () {
|
||||
done(
|
||||
seleniumUtils.getBoundingRect( [
|
||||
|
@ -62,6 +62,11 @@ module.exports = {
|
|||
);
|
||||
} );
|
||||
},
|
||||
citoidInspectorTeardown: function () {
|
||||
var done = arguments[ arguments.length - 1 ],
|
||||
surface = ve.init.target.surface;
|
||||
surface.context.inspectors.currentWindow.close().closed.then( done );
|
||||
},
|
||||
toolbarHeadings: function () {
|
||||
seleniumUtils.runMenuTask( arguments[ arguments.length - 1 ], ve.init.target.toolbar.tools.paragraph );
|
||||
},
|
||||
|
@ -100,6 +105,11 @@ module.exports = {
|
|||
toolbarCategory: function () {
|
||||
seleniumUtils.runMenuTask( arguments[ arguments.length - 1 ], ve.init.target.actionsToolbar.tools.categories, false, true );
|
||||
},
|
||||
toolbarTeardown: function () {
|
||||
var done = arguments[ arguments.length - 1 ];
|
||||
seleniumUtils.collapseToolbar();
|
||||
done();
|
||||
},
|
||||
save: function () {
|
||||
var done = arguments[ arguments.length - 1 ],
|
||||
surface = ve.init.target.surface;
|
||||
|
@ -117,6 +127,11 @@ module.exports = {
|
|||
} );
|
||||
ve.init.target.toolbarSaveButton.onSelect();
|
||||
},
|
||||
saveTeardown: function () {
|
||||
var done = arguments[ arguments.length - 1 ],
|
||||
surface = ve.init.target.surface;
|
||||
surface.dialogs.currentWindow.close().closed.then( done );
|
||||
},
|
||||
specialCharacters: function () {
|
||||
var done = arguments[ arguments.length - 1 ],
|
||||
surface = ve.init.target.surface;
|
||||
|
@ -135,6 +150,11 @@ module.exports = {
|
|||
} );
|
||||
ve.init.target.toolbar.tools.specialCharacter.onSelect();
|
||||
},
|
||||
specialCharactersTeardown: function () {
|
||||
var done = arguments[ arguments.length - 1 ],
|
||||
surface = ve.init.target.surface;
|
||||
surface.getToolbarDialogs().currentWindow.close().closed.then( done );
|
||||
},
|
||||
formula: function () {
|
||||
var done = arguments[ arguments.length - 1 ],
|
||||
surface = ve.init.target.surface;
|
||||
|
@ -155,6 +175,11 @@ module.exports = {
|
|||
} );
|
||||
surface.executeCommand( 'mathDialog' );
|
||||
},
|
||||
formulaTeardown: function () {
|
||||
var done = arguments[ arguments.length - 1 ],
|
||||
surface = ve.init.target.surface;
|
||||
surface.dialogs.currentWindow.close().closed.then( done );
|
||||
},
|
||||
referenceList: function () {
|
||||
var done = arguments[ arguments.length - 1 ],
|
||||
surface = ve.init.target.surface;
|
||||
|
@ -174,6 +199,15 @@ module.exports = {
|
|||
// The first command inserts a reference list instantly, so run again to open the window
|
||||
surface.executeCommand( 'referencesList' );
|
||||
},
|
||||
referenceListTeardown: function () {
|
||||
var done = arguments[ arguments.length - 1 ],
|
||||
surface = ve.init.target.surface;
|
||||
surface.dialogs.currentWindow.close().closed.then( function () {
|
||||
// Remove the reference list
|
||||
surface.getModel().undo();
|
||||
done();
|
||||
} );
|
||||
},
|
||||
toolbarCite: function () {
|
||||
var done = arguments[ arguments.length - 1 ];
|
||||
|
||||
|
@ -187,6 +221,11 @@ module.exports = {
|
|||
);
|
||||
}, 100 );
|
||||
},
|
||||
toolbarCiteTeardown: function () {
|
||||
var done = arguments[ arguments.length - 1 ];
|
||||
ve.init.target.toolbar.tools.citoid.$element.css( 'font-size', '' );
|
||||
done();
|
||||
},
|
||||
linkSearchResults: function () {
|
||||
var done = arguments[ arguments.length - 1 ],
|
||||
surface = ve.init.target.surface;
|
||||
|
@ -213,5 +252,15 @@ module.exports = {
|
|||
} );
|
||||
} );
|
||||
ve.init.target.surface.executeCommand( 'link' );
|
||||
},
|
||||
linkSearchResultsTeardown: function () {
|
||||
var done = arguments[ arguments.length - 1 ],
|
||||
surface = ve.init.target.surface;
|
||||
|
||||
surface.context.inspectors.currentWindow.close().closed.then( function () {
|
||||
// Remove content
|
||||
surface.getModel().undo();
|
||||
done();
|
||||
} );
|
||||
}
|
||||
};
|
||||
|
|
|
@ -79,7 +79,7 @@ function createScreenshotEnvironment( test ) {
|
|||
} );
|
||||
}
|
||||
|
||||
function runScreenshotTest( lang, name, clientScript, padding ) {
|
||||
function runScreenshotTest( lang, name, clientScript, padding, teardownScript ) {
|
||||
if ( !clientSize ) {
|
||||
// Setup failed, don't generated a broken screenshot
|
||||
return;
|
||||
|
@ -97,6 +97,10 @@ function createScreenshotEnvironment( test ) {
|
|||
} else {
|
||||
fs.writeFile( filename, base64Image, 'base64' );
|
||||
}
|
||||
} ).then( function () {
|
||||
if ( teardownScript ) {
|
||||
return driver.executeAsyncScript( teardownScript );
|
||||
}
|
||||
} );
|
||||
}, function ( e ) {
|
||||
// Log error (timeout)
|
||||
|
|
|
@ -11,16 +11,18 @@ function runTests( lang ) {
|
|||
|
||||
test.describe( 'Screenshots: ' + lang, function () {
|
||||
this.lang = lang;
|
||||
test.it( 'Toolbar & action tools', function () {
|
||||
test.it( 'Screenshots', function () {
|
||||
|
||||
// Toolbar & action tools
|
||||
runLang( 'VisualEditor_toolbar', userGuide.toolbar, 0 );
|
||||
runLang( 'VisualEditor_toolbar_actions', userGuide.toolbarActions, 0 );
|
||||
} );
|
||||
test.it( 'Citoid inspector', function () {
|
||||
|
||||
// Citoid inspector
|
||||
runLang( 'VisualEditor_Citoid_Inspector', userGuide.citoidInspector );
|
||||
runLang( 'VisualEditor_Citoid_Inspector_Manual', userGuide.citoidInspectorManual );
|
||||
runLang( 'VisualEditor_Citoid_Inspector_Reuse', userGuide.citoidInspectorReuse );
|
||||
} );
|
||||
test.it( 'Tool groups (headings/text style/indentation/insert/page settings)', function () {
|
||||
runLang( 'VisualEditor_Citoid_Inspector_Reuse', userGuide.citoidInspectorReuse, undefined, userGuide.citoidInspectorTeardown );
|
||||
|
||||
// Tool groups (headings/text style/indentation/insert/page settings)
|
||||
runLang( 'VisualEditor_Toolbar_Headings', userGuide.toolbarHeadings );
|
||||
runLang( 'VisualEditor_Toolbar_Formatting', userGuide.toolbarFormatting );
|
||||
runLang( 'VisualEditor_Toolbar_Lists_and_indentation', userGuide.toolbarLists );
|
||||
|
@ -32,25 +34,25 @@ function runTests( lang ) {
|
|||
runLang( 'VisualEditor_References_List_Insert_Menu', userGuide.toolbarReferences );
|
||||
runLang( 'VisualEditor_More_Settings', userGuide.toolbarSettings );
|
||||
runLang( 'VisualEditor_page_settings_item', userGuide.toolbarPageSettings );
|
||||
runLang( 'VisualEditor_category_item', userGuide.toolbarCategory );
|
||||
} );
|
||||
test.it( 'Save dialog', function () {
|
||||
runLang( 'VisualEditor_save_dialog', userGuide.save );
|
||||
} );
|
||||
test.it( 'Special character inserter', function () {
|
||||
runLang( 'VisualEditor_Toolbar_SpecialCharacters', userGuide.specialCharacters );
|
||||
} );
|
||||
test.it( 'Math dialog', function () {
|
||||
runLang( 'VisualEditor_formula', userGuide.formula );
|
||||
} );
|
||||
test.it( 'Reference list dialog', function () {
|
||||
runLang( 'VisualEditor_references_list', userGuide.referenceList );
|
||||
} );
|
||||
test.it( 'Cite button', function () {
|
||||
runLang( 'VisualEditor_citoid_Cite_button', userGuide.toolbarCite, 0 );
|
||||
} );
|
||||
test.it( 'Link inspector', function () {
|
||||
runLang( 'VisualEditor-link_tool-search_results', userGuide.linkSearchResults );
|
||||
runLang( 'VisualEditor_category_item', userGuide.toolbarCategory, undefined, userGuide.toolbarTeardown );
|
||||
|
||||
// Save dialog
|
||||
runLang( 'VisualEditor_save_dialog', userGuide.save, undefined, userGuide.saveTeardown );
|
||||
|
||||
// Special character inserter
|
||||
runLang( 'VisualEditor_Toolbar_SpecialCharacters', userGuide.specialCharacters, undefined, userGuide.specialCharactersTeardown );
|
||||
|
||||
// Math dialog
|
||||
runLang( 'VisualEditor_formula', userGuide.formula, undefined, userGuide.formulaTeardown );
|
||||
|
||||
// Reference list dialog
|
||||
runLang( 'VisualEditor_references_list', userGuide.referenceList, undefined, userGuide.referenceListTeardown );
|
||||
|
||||
// Cite button
|
||||
runLang( 'VisualEditor_citoid_Cite_button', userGuide.toolbarCite, undefined, userGuide.toolbarCiteTeardown );
|
||||
|
||||
// Link inspector
|
||||
runLang( 'VisualEditor-link_tool-search_results', userGuide.linkSearchResults, undefined, userGuide.linkSearchResultsTeardown );
|
||||
} );
|
||||
} );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue