Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop' into florianduros/tooltip/views-elements
Browse files Browse the repository at this point in the history
  • Loading branch information
florianduros authored Apr 29, 2024
2 parents 7f3f3d3 + 9cc362e commit 48ad1da
Show file tree
Hide file tree
Showing 21 changed files with 340 additions and 199 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/netlify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
name: Upload Preview Build to Netlify
on:
workflow_run:
workflows: ["Element Web - Build"]
workflows: ["End to End Tests"]
types:
- completed
jobs:
Expand All @@ -29,7 +29,7 @@ jobs:
with:
github-token: ${{ secrets.ELEMENT_BOT_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
name: previewbuild
name: webapp
path: webapp

- name: 📤 Deploy to Netlify
Expand Down
41 changes: 29 additions & 12 deletions playwright/e2e/read-receipts/editing-messages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ test.describe("Read receipts", () => {
// Given we have read the thread
await util.goTo(room1);
await util.receiveMessages(room2, ["Msg1", msg.threadedOff("Msg1", "Resp1")]);
await util.assertUnread(room2, 2);
await util.assertUnread(room2, 1);
await util.goTo(room2);
await util.openThread("Msg1");
await util.assertRead(room2);
await util.backToThreadsList();
await util.assertReadThread("Resp1");
await util.goTo(room1);

// When a message inside it is edited
Expand All @@ -202,6 +202,7 @@ test.describe("Read receipts", () => {
await util.goTo(room2);
await util.assertReadThread("Msg1");
});

test("Reading an edit of a threaded message makes the room read", async ({
roomAlpha: room1,
roomBeta: room2,
Expand All @@ -211,11 +212,11 @@ test.describe("Read receipts", () => {
// Given an edited thread message appears after we read it
await util.goTo(room1);
await util.receiveMessages(room2, ["Msg1", msg.threadedOff("Msg1", "Resp1")]);
await util.assertUnread(room2, 2);
await util.assertUnread(room2, 1);
await util.goTo(room2);
await util.openThread("Msg1");
await util.assertRead(room2);
await util.backToThreadsList();
await util.assertReadThread("Resp1");
await util.goTo(room1);
await util.receiveMessages(room2, [msg.editOf("Resp1", "Edit1")]);
await util.assertStillRead(room2);
Expand All @@ -228,6 +229,7 @@ test.describe("Read receipts", () => {
await util.assertStillRead(room2);
await util.assertReadThread("Msg1");
});

test("Marking a room as read after an edit in a thread makes it read", async ({
roomAlpha: room1,
roomBeta: room2,
Expand All @@ -241,14 +243,16 @@ test.describe("Read receipts", () => {
msg.threadedOff("Msg1", "Resp1"),
msg.editOf("Resp1", "Edit1"),
]);
await util.assertUnread(room2, 2);
await util.assertUnread(room2, 1);

// When I mark the room as read
await util.markAsRead(room2);

// Then it is read
await util.assertRead(room2);
await util.assertReadThread("Msg1");
});

test("Editing a thread message after marking as read leaves the room read", async ({
roomAlpha: room1,
roomBeta: room2,
Expand All @@ -258,7 +262,7 @@ test.describe("Read receipts", () => {
// Given a room is marked as read
await util.goTo(room1);
await util.receiveMessages(room2, ["Msg1", msg.threadedOff("Msg1", "Resp1")]);
await util.assertUnread(room2, 2);
await util.assertUnread(room2, 1);
await util.markAsRead(room2);
await util.assertRead(room2);

Expand All @@ -267,7 +271,9 @@ test.describe("Read receipts", () => {

// Then the room remains read
await util.assertStillRead(room2);
await util.assertReadThread("Msg1");
});

test("A room with an edited threaded message is still read after restart", async ({
roomAlpha: room1,
roomBeta: room2,
Expand All @@ -287,6 +293,7 @@ test.describe("Read receipts", () => {
// Then is it still read
await util.assertRead(room2);
});

test("A room where all threaded edits are read is still read after restart", async ({
roomAlpha: room1,
roomBeta: room2,
Expand All @@ -295,20 +302,23 @@ test.describe("Read receipts", () => {
}) => {
await util.goTo(room1);
await util.receiveMessages(room2, ["Msg1", msg.threadedOff("Msg1", "Resp1")]);
await util.assertUnread(room2, 2);
await util.assertUnread(room2, 1);
await util.receiveMessages(room2, [msg.editOf("Resp1", "Edit1")]);
await util.assertUnread(room2, 2);
await util.assertUnread(room2, 1);

await util.goTo(room2);

await util.openThread("Msg1");
await util.assertRead(room2);
await util.assertReadThread("Msg1");
await util.goTo(room1); // Make sure we are looking at room1 after reload
await util.assertStillRead(room2);

await util.saveAndReload();
await util.assertRead(room2);
await util.assertReadThread("Msg1");
});

test("A room where all threaded edits are marked as read is still read after restart", async ({
roomAlpha: room1,
roomBeta: room2,
Expand All @@ -321,15 +331,17 @@ test.describe("Read receipts", () => {
msg.threadedOff("Msg1", "Resp1"),
msg.editOf("Resp1", "Edit1"),
]);
await util.assertUnread(room2, 2);
await util.assertUnread(room2, 1);
await util.markAsRead(room2);
await util.assertRead(room2);
await util.assertReadThread("Msg1");

// When I restart
await util.saveAndReload();

// It is still read
await util.assertRead(room2);
await util.assertReadThread("Msg1");
});
});

Expand All @@ -343,7 +355,7 @@ test.describe("Read receipts", () => {
// Given I have read a thread
await util.goTo(room1);
await util.receiveMessages(room2, ["Msg1", msg.threadedOff("Msg1", "Resp1")]);
await util.assertUnread(room2, 2);
await util.assertUnread(room2, 1);
await util.goTo(room2);
await util.openThread("Msg1");
await util.backToThreadsList();
Expand All @@ -361,6 +373,7 @@ test.describe("Read receipts", () => {
await util.assertStillRead(room2);
await util.assertReadThread("Edit1");
});

test("Reading an edit of a thread root leaves the room read", async ({
roomAlpha: room1,
roomBeta: room2,
Expand All @@ -386,6 +399,7 @@ test.describe("Read receipts", () => {
await util.goTo(room1);
await util.assertStillRead(room2);
});

test("Editing a thread root after reading leaves the room read", async ({
roomAlpha: room1,
roomBeta: room2,
Expand All @@ -405,6 +419,7 @@ test.describe("Read receipts", () => {
// Then the room stays read
await util.assertStillRead(room2);
});

test("Marking a room as read after an edit of a thread root keeps it read", async ({
roomAlpha: room1,
roomBeta: room2,
Expand All @@ -431,6 +446,7 @@ test.describe("Read receipts", () => {
await util.goTo(room1);
await util.assertStillRead(room2);
});

test("Editing a thread root that is a reply after marking as read leaves the room read", async ({
roomAlpha: room1,
roomBeta: room2,
Expand All @@ -444,7 +460,7 @@ test.describe("Read receipts", () => {
msg.replyTo("Msg", "Reply"),
msg.threadedOff("Reply", "InThread"),
]);
await util.assertUnread(room2, 3);
await util.assertUnread(room2, 2);
await util.markAsRead(room2);
await util.assertRead(room2);

Expand All @@ -458,6 +474,7 @@ test.describe("Read receipts", () => {
await util.goTo(room2);
await util.assertReadThread("Edited Reply");
});

test("Marking a room as read after an edit of a thread root that is a reply leaves it read", async ({
roomAlpha: room1,
roomBeta: room2,
Expand All @@ -472,7 +489,7 @@ test.describe("Read receipts", () => {
msg.threadedOff("Reply", "InThread"),
]);
await util.receiveMessages(room2, [msg.editOf("Reply", "Edited Reply")]);
await util.assertUnread(room2, 3);
await util.assertUnread(room2, 2);

// When I mark the room as read
await util.markAsRead(room2);
Expand Down
31 changes: 17 additions & 14 deletions playwright/e2e/read-receipts/high-level.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,15 @@ test.describe("Read receipts", () => {
...msg.manyThreadedOff("Root3", many("T", 20)),
]);
await util.goTo(room2);
await util.assertUnread(room2, 60);
await util.assertRead(room2);
await util.assertUnreadThread("Root1");
await util.assertUnreadThread("Root2");
await util.assertUnreadThread("Root3");
await util.openThread("Root1");
await util.assertUnread(room2, 40);
await util.assertReadThread("Root1");
await util.openThread("Root2");
await util.assertUnread(room2, 20);
await util.assertReadThread("Root2");
await util.openThread("Root3");
await util.assertRead(room2);
await util.assertReadThread("Root3");

// When I restart and page up to load old thread roots
Expand All @@ -247,6 +247,7 @@ test.describe("Read receipts", () => {
await util.assertReadThread("Root2");
await util.assertReadThread("Root3");
});

test("Paging up to find old threads that were never read keeps the room unread", async ({
cryptoBackend,
roomAlpha: room1,
Expand All @@ -268,7 +269,7 @@ test.describe("Read receipts", () => {
...many("Msg", 100),
]);
await util.goTo(room2);
await util.assertUnread(room2, 6);
await util.assertRead(room2);
await util.assertUnreadThread("Root1");
await util.assertUnreadThread("Root2");
await util.assertUnreadThread("Root3");
Expand All @@ -278,20 +279,21 @@ test.describe("Read receipts", () => {
await util.goTo(room1);
await util.saveAndReload();

// Then the room remembers it's unread
// Then the room remembers it's read
// TODO: I (andyb) think this will fall in an encrypted room
await util.assertUnread(room2, 6);
await util.assertRead(room2);

// And when I page up to load old thread roots
await util.goTo(room2);
await util.pageUp();

// Then the room remains unread
await util.assertUnread(room2, 6);
// Then the room remains read
await util.assertRead(room2);
await util.assertUnreadThread("Root1");
await util.assertUnreadThread("Root2");
await util.assertUnreadThread("Root3");
});

test("Looking in thread view to find old threads that were never read makes the room unread", async ({
roomAlpha: room1,
roomBeta: room2,
Expand All @@ -310,7 +312,7 @@ test.describe("Read receipts", () => {
...many("Msg", 100),
]);
await util.goTo(room2);
await util.assertUnread(room2, 6);
await util.assertRead(room2);
await util.assertUnreadThread("Root1");
await util.assertUnreadThread("Root2");
await util.assertUnreadThread("Root3");
Expand All @@ -320,20 +322,21 @@ test.describe("Read receipts", () => {
await util.goTo(room1);
await util.saveAndReload();

// Then the room remembers it's unread
// Then the room remembers it's read
// TODO: I (andyb) think this will fall in an encrypted room
await util.assertUnread(room2, 6);
await util.assertRead(room2);

// And when I open the threads view
await util.goTo(room2);
await util.openThreadList();

// Then the room remains unread
await util.assertUnread(room2, 6);
// Then the room remains read
await util.assertRead(room2);
await util.assertUnreadThread("Root1");
await util.assertUnreadThread("Root2");
await util.assertUnreadThread("Root3");
});

test("After marking room as read, paging up to find old threads that were never read leaves the room read", async ({
cryptoBackend,
roomAlpha: room1,
Expand Down
Loading

0 comments on commit 48ad1da

Please sign in to comment.