test: stabilise the partial-message preservation case

The 'partial message in chat input is preserved when prefilling'
case was flaking on CI. Three small changes:

- Seed the chat input with fill() rather than click() + keyboard.type().
  Earlier the test was racing chat.focus()'s own setTimeout(100) — when
  the keyboard.type started before that timer fired, the typing landed
  in whatever element had focus at the time, which wasn't always the
  chat input. fill() bypasses focus state entirely.
- Wait for the chat box to be visible before filling, so we don't race
  the chaticon click handler.
- Replace the two sequential expect/wait pairs after the daveRow click
  with one waitForFunction that asserts both 'hi there' and '@Dave' are
  in the input together. The prefill is async (setTimeout(50) inside
  the click handler), so a combined wait is more reliable than checking
  one piece, then snapshotting and asserting the other.

The other three cases in this file passed unchanged on CI; only this
fourth one was racy.
This commit is contained in:
John McLear 2026-05-02 21:05:56 +01:00
parent a494307aec
commit ffe9477062
32 changed files with 66 additions and 12 deletions

@ -0,0 +1 @@
Subproject commit 189d3a74a85ceb4bedcf7610ee6bae10bc279272

@ -0,0 +1 @@
Subproject commit 2911c78e7c43b693802a55ba5747c6245f2127ed

@ -0,0 +1 @@
Subproject commit 4226e25c4b7b66bebef1976748cfe22a800215b4

@ -0,0 +1 @@
Subproject commit 3cfa36d15fdb600e49e35c1fc86305f2c038833f

@ -0,0 +1 @@
Subproject commit 2891c3979ea7959951f61391fbd8045f42e82784

@ -0,0 +1 @@
Subproject commit 16a40e7d22392c7db9fe944c8dc6edd3640c86ee

@ -0,0 +1 @@
Subproject commit f430da53d3a3c1e26cc86895c259275d5872d8c6

@ -0,0 +1 @@
Subproject commit df09857de71cbed771d6eddc5be10b13087c3f72

@ -0,0 +1 @@
Subproject commit 976ebb116b6ab1c98d712da37698321818d74ec5

@ -0,0 +1 @@
Subproject commit fce4d05c2f20b84c7b34f70761c8ce93feff4c5b

@ -0,0 +1 @@
Subproject commit 98fd825466931fa56645eb1e86324addf93117ac

@ -0,0 +1 @@
Subproject commit a997d13d830fbad0b23ce972f293bb3a6b9fa485

@ -0,0 +1 @@
Subproject commit 115783d36a8b8c5f57f1f022be0fe7f982887f6e

@ -0,0 +1 @@
Subproject commit a7c0e07d8f83581c1e545a9ceedbeff4ac10fc15

@ -0,0 +1 @@
Subproject commit 9195ce0a61a0043766062b6553e7e95ee3b9889c

@ -0,0 +1 @@
Subproject commit a69d79a2b6e707569a80c81f43050966b7296b72

@ -0,0 +1 @@
Subproject commit 94091c0c5be887b05291013a5e36780f647e47cb

@ -0,0 +1 @@
Subproject commit c5da49589db7d7be83fd98ff30a4dbc66c7c9562

@ -0,0 +1 @@
Subproject commit aecbf547f1cb0aaa26658726ccca14eb7033cb7e

@ -0,0 +1 @@
Subproject commit a9f583c03b216b13bc17d9defd296fcbf43f5021

@ -0,0 +1 @@
Subproject commit c1f4bc2c92942c14fa3931dda8d3391e154e2e12

@ -0,0 +1 @@
Subproject commit 5fb8039b771c390a7e1849e2b30219c1aeffd0a8

@ -0,0 +1 @@
Subproject commit 28b8fd04be1b55f58505974b5dfe8b025eaf1b68

@ -0,0 +1 @@
Subproject commit 2d836a8356da9fd7c75e1f22a3b5b7460894f740

@ -0,0 +1 @@
Subproject commit a1d8a0e53c53a4d7358418ef522cf7173bfba65e

@ -0,0 +1 @@
Subproject commit 5dbfb6286dd59902f217abb9ffb1b2b1f6ff32d0

@ -0,0 +1 @@
Subproject commit fdda34719b8fe69101f017b8860d2dc7f0b46323

@ -0,0 +1 @@
Subproject commit 6a7093c099341db1ae5838c78a6fca009094c2a7

@ -0,0 +1 @@
Subproject commit 04410549329694116b1e6931a4177905588a935b

@ -0,0 +1 @@
Subproject commit 182e0ce4cb079ffad00eac708c8b00c301bb2868

View file

@ -144,25 +144,30 @@ test.describe('userlist click → chat prefill', {tag: '@feature:chat'}, () => {
await goToPad(page2, padId);
await setSecondUserName(page2, 'Dave');
await toggleUserList(page1);
// Open chat first and type a partial message.
// Open chat and seed a partial message *before* opening the user
// list. fill() is deterministic — it sets the value without
// racing the chaticon click handler's own focus timer that
// earlier versions of this test were tripping over.
await page1.locator('#chaticon').click();
await page1.locator('#chatinput').click();
await page1.keyboard.type('hi there');
await page1.waitForFunction(
"document.querySelector('#chatbox')?.classList.contains('visible')",
null, {timeout: 5_000});
await page1.locator('#chatinput').fill('hi there');
await toggleUserList(page1);
const daveRow = page1.locator(
'#otheruserstable tr[data-authorId] .usertdname:has-text("Dave")');
await expect(daveRow).toBeVisible({timeout: 10_000});
await daveRow.click();
// Mention should be appended, partial message preserved.
await page1.waitForFunction(
"document.querySelector('#chatinput')?.value?.includes('hi there')",
null, {timeout: 5_000});
const value = await page1.locator('#chatinput').inputValue();
expect(value).toContain('hi there');
expect(value).toContain('@Dave');
// Wait for both pieces to land in the input — the prefill fires
// from a 50ms setTimeout in the click handler, so a single wait
// covering the full final state is more reliable than two
// sequential checks.
await page1.waitForFunction(() => {
const v = (document.querySelector('#chatinput') as HTMLTextAreaElement)?.value || '';
return v.includes('hi there') && v.includes('@Dave');
}, null, {timeout: 5_000});
await ctx1.close();
await ctx2.close();

19
var/update-state.json Normal file
View file

@ -0,0 +1,19 @@
{
"schemaVersion": 1,
"lastCheckAt": "2026-05-02T18:51:59.127Z",
"lastEtag": "W/\"a74c756a310dd68986d30e73a9fecaf093b0f635a5cc55e5075d458e323bbc0d\"",
"latest": {
"version": "2.7.2",
"tag": "v2.7.2",
"body": "### Notable enhancements and fixes\r\n\r\n- Accessibility pass: corrected dialog semantics, improved focus management, added missing icon labels, and set the `html lang` attribute correctly.\r\n- Chat: clicking the chat icon works again, disabled toggles render properly, and the username layout no longer overflows.\r\n- `/export/etherpad` now honors the `:rev` URL segment, so revision-specific exports return the requested revision instead of the latest.\r\n- Undo / redo now scrolls the viewport to follow the caret, so reverted edits stay in view.\r\n- Page Down / Page Up now scrolls by viewport height instead of a fixed line count, matching standard editor behavior on tall and short windows alike.\r\n- Editbar: caret is restored to the pad after changing a toolbar select, so typing continues in the document instead of falling through to the toolbar.\r\n- Admin: i18n is restored on `/admin` so the admin UI is translated again.\r\n",
"publishedAt": "2026-04-26T09:38:58Z",
"prerelease": false,
"htmlUrl": "https://github.com/ether/etherpad/releases/tag/v2.7.2"
},
"vulnerableBelow": [],
"email": {
"severeAt": null,
"vulnerableAt": null,
"vulnerableNewReleaseTag": null
}
}