mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-28 03:16:16 -04:00
adminsettings test: Refactoring. We cannot guarantee that the system time on
SauceLabs and Github is in sync. In case the SauceLabs runner's clock is slow the test would have failed. Also be a little stricter for other assertions.
This commit is contained in:
parent
c228283c17
commit
da804f0142
1 changed files with 7 additions and 10 deletions
|
@ -38,7 +38,8 @@ describe('Admin > Settings', function () {
|
||||||
// reset it to the old value
|
// reset it to the old value
|
||||||
helper.newAdmin('settings');
|
helper.newAdmin('settings');
|
||||||
await helper.waitForPromise(
|
await helper.waitForPromise(
|
||||||
() => helper.admin$ && helper.admin$('.settings').val().length > 0, 20000);
|
() => helper.admin$ &&
|
||||||
|
helper.admin$('.settings').val().length === settingsLength + 11, 20000);
|
||||||
|
|
||||||
// replace the test value with a line break
|
// replace the test value with a line break
|
||||||
helper.admin$('.settings').val((_, text) => text.replace('/* test */\n', ''));
|
helper.admin$('.settings').val((_, text) => text.replace('/* test */\n', ''));
|
||||||
|
@ -50,12 +51,11 @@ describe('Admin > Settings', function () {
|
||||||
// settings should have the old value
|
// settings should have the old value
|
||||||
helper.newAdmin('settings');
|
helper.newAdmin('settings');
|
||||||
await helper.waitForPromise(
|
await helper.waitForPromise(
|
||||||
() => helper.admin$ && helper.admin$('.settings').val().length > 0, 36000);
|
() => helper.admin$ && helper.admin$('.settings').val().length === settingsLength &&
|
||||||
expect(settings).to.be(helper.admin$('.settings').val());
|
settings === helper.admin$('.settings').val(), 20000);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('restart works', async function () {
|
it('restart works', async function () {
|
||||||
this.timeout(60000);
|
|
||||||
const getStartTime = async () => {
|
const getStartTime = async () => {
|
||||||
try {
|
try {
|
||||||
const {httpStartTime} = await $.ajax({
|
const {httpStartTime} = await $.ajax({
|
||||||
|
@ -66,18 +66,15 @@ describe('Admin > Settings', function () {
|
||||||
});
|
});
|
||||||
return httpStartTime;
|
return httpStartTime;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
helper.logDebugMsg(`an error occurred: ${err.message} of type ${err.name}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
await helper.waitForPromise(async () => {
|
const oldStartTime = await getStartTime();
|
||||||
const startTime = await getStartTime();
|
|
||||||
return startTime != null && startTime > 0 && Date.now() > startTime;
|
|
||||||
}, 1000, 500);
|
|
||||||
const clickTime = Date.now();
|
|
||||||
helper.admin$('#restartEtherpad').click();
|
helper.admin$('#restartEtherpad').click();
|
||||||
await helper.waitForPromise(async () => {
|
await helper.waitForPromise(async () => {
|
||||||
const startTime = await getStartTime();
|
const startTime = await getStartTime();
|
||||||
return startTime != null && startTime >= clickTime;
|
return startTime != null && startTime >= oldStartTime;
|
||||||
}, 60000, 500);
|
}, 60000, 500);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue