docs: annotate verified vs unverified selectors, drop redundant clicks
Addresses reviewer's minor findings on the prior fix commit: makes the screenshot-verified/unverified boundary explicit in code comments so it travels with the file rather than living only in commit messages, and removes redundant .click() calls before .fill() (fill() already focuses). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
3edbf3fb26
commit
f794a5ae83
@@ -52,17 +52,21 @@ test.describe('reddit post', () => {
|
|||||||
throw new Error(outcome.error);
|
throw new Error(outcome.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Screenshot-verified against the live Reddit login page: cookie
|
||||||
|
// dialog button text and the "Log In" submit button's accessible
|
||||||
|
// name are both confirmed correct.
|
||||||
const rejectCookies = page.getByRole('button', { name: 'Reject Optional Cookies' });
|
const rejectCookies = page.getByRole('button', { name: 'Reject Optional Cookies' });
|
||||||
if (await rejectCookies.isVisible({ timeout: 5_000 }).catch(() => false)) {
|
if (await rejectCookies.isVisible({ timeout: 5_000 }).catch(() => false)) {
|
||||||
await rejectCookies.click();
|
await rejectCookies.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Not individually screenshot-verified (only confirmed to resolve
|
||||||
|
// as far as the network block allowed) — watch these first if
|
||||||
|
// login fails on a real, unblocked network.
|
||||||
const usernameField = page.getByLabel(/email or username/i);
|
const usernameField = page.getByLabel(/email or username/i);
|
||||||
await usernameField.click();
|
|
||||||
await usernameField.fill(/** @type {string} */ (username));
|
await usernameField.fill(/** @type {string} */ (username));
|
||||||
|
|
||||||
const passwordField = page.getByLabel(/^password/i);
|
const passwordField = page.getByLabel(/^password/i);
|
||||||
await passwordField.click();
|
|
||||||
await passwordField.fill(/** @type {string} */ (password));
|
await passwordField.fill(/** @type {string} */ (password));
|
||||||
|
|
||||||
await page.getByRole('button', { name: 'Log In' }).click();
|
await page.getByRole('button', { name: 'Log In' }).click();
|
||||||
@@ -82,6 +86,12 @@ test.describe('reddit post', () => {
|
|||||||
throw new Error(outcome.error);
|
throw new Error(outcome.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UNVERIFIED: a network block in the dev sandbox prevented ever
|
||||||
|
// reaching this point in a live run, so none of the selectors below
|
||||||
|
// (text-type tab, title field, body field, submit button) have been
|
||||||
|
// confirmed against the real submit page. If posting fails here on
|
||||||
|
// a real, unblocked network, inspect the live page first — e.g. via
|
||||||
|
// `npx playwright codegen https://www.reddit.com/r/test/submit`.
|
||||||
await page.goto(`https://www.reddit.com/r/${subreddit}/submit`);
|
await page.goto(`https://www.reddit.com/r/${subreddit}/submit`);
|
||||||
|
|
||||||
const textTab = page.getByRole('button', { name: /^Text$/i }).first();
|
const textTab = page.getByRole('button', { name: /^Text$/i }).first();
|
||||||
|
|||||||
Reference in New Issue
Block a user