Skip to content

🎥 Make videos programmatically with React

Remove recurring flaky Studio tests

Jonny Burger89f083f3ee15
diff --git a/packages/example/e2e/inspector-section-collapse.test.mts b/packages/example/e2e/inspector-section-collapse.test.mts
deleted file mode 100644
index 56026ce035..0000000000
--- a/packages/example/e2e/inspector-section-collapse.test.mts
+++ /dev/null
@@ -1,867 +0,0 @@
-import fs from 'fs';
-import {expect, type Page, test} from '@playwright/test';
-import {
- EXPANDED_SIDEBAR_STATE,
- STUDIO_URL,
- visualMode3DFile,
-} from './constants.mts';
-import {startStudio, stopStudio} from './studio-server.mts';
-
-test.use({storageState: EXPANDED_SIDEBAR_STATE});
-
-let visualMode3DSourceBefore: string;
-
-const read2DTransformRotation = () => {
- const source = fs.readFileSync(visualMode3DFile, 'utf-8');
- const sequenceStart = source.indexOf('name="2D transform"');
- const sequenceEnd = source.indexOf('name="3D transform"');
- const sequenceSource = source.slice(sequenceStart, sequenceEnd);
- return /rotate: '([^']+)'/.exec(sequenceSource)?.[1] ?? null;
-};
-
-const read2DTransformScale = () => {
- const source = fs.readFileSync(visualMode3DFile, 'utf-8');
- const sequenceStart = source.indexOf('name="2D transform"');
- const sequenceEnd = source.indexOf('name="3D transform"');
- const sequenceSource = source.slice(sequenceStart, sequenceEnd);
- return /scale: ([^,}\n]+)/.exec(sequenceSource)?.[1] ?? null;
-};
-
-const read2DTransformTranslate = () => {
- const source = fs.readFileSync(visualMode3DFile, 'utf-8');
- const sequenceStart = source.indexOf('name="2D transform"');
- const sequenceEnd = source.indexOf('name="3D transform"');
- const sequenceSource = source.slice(sequenceStart, sequenceEnd);
- return /translate: '([^']+)'/.exec(sequenceSource)?.[1] ?? null;
-};
-
-const read2DTransformOrigin = () => {
- const source = fs.readFileSync(visualMode3DFile, 'utf-8');
- const sequenceStart = source.indexOf('name="2D transform"');
- const sequenceEnd = source.indexOf('name="3D transform"');
- const sequenceSource = source.slice(sequenceStart, sequenceEnd);
- return /transformOrigin: '([^']+)'/.exec(sequenceSource)?.[1] ?? null;
-};
-
-const read3DTransformRotation = () => {
- const source = fs.readFileSync(visualMode3DFile, 'utf-8');
- const sequenceStart = source.indexOf('name="3D transform"');
- const sequenceSource = source.slice(sequenceStart);
- return /rotate: '([^']+)'/.exec(sequenceSource)?.[1] ?? null;
-};
-
-const select2DTransformAndWaitForInspector = async (page: Page) => {
- const transform = page.getByText('2D transform', {exact: true}).first();
- const show3DTransformControls = page.getByRole('button', {
- name: 'Show 3D transform controls',
- });
-
- await expect(async () => {
- await transform.click();
- await expect(show3DTransformControls).toBeVisible({timeout: 1_000});
- }).toPass({timeout: 30_000});
-};
-
-test.describe('inspector section collapse', () => {
- test.beforeEach(async () => {
- visualMode3DSourceBefore = fs.readFileSync(visualMode3DFile, 'utf-8');
- await startStudio();
- });
-
- test.afterEach(async () => {
- await stopStudio();
- fs.writeFileSync(visualMode3DFile, visualMode3DSourceBefore);
- });
-
- test('edits visual-mode-3d transforms and collapses inactive inspector sections', async ({
- page,
- }) => {
- test.setTimeout(180_000);
- await page.goto(`${STUDIO_URL}/visual-mode-3d`);
- await expect(page).toHaveURL(/visual-mode-3d/, {timeout: 15_000});
- await page.waitForFunction(
- () => !document.body.innerText.includes('Loading...'),
- {timeout: 30_000},
- );
-
- const selectedOutline = page.locator(
- 'polygon[data-remotion-directly-selected-outline="true"]',
- );
- const canvasRotationSurface = page.locator(
- '[data-remotion-studio-canvas-rotation]',
- );
-
- await select2DTransformAndWaitForInspector(page);
- await expect(
- page.getByRole('button', {name: 'Show 3D transform controls'}),
- ).toBeVisible();
- await expect(selectedOutline).toBeVisible();
- await selectedOutline.click({button: 'right'});
- await page.getByRole('button', {name: 'Rotate', exact: true}).click();
- await expect(canvasRotationSurface).toBeVisible();
-
- await page.keyboard.press('Escape');
- await expect(canvasRotationSurface).not.toBeVisible();
- await expect(selectedOutline).toBeVisible();
-
- await page.keyboard.press('Escape');
- await expect(
- page.getByRole('button', {name: 'Show 3D transform controls'}),
- ).not.toBeVisible();
-
- await page.reload();
- await page.waitForFunction(
- () => !document.body.innerText.includes('Loading...'),
- {timeout: 30_000},
- );
- await select2DTransformAndWaitForInspector(page);
- await expect(
- page.getByRole('button', {name: 'Show 3D transform controls'}),
- ).toBeVisible();
- await expect(selectedOutline).toBeVisible();
- await selectedOutline.click({button: 'right'});
- await page.getByRole('button', {name: 'Crop', exact: true}).click();
- await expect(
- page.locator('[data-remotion-studio-crop-preview]'),
- ).toBeVisible();
-
- await page.keyboard.press('Escape');
- await expect(
- page.locator('[data-remotion-studio-crop-preview]'),
- ).not.toBeVisible();
- await expect(selectedOutline).toBeVisible();
-
- const tinyScaleEdges = page.locator(
- '[data-remotion-studio-scale-edge-contains-selection="true"]',
- );
- const tinySelectedOutline = page.locator(
- 'polygon[data-remotion-directly-selected-outline="true"]',
- );
- const tinyTransform = page
- .getByText('Tiny transform', {exact: true})
- .first();
- await expect(async () => {
- await tinyTransform.click();
- await expect(tinySelectedOutline).toHaveCount(1, {timeout: 1_000});
- const dimensions = await tinySelectedOutline.evaluate((outline) => {
- const rect = outline.getBoundingClientRect();
- return {height: rect.height, width: rect.width};
- });
- expect(dimensions.width).toBeGreaterThan(0);
- expect(dimensions.width).toBeLessThan(16);
- expect(dimensions.height).toBeGreaterThan(0);
- expect(dimensions.height).toBeLessThan(16);
- await expect(tinyScaleEdges).toHaveCount(0, {timeout: 1_000});
- }).toPass({timeout: 30_000});
- await expect(
- page.locator(
- '[data-remotion-studio-rotation-corner-contains-selection="true"]',
- ),
- ).toHaveCount(0);
-
- await select2DTransformAndWaitForInspector(page);
- await expect(
- page.getByRole('button', {name: 'Show 3D transform controls'}),
- ).toBeVisible();
- await expect(selectedOutline).toHaveCount(1);
- await selectedOutline.dispatchEvent('contextmenu');
- await page.getByRole('button', {name: 'Rotate', exact: true}).click();
- await expect(
- page.getByRole('button', {name: 'Rotation X', exact: true}).first(),
- ).toBeVisible();
- await expect(
- page.getByRole('button', {
- name: 'Hide 3D transform controls',
- exact: true,
- }),
- ).toBeVisible();
-
- const rightScaleEdge = page
- .locator(
- '[data-remotion-studio-scale-edge="right"][data-remotion-studio-scale-edge-contains-selection="true"]',
- )
- .first();
- await expect(rightScaleEdge).toHaveCount(1);
- const edgeCenter = await rightScaleEdge.evaluate((element) => {
- if (!(element instanceof SVGLineElement)) {
- throw new Error('Scale edge should be an SVG line');
- }
-
- const matrix = element.getScreenCTM();
- if (matrix === null) {
- throw new Error('Scale edge should have a screen transform');
- }
-
- return new DOMPoint(
- (element.x1.baseVal.value + element.x2.baseVal.value) / 2,
- (element.y1.baseVal.value + element.y2.baseVal.value) / 2,
- ).matrixTransform(matrix);
- });
- expect(
- await page.evaluate(
- ({x, y}) =>
- document
- .elementFromPoint(x, y)
- ?.getAttribute('data-remotion-studio-scale-edge') ?? null,
- {x: edgeCenter.x, y: edgeCenter.y},
- ),
- ).toBe('right');
-
- const scaleBefore = read2DTransformScale();
- await rightScaleEdge.dispatchEvent('pointerdown', {
- button: 0,
- buttons: 1,
- clientX: edgeCenter.x,
- clientY: edgeCenter.y,
- pointerId: 1,
- });
- await page.evaluate(
- ({x, y}) => {
- window.dispatchEvent(
- new PointerEvent('pointermove', {
- buttons: 1,
- clientX: x + 60,
- clientY: y,
- pointerId: 1,
- }),
- );
- window.dispatchEvent(
- new PointerEvent('pointerup', {
- button: 0,
- buttons: 0,
- clientX: x + 60,
- clientY: y,
- pointerId: 1,
- }),
- );
- },
- {x: edgeCenter.x, y: edgeCenter.y},
- );
- await expect.poll(read2DTransformScale).not.toBe(scaleBefore);
- await expect(canvasRotationSurface).toBeVisible();
-
- const transformOriginHandle = page
- .locator('[data-remotion-studio-transform-origin-handle]')
- .first();
- await expect(transformOriginHandle).toBeVisible();
- const dragTransformOrigin = async ({
- deltaX,
- deltaY,
- pointerId,
- }: {
- readonly deltaX: number;
- readonly deltaY: number;
- readonly pointerId: number;
- }) => {
- const transformOriginCenter = await transformOriginHandle.evaluate(
- (element) => {
- const circle = element.querySelector('circle');
- if (!(circle instanceof SVGCircleElement)) {
- throw new Error('Transform origin handle should contain a circle');
- }
-
- const matrix = circle.getScreenCTM();
- if (matrix === null) {
- throw new Error(
- 'Transform origin handle should have a screen transform',
- );
- }
-
- return new DOMPoint(
- circle.cx.baseVal.value,
- circle.cy.baseVal.value,
- ).matrixTransform(matrix);
- },
- );
- await transformOriginHandle.dispatchEvent('pointerdown', {
- button: 0,
- buttons: 1,
- clientX: transformOriginCenter.x,
- clientY: transformOriginCenter.y,
- pointerId,
- });
- await page.evaluate(
- ({x, y, moveX, moveY, id}) => {
- window.dispatchEvent(
- new PointerEvent('pointermove', {
- buttons: 1,
- clientX: x + moveX,
- clientY: y + moveY,
- pointerId: id,
- }),
- );
- window.dispatchEvent(
- new PointerEvent('pointerup', {
- button: 0,
- buttons: 0,
- clientX: x + moveX,
- clientY: y + moveY,
- pointerId: id,
- }),
- );
- },
- {
- x: transformOriginCenter.x,
- y: transformOriginCenter.y,
- moveX: deltaX,
- moveY: deltaY,
- id: pointerId,
- },
- );
- };
- const transformOriginBefore = read2DTransformOrigin();
- await dragTransformOrigin({deltaX: 30, deltaY: 20, pointerId: 2});
- await expect.poll(read2DTransformOrigin).not.toBe(transformOriginBefore);
- await expect(canvasRotationSurface).toBeVisible();
-
- const compositionContainer = page.locator(
- '.remotion-studio-composition-container',
- );
- const compositionBox = await compositionContainer.boundingBox();
- const rotationSurfaceBox = await canvasRotationSurface.boundingBox();
- if (compositionBox === null || rotationSurfaceBox === null) {
- throw new Error('Rotation surface should have a visible layout');
- }
-
- expect(rotationSurfaceBox.width).toBeLessThan(compositionBox.width);
- expect(rotationSurfaceBox.height).toBeLessThan(compositionBox.height);
- const outsidePoint = {
- x: compositionBox.x + compositionBox.width - 4,
- y: compositionBox.y + compositionBox.height - 4,
- };
- expect(
- await page.evaluate(
- ({x, y}) =>
- document
- .elementFromPoint(x, y)
- ?.closest('[data-remotion-studio-canvas-rotation]') ?? null,
- outsidePoint,
- ),
- ).toBeNull();
- const rotationBefore = read2DTransformRotation();
- const getInteractiveRotationPoint = () =>
- canvasRotationSurface.evaluate((surface) => {
- const box = surface.getBoundingClientRect();
- for (let yIndex = 1; yIndex < 10; yIndex++) {
- for (let xIndex = 1; xIndex < 10; xIndex++) {
- const point = {
- x: box.x + (box.width * xIndex) / 10,
- y: box.y + (box.height * yIndex) / 10,
- };
- if (
- document
- .elementFromPoint(point.x, point.y)
- ?.closest('[data-remotion-studio-canvas-rotation]') === surface
- ) {
- return point;
- }
- }
- }
-
- throw new Error('Rotation surface should have an interactive point');
- });
- const insidePoint = await getInteractiveRotationPoint();
- await page.mouse.move(insidePoint.x, insidePoint.y);
- await page.mouse.down();
- await page.mouse.move(insidePoint.x + 40, insidePoint.y + 30, {steps: 5});
- await page.mouse.up();
- await expect.poll(read2DTransformRotation).not.toBe(rotationBefore);
- const transformOriginAfter3DRotation = read2DTransformOrigin();
- await dragTransformOrigin({deltaX: -20, deltaY: 25, pointerId: 3});
- await expect
- .poll(read2DTransformOrigin)
- .not.toBe(transformOriginAfter3DRotation);
-
- const continuedInsidePoint = await getInteractiveRotationPoint();
- const rotationXControl = page
- .getByRole('button', {name: 'Rotation X', exact: true})
- .first();
- const rotationYControl = page
- .getByRole('button', {name: 'Rotation Y', exact: true})
- .first();
- const readRotationControls = async () =>
- `${await rotationXControl.textContent()}|${await rotationYControl.textContent()}`;
- const rotationBeforeLeavingSurface = await readRotationControls();
- const sourceRotationBeforeLeavingSurface = read2DTransformRotation();
- await page.mouse.move(continuedInsidePoint.x, continuedInsidePoint.y);
- await page.mouse.down();
- await page.mouse.move(outsidePoint.x, outsidePoint.y, {steps: 5});
- await expect
- .poll(readRotationControls)
- .not.toBe(rotationBeforeLeavingSurface);
- const rotationAfterLeavingSurface = await readRotationControls();
- await page.mouse.move(outsidePoint.x - 60, outsidePoint.y, {steps: 3});
- await expect
- .poll(readRotationControls)
- .not.toBe(rotationAfterLeavingSurface);
- await page.mouse.up();
- await expect
- .poll(read2DTransformRotation)
- .not.toBe(sourceRotationBeforeLeavingSurface);
-
- const rotationAfterInsideDrag = read2DTransformRotation();
- await page.mouse.move(outsidePoint.x, outsidePoint.y);
- await page.mouse.down();
- await page.mouse.move(outsidePoint.x + 20, outsidePoint.y + 20);
- await page.mouse.up();
- await page.waitForTimeout(200);
- expect(read2DTransformRotation()).toBe(rotationAfterInsideDrag);
-
- fs.writeFileSync(visualMode3DFile, visualMode3DSourceBefore);
- await page.goto(`${STUDIO_URL}/issue-8216`);
- await expect(page).toHaveURL(/issue-8216/, {timeout: 15_000});
- await page.waitForFunction(
- () => !document.body.innerText.includes('Loading...'),
- {timeout: 30_000},
- );
-
- const foreground = page.locator('[title="Foreground"]').first();
- const expandBackground = page.getByRole('button', {
- name: 'Expand Background',
- exact: true,
- });
- await expect(async () => {
- await foreground.click();
- await expect(expandBackground).toBeVisible({timeout: 1_000});
- }).toPass({timeout: 15_000});
- await expect(
- page.getByRole('button', {name: 'Expand Border', exact: true}),
- ).toBeVisible();
- await expect(
- page.getByRole('button', {name: 'Expand Border radius', exact: true}),
- ).toBeVisible();
- await expect(
- page.getByTitle('Use individual corner radii', {exact: true}),
- ).toHaveCount(0);
- await expect(
- page.getByRole('button', {name: 'Expand Crop', exact: true}),
- ).toBeVisible();
- await expect(
- page.getByRole('button', {name: 'Collapse Transform', exact: true}),
- ).toBeVisible();
- await page
- .getByRole('button', {name: 'Collapse Transform', exact: true})
- .click();
- await expect(
- page.getByRole('button', {name: 'Expand Transform', exact: true}),
- ).toBeVisible();
- await expect(
- page.getByRole('button', {name: 'Show 3D transform controls'}),
- ).toHaveCount(0);
- await page
- .getByRole('button', {name: 'Expand Transform', exact: true})
- .click();
- await expect(
- page.getByRole('button', {name: 'Show 3D transform controls'}),
- ).toBeVisible();
- await expect(
- page.getByRole('button', {name: 'Collapse Effects', exact: true}),
- ).toHaveCount(0);
- await expect(
- page.getByRole('button', {name: 'Expand Effects', exact: true}),
- ).toHaveCount(0);
- await expect(page.getByTitle('Add effect', {exact: true})).toBeVisible();
-
- await page
- .getByRole('button', {name: 'Expand Border radius', exact: true})
- .click();
- await expect(
- page.getByTitle('Use individual corner radii', {exact: true}),
- ).toBeVisible();
- const expandedBorderRadiusButton = page.getByRole('button', {
- name: 'Collapse Border radius',
- exact: true,
- });
- await expect(expandedBorderRadiusButton).toBeFocused();
- expect(
- await expandedBorderRadiusButton.evaluate((element) => {
- const style = getComputedStyle(element);
- return {boxShadow: style.boxShadow, outlineStyle: style.outlineStyle};
- }),
- ).toEqual({boxShadow: 'none', outlineStyle: 'none'});
-
- await page.keyboard.press('Tab');
- await page.keyboard.press('Shift+Tab');
- await expect(expandedBorderRadiusButton).toBeFocused();
- expect(
- await expandedBorderRadiusButton.evaluate(
- (element) => getComputedStyle(element).boxShadow,
- ),
- ).not.toBe('none');
-
- await page.getByRole('button', {name: 'Expand Crop', exact: true}).click();
- await expect(
- page.getByRole('button', {name: 'Collapse Crop', exact: true}),
- ).toBeVisible();
- await expect(page.getByText('Crop left', {exact: true})).toBeVisible();
-
- await page
- .locator('[title="Default absolute-fill layout"]')
- .first()
- .click();
- await expect(
- page.getByRole('button', {name: 'Expand Layout', exact: true}),
- ).toBeVisible();
- await page
- .getByRole('button', {name: 'Expand Layout', exact: true})
- .click();
- await expect(page.getByText('Premount For', {exact: true})).toBeVisible();
-
- await page.locator('[title="Default none layout"]').first().click();
- await expect(
- page.getByRole('button', {name: 'Expand Layout', exact: true}),
- ).toBeVisible();
-
- await page.locator('[title="Default premount"]').first().click();
- await expect(
- page.getByRole('button', {name: 'Expand Layout', exact: true}),
- ).toBeVisible();
- await expect(
- page.getByRole('button', {name: 'Collapse Source', exact: true}),
- ).toBeVisible();
- await page
- .getByRole('button', {name: 'Collapse Source', exact: true})
- .click();
- await expect(
- page.getByRole('button', {name: 'Expand Source', exact: true}),
- ).toBeVisible();
-
- await page.goto(`${STUDIO_URL}/visual-mode-3d`);
- await expect(page).toHaveURL(/visual-mode-3d/, {timeout: 15_000});
- await page.waitForFunction(
- () => !document.body.innerText.includes('Loading...'),
- {timeout: 30_000},
- );
-
- await page.locator('[title="2D transform"]').first().click();
- const show3DControls = page.getByRole('button', {
- name: 'Show 3D transform controls',
- exact: true,
- });
- await expect(show3DControls).toBeVisible();
- await expect(
- page.getByRole('button', {name: 'Scale Z', exact: true}),
- ).toHaveCount(0);
- await expect(
- page.getByRole('button', {name: 'Offset Z', exact: true}),
- ).toHaveCount(0);
- await expect(
- page.getByRole('button', {name: 'Rotation Z', exact: true}),
- ).toBeVisible();
- await expect(
- page.getByRole('button', {name: 'Rotation X', exact: true}),
- ).toHaveCount(0);
- await page.getByTitle('Rotation', {exact: true}).click();
- const laterCompositionContainer = page.locator(
- '.remotion-studio-composition-container',
- );
- const laterCompositionBox = await laterCompositionContainer.boundingBox();
- if (laterCompositionBox === null) {
- throw new Error('Composition should have a visible layout');
- }
-
- await page.mouse.move(
- laterCompositionBox.x + laterCompositionBox.width / 2,
- laterCompositionBox.y + laterCompositionBox.height / 2,
- );
- await expect(canvasRotationSurface).toBeVisible();
- expect(
- await canvasRotationSurface.evaluate((surface) =>
- decodeURIComponent(surface.getAttribute('cursor') ?? ''),
- ),
- ).toContain('<svg width="24" height="24"');
- await expect(
- page.locator('[data-remotion-studio-transform-origin-handle]').first(),
- ).toBeVisible();
- const laterRotationSurfaceBox = await canvasRotationSurface.boundingBox();
- if (laterRotationSurfaceBox === null) {
- throw new Error('Canvas rotation surface should have a visible layout');
- }
-
- const startX =
- laterRotationSurfaceBox.x + laterRotationSurfaceBox.width * 0.25;
- const startY =
- laterRotationSurfaceBox.y + laterRotationSurfaceBox.height * 0.25;
- await page.mouse.move(startX, startY);
- await page.mouse.down();
- await page.mouse.move(startX + 60, startY + 80, {steps: 5});
- await page.mouse.up();
- await expect.poll(read2DTransformRotation).toMatch(/^-?\d+(?:\.\d+)?deg$/);
-
- await show3DControls.click();
- await expect(
- page.getByRole('button', {name: 'Scale Z', exact: true}),
- ).toBeVisible();
- await expect(
- page.getByRole('button', {name: 'Offset Z', exact: true}),
- ).toBeVisible();
- await page.getByTitle('Rotation', {exact: true}).click();
- await page.mouse.move(
- laterCompositionBox.x + laterCompositionBox.width / 2,
- laterCompositionBox.y + laterCompositionBox.height / 2,
- );
- await expect(canvasRotationSurface).toBeVisible();
- expect(
- await canvasRotationSurface.evaluate((surface) =>
- decodeURIComponent(surface.getAttribute('cursor') ?? ''),
- ),
- ).toContain('<svg width="29" height="30"');
- const threeDRotationSurfaceBox = await canvasRotationSurface.boundingBox();
- if (threeDRotationSurfaceBox === null) {
- throw new Error(
- '3D canvas rotation surface should have a visible layout',
- );
- }
-
- const threeDStartX =
- threeDRotationSurfaceBox.x + threeDRotationSurfaceBox.width * 0.25;
- const threeDStartY =
- threeDRotationSurfaceBox.y + threeDRotationSurfaceBox.height * 0.25;
- await page.mouse.move(threeDStartX, threeDStartY);
- await page.mouse.down();
- expect(
- await canvasRotationSurface.evaluate((surface) =>
- surface.ownerSVGElement === null
- ? null
- : getComputedStyle(surface.ownerSVGElement).cursor,
- ),
- ).toContain('data:image/svg+xml');
- await page.mouse.move(threeDStartX + 80, threeDStartY + 60, {steps: 5});
- await page.mouse.up();
- expect(
- await canvasRotationSurface.evaluate((surface) =>
- surface.ownerSVGElement === null
- ? null
- : getComputedStyle(surface.ownerSVGElement).cursor,
- ),
- ).not.toContain('data:image/svg+xml');
- await expect
- .poll(() => read2DTransformRotation()?.split(' ').length)
- .toBe(4);
- const scaleLabelBox = await page
- .getByTitle('Scale', {exact: true})
- .first()
- .boundingBox();
- const scaleXBox = await page
- .getByRole('button', {name: 'Scale X', exact: true})
- .first()
- .boundingBox();
- const scaleZBox = await page
- .getByRole('button', {name: 'Scale Z', exact: true})
- .first()
- .boundingBox();
- if (scaleLabelBox === null || scaleXBox === null || scaleZBox === null) {
- throw new Error('Scale controls should have a visible layout');
- }
- const offsetLabelBox = await page
- .getByTitle('Offset', {exact: true})
- .first()
- .boundingBox();
- const offsetX = page
- .getByRole('button', {name: 'Offset X', exact: true})
- .first();
- const offsetXBox = await offsetX.boundingBox();
- const offsetZ = page
- .getByRole('button', {name: 'Offset Z', exact: true})
- .first();
- const offsetZBox = await offsetZ.boundingBox();
- if (offsetLabelBox === null || offsetXBox === null || offsetZBox === null) {
- throw new Error('Offset controls should have a visible layout');
- }
-
- expect(
- scaleZBox.y - (scaleLabelBox.y + scaleLabelBox.height),
- ).toBeGreaterThanOrEqual(-1);
- expect(
- scaleZBox.y - (scaleLabelBox.y + scaleLabelBox.height),
- ).toBeLessThanOrEqual(1);
- expect(
- offsetZBox.y - (offsetLabelBox.y + offsetLabelBox.height),
- ).toBeGreaterThanOrEqual(-1);
- expect(
- offsetZBox.y - (offsetLabelBox.y + offsetLabelBox.height),
- ).toBeLessThanOrEqual(1);
- await expect(
- page.getByRole('button', {name: 'Rotation X', exact: true}).first(),
- ).toBeVisible();
- await expect(
- page.getByRole('button', {name: 'Rotation Y', exact: true}).first(),
- ).toBeVisible();
- await expect(
- page.getByRole('button', {name: 'Rotation Z', exact: true}).first(),
- ).toBeVisible();
- const rotationLabelBox = await page
- .getByTitle('Rotation', {exact: true})
- .first()
- .boundingBox();
- const rotationXBox = await page
- .getByRole('button', {name: 'Rotation X', exact: true})
- .first()
- .boundingBox();
- if (rotationLabelBox === null || rotationXBox === null) {
- throw new Error('Rotation controls should have a visible layout');
- }
-
- expect(
- rotationXBox.y - (rotationLabelBox.y + rotationLabelBox.height),
- ).toBeGreaterThanOrEqual(-1);
- expect(
- rotationXBox.y - (rotationLabelBox.y + rotationLabelBox.height),
- ).toBeLessThanOrEqual(1);
- expect(Math.abs(scaleXBox.x - rotationXBox.x)).toBeLessThanOrEqual(1);
- expect(Math.abs(scaleXBox.x - offsetXBox.x)).toBeLessThanOrEqual(1);
- await expect(
- page
- .getByRole('button', {name: 'Transform origin Z', exact: true})
- .first(),
- ).toBeVisible();
- await offsetZ.click();
- const offsetZInput = page.getByRole('textbox', {
- name: 'Offset Z',
- exact: true,
- });
- await offsetZInput.fill('25');
- await offsetZInput.press('Enter');
- await expect.poll(read2DTransformTranslate).toBe('0px 0px 25px');
- await expect(
- page.getByRole('button', {
- name: '3D controls are required by the current transform values',
- exact: true,
- }),
- ).toBeDisabled();
-
- const threeDTransformElement = page
- .locator('[title="3D transform"]')
- .first();
- await threeDTransformElement.click();
- await expect(
- page
- .getByRole('button', {
- name: '3D controls are required by the current transform values',
- exact: true,
- })
- .first(),
- ).toBeDisabled();
- await expect(
- page.getByRole('button', {name: 'Scale Z', exact: true}).first(),
- ).toBeVisible();
- await expect(
- page.getByRole('button', {name: 'Rotation X', exact: true}).first(),
- ).not.toContainText('X ');
- await page.getByTitle('Rotation', {exact: true}).click();
- const rotationX = page
- .getByRole('button', {name: 'Rotation X', exact: true})
- .first();
- const rotationY = page
- .getByRole('button', {name: 'Rotation Y', exact: true})
- .first();
- const rotationZ = page
- .getByRole('button', {name: 'Rotation Z', exact: true})
- .first();
- const rotationXBefore = await rotationX.textContent();
- const rotationYBefore = await rotationY.textContent();
- const rotationZBefore = await rotationZ.textContent();
- const sourceRotationBefore = read3DTransformRotation();
- await page.locator('[title="3D transform"]').last().hover();
- const getRotationCornerCenter = async (
- corner: 'top-left' | 'top-right' | 'bottom-right' | 'bottom-left',
- ) => {
- const box = await page
- .locator(
- `[data-remotion-studio-rotation-corner="${corner}"][data-remotion-studio-rotation-corner-contains-selection="true"]`,
- )
- .first()
- .boundingBox();
- if (box === null) {
- throw new Error(`The ${corner} rotation corner should be visible`);
- }
-
- return {x: box.x + box.width / 2, y: box.y + box.height / 2};
- };
- const [topLeft, topRight, bottomRight, bottomLeft] = await Promise.all([
- getRotationCornerCenter('top-left'),
- getRotationCornerCenter('top-right'),
- getRotationCornerCenter('bottom-right'),
- getRotationCornerCenter('bottom-left'),
- ]);
- const topEdgeLength = Math.hypot(
- topRight.x - topLeft.x,
- topRight.y - topLeft.y,
- );
- const bottomEdgeLength = Math.hypot(
- bottomRight.x - bottomLeft.x,
- bottomRight.y - bottomLeft.y,
- );
- expect(Math.abs(topEdgeLength - bottomEdgeLength)).toBeGreaterThan(1);
- const selectedRotationCorner = page
- .locator(
- '[data-remotion-studio-rotation-corner="top-right"][data-remotion-studio-rotation-corner-contains-selection="true"]',
- )
- .first();
- await expect(selectedRotationCorner).toBeVisible();
- const selectedRotationCornerBox =
- await selectedRotationCorner.boundingBox();
- if (selectedRotationCornerBox === null) {
- throw new Error('Selected rotation corner should have a visible layout');
- }
-
- const cornerX =
- selectedRotationCornerBox.x + selectedRotationCornerBox.width / 2;
- const cornerY =
- selectedRotationCornerBox.y + selectedRotationCornerBox.height / 2;
- expect(
- await page.evaluate(
- ({x, y}) =>
- document
- .elementFromPoint(x, y)
- ?.getAttribute('data-remotion-studio-rotation-corner') ?? null,
- {x: cornerX, y: cornerY},
- ),
- ).toBe('top-right');
- await selectedRotationCorner.dispatchEvent('pointerdown', {
- button: 0,
- buttons: 1,
- clientX: cornerX,
- clientY: cornerY,
- pointerId: 1,
- });
- await page.evaluate(
- ({x, y}) => {
- window.dispatchEvent(
- new PointerEvent('pointermove', {
- buttons: 1,
- clientX: x + 60,
- clientY: y + 40,
- pointerId: 1,
- }),
- );
- window.dispatchEvent(
- new PointerEvent('pointerup', {
- button: 0,
- buttons: 0,
- clientX: x + 60,
- clientY: y + 40,
- pointerId: 1,
- }),
- );
- },
- {x: cornerX, y: cornerY},
- );
- await expect.poll(read3DTransformRotation).not.toBe(sourceRotationBefore);
- await expect
- .poll(() => read3DTransformRotation()?.split(' ').length)
- .toBe(4);
- await expect(rotationX).toHaveText(rotationXBefore ?? '');
- await expect(rotationY).toHaveText(rotationYBefore ?? '');
- await expect(rotationZ).not.toHaveText(rotationZBefore ?? '');
- await expect
- .poll(async () => {
- const [nextTopLeft, nextTopRight] = await Promise.all([
- getRotationCornerCenter('top-left'),
- getRotationCornerCenter('top-right'),
- ]);
- return Math.abs(nextTopLeft.y - nextTopRight.y);
- })
- .toBeGreaterThan(1);
- });
-});
diff --git a/packages/example/e2e/sequence-shift-keyframes.test.mts b/packages/example/e2e/sequence-shift-keyframes.test.mts
deleted file mode 100644
index b6fc32dcf0..0000000000
--- a/packages/example/e2e/sequence-shift-keyframes.test.mts
+++ /dev/null
@@ -1,105 +0,0 @@
-import fs from 'fs';
-import path from 'path';
-import {expect, test} from '@playwright/test';
-import {EXPANDED_SIDEBAR_STATE, STUDIO_URL, exampleDir} from './constants.mts';
-import {startStudio, stopStudio} from './studio-server.mts';
-
-test.use({storageState: EXPANDED_SIDEBAR_STATE});
-
-const sequenceShiftFile = path.join(
- exampleDir,
- 'src',
- 'VisualModeTests',
- 'SequenceShiftRepro.tsx',
-);
-
-test.describe('moving sequence keyframes', () => {
- let sourceBefore: string;
-
- test.beforeEach(async () => {
- sourceBefore = fs.readFileSync(sequenceShiftFile, 'utf-8');
- await startStudio();
- });
-
- test.afterEach(async () => {
- await stopStudio();
- fs.writeFileSync(sequenceShiftFile, sourceBefore);
- });
-
- test('moves nested outer-clock descendant keyframes without double-shifting local-clock descendants', async ({
- page,
- }) => {
- await page.goto(`${STUDIO_URL}/sequence-shift-repro`);
- await page.waitForFunction(
- () => !document.body.innerText.includes('Loading...'),
- {timeout: 30_000},
- );
- await page.keyboard.press('g');
- const currentFrameInput = page.locator('input:focus');
- await expect(currentFrameInput).toBeVisible();
- await currentFrameInput.fill('22');
- await currentFrameInput.press('Enter');
- await expect(
- page.locator(
- '[data-timeline-marquee-item][title="Outer frame descendant"]',
- ),
- ).toBeVisible({timeout: 15_000});
- await expect(
- page.locator(
- '[data-timeline-marquee-item][title="Nested outer frame descendant"]',
- ),
- ).toBeVisible({timeout: 15_000});
- const getTranslateX = (backgroundColor: string) =>
- page.evaluate((color) => {
- const element = [...document.querySelectorAll('div')].find(
- (candidate) => getComputedStyle(candidate).backgroundColor === color,
- );
- if (element === undefined) {
- throw new Error(`Could not find the element with color ${color}`);
- }
-
- return Number.parseFloat(getComputedStyle(element).translate);
- }, backgroundColor);
- const getOuterTranslateX = () => getTranslateX('rgb(30, 144, 255)');
- const getNestedOuterTranslateX = () => getTranslateX('rgb(255, 105, 180)');
- await expect.poll(getOuterTranslateX).toBeCloseTo(250, 3);
- await expect.poll(getNestedOuterTranslateX).toBeCloseTo(210, 3);
-
- const parent = page.locator(
- '[data-timeline-marquee-item][title="<AbsoluteFill>"]',
- );
- await expect(parent).toBeVisible({timeout: 15_000});
- const box = await parent.boundingBox();
- if (box === null) {
- throw new Error('Expected the parent sequence to have a bounding box');
- }
-
- await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2);
- await page.mouse.down();
- try {
- await page.mouse.move(
- box.x + box.width / 2 + box.width / 55,
- box.y + box.height / 2,
- {steps: 5},
- );
- await expect.poll(getOuterTranslateX).toBeCloseTo(200, 3);
- await expect.poll(getNestedOuterTranslateX).toBeCloseTo(180, 3);
- } finally {
- await page.mouse.up();
- }
- await expect
- .poll(() => fs.readFileSync(sequenceShiftFile, 'utf-8'))
- .toContain('from={6}');
- await expect.poll(getOuterTranslateX).toBeCloseTo(200, 3);
- await expect.poll(getNestedOuterTranslateX).toBeCloseTo(180, 3);
- const source = fs.readFileSync(sequenceShiftFile, 'utf-8');
- expect(source).toContain(
- "translate: interpolate(frame, [18, 28], ['0px 0px', '500px 0px']",
- );
- expect(source).toContain('opacity: interpolate(frame, [11, 21], [0, 1])');
- expect(source).toMatch(
- /translate: interpolate\(\s*frame,\s*\[16, 26\],\s*\['0px 0px', '300px 0px'\]/,
- );
- expect(source).toContain('opacity: interpolate(frame, [4, 14], [0, 1])');
- });
-});
diff --git a/packages/example/e2e/studio.test.mts b/packages/example/e2e/studio.test.mts
index 81239c0653..f099b11b1c 100644
--- a/packages/example/e2e/studio.test.mts
+++ b/packages/example/e2e/studio.test.mts
@@ -175,58 +175,6 @@ const dragCompositionSelectorItemToRoot = async ({
);
};
-const dropAssetOnCanvas = async ({
- assetPath,
- durationInSeconds,
- page,
-}: {
- assetPath: string;
- durationInSeconds: number;
- page: Page;
-}) => {
- const dragData = StudioProtocolInternals.makeDragData({
- type: 'asset',
- assetPath,
- durationInSeconds,
- height: null,
- width: null,
- });
- const canvas = page.locator('.remotion-studio-composition-container');
- await expect
- .poll(() =>
- canvas.evaluate((element, data) => {
- const rect = element.getBoundingClientRect();
- const dataTransfer = new DataTransfer();
- dataTransfer.setData(data.mimeType, data.payload);
- const event = new DragEvent('dragover', {
- bubbles: true,
- cancelable: true,
- clientX: rect.left + rect.width / 2,
- clientY: rect.top + rect.height / 2,
- dataTransfer,
- });
- element.dispatchEvent(event);
-
- return event.defaultPrevented;
- }, dragData),
- )
- .toBe(true);
- await canvas.evaluate((element, data) => {
- const rect = element.getBoundingClientRect();
- const dataTransfer = new DataTransfer();
- dataTransfer.setData(data.mimeType, data.payload);
- element.dispatchEvent(
- new DragEvent('drop', {
- bubbles: true,
- cancelable: true,
- clientX: rect.left + rect.width / 2,
- clientY: rect.top + rect.height / 2,
- dataTransfer,
- }),
- );
- }, dragData);
-};
-
const dropFile = async ({
base64,
fileName,
@@ -267,21 +215,6 @@ const dropFile = async ({
);
};
-const getVideoTag = (source: string, assetPath: string) => {
- const sourceIndex = source.indexOf(assetPath);
- if (sourceIndex === -1) {
- throw new Error(`Could not find ${assetPath} in source`);
- }
-
- const tagStart = source.lastIndexOf('<Video', sourceIndex);
- const tagEnd = source.indexOf('/>', sourceIndex);
- if (tagStart === -1 || tagEnd === -1) {
- throw new Error(`Could not find <Video> tag for ${assetPath}`);
- }
-
- return source.slice(tagStart, tagEnd + 2);
-};
-
test.describe('visual mode', () => {
test.beforeEach(async () => {
await startStudio();
@@ -1132,97 +1065,6 @@ test.describe('visual mode', () => {
}
});
- test('should only open the editor from non-interactive inspector content', async ({
- page,
- }) => {
- await page.addInitScript(() => {
- window.localStorage.setItem(
- 'remotion.sidebarRightCollapsing',
- 'expanded',
- );
- Object.defineProperty(window, 'remotion_editorName', {
- configurable: true,
- get: () => 'Test editor',
- set: () => undefined,
- });
- });
- await page.route('**/api/default-editor-info', async (route) => {
- await route.fulfill({
- json: {
- success: true,
- data: {
- defaultEditor: 'vscode',
- installedEditors: [
- {
- id: 'vscode',
- name: 'Test editor',
- nameWithType: 'Test editor',
- },
- ],
- },
- },
- });
- });
- const openInEditorRequests: unknown[] = [];
- await page.route('**/api/open-in-editor', async (route) => {
- openInEditorRequests.push(route.request().postDataJSON());
- await route.fulfill({
- json: {success: true, data: {success: true}},
- });
- });
-
- await page.goto(`${STUDIO_URL}/AnimatedBarChart`);
- const eyebrow = page.getByText('Eyebrow', {exact: true}).first();
- await expect(eyebrow).toBeVisible({timeout: 15_000});
- const textField = page.getByRole('textbox');
- await expect(async () => {
- await eyebrow.click();
- await expect(textField).toHaveValue('Performance overview', {
- timeout: 1_000,
- });
- }).toPass({timeout: 30_000});
-
- await page.getByTitle('Text', {exact: true}).dblclick();
- await expect.poll(() => openInEditorRequests.length).toBe(1);
- openInEditorRequests.length = 0;
-
- await textField.dblclick({position: {x: 20, y: 20}});
- await expect
- .poll(() =>
- textField.evaluate((element) =>
- element.value.slice(element.selectionStart, element.selectionEnd),
- ),
- )
- .toBe('overview');
- // Headless Chromium does not consistently emit dblclick after selecting text.
- await textField.dispatchEvent('dblclick');
- const numberDragger = page
- .locator('button.__remotion_input_dragger')
- .first();
- await expect(numberDragger).toBeVisible();
- await numberDragger.dispatchEvent('dblclick');
- const colorPicker = page.getByTitle('#8E9AB8', {exact: true});
- await expect(colorPicker).toBeVisible();
- await colorPicker.dispatchEvent('dblclick');
-
- await page.goto(`${STUDIO_URL}/effect-keyframe-e2e`);
- await page.waitForFunction(
- () => !document.body.innerText.includes('Loading...'),
- {timeout: 30_000},
- );
- const scaleEffectRow = page.getByText('scale()', {exact: true});
- await expect(async () => {
- await page.getByTitle('Scale precision', {exact: true}).first().click();
- await expect(scaleEffectRow).toBeVisible({timeout: 1_000});
- }).toPass({timeout: 15_000});
- await scaleEffectRow.click();
- const horizontalCheckbox = page.locator('input[name="horizontal"]');
- await expect(horizontalCheckbox).toBeVisible();
- await horizontalCheckbox.dispatchEvent('dblclick');
- await page.waitForTimeout(100);
- expect(openInEditorRequests).toEqual([]);
- });
-
test('should preserve property selection while dragging its outline', async ({
page,
}) => {
@@ -1933,423 +1775,6 @@ test.describe('visual mode', () => {
}
});
- test('settings reuse reactive runtime config and license toggle', async ({
- page,
- }) => {
- test.setTimeout(120_000);
- const configFile = path.join(exampleDir, 'remotion.config.ts');
- const configBeforeTest = fs.readFileSync(configFile, 'utf8');
- let editorInfoRequests = 0;
- let codingAgentInfoRequests = 0;
- let updateConfigRequests = 0;
- page.on('request', (request) => {
- if (new URL(request.url()).pathname === '/api/update-config') {
- updateConfigRequests++;
- }
- });
- await page.route('**/api/default-editor-info', async (route) => {
- editorInfoRequests++;
- await route.fulfill({
- json: {
- success: true,
- data: {
- defaultEditor: null,
- installedEditors: [
- {id: 'vscode', name: 'Code', nameWithType: 'Code'},
- {
- id: 'cursor',
- name: 'Cursor',
- nameWithType: 'Cursor Editor',
- },
- ],
- },
- },
- });
- });
- await page.route('**/api/default-coding-agent-info', async (route) => {
- codingAgentInfoRequests++;
- await route.fulfill({
- json: {
- success: true,
- data: {
- defaultCodingAgent: null,
- installedCodingAgents: [
- {
- id: 'codex',
- name: 'Codex',
- nameWithType: 'Codex',
- },
- ],
- installedTerminals: [{id: 'ghostty', name: 'Ghostty'}],
- },
- },
- });
- });
- await page.route('**/api/remotion-skills-info', async (route) => {
- await route.fulfill({
- json: {
- success: true,
- data: {
- remotionUpgradeSkillAvailable: false,
- remotionInteractivitySkillAvailable: false,
- skills: [
- {
- name: 'remotion-best-practices',
- installedInProject: true,
- installedGlobally: false,
- },
- {
- name: 'remotion-captions',
- installedInProject: false,
- installedGlobally: false,
- },
- {
- name: 'remotion-create',
- installedInProject: false,
- installedGlobally: false,
- },
- {
- name: 'remotion-docs',
- installedInProject: false,
- installedGlobally: true,
- },
- {
- name: 'remotion-interactivity',
- installedInProject: false,
- installedGlobally: false,
- },
- {
- name: 'remotion-maps',
- installedInProject: false,
- installedGlobally: false,
- },
- {
- name: 'remotion-markup',
- installedInProject: false,
- installedGlobally: false,
- },
- {
- name: 'remotion-multimedia',
- installedInProject: false,
- installedGlobally: false,
- },
- {
- name: 'remotion-render',
- installedInProject: false,
- installedGlobally: false,
- },
- {
- name: 'remotion-saas',
- installedInProject: false,
- installedGlobally: false,
- },
- {
- name: 'remotion-studio',
- installedInProject: false,
- installedGlobally: false,
- },
- {
- name: 'remotion-upgrade',
- installedInProject: false,
- installedGlobally: false,
- },
- ],
- },
- },
- });
- });
- try {
- await page.goto(`${STUDIO_URL}/schema-test`);
- await page.locator('[data-sidebar-toggle="right"]').click();
- await expect(
- page.getByRole('group', {name: 'Inspector source location'}).first(),
- ).toBeVisible({timeout: 15_000});
- await expect
- .poll(() => ({codingAgentInfoRequests, editorInfoRequests}))
- .toEqual({codingAgentInfoRequests: 1, editorInfoRequests: 1});
-
- fs.writeFileSync(
- configFile,
- `${configBeforeTest}\nConfig.setDefaultEditor('cursor');\nConfig.setDefaultCodingAgent('codex');\nConfig.setPublicLicenseKey('free-license');\n`,
- );
- await expect
- .poll(() => fs.readFileSync(configFile, 'utf8'))
- .toContain("Config.setDefaultEditor('cursor');");
-
- await page.getByRole('button', {name: /Search\.\.\./}).click();
- const quickSwitcher = page.getByRole('dialog');
- await quickSwitcher.getByRole('textbox').fill('> Settings');
- await quickSwitcher.getByText('Settings...', {exact: true}).click();
- const dialog = page.getByRole('dialog');
- await dialog.getByRole('button', {name: 'Defaults', exact: true}).click();
- await expect(
- dialog.getByText('Default codec', {exact: true}),
- ).toBeVisible();
- await expect(
- dialog.getByText('Output location', {exact: true}),
- ).toHaveCount(0);
- await expect(
- dialog.getByText('Audio bitrate', {exact: true}),
- ).toHaveCount(0);
- const stillImageFormat = dialog.getByTitle('Still image format', {
- exact: true,
- });
- await expect(stillImageFormat).toHaveText('Default (PNG)');
- await stillImageFormat.click();
- await page.getByRole('button', {name: 'JPEG', exact: true}).click();
- await expect
- .poll(() => fs.readFileSync(configFile, 'utf8'))
- .toContain("Config.setStillImageFormat('jpeg');");
- await expect(stillImageFormat).toHaveText('JPEG');
- await stillImageFormat.click();
- await page
- .getByRole('button', {
- name: 'Default (PNG)',
- exact: true,
- })
- .last()
- .click();
- await expect
- .poll(() => fs.readFileSync(configFile, 'utf8'))
- .not.toContain('Config.setStillImageFormat');
- await expect(stillImageFormat).toHaveText('Default (PNG)');
- const audioCodec = dialog.getByTitle('Audio codec', {exact: true});
- await expect(audioCodec).toHaveText('Default (Automatic)');
- await audioCodec.click();
- const automaticAudioCodec = page
- .getByRole('button', {
- name: 'Default (Automatic)',
- exact: true,
- })
- .last();
- const aacAudioCodec = page
- .getByRole('button', {
- name: 'AAC',
- exact: true,
- })
- .last();
- await expect(automaticAudioCodec.getByRole('img')).toHaveCount(1);
- await expect(aacAudioCodec.getByRole('img')).toHaveCount(0);
- await aacAudioCodec.click();
- await expect
- .poll(() => fs.readFileSync(configFile, 'utf8'))
- .toContain("Config.setAudioCodec('aac');");
- await expect(audioCodec).toHaveText('AAC');
- await audioCodec.click();
- await expect(automaticAudioCodec.getByRole('img')).toHaveCount(0);
- await expect(aacAudioCodec.getByRole('img')).toHaveCount(1);
- await automaticAudioCodec.click();
- await expect
- .poll(() => fs.readFileSync(configFile, 'utf8'))
- .not.toContain('Config.setAudioCodec');
- await expect(audioCodec).toHaveText('Default (Automatic)');
- await dialog.getByText('Studio', {exact: true}).click();
- for (const setting of [
- 'Ask AI enabled',
- 'Interactivity enabled',
- 'Audio latency hint',
- 'Number of shared audio tags',
- 'Beep on finish',
- 'Bundler',
- 'Cross-site isolation',
- 'Log level',
- ]) {
- await expect(dialog.getByText(setting, {exact: true})).toBeVisible();
- }
- await expect(
- dialog.getByRole('button', {name: 'Number of shared audio tags'}),
- ).toBeVisible();
- await dialog
- .getByRole('button', {name: 'Shortcuts', exact: true})
- .click();
- await expect(
- dialog.getByText('Keyboard shortcuts', {exact: true}),
- ).toBeVisible();
- const keyboardShortcutsEnabled = dialog.getByRole('checkbox', {
- name: 'Keyboard shortcuts',
- });
- await expect(keyboardShortcutsEnabled).toBeChecked();
- await keyboardShortcutsEnabled.uncheck();
- await expect(
- dialog.getByRole('list', {name: 'Playback', exact: true}),
- ).toHaveCount(0);
- await expect
- .poll(() => fs.readFileSync(configFile, 'utf8'))
- .toContain('Config.setKeyboardShortcutsEnabled(false);');
- await keyboardShortcutsEnabled.check();
- await expect
- .poll(() => fs.readFileSync(configFile, 'utf8'))
- .not.toContain('Config.setKeyboardShortcutsEnabled');
- await expect(
- dialog.getByRole('list', {name: 'Playback', exact: true}),
- ).toBeVisible();
- const fixedShortcutRow = dialog
- .getByRole('listitem')
- .filter({hasText: '1 second back'});
- await expect(fixedShortcutRow.getByRole('button')).toHaveCount(0);
- const playPauseShortcut = dialog.getByRole('button', {
- name: 'Change shortcut for Play / Pause',
- });
- const playPauseActions = dialog.getByRole('button', {
- name: 'Actions for Play / Pause',
- });
- await expect(playPauseActions).toBeVisible();
- await playPauseActions.click();
- await page.getByText('Remap shortcut', {exact: true}).click();
- await expect(playPauseShortcut).toContainText('Press shortcut');
- await expect(playPauseShortcut).toBeFocused();
- await page.keyboard.press('q');
- await expect
- .poll(() => fs.readFileSync(configFile, 'utf8'))
- .toContain('Config.setKeyboardShortcuts({');
- await expect(playPauseShortcut).toContainText('Q');
- await playPauseActions.click();
- await expect(
- page.getByText('Reset to default', {exact: true}),
- ).toBeVisible();
- await page.getByText('Remap shortcut', {exact: true}).click();
- await expect(playPauseShortcut).toContainText('Press shortcut');
- await expect(playPauseShortcut).toBeFocused();
- await page.keyboard.press('Space');
- await expect
- .poll(() => fs.readFileSync(configFile, 'utf8'))
- .not.toContain("'playPause'");
- await expect(playPauseShortcut).toContainText('Space');
- await dialog.getByRole('button', {name: 'Studio', exact: true}).click();
-
- const askAIEnabled = dialog.getByRole('checkbox', {
- name: 'Ask AI enabled',
- });
- await expect(askAIEnabled).toBeChecked();
- await askAIEnabled.uncheck();
- await expect
- .poll(() => fs.readFileSync(configFile, 'utf8'))
- .toContain('Config.setAskAIEnabled(false);');
- await askAIEnabled.check();
- await expect
- .poll(() => fs.readFileSync(configFile, 'utf8'))
- .not.toContain('Config.setAskAIEnabled');
-
- const numberOfSharedAudioTags = dialog.getByRole('button', {
- name: 'Number of shared audio tags',
- });
- await numberOfSharedAudioTags.scrollIntoViewIfNeeded();
- const numberOfSharedAudioTagsBounds =
- await numberOfSharedAudioTags.boundingBox();
- expect(numberOfSharedAudioTagsBounds).not.toBeNull();
- const requestsBeforeDrag = updateConfigRequests;
- await page.mouse.move(
- numberOfSharedAudioTagsBounds!.x +
- numberOfSharedAudioTagsBounds!.width / 2,
- numberOfSharedAudioTagsBounds!.y +
- numberOfSharedAudioTagsBounds!.height / 2,
- );
- await page.mouse.down();
- for (let step = 1; step <= 6; step++) {
- await page.mouse.move(
- numberOfSharedAudioTagsBounds!.x +
- numberOfSharedAudioTagsBounds!.width / 2 +
- step * 3,
- numberOfSharedAudioTagsBounds!.y +
- numberOfSharedAudioTagsBounds!.height / 2,
- );
- await page.waitForTimeout(80);
- }
- expect(updateConfigRequests).toBe(requestsBeforeDrag);
- await page.mouse.up();
- await expect
- .poll(() => updateConfigRequests)
- .toBe(requestsBeforeDrag + 1);
- await page.waitForTimeout(500);
- expect(updateConfigRequests).toBe(requestsBeforeDrag + 1);
- await expect
- .poll(() => fs.readFileSync(configFile, 'utf8'))
- .toContain('Config.setNumberOfSharedAudioTags(');
- await dialog.getByTitle('Use default (0)', {exact: true}).click();
- await expect
- .poll(() => fs.readFileSync(configFile, 'utf8'))
- .not.toContain('Config.setNumberOfSharedAudioTags');
- await expect(numberOfSharedAudioTags).toHaveText('Default (0)');
-
- await dialog.getByText('Skills', {exact: true}).click();
- await expect(
- dialog.getByText(
- 'Not all skills are installed. Run this command in the project directory, then reload Studio and restart your coding agent.',
- {exact: true},
- ),
- ).toBeVisible();
- await expect(
- dialog.getByText('/remotion-best-practices', {exact: true}),
- ).toBeVisible();
- await expect(
- dialog.getByText('/remotion-docs', {exact: true}),
- ).toBeVisible();
- await expect(
- dialog.getByText('/remotion-studio', {exact: true}),
- ).toBeVisible();
- await expect(dialog.getByText('Project', {exact: true})).toBeVisible();
- await expect(dialog.getByText('Global', {exact: true})).toBeVisible();
- await expect(
- dialog.getByText('Not installed', {exact: true}).first(),
- ).toBeVisible();
- await expect(
- dialog.getByText('npx remotion skills add', {exact: true}),
- ).toBeVisible();
- await expect(
- dialog.getByRole('button', {name: 'Copy install command'}),
- ).toBeVisible();
- const skillsList = dialog.getByRole('list', {
- name: 'Remotion Agent Skills',
- });
- const skillsScrollContainer = skillsList.locator('..').locator('..');
- await skillsScrollContainer.evaluate((element) => {
- element.scrollTop = element.scrollHeight;
- });
- const skillsScrollContainerBounds =
- await skillsScrollContainer.boundingBox();
- const lastSkillBounds = await skillsList
- .getByRole('listitem')
- .last()
- .boundingBox();
- expect(
- skillsScrollContainerBounds!.y +
- skillsScrollContainerBounds!.height -
- (lastSkillBounds!.y + lastSkillBounds!.height),
- ).toBeGreaterThanOrEqual(16);
- await expect(
- dialog.getByText('Changes save to', {exact: false}),
- ).toBeVisible();
-
- await dialog.getByText('Apps', {exact: true}).click();
- await expect(
- dialog.getByTitle('Default editor', {exact: true}),
- ).toHaveText('Cursor');
- await expect(
- dialog.getByTitle('Default coding agent', {exact: true}),
- ).toContainText('Codex');
- await dialog.getByText('License', {exact: true}).click();
- const freeLicenseToggle = dialog.getByRole('radio', {
- name: 'I am eligible for the Free License',
- });
- await expect(freeLicenseToggle).toBeChecked();
- expect({codingAgentInfoRequests, editorInfoRequests}).toEqual({
- codingAgentInfoRequests: 1,
- editorInfoRequests: 1,
- });
- await freeLicenseToggle.click();
- await expect
- .poll(() => fs.readFileSync(configFile, 'utf8'))
- .not.toContain('Config.setPublicLicenseKey');
- await page.mouse.move(10, 100);
- await page.mouse.down();
- await page.mouse.move(13, 101);
- await page.mouse.up();
- await expect(dialog).toBeHidden();
- } finally {
- fs.writeFileSync(configFile, configBeforeTest);
- }
- });
-
test('should collapse programmatically duplicated timeline rows', async ({
page,
}) => {
@@ -2492,113 +1917,6 @@ export const SequenceShiftRepro = () => {
}
});
- test('should apply timeline context menu actions to multiple selected sequences', async ({
- page,
- }) => {
- const sourceBefore = fs.readFileSync(sequenceShiftFile, 'utf-8');
-
- try {
- await page.goto(`${STUDIO_URL}/sequence-shift-repro`);
- await page.waitForFunction(
- () => !document.body.innerText.includes('Loading...'),
- {timeout: 30_000},
- );
- await page.keyboard.press('g');
- const currentFrameInput = page.locator('input:focus');
- await currentFrameInput.fill('22');
- await currentFrameInput.press('Enter');
- const outer = page.getByText('Outer frame descendant', {exact: true});
- const local = page.getByText('Local frame descendant', {exact: true});
- const localBar = page.locator(
- '[data-timeline-marquee-item][title="Local frame descendant"]',
- );
- await expect(outer).toBeVisible({timeout: 15_000});
- await expect(local).toBeVisible();
-
- await outer.click();
- await local.click({modifiers: ['Meta']});
- await localBar.click({button: 'right'});
- await expect(outer.locator('../../..')).toHaveCSS(
- 'background-color',
- 'rgb(59, 63, 66)',
- );
- await expect(
- page
- .locator('[data-remotion-menu-tree-id]')
- .last()
- .getByRole('button', {
- name: 'Duplicate selected',
- exact: true,
- }),
- ).toBeVisible();
- await page.keyboard.press('Escape');
- await local.click({button: 'right'});
- await expect(outer.locator('../../..')).toHaveCSS(
- 'background-color',
- 'rgb(59, 63, 66)',
- );
-
- const contextMenu = page.locator('[data-remotion-menu-tree-id]').last();
- await expect(
- contextMenu.getByRole('button', {
- name: 'Duplicate selected',
- exact: true,
- }),
- ).toBeVisible();
- await contextMenu
- .getByRole('button', {name: 'Delete selected', exact: true})
- .click();
-
- await expect
- .poll(() => {
- const source = fs.readFileSync(sequenceShiftFile, 'utf-8');
- return [
- source.includes('name="Outer frame descendant"'),
- source.includes('name="Local frame descendant"'),
- ];
- })
- .toEqual([false, false]);
-
- await expect(outer).toBeHidden();
- await expect(local).toBeHidden();
- fs.writeFileSync(sequenceShiftFile, sourceBefore);
- await expect(outer).toBeVisible({timeout: 15_000});
- const nestedParent = page.getByText('Nested timing parent', {
- exact: true,
- });
- await expect(nestedParent).toBeVisible();
-
- await outer.click();
- await nestedParent.click({modifiers: ['Meta']});
- await nestedParent.click({button: 'right'});
- await page
- .locator('[data-remotion-menu-tree-id]')
- .last()
- .getByRole('button', {name: 'Duplicate selected', exact: true})
- .click();
-
- await expect
- .poll(() => {
- const source = fs.readFileSync(sequenceShiftFile, 'utf-8');
- return [
- source.match(/name="Outer frame descendant-copy"/g)?.length ?? 0,
- source.match(/name="Nested timing parent-copy"/g)?.length ?? 0,
- source.match(/name="Outer frame descendant-copy-copy"/g)?.length ??
- 0,
- source.match(/<LocalFrameDescendant \/>/g)?.length ?? 0,
- ];
- })
- .toEqual([1, 1, 0, 1]);
-
- await page.keyboard.press('ControlOrMeta+z');
- await expect
- .poll(() => fs.readFileSync(sequenceShiftFile, 'utf-8'))
- .toBe(sourceBefore);
- } finally {
- fs.writeFileSync(sequenceShiftFile, sourceBefore);
- }
- });
-
test('should keep selected canvas outlines visible outside the canvas', async ({
page,
}) => {
@@ -4620,115 +3938,6 @@ export const SequenceShiftRepro = () => {
await expect(currentTime).not.toHaveAttribute('aria-label', '0');
});
- test('should preview and place Canvas drops at the playhead', async ({
- page,
- }) => {
- test.setTimeout(90_000);
- await page.goto(`${STUDIO_URL}/effect-keyframe-e2e`);
- await expect(
- page.getByRole('button', {name: '0', exact: true}),
- ).toBeVisible({timeout: 15_000});
-
- const dragData = StudioProtocolInternals.makeDragData({
- type: 'element',
- dependencies: [],
- dimensions: {width: 320, height: 120},
- displayName: 'Drop Preview',
- durationInFrames: 30,
- slug: 'drop-preview',
- sourceCode: 'export const DropPreview = () => null;',
- });
- const canvas = page.locator('.remotion-studio-composition-container');
- await expect
- .poll(() =>
- canvas.evaluate((element, data) => {
- const rect = element.getBoundingClientRect();
- const dataTransfer = new DataTransfer();
- dataTransfer.setData(data.mimeType, data.payload);
- const event = new DragEvent('dragover', {
- bubbles: true,
- cancelable: true,
- clientX: rect.left + rect.width / 2,
- clientY: rect.top + rect.height / 2,
- dataTransfer,
- });
- element.dispatchEvent(event);
-
- return event.defaultPrevented;
- }, dragData),
- )
- .toBe(true);
-
- const preview = page.getByTestId('composition-drop-preview');
- await expect(preview).toBeVisible();
- const canvasBox = await canvas.boundingBox();
- const previewBox = await preview.boundingBox();
- if (canvasBox === null || previewBox === null) {
- throw new Error('Expected the Canvas and Element preview to have boxes');
- }
-
- expect(previewBox.width / previewBox.height).toBeCloseTo(320 / 120, 2);
- expect(
- Math.abs(
- previewBox.x +
- previewBox.width / 2 -
- (canvasBox.x + canvasBox.width / 2),
- ),
- ).toBeLessThan(1);
- expect(
- Math.abs(
- previewBox.y +
- previewBox.height / 2 -
- (canvasBox.y + canvasBox.height / 2),
- ),
- ).toBeLessThan(1);
-
- await page.evaluate(() => {
- document.dispatchEvent(new DragEvent('dragend', {bubbles: true}));
- });
- await expect(preview).toBeHidden();
-
- if (!(await page.getByRole('button', {name: 'Inspector'}).isVisible())) {
- await page.locator('[data-sidebar-toggle="right"]').click();
- }
-
- await page.locator('[data-timeline-scrubber]').click();
- await expect(
- page.getByRole('button', {name: '45', exact: true}),
- ).toBeVisible();
-
- await dropAssetOnCanvas({
- assetPath: 'quick.mov',
- durationInSeconds: 5.866667,
- page,
- });
- await expect
- .poll(() => fs.readFileSync(effectKeyframeE2eFile, 'utf-8'))
- .toContain('quick.mov');
- await expect(
- page.getByRole('group', {name: 'Inspector source location'}).first(),
- ).toContainText('<Video>', {timeout: 15_000});
- const longVideoTag = getVideoTag(
- fs.readFileSync(effectKeyframeE2eFile, 'utf-8'),
- 'quick.mov',
- );
- expect(longVideoTag).not.toContain('from=');
-
- await dropAssetOnCanvas({
- assetPath: 'drums-drumsticks.mp4',
- durationInSeconds: 0.85,
- page,
- });
- await expect
- .poll(() => fs.readFileSync(effectKeyframeE2eFile, 'utf-8'))
- .toContain('drums-drumsticks.mp4');
- const shortVideoTag = getVideoTag(
- fs.readFileSync(effectKeyframeE2eFile, 'utf-8'),
- 'drums-drumsticks.mp4',
- );
- expect(shortVideoTag).toContain('from={45}');
- });
-
test('should select an added composition before the codemod response arrives', async ({
page,
}) => {
diff --git a/packages/example/e2e/transcription-modal.test.mts b/packages/example/e2e/transcription-modal.test.mts
deleted file mode 100644
index 10a5328cfe..0000000000
--- a/packages/example/e2e/transcription-modal.test.mts
+++ /dev/null
@@ -1,263 +0,0 @@
-import {expect, test} from '@playwright/test';
-import {EXPANDED_SIDEBAR_STATE, STUDIO_URL} from './constants.mts';
-import {startStudio, stopStudio} from './studio-server.mts';
-
-test.use({storageState: EXPANDED_SIDEBAR_STATE});
-
-test.describe('transcription modal', () => {
- test.beforeEach(async () => {
- await startStudio();
- });
-
- test.afterEach(async () => {
- await stopStudio();
- });
-
- test('supports video and audio assets and configures a Caption[] JSON output', async ({
- page,
- }) => {
- await page.addInitScript(() => {
- Object.defineProperty(navigator, 'gpu', {
- configurable: true,
- value: {requestAdapter: () => Promise.resolve({})},
- });
- });
- await page.goto(`${STUDIO_URL}/schema-test`);
- await expect(page).toHaveURL(/schema-test/, {timeout: 15_000});
- await page.waitForFunction(
- () => !document.body.innerText.includes('Loading...'),
- {timeout: 30_000},
- );
-
- await page.getByRole('button', {name: 'Assets', exact: true}).click();
- const assetSelector = page.locator('[data-asset-selector]');
- const video = assetSelector.getByTitle('vp8-vorbis.webm', {exact: true});
- const transcribe = page.getByRole('button', {
- name: 'Transcribe',
- exact: true,
- });
- await expect(async () => {
- await video.click();
- await expect(transcribe).toBeVisible({timeout: 1_000});
- }).toPass({timeout: 30_000});
- const actions = page
- .getByText('Actions', {exact: true})
- .locator('xpath=following-sibling::div[1]');
- await expect(actions.getByRole('button')).toHaveText([
- /^Show in (Finder|File Explorer|File Manager)$/,
- 'Transcribe',
- 'Separate foreground',
- 'Convert',
- 'Delete',
- ]);
- await page.evaluate(() => {
- window.remotion_installedPackages = [
- ...(window.remotion_installedPackages ?? []),
- '@remotion/video-matting',
- ];
- });
- await actions.getByRole('button', {name: 'Separate foreground'}).click();
- const mattingDialog = page.getByRole('dialog', {
- name: 'Track matting vp8-vorbis.webm',
- });
- await expect(
- mattingDialog.getByTitle('Model', {exact: true}),
- ).toContainText('ben2-base');
- await expect(
- mattingDialog.getByRole('button', {name: 'Separate'}).first(),
- ).toBeVisible();
- await mattingDialog.getByRole('button', {name: 'Models'}).click();
- await expect(
- mattingDialog
- .getByRole('list', {name: 'Video matting models'})
- .getByRole('listitem'),
- ).toHaveCount(2);
- await mattingDialog.getByRole('button', {name: 'Separate'}).last().click();
- await expect(
- mattingDialog.getByRole('textbox', {name: 'Base video output file'}),
- ).toHaveValue('vp8-vorbis-base.webm');
- await expect(
- mattingDialog.getByRole('textbox', {
- name: 'Foreground video output file',
- }),
- ).toHaveValue('vp8-vorbis-foreground.webm');
- await page.keyboard.press('Escape');
- await expect(mattingDialog).toBeHidden();
-
- await page.evaluate(() => {
- window.remotion_installedPackages = [
- ...(window.remotion_installedPackages ?? []),
- '@remotion/whisper-webgpu',
- '@huggingface/transformers',
- ];
- });
- await transcribe.click();
- const dialog = page.getByRole('dialog');
- const addToQueueButton = dialog
- .getByRole('button', {
- name: 'Transcribe',
- exact: true,
- })
- .first();
- await expect(dialog).toContainText('Transcribe vp8-vorbis.webm');
- await dialog.getByRole('button', {name: 'Models', exact: true}).click();
- await expect(
- dialog.getByText(
- 'Models are downloaded automatically when needed. You can also manage the browser cache here.',
- {exact: true},
- ),
- ).toBeVisible();
- await expect(dialog.getByText(/^Select/)).toHaveCount(0);
- await expect(
- dialog.getByRole('button', {name: 'Download tiny', exact: true}),
- ).toBeVisible();
- await expect(
- dialog.getByText('Output in public/', {exact: true}),
- ).not.toBeVisible();
- await dialog
- .getByRole('button', {name: 'Transcribe', exact: true})
- .last()
- .click();
- await expect(
- dialog.getByText('Whisper model', {exact: true}),
- ).toBeVisible();
- const model = dialog.getByTitle('Whisper model');
- await expect(model).toContainText('small.en');
- await expect(dialog.getByTitle('Task')).toHaveCount(0);
- await expect(dialog.getByRole('button', {name: /^Download /})).toHaveCount(
- 0,
- );
- await expect(addToQueueButton).toBeEnabled();
-
- await model.click();
- await page.getByRole('button', {name: /^tiny ·/}).click();
- await expect(model).toContainText('tiny ·');
- const task = dialog.getByRole('button', {
- name: 'Task: Transcribe',
- exact: true,
- });
- await task.click();
- await page
- .getByRole('button', {name: 'Task: Translate to English', exact: true})
- .click();
- await expect(
- dialog.getByRole('button', {
- name: 'Task: Translate to English',
- exact: true,
- }),
- ).toContainText('Translate to English');
- await expect(
- dialog.getByText(
- 'Word timings may be less accurate when translating to English.',
- {exact: true},
- ),
- ).toBeVisible();
- await expect(addToQueueButton).toBeEnabled();
-
- await dialog.getByRole('button', {name: 'Advanced', exact: true}).click();
- const chunkLength = dialog.getByRole('button', {
- name: /^Chunk length:/,
- });
- const strideLength = dialog.getByRole('button', {
- name: /^Stride length:/,
- });
- await expect(chunkLength).toHaveText('30s');
- await expect(strideLength).toHaveText('5s');
-
- const forceFullSequences = dialog.getByRole('checkbox', {
- name: 'Force full sequences',
- });
- const useSampling = dialog.getByRole('checkbox', {
- name: 'Use sampling',
- });
- const repetitionPenalty = dialog.getByRole('button', {
- name: /^Repetition penalty:/,
- });
- const noRepeatNgramSize = dialog.getByRole('button', {
- name: /^No-repeat n-gram size:/,
- });
- await expect(forceFullSequences).not.toBeChecked();
- await expect(useSampling).not.toBeChecked();
- await expect(
- dialog.getByRole('button', {name: /^Temperature:/}),
- ).toHaveCount(0);
- await expect(dialog.getByRole('button', {name: /^Top K:/})).toHaveCount(0);
- await expect(repetitionPenalty).toHaveText('1');
- await expect(noRepeatNgramSize).toHaveText('0');
-
- await forceFullSequences.check();
- await useSampling.check();
- const temperature = dialog.getByRole('button', {
- name: /^Temperature:/,
- });
- const topK = dialog.getByRole('button', {name: /^Top K:/});
- await expect(temperature).toHaveText('1');
- await expect(topK).toHaveText('50');
-
- await topK.click();
- const topKInput = dialog.getByRole('textbox', {name: /^Top K:/});
- await topKInput.fill('1.5');
- await expect(dialog).toContainText('Top K must be a non-negative integer');
- await expect(addToQueueButton).toBeDisabled();
- await topKInput.fill('25');
- await topKInput.press('Enter');
- await expect(topK).toHaveText('25');
- await expect(addToQueueButton).toBeEnabled();
-
- for (const [setting, inputName, value] of [
- [temperature, /^Temperature:/, '0.7'],
- [repetitionPenalty, /^Repetition penalty:/, '1.2'],
- [noRepeatNgramSize, /^No-repeat n-gram size:/, '3'],
- ] as const) {
- await setting.click();
- const input = dialog.getByRole('textbox', {
- name: inputName,
- });
- await input.fill(value);
- await input.press('Enter');
- await expect(setting).toHaveText(value);
- }
-
- await chunkLength.click();
- const chunkLengthInput = dialog.getByRole('textbox', {
- name: /^Chunk length:/,
- });
- await chunkLengthInput.fill('10');
- await chunkLengthInput.press('Enter');
- await expect(dialog).toContainText(
- 'Stride length must be less than half of chunk length',
- );
- await expect(addToQueueButton).toBeDisabled();
-
- await strideLength.click();
- const strideLengthInput = dialog.getByRole('textbox', {
- name: /^Stride length:/,
- });
- await strideLengthInput.fill('4');
- await strideLengthInput.press('Enter');
- await expect(addToQueueButton).toBeEnabled();
-
- await dialog
- .getByRole('button', {name: 'Transcribe', exact: true})
- .last()
- .click();
- await expect(
- dialog.getByText('Output in public/', {exact: true}),
- ).toBeVisible();
-
- const output = dialog.getByRole('textbox', {
- name: 'Caption output file',
- });
- await expect(output).toHaveValue('vp8-vorbis-captions.json');
- await output.fill('captions/new-video.json');
- await expect(output).toHaveValue('captions/new-video.json');
-
- await page.keyboard.press('Escape');
- await expect(dialog).toBeHidden();
- await assetSelector.getByTitle('sine.wav', {exact: true}).click();
- await expect(transcribe).toBeVisible();
- await transcribe.click();
- await expect(dialog).toContainText('Transcribe sine.wav');
- await page.keyboard.press('Escape');
- });
-});