validate: removed-from-sale IAPs are no blockers; shots capture --device landscape (Mac / Chromebook frames from a web build); playwright lookup says why each place failed
This commit is contained in:
parent
cdd9321794
commit
d0f568ebc2
13 changed files with 230 additions and 48 deletions
|
|
@ -4,7 +4,7 @@
|
|||
// a list on the phone and a grid at 1180x820 needs different selectors; the miss message names the selector and the size.
|
||||
import type { ShotSelector } from '../lib/config';
|
||||
|
||||
type Device = 'phone' | 'tablet';
|
||||
import type { CaptureDevice as Device } from './devices';
|
||||
|
||||
/** Candidates for one device: its own list first, then the shared ones, without repeats. */
|
||||
export function candidates(sel: ShotSelector | undefined, device: Device): string[] {
|
||||
|
|
@ -19,12 +19,12 @@ export function validateSelector(where: string, sel: unknown): string[] {
|
|||
const okList = (v: unknown): boolean => ok(v) || (Array.isArray(v) && v.length > 0 && v.every(ok));
|
||||
if (okList(sel)) return [];
|
||||
if (sel && typeof sel === 'object' && !Array.isArray(sel)) {
|
||||
const o = sel as Record<string, unknown>, bad = Object.keys(o).filter(k => !['phone', 'tablet', 'any'].includes(k));
|
||||
if (bad.length) return [`${where}: unknown key ${bad.join(', ')} (phone | tablet | any)`];
|
||||
if (!Object.keys(o).length) return [`${where}: at least one of phone | tablet | any`];
|
||||
const o = sel as Record<string, unknown>, bad = Object.keys(o).filter(k => !['phone', 'tablet', 'landscape', 'any'].includes(k));
|
||||
if (bad.length) return [`${where}: unknown key ${bad.join(', ')} (phone | tablet | landscape | any)`];
|
||||
if (!Object.keys(o).length) return [`${where}: at least one of phone | tablet | landscape | any`];
|
||||
return Object.entries(o).filter(([, v]) => !okList(v)).map(([k]) => `${where}.${k}: a selector or a list of selectors`);
|
||||
}
|
||||
return [`${where}: a selector, a list of selectors, or { phone, tablet, any }`];
|
||||
return [`${where}: a selector, a list of selectors, or { phone, tablet, landscape, any }`];
|
||||
}
|
||||
|
||||
/** Minimal Playwright surface used here, so tests can fake a page. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue