Fix test failures on Chrome 72

This commit is contained in:
JC Brand 2019-02-01 15:22:45 +01:00
parent 9c28ef13bf
commit c023bd1d47
6 changed files with 18 additions and 12 deletions

View File

@ -1,4 +1,4 @@
dist: trusty
dist: xenial
language: node_js
cache:
directories:
@ -6,7 +6,7 @@ cache:
addons:
chrome: stable
node_js:
- "9"
- "10"
before_install:
- npm install -g lerna
- rm -rf ./node_modules

View File

@ -229,7 +229,7 @@ eslint: stamp-npm
.PHONY: check
check: dist/converse.js eslint
LOG_CR_VERBOSITY=INFO $(CHROMIUM) --no-sandbox http://localhost:$(HTTPSERVE_PORT)/tests/index.html
LOG_CR_VERBOSITY=INFO $(CHROMIUM) --disable-gpu --no-sandbox http://localhost:$(HTTPSERVE_PORT)/tests/index.html
########################################################################
## Documentation

View File

@ -2300,7 +2300,7 @@
expect(textarea.value).toBe('But soft, what light through yonder window breaks?');
expect(view.model.messages.at(0).get('correcting')).toBe(true);
expect(view.el.querySelectorAll('.chat-msg').length).toBe(2);
await u.hasClass('correcting', view.el.querySelector('.chat-msg'));
await test_utils.waitUntil(() => u.hasClass('correcting', view.el.querySelector('.chat-msg')));
expect(textarea.value).toBe('But soft, what light through yonder window breaks?');
view.keyPressed({
target: textarea,
@ -2309,7 +2309,7 @@
expect(textarea.value).toBe('');
expect(view.model.messages.at(0).get('correcting')).toBe(false);
expect(view.el.querySelectorAll('.chat-msg').length).toBe(2);
expect(u.hasClass('correcting', view.el.querySelector('.chat-msg'))).toBe(false);
await test_utils.waitUntil(() => !u.hasClass('correcting', view.el.querySelector('.chat-msg')));
done();
}));

View File

@ -3951,7 +3951,7 @@
test_utils.openControlBox();
_converse.emit('rosterContactsFetched');
var roomspanel = _converse.chatboxviews.get('controlbox').roomspanel;
const roomspanel = _converse.chatboxviews.get('controlbox').roomspanel;
roomspanel.el.querySelector('.show-add-muc-modal').click();
test_utils.closeControlBox(_converse);
const modal = roomspanel.add_room_modal;
@ -3960,8 +3960,8 @@
roomspanel.delegateEvents(); // We need to rebind all events otherwise our spy won't be called
modal.el.querySelector('input[name="chatroom"]').value = 'lounce@muc.localhost';
modal.el.querySelector('form input[type="submit"]').click();
await test_utils.waitUntil(() => _converse.chatboxes.length);
expect(sizzle('.chatroom', _converse.el).filter(u.isVisible).length).toBe(1); // There should now be an open chatroom
await test_utils.waitUntil(() => _converse.chatboxes.length);
await test_utils.waitUntil(() => sizzle('.chatroom', _converse.el).filter(u.isVisible).length === 1);
done();
}));

View File

@ -5,11 +5,13 @@
const u = converse.env.utils;
function deviceListFetched (_converse, jid) {
return _.filter(
async function deviceListFetched (_converse, jid) {
const stanza = await test_utils.waitUntil(() => _.filter(
_converse.connection.IQ_stanzas,
iq => iq.nodeTree.querySelector(`iq[to="${jid}"] items[node="eu.siacs.conversations.axolotl.devicelist"]`)
).pop();
).pop());
await test_utils.waitUntil(() => _converse.devicelists.get(jid));
return stanza;
}
function ownDeviceHasBeenPublished (_converse) {
@ -115,7 +117,7 @@
_converse.connection._dataRecv(test_utils.createRequest(stanza));
await test_utils.waitUntil(() => _converse.omemo_store);
const devicelist = _converse.devicelists.get({'jid': contact_jid});
expect(devicelist.devices.length).toBe(1);
await test_utils.waitUntil(() => devicelist.devices.length === 1);
const view = _converse.chatboxviews.get(contact_jid);
view.model.set('omemo_active', true);
@ -291,6 +293,7 @@
await test_utils.waitUntil(() => _converse.omemo_store);
expect(_converse.devicelists.length).toBe(2);
await test_utils.waitUntil(() => deviceListFetched(_converse, contact_jid));
const devicelist = _converse.devicelists.get(contact_jid);
expect(devicelist.devices.length).toBe(1);
expect(devicelist.devices.at(0).get('id')).toBe('4e30f35051b7b8b42abe083742187228');
@ -444,6 +447,7 @@
expect(_converse.devicelists.length).toBe(2);
const devicelist = _converse.devicelists.get(contact_jid);
await test_utils.waitUntil(() => deviceListFetched(_converse, contact_jid));
expect(devicelist.devices.length).toBe(1);
expect(devicelist.devices.at(0).get('id')).toBe('4e30f35051b7b8b42abe083742187228');
@ -1239,6 +1243,7 @@
await test_utils.waitUntil(() => _converse.omemo_store);
expect(_converse.devicelists.length).toBe(2);
await test_utils.waitUntil(() => deviceListFetched(_converse, contact_jid));
const devicelist = _converse.devicelists.get(contact_jid);
expect(devicelist.devices.length).toBe(2);
expect(devicelist.devices.at(0).get('id')).toBe('4e30f35051b7b8b42abe083742187228');

View File

@ -26,6 +26,7 @@
test_utils.openChatBoxFor(_converse, contact_jid);
await test_utils.waitUntil(() => _converse.chatboxes.length);
const view = _converse.chatboxviews.get(contact_jid);
await new Promise((resolve) => view.model.once('contactAdded', resolve));
let show_modal_button = view.el.querySelector('.show-user-details-modal');
expect(u.isVisible(show_modal_button)).toBeTruthy();
show_modal_button.click();