mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Fix spec problem
This commit is contained in:
parent
8d0fb2867e
commit
bcf76c65e7
9 changed files with 27 additions and 27 deletions
|
|
@ -44,7 +44,7 @@ export async function waitForMapLibre(page, timeout = 10000) {
|
||||||
|
|
||||||
// Wait for map instance to exist and style to be loaded
|
// Wait for map instance to exist and style to be loaded
|
||||||
await page.waitForFunction(() => {
|
await page.waitForFunction(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]');
|
const element = document.querySelector('[data-controller*="maps-v2"]');
|
||||||
if (!element) return false;
|
if (!element) return false;
|
||||||
const app = window.Stimulus || window.Application;
|
const app = window.Stimulus || window.Application;
|
||||||
if (!app) return false;
|
if (!app) return false;
|
||||||
|
|
@ -67,7 +67,7 @@ export async function waitForMapLibre(page, timeout = 10000) {
|
||||||
*/
|
*/
|
||||||
export async function hasMapInstance(page) {
|
export async function hasMapInstance(page) {
|
||||||
return await page.evaluate(() => {
|
return await page.evaluate(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]');
|
const element = document.querySelector('[data-controller*="maps-v2"]');
|
||||||
if (!element) return false;
|
if (!element) return false;
|
||||||
|
|
||||||
// Get Stimulus controller instance
|
// Get Stimulus controller instance
|
||||||
|
|
@ -86,7 +86,7 @@ export async function hasMapInstance(page) {
|
||||||
*/
|
*/
|
||||||
export async function getMapZoom(page) {
|
export async function getMapZoom(page) {
|
||||||
return await page.evaluate(() => {
|
return await page.evaluate(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]');
|
const element = document.querySelector('[data-controller*="maps-v2"]');
|
||||||
if (!element) return null;
|
if (!element) return null;
|
||||||
|
|
||||||
const app = window.Stimulus || window.Application;
|
const app = window.Stimulus || window.Application;
|
||||||
|
|
@ -104,7 +104,7 @@ export async function getMapZoom(page) {
|
||||||
*/
|
*/
|
||||||
export async function getMapCenter(page) {
|
export async function getMapCenter(page) {
|
||||||
return await page.evaluate(() => {
|
return await page.evaluate(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]');
|
const element = document.querySelector('[data-controller*="maps-v2"]');
|
||||||
if (!element) return null;
|
if (!element) return null;
|
||||||
|
|
||||||
const app = window.Stimulus || window.Application;
|
const app = window.Stimulus || window.Application;
|
||||||
|
|
@ -125,7 +125,7 @@ export async function getMapCenter(page) {
|
||||||
*/
|
*/
|
||||||
export async function getPointsSourceData(page) {
|
export async function getPointsSourceData(page) {
|
||||||
return await page.evaluate(() => {
|
return await page.evaluate(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]');
|
const element = document.querySelector('[data-controller*="maps-v2"]');
|
||||||
if (!element) return { hasSource: false, featureCount: 0, features: [] };
|
if (!element) return { hasSource: false, featureCount: 0, features: [] };
|
||||||
|
|
||||||
const app = window.Stimulus || window.Application;
|
const app = window.Stimulus || window.Application;
|
||||||
|
|
@ -154,7 +154,7 @@ export async function getPointsSourceData(page) {
|
||||||
*/
|
*/
|
||||||
export async function hasLayer(page, layerId) {
|
export async function hasLayer(page, layerId) {
|
||||||
return await page.evaluate((id) => {
|
return await page.evaluate((id) => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]');
|
const element = document.querySelector('[data-controller*="maps-v2"]');
|
||||||
if (!element) return false;
|
if (!element) return false;
|
||||||
|
|
||||||
const app = window.Stimulus || window.Application;
|
const app = window.Stimulus || window.Application;
|
||||||
|
|
@ -207,7 +207,7 @@ export async function hasPopup(page) {
|
||||||
*/
|
*/
|
||||||
export async function getLayerVisibility(page, layerId) {
|
export async function getLayerVisibility(page, layerId) {
|
||||||
return await page.evaluate((id) => {
|
return await page.evaluate((id) => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]');
|
const element = document.querySelector('[data-controller*="maps-v2"]');
|
||||||
if (!element) return false;
|
if (!element) return false;
|
||||||
|
|
||||||
const app = window.Stimulus || window.Application;
|
const app = window.Stimulus || window.Application;
|
||||||
|
|
@ -228,7 +228,7 @@ export async function getLayerVisibility(page, layerId) {
|
||||||
*/
|
*/
|
||||||
export async function getRoutesSourceData(page) {
|
export async function getRoutesSourceData(page) {
|
||||||
return await page.evaluate(() => {
|
return await page.evaluate(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]');
|
const element = document.querySelector('[data-controller*="maps-v2"]');
|
||||||
if (!element) return { hasSource: false, featureCount: 0, features: [] };
|
if (!element) return { hasSource: false, featureCount: 0, features: [] };
|
||||||
|
|
||||||
const app = window.Stimulus || window.Application;
|
const app = window.Stimulus || window.Application;
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ test.describe('Area Selection in Maps V2', () => {
|
||||||
|
|
||||||
// Check if selection layer has been added to map
|
// Check if selection layer has been added to map
|
||||||
const hasSelectionLayer = await page.evaluate(() => {
|
const hasSelectionLayer = await page.evaluate(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]')
|
const element = document.querySelector('[data-controller*="maps-v2"]')
|
||||||
const app = window.Stimulus || window.Application
|
const app = window.Stimulus || window.Application
|
||||||
const controller = app.getControllerForElementAndIdentifier(element, 'maps-v2')
|
const controller = app.getControllerForElementAndIdentifier(element, 'maps-v2')
|
||||||
return controller.selectionLayer !== undefined
|
return controller.selectionLayer !== undefined
|
||||||
|
|
@ -295,7 +295,7 @@ test.describe('Area Selection in Maps V2', () => {
|
||||||
|
|
||||||
// Check if selected points layer exists
|
// Check if selected points layer exists
|
||||||
const hasSelectedPointsLayer = await page.evaluate(() => {
|
const hasSelectedPointsLayer = await page.evaluate(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]')
|
const element = document.querySelector('[data-controller*="maps-v2"]')
|
||||||
const app = window.Stimulus || window.Application
|
const app = window.Stimulus || window.Application
|
||||||
const controller = app.getControllerForElementAndIdentifier(element, 'maps-v2')
|
const controller = app.getControllerForElementAndIdentifier(element, 'maps-v2')
|
||||||
return controller?.selectedPointsLayer !== undefined
|
return controller?.selectedPointsLayer !== undefined
|
||||||
|
|
@ -305,7 +305,7 @@ test.describe('Area Selection in Maps V2', () => {
|
||||||
if (hasSelectedPointsLayer) {
|
if (hasSelectedPointsLayer) {
|
||||||
// Verify layer is on the map
|
// Verify layer is on the map
|
||||||
const layerExistsOnMap = await page.evaluate(() => {
|
const layerExistsOnMap = await page.evaluate(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]')
|
const element = document.querySelector('[data-controller*="maps-v2"]')
|
||||||
const app = window.Stimulus || window.Application
|
const app = window.Stimulus || window.Application
|
||||||
const controller = app.getControllerForElementAndIdentifier(element, 'maps-v2')
|
const controller = app.getControllerForElementAndIdentifier(element, 'maps-v2')
|
||||||
return controller?.map?.getLayer('selected-points') !== undefined
|
return controller?.map?.getLayer('selected-points') !== undefined
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ test.describe('Heatmap Layer', () => {
|
||||||
|
|
||||||
// Wait for heatmap layer to be created
|
// Wait for heatmap layer to be created
|
||||||
await page.waitForFunction(() => {
|
await page.waitForFunction(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]')
|
const element = document.querySelector('[data-controller*="maps-v2"]')
|
||||||
if (!element) return false
|
if (!element) return false
|
||||||
const app = window.Stimulus || window.Application
|
const app = window.Stimulus || window.Application
|
||||||
const controller = app?.getControllerForElementAndIdentifier(element, 'maps-v2')
|
const controller = app?.getControllerForElementAndIdentifier(element, 'maps-v2')
|
||||||
|
|
@ -30,7 +30,7 @@ test.describe('Heatmap Layer', () => {
|
||||||
}, { timeout: 3000 }).catch(() => false)
|
}, { timeout: 3000 }).catch(() => false)
|
||||||
|
|
||||||
const hasHeatmap = await page.evaluate(() => {
|
const hasHeatmap = await page.evaluate(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]')
|
const element = document.querySelector('[data-controller*="maps-v2"]')
|
||||||
if (!element) return false
|
if (!element) return false
|
||||||
const app = window.Stimulus || window.Application
|
const app = window.Stimulus || window.Application
|
||||||
const controller = app?.getControllerForElementAndIdentifier(element, 'maps-v2')
|
const controller = app?.getControllerForElementAndIdentifier(element, 'maps-v2')
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ test.describe('Points Layer', () => {
|
||||||
test('displays points layer', async ({ page }) => {
|
test('displays points layer', async ({ page }) => {
|
||||||
// Wait for points layer to be added
|
// Wait for points layer to be added
|
||||||
await page.waitForFunction(() => {
|
await page.waitForFunction(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]')
|
const element = document.querySelector('[data-controller*="maps-v2"]')
|
||||||
const app = window.Stimulus || window.Application
|
const app = window.Stimulus || window.Application
|
||||||
const controller = app?.getControllerForElementAndIdentifier(element, 'maps-v2')
|
const controller = app?.getControllerForElementAndIdentifier(element, 'maps-v2')
|
||||||
return controller?.map?.getLayer('points') !== undefined
|
return controller?.map?.getLayer('points') !== undefined
|
||||||
|
|
@ -31,7 +31,7 @@ test.describe('Points Layer', () => {
|
||||||
|
|
||||||
test('loads and displays point data', async ({ page }) => {
|
test('loads and displays point data', async ({ page }) => {
|
||||||
await page.waitForFunction(() => {
|
await page.waitForFunction(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]')
|
const element = document.querySelector('[data-controller*="maps-v2"]')
|
||||||
const app = window.Stimulus || window.Application
|
const app = window.Stimulus || window.Application
|
||||||
const controller = app?.getControllerForElementAndIdentifier(element, 'maps-v2')
|
const controller = app?.getControllerForElementAndIdentifier(element, 'maps-v2')
|
||||||
return controller?.map?.getSource('points-source') !== undefined
|
return controller?.map?.getSource('points-source') !== undefined
|
||||||
|
|
@ -47,7 +47,7 @@ test.describe('Points Layer', () => {
|
||||||
test('points source contains valid GeoJSON features', async ({ page }) => {
|
test('points source contains valid GeoJSON features', async ({ page }) => {
|
||||||
// Wait for source to be added
|
// Wait for source to be added
|
||||||
await page.waitForFunction(() => {
|
await page.waitForFunction(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]')
|
const element = document.querySelector('[data-controller*="maps-v2"]')
|
||||||
const app = window.Stimulus || window.Application
|
const app = window.Stimulus || window.Application
|
||||||
const controller = app?.getControllerForElementAndIdentifier(element, 'maps-v2')
|
const controller = app?.getControllerForElementAndIdentifier(element, 'maps-v2')
|
||||||
return controller?.map?.getSource('points-source') !== undefined
|
return controller?.map?.getSource('points-source') !== undefined
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ test.describe('Routes Layer', () => {
|
||||||
test.describe('Layer Existence', () => {
|
test.describe('Layer Existence', () => {
|
||||||
test('routes layer exists on map', async ({ page }) => {
|
test('routes layer exists on map', async ({ page }) => {
|
||||||
await page.waitForFunction(() => {
|
await page.waitForFunction(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]')
|
const element = document.querySelector('[data-controller*="maps-v2"]')
|
||||||
if (!element) return false
|
if (!element) return false
|
||||||
const app = window.Stimulus || window.Application
|
const app = window.Stimulus || window.Application
|
||||||
if (!app) return false
|
if (!app) return false
|
||||||
|
|
@ -37,7 +37,7 @@ test.describe('Routes Layer', () => {
|
||||||
test.describe('Data Source', () => {
|
test.describe('Data Source', () => {
|
||||||
test('routes source has data', async ({ page }) => {
|
test('routes source has data', async ({ page }) => {
|
||||||
await page.waitForFunction(() => {
|
await page.waitForFunction(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]')
|
const element = document.querySelector('[data-controller*="maps-v2"]')
|
||||||
if (!element) return false
|
if (!element) return false
|
||||||
const app = window.Stimulus || window.Application
|
const app = window.Stimulus || window.Application
|
||||||
if (!app) return false
|
if (!app) return false
|
||||||
|
|
@ -92,7 +92,7 @@ test.describe('Routes Layer', () => {
|
||||||
test.describe('Styling', () => {
|
test.describe('Styling', () => {
|
||||||
test('routes have solid color', async ({ page }) => {
|
test('routes have solid color', async ({ page }) => {
|
||||||
await page.waitForFunction(() => {
|
await page.waitForFunction(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]')
|
const element = document.querySelector('[data-controller*="maps-v2"]')
|
||||||
if (!element) return false
|
if (!element) return false
|
||||||
const app = window.Stimulus || window.Application
|
const app = window.Stimulus || window.Application
|
||||||
if (!app) return false
|
if (!app) return false
|
||||||
|
|
@ -101,7 +101,7 @@ test.describe('Routes Layer', () => {
|
||||||
}, { timeout: 20000 })
|
}, { timeout: 20000 })
|
||||||
|
|
||||||
const routeLayerInfo = await page.evaluate(() => {
|
const routeLayerInfo = await page.evaluate(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]')
|
const element = document.querySelector('[data-controller*="maps-v2"]')
|
||||||
if (!element) return null
|
if (!element) return null
|
||||||
|
|
||||||
const app = window.Stimulus || window.Application
|
const app = window.Stimulus || window.Application
|
||||||
|
|
@ -132,7 +132,7 @@ test.describe('Routes Layer', () => {
|
||||||
test.describe('Layer Order', () => {
|
test.describe('Layer Order', () => {
|
||||||
test('routes layer renders below points layer', async ({ page }) => {
|
test('routes layer renders below points layer', async ({ page }) => {
|
||||||
await page.waitForFunction(() => {
|
await page.waitForFunction(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]')
|
const element = document.querySelector('[data-controller*="maps-v2"]')
|
||||||
const app = window.Stimulus || window.Application
|
const app = window.Stimulus || window.Application
|
||||||
const controller = app?.getControllerForElementAndIdentifier(element, 'maps-v2')
|
const controller = app?.getControllerForElementAndIdentifier(element, 'maps-v2')
|
||||||
return controller?.map?.getLayer('routes') !== undefined &&
|
return controller?.map?.getLayer('routes') !== undefined &&
|
||||||
|
|
@ -140,7 +140,7 @@ test.describe('Routes Layer', () => {
|
||||||
}, { timeout: 10000 })
|
}, { timeout: 10000 })
|
||||||
|
|
||||||
const layerOrder = await page.evaluate(() => {
|
const layerOrder = await page.evaluate(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]')
|
const element = document.querySelector('[data-controller*="maps-v2"]')
|
||||||
if (!element) return null
|
if (!element) return null
|
||||||
|
|
||||||
const app = window.Stimulus || window.Application
|
const app = window.Stimulus || window.Application
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ test.describe('Location Search', () => {
|
||||||
await page.waitForTimeout(1000)
|
await page.waitForTimeout(1000)
|
||||||
|
|
||||||
const hasSearchManager = await page.evaluate(() => {
|
const hasSearchManager = await page.evaluate(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]')
|
const element = document.querySelector('[data-controller*="maps-v2"]')
|
||||||
if (!element) return false
|
if (!element) return false
|
||||||
|
|
||||||
const app = window.Stimulus || window.Application
|
const app = window.Stimulus || window.Application
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ test.describe('Map Settings', () => {
|
||||||
test('points layer visibility matches toggle state', async ({ page }) => {
|
test('points layer visibility matches toggle state', async ({ page }) => {
|
||||||
// Wait for points layer to exist
|
// Wait for points layer to exist
|
||||||
await page.waitForFunction(() => {
|
await page.waitForFunction(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]')
|
const element = document.querySelector('[data-controller*="maps-v2"]')
|
||||||
const app = window.Stimulus || window.Application
|
const app = window.Stimulus || window.Application
|
||||||
const controller = app?.getControllerForElementAndIdentifier(element, 'maps-v2')
|
const controller = app?.getControllerForElementAndIdentifier(element, 'maps-v2')
|
||||||
return controller?.map?.getLayer('points') !== undefined
|
return controller?.map?.getLayer('points') !== undefined
|
||||||
|
|
@ -79,7 +79,7 @@ test.describe('Map Settings', () => {
|
||||||
test('routes layer visibility matches toggle state', async ({ page }) => {
|
test('routes layer visibility matches toggle state', async ({ page }) => {
|
||||||
// Wait for routes layer to exist
|
// Wait for routes layer to exist
|
||||||
await page.waitForFunction(() => {
|
await page.waitForFunction(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]')
|
const element = document.querySelector('[data-controller*="maps-v2"]')
|
||||||
const app = window.Stimulus || window.Application
|
const app = window.Stimulus || window.Application
|
||||||
const controller = app?.getControllerForElementAndIdentifier(element, 'maps-v2')
|
const controller = app?.getControllerForElementAndIdentifier(element, 'maps-v2')
|
||||||
return controller?.map?.getLayer('routes') !== undefined
|
return controller?.map?.getLayer('routes') !== undefined
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ test.describe('Realtime Family Tracking', () => {
|
||||||
test.skip('family layer exists but is hidden by default', async ({ page }) => {
|
test.skip('family layer exists but is hidden by default', async ({ page }) => {
|
||||||
// Family layer is created but hidden until ActionCable data arrives
|
// Family layer is created but hidden until ActionCable data arrives
|
||||||
const layerExists = await page.evaluate(() => {
|
const layerExists = await page.evaluate(() => {
|
||||||
const element = document.querySelector('[data-controller="maps-v2"]')
|
const element = document.querySelector('[data-controller*="maps-v2"]')
|
||||||
const app = window.Stimulus || window.Application
|
const app = window.Stimulus || window.Application
|
||||||
const controller = app?.getControllerForElementAndIdentifier(element, 'maps-v2')
|
const controller = app?.getControllerForElementAndIdentifier(element, 'maps-v2')
|
||||||
return controller?.map?.getLayer('family') !== undefined
|
return controller?.map?.getLayer('family') !== undefined
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ export default defineConfig({
|
||||||
|
|
||||||
/* Run your local dev server before starting the tests */
|
/* Run your local dev server before starting the tests */
|
||||||
webServer: {
|
webServer: {
|
||||||
command: 'OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES RAILS_ENV=test rails server -p 3000',
|
command: 'OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES RAILS_ENV=development rails server -p 3000',
|
||||||
url: 'http://localhost:3000',
|
url: 'http://localhost:3000',
|
||||||
reuseExistingServer: !process.env.CI,
|
reuseExistingServer: !process.env.CI,
|
||||||
timeout: 120 * 1000,
|
timeout: 120 * 1000,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue