remove explicit timeouts from tests for selectors

- gets rid of the waitAndQuery vs query distinction,
  all queries now wait if needed (called query and queryAll)
- remove explicit timeouts,
  as they depend on the speed of the machine the tests run on
This commit is contained in:
Bruno Windels 2019-04-16 15:35:31 +02:00
parent c40f7f6a3c
commit 48c1d46aa7
12 changed files with 57 additions and 59 deletions

View file

@ -20,7 +20,7 @@ module.exports = async function sendMessage(session, message) {
session.log.step(`writes "${message}" in room`);
// this selector needs to be the element that has contenteditable=true,
// not any if its parents, otherwise it behaves flaky at best.
const composer = await session.waitAndQuery('.mx_MessageComposer_editor');
const composer = await session.query('.mx_MessageComposer_editor');
// sometimes the focus that type() does internally doesn't seem to work
// and calling click before seems to fix it 🤷
await composer.click();
@ -29,6 +29,6 @@ module.exports = async function sendMessage(session, message) {
assert.equal(text.trim(), message.trim());
await composer.press("Enter");
// wait for the message to appear sent
await session.waitAndQuery(".mx_EventTile_last:not(.mx_EventTile_sending)");
await session.query(".mx_EventTile_last:not(.mx_EventTile_sending)");
session.log.done();
}