adminsettings test: Be a little stricter for some assertions

pull/5119/head
webzwo0i 2021-07-16 20:46:04 +02:00 committed by Richard Hansen
parent cc6fda6916
commit 91d3974a0d
1 changed files with 6 additions and 4 deletions

View File

@ -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,6 +66,8 @@ describe('Admin > Settings', function () {
}); });
return httpStartTime; return httpStartTime;
} catch (err) { } catch (err) {
document.getElementById('console').append(
`an error occurred: ${err.message} of type ${err.name}\n`);
return null; return null;
} }
}; };