tests: frontend helper for admin UI tests

admin-tests
John McLear 2021-02-06 20:13:55 +00:00
parent c639e743d7
commit b79c347196
1 changed files with 17 additions and 0 deletions

View File

@ -1,4 +1,5 @@
'use strict'; 'use strict';
const helper = {}; // eslint-disable-line no-redeclare const helper = {}; // eslint-disable-line no-redeclare
(function () { (function () {
@ -180,6 +181,22 @@ const helper = {}; // eslint-disable-line no-redeclare
return padName; return padName;
}; };
helper.newAdmin = async function (page) {
// define the iframe
$iframe = $(`<iframe src='/admin/${page}'></iframe>`);
// clean up inner iframe references
helper.admin$ = null;
// remove old iframe
$('#iframe-container iframe').remove();
// set new iframe
$('#iframe-container').append($iframe);
$iframe.one('load', () => {
helper.admin$ = getFrameJQuery($('#iframe-container iframe'));
});
};
helper.waitFor = function (conditionFunc, timeoutTime = 1900, intervalTime = 10) { helper.waitFor = function (conditionFunc, timeoutTime = 1900, intervalTime = 10) {
const deferred = new $.Deferred(); const deferred = new $.Deferred();