mirror of
https://github.com/immich-app/immich
synced 2026-08-15 13:03:57 +00:00
fix: add map mock network for e2e tests
Co-authored-by: Afonso Mendonça Ribeiro <afonso.mendonca.ribeiro@tecnico.ulisboa.pt>
This commit is contained in:
parent
c2c0ca8032
commit
5c02f85974
5 changed files with 34 additions and 11 deletions
32
e2e/src/ui/mock-network/map-network.ts
Normal file
32
e2e/src/ui/mock-network/map-network.ts
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import type { MapMarkerResponseDto } from '@immich/sdk';
|
||||
import { BrowserContext } from '@playwright/test';
|
||||
import { TimelineData } from 'src/ui/generators/timeline';
|
||||
|
||||
export const setupMapMockApiRoutes = async (context: BrowserContext, timelineData: TimelineData) => {
|
||||
await context.route('**/api/map/markers', async (route) => {
|
||||
const markers: MapMarkerResponseDto[] = [];
|
||||
|
||||
for (const bucket of timelineData.buckets.values()) {
|
||||
for (const asset of bucket) {
|
||||
// Only include assets with GPS coordinates
|
||||
if (asset.latitude !== null && asset.longitude !== null) {
|
||||
markers.push({
|
||||
id: asset.id,
|
||||
lat: asset.latitude,
|
||||
lon: asset.longitude,
|
||||
city: asset.city,
|
||||
state: null,
|
||||
country: asset.country,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
markers.sort((a, b) => a.id.localeCompare(b.id));
|
||||
|
||||
return route.fulfill({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
json: markers,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
@ -72,8 +72,6 @@ export const mapUtils = {
|
|||
return page.getByLabel(/map settings/i);
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Verify all standard map controls are visible
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@
|
|||
{#if onToggleTimeline}
|
||||
<Control position="top-right">
|
||||
<ControlGroup>
|
||||
<ControlButton onclick={() => onToggleTimeline?.()}>
|
||||
<ControlButton title={$t('timeline')} onclick={() => onToggleTimeline?.()}>
|
||||
<Icon
|
||||
title={$t('timeline')}
|
||||
icon={mdiImageMultiple}
|
||||
|
|
|
|||
|
|
@ -26,12 +26,6 @@
|
|||
let isTimelinePanelVisible = $state(false);
|
||||
let visibleAssetIds = $state<Set<string>>();
|
||||
|
||||
// Mobile Bottom Sheet State
|
||||
let sheetHeight = $state(50);
|
||||
let isDraggingSheet = $state(false);
|
||||
let innerWidth = $state(1024);
|
||||
let isMobile = $derived(innerWidth < 768);
|
||||
|
||||
const isSameBbox = (a: SelectionBBox | undefined, b: SelectionBBox) => {
|
||||
if (!a) {
|
||||
return false;
|
||||
|
|
@ -50,7 +44,6 @@
|
|||
selectedClusterBBox = undefined;
|
||||
selectedClusterIds = new Set();
|
||||
visibleAssetIds = undefined;
|
||||
sheetHeight = 50; // Reset for next open
|
||||
}
|
||||
|
||||
function toggleTimeline() {
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@
|
|||
<div class="flex items-center gap-2">
|
||||
<Icon icon={mdiImageMultiple} size="20" />
|
||||
<p class="text-sm font-medium text-immich-fg dark:text-immich-dark-fg">
|
||||
{$t('assets_count', { values: { count: timelineManager?.assetsCount ?? 0 } })}
|
||||
{$t('assets_count', { values: { count: timelineManager?.assetCount ?? 0 } })}
|
||||
</p>
|
||||
</div>
|
||||
<CloseButton onclick={onClose} />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue