Skip to content

Commit acf0b3b

Browse files
committed
Refactor after the refactor hit main
1 parent 2b5fcde commit acf0b3b

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

cypress/e2e/trafficlight/actions/timeline.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,18 @@ export function verifyLastMessageIsTrusted(): string {
4646
.find(".mx_EventTile_e2eIcon").should("not.exist");
4747
return "verified";
4848
}
49+
50+
export function getTimeline(): JSONValue {
51+
const rsp = [];
52+
Cypress.$('.mx_EventTile').each(
53+
function(index, obj) {
54+
tile = {};
55+
tile['user'] = Cypress.$(obj).find('.mx_BaseAvatar_image').attr('title');
56+
const e2eicon = Cypress.$(obj).find('.mx_EventTile_e2eIcon').attr('class');
57+
tile['e2e_issues'] = e2eicon;
58+
tile['message'] = Cypress.$(obj).find('.mx_EventTile_content').text();
59+
rsp.push(tile);
60+
},
61+
);
62+
return { "response": "got_timeline", "timeline": rsp };
63+
}

cypress/e2e/trafficlight/trafficlight.spec.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import {
3939
openRoom,
4040
} from "./actions/room";
4141
import {
42+
getTimeline,
4243
sendMessage,
4344
verifyLastMessageIsTrusted,
4445
verifyLastMessageIsUTD,
@@ -253,20 +254,7 @@ function runAction(action: string, data: JSONValue): string | JSONValue | undefi
253254
return advanceClock(milliseconds);
254255
}
255256
case "get_timeline": {
256-
cy.log("Searching for information");
257-
const rsp = [];
258-
// TODO: assert we're in a specific room at this time.
259-
Cypress.$('.mx_EventTile').each(
260-
function(index, obj) {
261-
tile = {};
262-
tile['user'] = Cypress.$(obj).find(".mx_BaseAvatar_image").attr("title");
263-
const e2eicon = Cypress.$(obj).find(".mx_EventTile_e2eIcon").attr("class");
264-
tile['e2e_issues'] = e2eicon;
265-
tile['message'] = Cypress.$(obj).find(".mx_EventTile_content").text();
266-
rsp.push(tile);
267-
},
268-
);
269-
return { "response": "got_timeline", "timeline": rsp };
257+
return getTimeline();
270258
}
271259
case "clear_idb_storage":
272260
return clearIDBStorage();

0 commit comments

Comments
 (0)