mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 03:12:42 +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) {
|
if (opts.padPrefs) {
|
||||||
helper.setPadPrefCookie(opts.padPrefs);
|
helper.setPadPrefCookie(opts.padPrefs);
|
||||||
}
|
}
|
||||||
|
const $loading = helper.padChrome$('#editorloadingbox');
|
||||||
|
const $container = helper.padChrome$('#editorcontainer');
|
||||||
try {
|
try {
|
||||||
await helper.waitForPromise(
|
await helper.waitForPromise(
|
||||||
() => !$iframe.contents().find('#editorloadingbox').is(':visible'), 10000);
|
() => !$loading.is(':visible') && $container.hasClass('initialized'), 10000);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (opts._retry++ >= 4) throw new Error('Pad never loaded');
|
if (opts._retry++ >= 4) throw new Error('Pad never loaded');
|
||||||
return await helper.aNewPad(opts);
|
return await helper.aNewPad(opts);
|
||||||
|
|
Loading…
Reference in a new issue