LGTM
This commit is contained in:
parent
a8165249a4
commit
a4103b0896
64 changed files with 5376 additions and 3832 deletions
|
|
@ -103,7 +103,7 @@ export class DashboardRecorder {
|
|||
throw new Error('No recorded hexagon response is available for map clicking');
|
||||
}
|
||||
|
||||
const mapBox = await this.page.locator('[data-tutorial="map"]').boundingBox();
|
||||
const mapBox = await this.mapBoundingBox();
|
||||
if (!mapBox) throw new Error('Map container has no bounding box');
|
||||
const clear = await this.clickableBox(mapBox);
|
||||
|
||||
|
|
@ -152,6 +152,23 @@ export class DashboardRecorder {
|
|||
return candidates.slice(0, limit).map(({ score: _score, ...target }) => target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Locate the map container's bounding box. DesktopMapPage tags it with
|
||||
* `[data-tutorial="map"]`, but MobileMapPage does not, so on mobile we
|
||||
* fall back to the maplibre-gl canvas element. The canvas is always
|
||||
* present once the map has loaded (we already wait for `canvas` in
|
||||
* prepareTimeline). The first canvas in the document IS the map.
|
||||
*/
|
||||
private async mapBoundingBox(): Promise<
|
||||
{ x: number; y: number; width: number; height: number } | null
|
||||
> {
|
||||
const desktopAnchor = this.page.locator('[data-tutorial="map"]').first();
|
||||
if ((await desktopAnchor.count()) > 0) {
|
||||
return desktopAnchor.boundingBox();
|
||||
}
|
||||
return this.page.locator('canvas').first().boundingBox();
|
||||
}
|
||||
|
||||
/**
|
||||
* The pixel rect inside `mapBox` that's safe to click — i.e. not under
|
||||
* the dashboard's left filters pane, right details pane, or (on mobile)
|
||||
|
|
@ -279,7 +296,7 @@ export class DashboardRecorder {
|
|||
const snapshot = this.lastPostcodes;
|
||||
if (!snapshot || snapshot.features.length === 0) return [];
|
||||
|
||||
const mapBox = await this.page.locator('[data-tutorial="map"]').boundingBox();
|
||||
const mapBox = await this.mapBoundingBox();
|
||||
if (!mapBox) throw new Error('Map container has no bounding box');
|
||||
const clear = await this.clickableBox(mapBox);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue