Fix frontend test failures across all browsers#7416
Conversation
- Fix home button using fragile relative URL (window.location.href + "/../..") that WebKit doesn't resolve correctly. Use window.location.origin instead. - Wait for #editorcontainer.initialized in goToNewPad/goToPad/ appendQueryParams so toolbar, chat, and cookie handlers are fully set up before tests interact with them. - Clear cookies in chat test beforeEach to prevent chatAndUsers cookie from prior tests disabling the sticky chat checkbox. - Wait for navigation to complete in editbar home button test. Fixes ether#7405 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Review Summary by QodoFix frontend test failures across all browsers
WalkthroughsDescription• Fix home button using window.location.origin instead of fragile relative URL • Wait for #editorcontainer.initialized selector in pad helper functions • Clear cookies in chat test to prevent state pollution between tests • Wait for navigation completion in editbar home button test Diagramflowchart LR
A["Home Button Navigation"] -->|Replace fragile relative URL| B["Use window.location.origin"]
C["Test Initialization"] -->|Wait for editor container| D["#editorcontainer.initialized"]
E["Chat Test State"] -->|Clear cookies| F["Prevent test pollution"]
G["Editbar Navigation"] -->|Wait for URL change| H["Assert navigation complete"]
File Changes1. src/static/js/pad_editbar.ts
|
Code Review by Qodo
1. padeditbar home indent mismatch
|
| this.registerDropdownCommand('embed'); | ||
| this.registerCommand('home', ()=>{ | ||
| window.location.href = window.location.href + "/../.." | ||
| window.location.href = window.location.origin + '/' |
There was a problem hiding this comment.
1. padeditbar home indent mismatch 📘 Rule violation ⚙ Maintainability
The modified home command line is not indented with 2 spaces as required, introducing inconsistent formatting. This violates the repository indentation standard and can reduce readability/consistency.
Agent Prompt
## Issue description
A newly modified line does not follow the required 2-space indentation.
## Issue Context
Compliance requires spaces-only and 2-space indentation for all code.
## Fix Focus Areas
- src/static/js/pad_editbar.ts[359-359]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| }); | ||
| await page.goto(page.url()+"?"+ searchParams.toString()); | ||
| await page.waitForSelector('iframe[name="ace_outer"]'); | ||
| await page.waitForSelector('#editorcontainer.initialized'); |
There was a problem hiding this comment.
2. padhelper added waits misindented 📘 Rule violation ⚙ Maintainability
The newly added waitForSelector('#editorcontainer.initialized') lines are not indented with 2
spaces as required. This introduces formatting that violates the indentation standard.
Agent Prompt
## Issue description
Newly added lines in `padHelper.ts` do not follow 2-space indentation.
## Issue Context
Compliance requires spaces-only and 2-space indentation across the codebase.
## Fix Focus Areas
- src/tests/frontend-new/helper/padHelper.ts[114-114]
- src/tests/frontend-new/helper/padHelper.ts[122-122]
- src/tests/frontend-new/helper/padHelper.ts[129-129]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| test.beforeEach(async ({ page, context })=>{ | ||
| await context.clearCookies(); |
There was a problem hiding this comment.
3. chat.spec beforeeach misindented 📘 Rule violation ⚙ Maintainability
The newly added context.clearCookies() line (and surrounding modified setup) is not indented with 2 spaces as required. This violates the formatting/indentation compliance rule.
Agent Prompt
## Issue description
New lines in `chat.spec.ts` do not follow 2-space indentation.
## Issue Context
Compliance requires spaces-only and 2-space indentation.
## Fix Focus Areas
- src/tests/frontend-new/specs/chat.spec.ts[17-18]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| expect(attribute).toBe('pad.toolbar.home.title'); | ||
|
|
||
| await homeButton.click(); | ||
| await page.waitForURL((url) => !url.pathname.includes('/p/')); |
There was a problem hiding this comment.
4. editbar.spec waitforurl misindented 📘 Rule violation ⚙ Maintainability
The newly added page.waitForURL(...) line is not indented with 2 spaces as required. This violates the code formatting standard for indentation.
Agent Prompt
## Issue description
A newly added line in `editbar.spec.ts` does not follow 2-space indentation.
## Issue Context
Compliance requires spaces-only and 2-space indentation.
## Fix Focus Areas
- src/tests/frontend-new/specs/editbar.spec.ts[15-15]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Playwright runs locally and doesn't need Sauce Labs secrets, so there's no reason to limit frontend tests to push events only. Also remove stale Sauce Labs references from workflow names/comments. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The stickToScreen() handler manages checkbox state internally with its own toggle logic and a setTimeout. Playwright's check()/uncheck() methods verify state after clicking, but race with the async toggle, causing "Clicking the checkbox did not change its state" errors. Using click() avoids this — the waitForSelector calls already verify the final state. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove force:true from sticky chat checkbox clicks — it can bypass jQuery event handlers preventing stickToScreen() from firing. - Wait for chatbox stickyChat class instead of checkbox state, since stickToScreen() manages the checkbox asynchronously via setTimeout. - Reduce workers from 5 to 2 to avoid overloading the single Etherpad server instance, which causes goToNewPad timeouts on CI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove all Sauce Labs references (steps, comments, secrets) from frontend test workflows — Playwright replaced Sauce Labs - Remove unused set-output steps and GIT_HASH exports - Remove stale commented-out code from admin tests - Restrict load test to push events only (no need on PRs) - Fix artifact names to not reference undefined matrix.node Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The label element intercepts pointer events on the checkbox (reported by Webkit). On Chrome/Firefox the checkbox is "not stable" due to animations. Clicking the label is how a real user interacts with it and properly triggers the jQuery click handler. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use URL API to resolve '../..' relative to current URL instead of hardcoding origin + '/'. This preserves any configured base path (e.g. /etherpad) for reverse-proxy installations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Addressing Qodo review: Issues 1-4 (indentation): These are false positives — each added line matches the existing indentation style of its surrounding file. The test files use 4-space indent, Issue 5 (subpath bug): Fixed in commit 19ae682 — now uses |
Summary
window.location.origin + '/'instead of fragilewindow.location.href + "/../.."relative URL that WebKit doesn't resolve#editorcontainer.initializedingoToNewPad/goToPad/appendQueryParamsso toolbar, chat, and cookie handlers are fully set up before tests runbeforeEachto preventchatAndUserscookie from prior tests disabling the checkboxTest plan
Fixes #7405
🤖 Generated with Claude Code