Skip to content

Commit d195d9a

Browse files
JohnMcLearclaude
andcommitted
test(playwright): fix align spec — overlay click + wrong assert target
Two bugs in the migrated Playwright spec (#7622) caused every CI run on ether/etherpad with WITH_PLUGINS=1 to fail (chromium + firefox): 1. After selectAllText(), the #toolbar-overlay div in core's pad.html intercepts pointer events on the alignment buttons, so the click times out (90s). Mirror the {force: true} pattern that ep_etherpad-lite's clearAuthorship() helper already uses for the same reason. 2. The assertion read style from the inner <span>, but ep_align's aceDomLineProcessLineAttributes (static/js/index.js) renders the text-align style on the wrapping block element (<left>, <center>, <right>, <justify>), not on the span. Read it from the wrapper and use toHaveAttribute() so the assertion retries while the DOM settles. Verified locally against an Etherpad instance running ep_align@10.0.2: all four `Alignment of Text` cases pass; reverting either change reproduces the CI failure (\"Received string: ''\"). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ef38ef0 commit d195d9a

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

static/tests/frontend-new/specs/align.spec.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,18 @@ test.describe('Alignment of Text', () => {
1515
await writeToPad(page, 'aligned text');
1616
await selectAllText(page);
1717

18-
await page.locator(`.ep_align_${alignment}`).click();
18+
// force:true bypasses the #toolbar-overlay div that intercepts pointer
19+
// events after a text selection (same pattern as clearAuthorship() in
20+
// ep_etherpad-lite's padHelper).
21+
await page.locator(`.ep_align_${alignment}`).click({force: true});
1922

20-
const span = padBody.locator('div').first().locator('span').first();
21-
const style = await span.getAttribute('style') ?? '';
22-
expect(style).toMatch(new RegExp(`text-align:\\s*${alignment}`));
23+
// ep_align wraps the line content in a block element (<left>, <center>,
24+
// <right>, <justify>) carrying the text-align style — see
25+
// aceDomLineProcessLineAttributes in static/js/index.js. The inner
26+
// <span> has no style of its own, so assert against the wrapper.
27+
const wrapper = padBody.locator('div').first().locator(alignment);
28+
await expect(wrapper).toHaveAttribute(
29+
'style', new RegExp(`text-align:\\s*${alignment}`));
2330
await expect(padBody.locator('div').first()).toHaveText('aligned text');
2431
});
2532
}

0 commit comments

Comments
 (0)