diff --git a/client-v3/e2e/tests/12-show-config-sessions.spec.ts b/client-v3/e2e/tests/12-show-config-sessions.spec.ts index 1b9a07dc6..0f0b2b9c0 100644 --- a/client-v3/e2e/tests/12-show-config-sessions.spec.ts +++ b/client-v3/e2e/tests/12-show-config-sessions.spec.ts @@ -1,6 +1,6 @@ /** - * Show Config — Sessions tab: session tags CRUD. - * Note: actual session start/stop is tested in 13-live-show.spec.ts. + * Show Config — Sessions tab: session start via the tab button + session tags CRUD. + * Spec 13 covers session start/stop via the navbar. */ import { test, expect, type BrowserContext, type Page } from '@playwright/test'; import { @@ -73,3 +73,25 @@ test('deletes a session tag', async () => { timeout: 5_000, }); }); + +// ── Session start via the tab button ───────────────────────────────────── + +test('switches back to Sessions sub-tab', async () => { + await page.click('button[role="tab"]:has-text("Sessions")'); + await expect(page.locator('button.btn-success:has-text("Start Session")')).toBeVisible({ + timeout: 10_000, + }); +}); + +test('starts a session via the Sessions tab Start button', async () => { + await page.click('button.btn-success:has-text("Start Session")'); + // START_SHOW WS message pushes all clients to /live + await page.waitForURL(`${UI_BASE}/live`, { timeout: 10_000 }); +}); + +test('stops the session via the navbar to restore state for later specs', async () => { + await page.locator('text=Live Config').click(); + await page.click('button:has-text("Stop Session")'); + await confirmDialog(page); + await expect(page.locator('a:has-text("Live")')).toHaveClass(/disabled/, { timeout: 10_000 }); +}); diff --git a/client-v3/package-lock.json b/client-v3/package-lock.json index ea1b7a34f..6b12e0835 100644 --- a/client-v3/package-lock.json +++ b/client-v3/package-lock.json @@ -1,12 +1,12 @@ { "name": "client-v3", - "version": "0.30.4", + "version": "0.30.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "client-v3", - "version": "0.30.4", + "version": "0.30.5", "dependencies": { "@vuelidate/core": "^2.0.3", "@vuelidate/validators": "^2.0.4", diff --git a/client-v3/package.json b/client-v3/package.json index a19618597..52432f028 100644 --- a/client-v3/package.json +++ b/client-v3/package.json @@ -1,6 +1,6 @@ { "name": "client-v3", - "version": "0.30.4", + "version": "0.30.5", "description": "DigiScript front end (Vue 3)", "author": "DreamTeamProd", "private": true, diff --git a/client-v3/src/components/show/config/sessions/SessionList.vue b/client-v3/src/components/show/config/sessions/SessionList.vue index fecc0de6e..f55ab2f3a 100644 --- a/client-v3/src/components/show/config/sessions/SessionList.vue +++ b/client-v3/src/components/show/config/sessions/SessionList.vue @@ -2,22 +2,13 @@ - - - Start Session - - - Stop Session - - + + Start Session + @@ -65,14 +56,15 @@ import log from 'loglevel'; import { makeURL, msToTimerString, contrastColor } from '@/js/utils'; import { useSystemStore } from '@/stores/system'; import { useShowStore } from '@/stores/show'; +import { useWebSocketStore } from '@/stores/websocket'; import { toast } from '@/js/toast'; import SessionTagDropdown from './SessionTagDropdown.vue'; const systemStore = useSystemStore(); const showStore = useShowStore(); +const wsStore = useWebSocketStore(); const startingSession = ref(false); -const stoppingSession = ref(false); const sessionFields = [ { key: 'start_date_time', label: 'Start Time' }, @@ -96,9 +88,17 @@ function revisionLabel(revisionId: number | null): string { } async function startSession(): Promise { + if (!wsStore.internalUUID) { + toast.error('Unable to start new show session'); + return; + } startingSession.value = true; try { - const response = await fetch(makeURL('/api/v1/show/sessions/start'), { method: 'POST' }); + const response = await fetch(makeURL('/api/v1/show/sessions/start'), { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ session_id: wsStore.internalUUID }), + }); if (response.ok) { toast.success('Started new show session'); await showStore.getShowSessionData(); @@ -110,22 +110,6 @@ async function startSession(): Promise { startingSession.value = false; } } - -async function stopSession(): Promise { - stoppingSession.value = true; - try { - const response = await fetch(makeURL('/api/v1/show/sessions/stop'), { method: 'POST' }); - if (response.ok) { - toast.success('Stopped show session'); - await showStore.getShowSessionData(); - } else { - log.error('Unable to stop show session'); - toast.error('Unable to stop show session'); - } - } finally { - stoppingSession.value = false; - } -}