Skip to content

Commit f2a97a9

Browse files
JohnMcLearclaude
andcommitted
test(7553): use actual readonly-URL selector in Playwright spec
The previous test looked up (capital-I) and called inputValue() on it. The real element is (lowercase) and it's a toggle checkbox, not a URL field. The readonly URL itself is in `#linkinput`, updated live when the readonly checkbox is checked. Wire the test to that flow. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent feae2a6 commit f2a97a9

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/tests/frontend-new/specs/hide_menu_right.spec.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {expect, test} from "@playwright/test";
1+
import {expect, Page, test} from "@playwright/test";
22
import {appendQueryParams, goToNewPad} from "../helper/padHelper";
33

44
test.beforeEach(async ({page}) => {
@@ -26,19 +26,26 @@ test.describe('showMenuRight URL parameter', function () {
2626
await expect(page.locator('#editbar .menu_right')).toBeVisible();
2727
});
2828

29-
test('readonly pad hides .menu_right by default', async function ({page}) {
30-
// Find the share link which exposes the readonly r.* id, then navigate.
29+
// Helper: open the Share popup, flip it to read-only, read the r.* URL
30+
// back out of #linkinput. The readonly toggle is a checkbox
31+
// (`#readonlyinput`) that rewrites #linkinput's value live.
32+
const getReadonlyUrl = async (page: Page) => {
3133
await page.locator('.buttonicon-embed').click();
32-
const readonlyUrl = await page.locator('#readonlyInput').inputValue();
33-
expect(readonlyUrl).toMatch(/\/p\/r\./);
34+
await page.locator('#readonlyinput').check();
35+
const url = await page.locator('#linkinput').inputValue();
36+
expect(url).toMatch(/\/p\/r\./);
37+
return url;
38+
};
39+
40+
test('readonly pad hides .menu_right by default', async function ({page}) {
41+
const readonlyUrl = await getReadonlyUrl(page);
3442
await page.goto(readonlyUrl);
3543
await page.waitForSelector('#editorcontainer.initialized');
3644
await expect(page.locator('#editbar .menu_right')).toBeHidden();
3745
});
3846

3947
test('readonly pad with showMenuRight=true keeps the menu visible', async function ({page}) {
40-
await page.locator('.buttonicon-embed').click();
41-
const readonlyUrl = await page.locator('#readonlyInput').inputValue();
48+
const readonlyUrl = await getReadonlyUrl(page);
4249
await page.goto(`${readonlyUrl}?showMenuRight=true`);
4350
await page.waitForSelector('#editorcontainer.initialized');
4451
await expect(page.locator('#editbar .menu_right')).toBeVisible();

0 commit comments

Comments
 (0)