take into account continuation tiles in when checking timeline messages

This commit is contained in:
Bruno Windels 2019-04-16 11:43:32 +02:00
parent 945daf294c
commit 9610e9b57e

View file

@ -82,6 +82,15 @@ module.exports.checkTimelineContains = async function (session, expectedMessages
})); }));
//filter out tiles that were not messages //filter out tiles that were not messages
timelineMessages = timelineMessages.filter((m) => !!m); timelineMessages = timelineMessages.filter((m) => !!m);
timelineMessages.reduce((prevSender, m) => {
if (m.continuation) {
m.sender = prevSender;
return prevSender;
} else {
return m.sender;
}
});
expectedMessages.forEach((expectedMessage) => { expectedMessages.forEach((expectedMessage) => {
const foundMessage = timelineMessages.find((message) => { const foundMessage = timelineMessages.find((message) => {
return message.sender === expectedMessage.sender && return message.sender === expectedMessage.sender &&
@ -132,6 +141,7 @@ async function getMessageFromEventTile(eventTile) {
return { return {
sender, sender,
body, body,
encrypted: classNames.includes("mx_EventTile_verified") encrypted: classNames.includes("mx_EventTile_verified"),
continuation: classNames.includes("mx_EventTile_continuation"),
}; };
} }