mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
tests: Wait for pad init before returning from helper.aNewPad()
This should make it easier to avoid race conditions.
This commit is contained in:
parent
4d2839457a
commit
653dbb3449
1 changed files with 3 additions and 1 deletions
|
@ -132,9 +132,11 @@ const helper = {};
|
|||
if (opts.padPrefs) {
|
||||
helper.setPadPrefCookie(opts.padPrefs);
|
||||
}
|
||||
const $loading = helper.padChrome$('#editorloadingbox');
|
||||
const $container = helper.padChrome$('#editorcontainer');
|
||||
try {
|
||||
await helper.waitForPromise(
|
||||
() => !$iframe.contents().find('#editorloadingbox').is(':visible'), 10000);
|
||||
() => !$loading.is(':visible') && $container.hasClass('initialized'), 10000);
|
||||
} catch (err) {
|
||||
if (opts._retry++ >= 4) throw new Error('Pad never loaded');
|
||||
return await helper.aNewPad(opts);
|
||||
|
|
Loading…
Reference in a new issue