clipwright/dashboard/e2e/specs/reframe-editor.spec.js
pedro-bento 0040aa49da
All checks were successful
CI / dashboard-e2e (push) Successful in 1m44s
CI / unit (push) Successful in 29s
CI / backend-e2e (push) Successful in 1m17s
test/e2e-coverage (#5)
Reviewed-on: #5
Co-authored-by: pedro-bento <mail@pbento.pt>
Co-committed-by: pedro-bento <mail@pbento.pt>
2026-10-04 22:28:46 +01:00

35 lines
1.7 KiB
JavaScript

import { test, expect } from '@playwright/test';
import { openApp, completedSession, JOB_ID } from '../fixtures/app.js';
test.describe('reframe editor', () => {
test('splits a scene and applies reframing through /api/clip/reframe', async ({ page }) => {
await openApp(page, { seed: { session: completedSession() } });
await expect(page.getByRole('heading', { name: 'First viral clip' })).toBeVisible();
await page.getByRole('button', { name: 'reframing' }).first().click();
await expect(page.getByRole('heading', { name: 'reframing' })).toBeVisible();
// Scenes came back from the mocked /scenes endpoint.
await expect(page.getByText(/scene 1 ·/)).toBeVisible();
await expect(page.getByText(/nothing adjusted yet/i)).toBeVisible();
await page.getByTitle('stack two regions instead of one window').first().click();
await expect(page.getByText(/1 scene reframed by hand/i)).toBeVisible();
const requestPromise = page.waitForRequest(
(r) => r.method() === 'POST' && r.url().includes('/api/clip/reframe'),
);
await page.getByRole('button', { name: /apply reframing/i }).click();
const request = await requestPromise;
const body = request.postDataJSON();
expect(body.job_id).toBe(JOB_ID);
expect(body.clip_index).toBe(0);
expect(body.crop_overrides['0']).toBeTruthy();
expect(body.crop_overrides['0'].top).toBeTruthy();
expect(body.crop_overrides['0'].bottom).toBeTruthy();
// A successful save closes the editor.
await expect(page.getByRole('heading', { name: 'reframing' })).toHaveCount(0);
});
});