mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 19:01:54 +00:00
fix(matrix): drive the DM invite through Element's new room list
Element 1.12.28 rewrote the room list. Pending invites now sit in their own section that renders collapsed, so no room row exists in the DOM until it is expanded. The predicate iterated an empty list and the poll spent its whole budget with no reachable path to success. Expand every collapsed section first, then match the row by the shape upstream's own test helpers document at revision fe37d199: role=row, aria-level=2, and a button whose aria-label starts with 'Open room'. Of the four previous selectors, three matched nothing in this build and the fourth reached only the Spaces navigation. Match aria-label as well as text, because Element renders the DM partner sometimes as a display name and sometimes as a raw MXID. role=gridcell is deliberately not among them: the cell precedes its own button in document order, so break would land on the DIV while Element's handler sits on the button. The accept regex is unchanged. Element 1.12.28 labels the DM accept 'Start chatting' and still ships 'Accept' and 'Join'; all three are covered and Decline stays excluded. Every click stays a raw DOM click because a persistent device-verification toast overlaps the room list and would intercept an actionability-checked click. Verified on a local compose deploy of variant 0 with sso and tor against 1.12.28: test-dm-admin-biber.js passed in 4.2m, 7 passed, no failures. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
7623c1680e
commit
9661800cb0
1 file changed
+15
-15
@@ -97,28 +97,31 @@ exports.register = function (shared) {
|
||||
await adminPage.keyboard.type(bootstrap);
|
||||
await adminPage.keyboard.press("Enter");
|
||||
|
||||
// Biber: wait for admin's invite to propagate, then accept. The flow
|
||||
// mirrors Element's invite UX: (1) click the sidebar tile for admin's
|
||||
// invite (the tile renders with admin's display name but no standalone
|
||||
// Accept button), then (2) click the primary accept action in the invite
|
||||
// view (modern Element labels this "Start chatting" for DMs; older
|
||||
// builds / non-DM invites use "Accept" / "Join"). MUST NOT match
|
||||
// "Decline" / "Decline and block".
|
||||
await expect
|
||||
.poll(async () => {
|
||||
return await biberPage.evaluate(() => {
|
||||
// Step 1: open the invite.
|
||||
// Pending invites sit in a section that renders collapsed, so the
|
||||
// invite row is absent from the DOM until it is expanded.
|
||||
const sections = document.querySelectorAll(
|
||||
'button[aria-expanded="false"][aria-label^="Toggle "]',
|
||||
);
|
||||
for (const section of sections) {
|
||||
section.click();
|
||||
}
|
||||
|
||||
const roomTiles = document.querySelectorAll(
|
||||
"[role='treeitem'], [role='option'], .mx_RoomTile, [data-testid^='room-tile']",
|
||||
'[role="row"][aria-level="2"] button[aria-label^="Open room"]',
|
||||
);
|
||||
for (const tile of roomTiles) {
|
||||
const text = (tile.textContent || "").trim();
|
||||
if (/administrator/i.test(text)) {
|
||||
const name = `${tile.getAttribute("aria-label") || ""} ${tile.textContent || ""}`;
|
||||
if (/administrator/i.test(name)) {
|
||||
tile.click();
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Step 2: click accept.
|
||||
|
||||
// Anchored: "Decline and block" contains an accept-looking word and
|
||||
// clicking it destroys the invite.
|
||||
const acceptCandidates = document.querySelectorAll(
|
||||
"button, a, [role='button']",
|
||||
);
|
||||
@@ -128,9 +131,6 @@ exports.register = function (shared) {
|
||||
b.click();
|
||||
}
|
||||
}
|
||||
// Success: invite accepted when the room timeline renders a
|
||||
// message composer for biber (only appears once membership is
|
||||
// `join`). Use the same composer signature as admin's side.
|
||||
return !!document.querySelector(
|
||||
"div[role='textbox'][contenteditable='true'], textarea[aria-label*='message' i]",
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user