mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 14:13:34 +01:00
tests: Wait for commit rather than sleep
This commit is contained in:
parent
2776946627
commit
dd9c08d821
2 changed files with 11 additions and 19 deletions
|
@ -17,10 +17,9 @@ describe('author of pad edition', function () {
|
|||
$firstLine.html(threeLines);
|
||||
|
||||
// wait for lines to be processed by Etherpad
|
||||
await helper.waitForPromise(() => {
|
||||
const $lineWithUnorderedList = getLine(LINE_WITH_UNORDERED_LIST);
|
||||
return $lineWithUnorderedList.text() === 'line with unordered list';
|
||||
});
|
||||
await helper.waitForPromise(() => (
|
||||
getLine(LINE_WITH_UNORDERED_LIST).text() === 'line with unordered list' &&
|
||||
helper.commits.length === 1));
|
||||
|
||||
// create the unordered list
|
||||
const $lineWithUnorderedList = getLine(LINE_WITH_UNORDERED_LIST);
|
||||
|
@ -29,10 +28,9 @@ describe('author of pad edition', function () {
|
|||
const $insertUnorderedListButton = helper.padChrome$('.buttonicon-insertunorderedlist');
|
||||
$insertUnorderedListButton.click();
|
||||
|
||||
await helper.waitForPromise(() => {
|
||||
const $lineWithUnorderedList = getLine(LINE_WITH_UNORDERED_LIST);
|
||||
return $lineWithUnorderedList.find('ul li').length === 1;
|
||||
});
|
||||
await helper.waitForPromise(() => (
|
||||
getLine(LINE_WITH_UNORDERED_LIST).find('ul li').length === 1 &&
|
||||
helper.commits.length === 2));
|
||||
|
||||
// create the ordered list
|
||||
const $lineWithOrderedList = getLine(LINE_WITH_ORDERED_LIST);
|
||||
|
@ -41,13 +39,9 @@ describe('author of pad edition', function () {
|
|||
const $insertOrderedListButton = helper.padChrome$('.buttonicon-insertorderedlist');
|
||||
$insertOrderedListButton.click();
|
||||
|
||||
await helper.waitForPromise(() => {
|
||||
const $lineWithOrderedList = getLine(LINE_WITH_ORDERED_LIST);
|
||||
return $lineWithOrderedList.find('ol li').length === 1;
|
||||
});
|
||||
|
||||
// Need a timeout here to make sure all changes were saved.
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
await helper.waitForPromise(() => (
|
||||
getLine(LINE_WITH_ORDERED_LIST).find('ol li').length === 1 &&
|
||||
helper.commits.length === 3));
|
||||
|
||||
// Expire cookie, so author is changed after reloading the pad.
|
||||
const {Cookies} = helper.padChrome$.window.require('ep_etherpad-lite/static/js/pad_utils');
|
||||
|
|
|
@ -11,10 +11,8 @@ describe('author of pad edition', function () {
|
|||
$firstLine.html('Hello World');
|
||||
|
||||
// wait for lines to be processed by Etherpad
|
||||
await helper.waitForPromise(() => $firstLine.text() === 'Hello World');
|
||||
|
||||
// Need a timeout here to make sure all changes were saved.
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
await helper.waitForPromise(() => (
|
||||
$firstLine.text() === 'Hello World' && helper.commits.length === 1));
|
||||
|
||||
// Delete token cookie, so author is changed after reloading the pad.
|
||||
const {Cookies} = helper.padChrome$.window.require('ep_etherpad-lite/static/js/pad_utils');
|
||||
|
|
Loading…
Reference in a new issue