Skip to content

🎥 Make videos programmatically with React

@remotion/example: Remove low-value E2E tests

Jonny Burgerb4fd5c570cfb
diff --git a/packages/example/e2e/font-weight-controls.test.mts b/packages/example/e2e/font-weight-controls.test.mts
deleted file mode 100644
index 8ed56c16bc..0000000000
--- a/packages/example/e2e/font-weight-controls.test.mts
+++ /dev/null
@@ -1,89 +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';
-
-const compositionFile = path.join(
- exampleDir,
- 'src',
- 'VisualModeTests',
- 'FontWeightControls.tsx',
-);
-
-test.use({storageState: EXPANDED_SIDEBAR_STATE});
-
-test.describe('font weight controls', () => {
- test.beforeEach(async () => {
- await startStudio();
- });
-
- test.afterEach(async () => {
- await stopStudio();
- });
-
- test('edits numeric, string, and keyword font weights without changing their types', async ({
- page,
- }) => {
- const originalSource = fs.readFileSync(compositionFile, 'utf-8');
-
- try {
- await page.goto(`${STUDIO_URL}/font-weight-controls`);
- await expect(page).toHaveURL(/font-weight-controls/, {timeout: 15_000});
-
- await page
- .locator('[data-timeline-marquee-item][title="Hundreds font weight"]')
- .click();
- const hundredsControl = page.getByRole('button', {
- name: '700',
- exact: true,
- });
- await expect(hundredsControl).toBeVisible();
- await hundredsControl.click();
- await page.locator('input[value="700"]').press('ArrowUp');
- await page.keyboard.press('Enter');
- await expect
- .poll(() => fs.readFileSync(compositionFile, 'utf-8'))
- .toContain('fontWeight: 800');
-
- await page
- .locator('[data-timeline-marquee-item][title="Numeric font weight"]')
- .click();
- const numericControl = page.getByRole('button', {
- name: '650',
- exact: true,
- });
- await expect(numericControl).toBeVisible();
- await numericControl.click();
- await page.locator('input[value="650"]').fill('450');
- await page.keyboard.press('Enter');
- await expect
- .poll(() => fs.readFileSync(compositionFile, 'utf-8'))
- .toContain('fontWeight: 450');
-
- await page
- .locator('[data-timeline-marquee-item][title="String font weight"]')
- .click();
- const stringControl = page.locator('input[value="650"]');
- await expect(stringControl).toBeVisible();
- await stringControl.fill('675');
- await page.keyboard.press('Enter');
- await expect
- .poll(() => fs.readFileSync(compositionFile, 'utf-8'))
- .toContain("fontWeight: '675'");
-
- await page
- .locator('[data-timeline-marquee-item][title="Keyword font weight"]')
- .click();
- const keywordControl = page.getByTitle('style.fontWeight');
- await expect(keywordControl).toContainText('bold');
- await keywordControl.click();
- await page.getByText('normal', {exact: true}).last().click();
- await expect
- .poll(() => fs.readFileSync(compositionFile, 'utf-8'))
- .toContain("fontWeight: 'normal'");
- } finally {
- fs.writeFileSync(compositionFile, originalSource);
- }
- });
-});
diff --git a/packages/example/e2e/inspector-control-layout.test.mts b/packages/example/e2e/inspector-control-layout.test.mts
deleted file mode 100644
index e43f273c08..0000000000
--- a/packages/example/e2e/inspector-control-layout.test.mts
+++ /dev/null
@@ -1,176 +0,0 @@
-import {expect, type Locator, test} from '@playwright/test';
-import {EXPANDED_SIDEBAR_STATE, STUDIO_URL} from './constants.mts';
-import {startStudio, stopStudio} from './studio-server.mts';
-
-const LONG_FONT_FAMILY =
- "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', Arial, sans-serif";
-
-test.use({storageState: EXPANDED_SIDEBAR_STATE});
-
-const getBox = async (locator: Locator) => {
- const box = await locator.boundingBox();
- expect(box).not.toBeNull();
- return box!;
-};
-
-const expectInspectorControlsToUseAvailableWidth = async (
- origin: Locator,
- destination: Locator,
- label: Locator,
- labelInput: Locator,
- routeColor: Locator,
- keyframeButton: Locator,
- colorButton: Locator,
-) => {
- const [
- originBox,
- destinationBox,
- labelBox,
- labelInputBox,
- routeColorBox,
- keyframeButtonBox,
- colorButtonBox,
- ] = await Promise.all([
- getBox(origin),
- getBox(destination),
- getBox(label),
- getBox(labelInput),
- getBox(routeColor),
- getBox(keyframeButton),
- getBox(colorButton),
- ]);
-
- for (const fieldBox of [
- destinationBox,
- labelBox,
- labelInputBox,
- routeColorBox,
- ]) {
- expect(Math.abs(fieldBox.x - originBox.x)).toBeLessThanOrEqual(2);
- }
-
- expect(keyframeButtonBox.x + keyframeButtonBox.width).toBeLessThanOrEqual(
- routeColorBox.x,
- );
- expect(routeColorBox.x + routeColorBox.width).toBeLessThan(colorButtonBox.x);
-};
-
-test.describe('Inspector control layout', () => {
- test.beforeEach(async () => {
- await startStudio();
- });
-
- test.afterEach(async () => {
- await stopStudio();
- });
-
- test('keeps inspector controls aligned', async ({page}) => {
- await page.goto(`${STUDIO_URL}/inspector-control-layout-e2e`);
- await expect(page).toHaveURL(/inspector-control-layout-e2e/, {
- timeout: 15_000,
- });
- await page.waitForFunction(
- () => !document.body.innerText.includes('Loading...'),
- {timeout: 30_000},
- );
-
- const sequence = page
- .getByText('Inspector control layout', {exact: true})
- .first();
- const origin = page.getByText('Origin [longitude, latitude]', {
- exact: true,
- });
- await expect(async () => {
- await sequence.click();
- await expect(origin).toBeVisible({timeout: 1_000});
- }).toPass({timeout: 30_000});
-
- const destination = page.getByText('Destination [longitude, latitude]', {
- exact: true,
- });
- const label = page.getByText('Origin label', {exact: true});
- const labelInput = page.getByRole('textbox');
- const routeColor = page.getByText('Route color', {exact: true});
- const keyframeButton = page
- .getByRole('button', {name: 'Add keyframe'})
- .first();
- const colorButton = page.getByRole('button', {name: '#ff5c4d'});
- const sourceAction = page.getByRole('button', {name: 'tablet.mp4'});
- const duplicateAction = page.getByRole('button', {
- name: 'Duplicate',
- exact: true,
- });
- const [sourceActionBox, duplicateActionBox] = await Promise.all([
- getBox(sourceAction),
- getBox(duplicateAction),
- ]);
- expect(
- Math.abs(sourceActionBox.x - duplicateActionBox.x),
- ).toBeLessThanOrEqual(1);
-
- await expectInspectorControlsToUseAvailableWidth(
- origin,
- destination,
- label,
- labelInput,
- routeColor,
- keyframeButton,
- colorButton,
- );
-
- await page.getByRole('button', {name: '-0.1276', exact: true}).click();
- await page.keyboard.press('Escape');
- await expectInspectorControlsToUseAvailableWidth(
- origin,
- destination,
- label,
- labelInput,
- routeColor,
- keyframeButton,
- colorButton,
- );
-
- const rightSplitter = page.locator('.remotion-splitter-vertical').last();
- const splitterBox = await getBox(rightSplitter);
- await page.mouse.move(
- splitterBox.x + splitterBox.width / 2,
- splitterBox.y + splitterBox.height / 2,
- );
- await page.mouse.down();
- await page.mouse.move(page.viewportSize()!.width - 250, splitterBox.y + 20);
- await page.mouse.up();
-
- await expectInspectorControlsToUseAvailableWidth(
- origin,
- destination,
- label,
- labelInput,
- routeColor,
- keyframeButton,
- colorButton,
- );
-
- const interactiveDiv = page
- .getByText('Computed font family', {exact: true})
- .first();
- const fontFamilyLabel = page.getByText('Font family', {exact: true});
- await expect(async () => {
- await interactiveDiv.click();
- await expect(fontFamilyLabel).toBeVisible({timeout: 1_000});
- }).toPass({timeout: 30_000});
-
- const computedFontFamily = page.getByText(LONG_FONT_FAMILY, {exact: true});
- const computedFontFamilyTooltip = page.getByTitle(LONG_FONT_FAMILY);
- await computedFontFamilyTooltip.hover();
- await expect(computedFontFamilyTooltip).toContainText(LONG_FONT_FAMILY);
- const fontSize = page.getByText('Font size', {exact: true});
- const [computedFontFamilyBox, fontSizeBox] = await Promise.all([
- getBox(computedFontFamily),
- getBox(fontSize),
- ]);
- expect(computedFontFamilyBox.height).toBeLessThanOrEqual(18);
- expect(
- computedFontFamilyBox.y + computedFontFamilyBox.height,
- ).toBeLessThanOrEqual(fontSizeBox.y);
- });
-});
diff --git a/packages/example/e2e/mixed-content-inspector.test.mts b/packages/example/e2e/mixed-content-inspector.test.mts
deleted file mode 100644
index 14dcf21fcc..0000000000
--- a/packages/example/e2e/mixed-content-inspector.test.mts
+++ /dev/null
@@ -1,31 +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('shows editable and computed text in the inspector', async ({page}) => {
- try {
- await startStudio();
- await page.goto(`${STUDIO_URL}/interactive-html-elements`);
- await expect(async () => {
- await page
- .locator('[data-timeline-marquee-item][title="Editable text"]')
- .click();
- await expect(page.getByRole('textbox')).toHaveValue(
- 'Editable text schema',
- {
- timeout: 1_000,
- },
- );
- }).toPass({timeout: 30_000});
- await expect(page.getByRole('textbox')).toBeEditable();
-
- await page
- .locator('[data-timeline-marquee-item][title="Mixed text (computed)"]')
- .click();
- await expect(page.getByText('computed', {exact: true})).toBeVisible();
- } finally {
- await stopStudio();
- }
-});
diff --git a/packages/example/e2e/rotation-keyframes.test.mts b/packages/example/e2e/rotation-keyframes.test.mts
deleted file mode 100644
index da1f68a0a8..0000000000
--- a/packages/example/e2e/rotation-keyframes.test.mts
+++ /dev/null
@@ -1,116 +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 rotationKeyframeFile = path.join(
- exampleDir,
- 'src',
- 'RotationKeyframeE2e.tsx',
-);
-
-const readRotationKeyframes = () => {
- const source = fs.readFileSync(rotationKeyframeFile, 'utf-8');
- const match =
- /rotate:\s*interpolate\(\s*frame,\s*\[([^\]]*)\],\s*\[([^\]]*)\]/.exec(
- source,
- );
- if (match === null) {
- throw new Error('Could not read rotation keyframes');
- }
-
- return {
- frames: match[1]
- .split(',')
- .map((frame) => Number(frame.trim()))
- .filter((frame) => !Number.isNaN(frame)),
- values: [...match[2].matchAll(/(['"])(.*?)\1/g)].map((value) => value[2]),
- };
-};
-
-test.describe('canvas rotation keyframes', () => {
- let sourceBefore: string;
-
- test.beforeEach(async () => {
- sourceBefore = fs.readFileSync(rotationKeyframeFile, 'utf-8');
- await startStudio();
- });
-
- test.afterEach(async () => {
- await stopStudio();
- fs.writeFileSync(rotationKeyframeFile, sourceBefore);
- });
-
- test('inserts and replaces keyframes in keyframed mode', async ({page}) => {
- await page.goto(`${STUDIO_URL}/rotation-keyframe-e2e`);
- await expect(page).toHaveURL(/rotation-keyframe-e2e/, {timeout: 15_000});
- await page.waitForFunction(
- () => !document.body.innerText.includes('Loading...'),
- {timeout: 30_000},
- );
-
- const keyframedRotation = page
- .getByTitle('Keyframed rotation', {exact: true})
- .first();
- const rotation = page.getByTitle('Rotation', {exact: true}).first();
- await expect(async () => {
- await keyframedRotation.click();
- await expect(rotation).toBeVisible({timeout: 1_000});
- }).toPass({timeout: 30_000});
- await rotation.click();
- const rotationSurface = page.locator(
- '[data-remotion-studio-canvas-rotation]',
- );
- await expect(rotationSurface).toBeVisible({timeout: 15_000});
- await page.getByTitle('Keyframe at frame 0', {exact: true}).first().click();
-
- await page.keyboard.press('g');
- const currentFrameInput = page.locator('input:focus');
- await expect(currentFrameInput).toBeVisible();
- await currentFrameInput.fill('10');
- await currentFrameInput.press('Enter');
-
- const dragRotationSurface = async (deltaX: number, deltaY: number) => {
- const point = await rotationSurface.evaluate((surface) => {
- const box = surface.getBoundingClientRect();
- for (let yIndex = 1; yIndex < 10; yIndex++) {
- for (let xIndex = 1; xIndex < 10; xIndex++) {
- const candidate = {
- x: box.x + (box.width * xIndex) / 10,
- y: box.y + (box.height * yIndex) / 10,
- };
- if (
- document
- .elementFromPoint(candidate.x, candidate.y)
- ?.closest('[data-remotion-studio-canvas-rotation]') === surface
- ) {
- return candidate;
- }
- }
- }
-
- throw new Error('Rotation surface should have an interactive point');
- });
- await page.mouse.move(point.x, point.y);
- await page.mouse.down();
- await page.mouse.move(point.x + deltaX, point.y + deltaY, {steps: 5});
- await page.mouse.up();
- };
-
- await dragRotationSurface(40, 30);
- await expect
- .poll(() => readRotationKeyframes().frames)
- .toEqual([0, 10, 30]);
- const firstValueAtFrame10 = readRotationKeyframes().values[1];
- expect(firstValueAtFrame10).toBeDefined();
-
- await dragRotationSurface(-30, 45);
- await expect
- .poll(() => readRotationKeyframes().values[1])
- .not.toBe(firstValueAtFrame10);
- expect(readRotationKeyframes().frames).toEqual([0, 10, 30]);
- });
-});
diff --git a/packages/example/e2e/schema-editor.test.mts b/packages/example/e2e/schema-editor.test.mts
deleted file mode 100644
index d36ff9ed0b..0000000000
--- a/packages/example/e2e/schema-editor.test.mts
+++ /dev/null
@@ -1,92 +0,0 @@
-import fs from 'fs';
-import {expect, test} from '@playwright/test';
-import {EXPANDED_SIDEBAR_STATE, rootFile} from './constants.mts';
-import {navigateToSchemaTest, readStudioLogs, stripAnsi} from './helpers.mts';
-import {startStudio, stopStudio} from './studio-server.mts';
-
-test.use({storageState: EXPANDED_SIDEBAR_STATE});
-
-test.describe('visual mode', () => {
- test.beforeEach(async () => {
- await startStudio();
- });
-
- test.afterEach(async () => {
- await stopStudio();
- });
-
- test('should edit schema props and update source code', async ({page}) => {
- await navigateToSchemaTest(page);
-
- await expect(
- page.getByRole('checkbox', {name: '<null>'}).first(),
- ).toBeVisible();
-
- const optionalEnumCheckbox = page.getByRole('checkbox', {
- name: '<undefined>',
- });
- const optionalEnumLabel = page.getByText('optionalEnum:', {exact: true});
- const optionalEnumLabelBefore = await optionalEnumLabel.boundingBox();
- expect(optionalEnumLabelBefore).not.toBeNull();
- await expect(optionalEnumCheckbox).toBeChecked();
- await optionalEnumCheckbox.uncheck();
-
- await expect(page.getByRole('button', {name: 'vert'})).toBeVisible();
- const optionalEnumLabelAfter = await optionalEnumLabel.boundingBox();
- expect(optionalEnumLabelAfter?.x).toBe(optionalEnumLabelBefore?.x);
- await expect
- .poll(
- () =>
- fs.readFileSync(rootFile, 'utf-8').includes("optionalEnum: 'vert'"),
- {
- message: 'Expected the optional enum value to be persisted',
- timeout: 10_000,
- },
- )
- .toBe(true);
-
- const titleInput = page
- .locator(
- 'input[name="title"][type="text"], input[name="title"]:not([type="checkbox"])',
- )
- .first();
- await expect(titleInput).toBeVisible({timeout: 15_000});
-
- const newTitle = 'e2e-test-title';
- const beforeContent = fs.readFileSync(rootFile, 'utf-8');
- expect(beforeContent).not.toContain(newTitle);
-
- const logCountBefore = readStudioLogs().length;
-
- await titleInput.fill(newTitle);
- await titleInput.blur();
-
- await expect
- .poll(
- () => {
- const content = fs.readFileSync(rootFile, 'utf-8');
- return content.includes(newTitle);
- },
- {
- message: `Expected E2eTestRoot.tsx to contain "${newTitle}" after prop edit`,
- timeout: 10_000,
- },
- )
- .toBe(true);
-
- expect(fs.readFileSync(rootFile, 'utf-8')).toContain(newTitle);
-
- // Verify exactly 1 "Updated default props" log was emitted
- await expect
- .poll(
- () => {
- const newLogs = readStudioLogs().slice(logCountBefore);
- return newLogs.filter((log) =>
- stripAnsi(log).includes('Updated default props for "schema-test"'),
- ).length;
- },
- {timeout: 5_000},
- )
- .toBe(1);
- });
-});
diff --git a/packages/example/e2e/studio.test.mts b/packages/example/e2e/studio.test.mts
deleted file mode 100644
index 7d0a580e09..0000000000
--- a/packages/example/e2e/studio.test.mts
+++ /dev/null
@@ -1,3659 +0,0 @@
-import fs from 'fs';
-import path from 'path';
-import {expect, test, type Page} from '@playwright/test';
-import {
- STUDIO_URL,
- effectKeyframeE2eFile,
- exampleDir,
- lostNodePathE2eFile,
- rootFile,
-} from './constants.mts';
-import {
- navigateToLostNodePathE2e,
- navigateToSchemaTest,
- retryCanvasInteractionUntilOutlineIsVisible,
-} from './helpers.mts';
-import {startStudio, stopStudio} from './studio-server.mts';
-
-const macCursorsFile = path.join(exampleDir, 'src', 'MacCursors', 'index.tsx');
-const sequenceShiftFile = path.join(
- exampleDir,
- 'src',
- 'VisualModeTests',
- 'SequenceShiftRepro.tsx',
-);
-const outlineSelectionCasesFile = path.join(
- exampleDir,
- 'src',
- 'VisualModeTests',
- 'OutlineSelectionCases.tsx',
-);
-
-const dragCompositionSelectorItem = async ({
- page,
- sourceTitle,
- targetTitle,
- position,
- dropAtPosition,
- drop,
-}: {
- page: Page;
- sourceTitle: string;
- targetTitle: string;
- position: 'before' | 'inside' | 'after';
- dropAtPosition: 'before' | 'inside' | 'after' | null;
- drop: boolean;
-}) => {
- return page.evaluate(
- ({
- sourceTitle: source,
- targetTitle: target,
- position: dropPosition,
- dropAtPosition: finalDropPosition,
- drop: shouldDrop,
- }) => {
- const items = Array.from(
- document.querySelectorAll<HTMLElement>(
- '.__remotion-composition-selector-item',
- ),
- );
- const sourceElement = items.find((element) => element.title === source);
- const targetElement = items.find((element) => element.title === target);
- if (!sourceElement || !targetElement) {
- throw new Error(
- `Could not find drag source ${source} or target ${target}`,
- );
- }
-
- const dataTransfer = new DataTransfer();
- sourceElement.dispatchEvent(
- new DragEvent('dragstart', {
- bubbles: true,
- cancelable: true,
- dataTransfer,
- }),
- );
- const rect = targetElement.getBoundingClientRect();
- const getClientY = (position: 'before' | 'inside' | 'after') =>
- position === 'before'
- ? rect.top + 1
- : position === 'after'
- ? rect.bottom - 1
- : rect.top + rect.height / 2;
- const clientY = getClientY(dropPosition);
- const dragOver = new DragEvent('dragover', {
- bubbles: true,
- cancelable: true,
- clientY,
- dataTransfer,
- });
- targetElement.dispatchEvent(dragOver);
- if (shouldDrop) {
- const dropClientY = getClientY(finalDropPosition ?? dropPosition);
- targetElement.dispatchEvent(
- new DragEvent('drop', {
- bubbles: true,
- cancelable: true,
- clientY: dropClientY,
- dataTransfer,
- }),
- );
- sourceElement.dispatchEvent(
- new DragEvent('dragend', {bubbles: true, dataTransfer}),
- );
- }
-
- return dragOver.defaultPrevented;
- },
- {sourceTitle, targetTitle, position, dropAtPosition, drop},
- );
-};
-
-const dragCompositionSelectorItemToRoot = async ({
- page,
- sourceTitle,
- drop,
-}: {
- page: Page;
- sourceTitle: string;
- drop: boolean;
-}) => {
- return page.evaluate(
- ({sourceTitle: source, drop: shouldDrop}) => {
- const sourceElement = Array.from(
- document.querySelectorAll<HTMLElement>(
- '.__remotion-composition-selector-item',
- ),
- ).find((element) => element.title === source);
- const root = Array.from(
- document.querySelectorAll<HTMLElement>(
- '.__remotion-vertical-scrollbar',
- ),
- ).find((element) =>
- element.querySelector('.__remotion-composition-selector-item'),
- );
- if (!sourceElement || !root) {
- throw new Error(`Could not find drag source ${source} or root list`);
- }
-
- const dataTransfer = new DataTransfer();
- sourceElement.dispatchEvent(
- new DragEvent('dragstart', {
- bubbles: true,
- cancelable: true,
- dataTransfer,
- }),
- );
- const rect = root.getBoundingClientRect();
- root.scrollTop = root.scrollHeight;
- const clientY = rect.bottom - 1;
- const dragOver = new DragEvent('dragover', {
- bubbles: true,
- cancelable: true,
- clientY,
- dataTransfer,
- });
- root.dispatchEvent(dragOver);
- if (shouldDrop) {
- root.dispatchEvent(
- new DragEvent('drop', {
- bubbles: true,
- cancelable: true,
- clientY,
- dataTransfer,
- }),
- );
- sourceElement.dispatchEvent(
- new DragEvent('dragend', {bubbles: true, dataTransfer}),
- );
- }
-
- return dragOver.defaultPrevented;
- },
- {sourceTitle, drop},
- );
-};
-
-test.describe('visual mode', () => {
- test.beforeEach(async () => {
- await startStudio();
- });
-
- test.afterEach(async () => {
- await stopStudio();
- });
-
- test('customizes playback and view shortcuts and keeps modifiers distinct', async ({
- page,
- }) => {
- const configFile = path.join(exampleDir, 'remotion.config.ts');
- const originalConfig = fs.readFileSync(configFile, 'utf8');
- try {
- await page.goto(`${STUDIO_URL}/schema-test`);
- const muteButton = page.getByRole('button', {
- name: 'Mute video',
- exact: true,
- });
- const unmuteButton = page.getByRole('button', {
- name: 'Unmute video',
- exact: true,
- });
- await expect(muteButton).toBeVisible();
- await page.keyboard.press('m');
- await expect(unmuteButton).toBeVisible();
- await page.keyboard.press('Shift+M');
- await expect(unmuteButton).toBeVisible();
- await page.keyboard.press('m');
- await expect(muteButton).toBeVisible();
-
- const loopButton = page.getByRole('button', {name: 'Loop', exact: true});
- if (
- await page
- .getByRole('button', {name: 'Loop', exact: true, pressed: true})
- .count()
- ) {
- await loopButton.click();
- }
- await page.keyboard.press('Shift+L');
- await expect(
- page.getByRole('button', {name: 'Loop', exact: true, pressed: true}),
- ).toBeVisible();
- await expect(
- page.getByRole('button', {name: 'Play', exact: true}),
- ).toBeVisible();
- await page.keyboard.press('l');
- await expect(
- page.getByRole('button', {name: 'Pause', exact: true}),
- ).toBeVisible();
- await page.keyboard.press('k');
- await expect(
- page.getByRole('button', {name: 'Play', exact: true}),
- ).toBeVisible();
-
- await page.getByRole('button', {name: 'Settings', exact: true}).click();
- const dialog = page.getByRole('dialog');
- await dialog
- .getByRole('button', {name: 'Shortcuts', exact: true})
- .click();
- for (const [name, key, action] of [
- ['Mute / Unmute', 'u', 'toggleMute'],
- ['Loop', 'y', 'toggleLoop'],
- ]) {
- const control = dialog.getByRole('button', {
- name: `Change shortcut for ${name}`,
- exact: true,
- });
- await control.click();
- await page.keyboard.press(key);
- await expect(control).toContainText(key.toUpperCase());
- await expect
- .poll(() => fs.readFileSync(configFile, 'utf8'))
- .toContain(action);
- await expect(
- page.getByRole('button', {
- name: action === 'toggleMute' ? 'Mute video' : 'Loop',
- exact: true,
- includeHidden: true,
- }),
- ).toHaveAttribute('aria-keyshortcuts', key);
- }
- await page.keyboard.press('Escape');
- await expect(dialog).toHaveCount(0);
- await page.reload();
- await expect(muteButton).toBeVisible();
- await page.keyboard.press('u');
- await expect(unmuteButton).toBeVisible();
- await page.keyboard.press('m');
- await expect(unmuteButton).toBeVisible();
- await unmuteButton.hover();
- await expect(page.getByRole('tooltip')).toContainText('U');
-
- await page.setViewportSize({width: 600, height: 800});
- await page.keyboard.press('y');
- await page.setViewportSize({width: 1280, height: 800});
- await expect(
- page.getByRole('button', {name: 'Loop', exact: true, pressed: false}),
- ).toBeVisible();
- await page.keyboard.press('Shift+L');
- await expect(
- page.getByRole('button', {name: 'Loop', exact: true, pressed: false}),
- ).toBeVisible();
- await page.keyboard.press('y');
- await expect(
- page.getByRole('button', {name: 'Loop', exact: true, pressed: true}),
- ).toBeVisible();
-
- await page.getByRole('button', {name: 'Settings', exact: true}).click();
- await dialog
- .getByRole('button', {name: 'Shortcuts', exact: true})
- .click();
- await dialog
- .getByRole('button', {name: 'Actions for Mute / Unmute', exact: true})
- .click();
- await page.getByText('Disable shortcut', {exact: true}).click();
- await expect(
- dialog.getByRole('button', {
- name: 'Change shortcut for Mute / Unmute',
- exact: true,
- }),
- ).toHaveText('Unassigned');
- await expect
- .poll(() => fs.readFileSync(configFile, 'utf8'))
- .toMatch(/toggleMute['"]?: null/);
- await page.keyboard.press('Escape');
- await page.keyboard.press('u');
- await expect(unmuteButton).toBeVisible();
- await page.getByRole('button', {name: 'Settings', exact: true}).click();
- await dialog
- .getByRole('button', {name: 'Shortcuts', exact: true})
- .click();
- for (const name of ['Mute / Unmute', 'Loop']) {
- await dialog
- .getByRole('button', {name: `Actions for ${name}`, exact: true})
- .click();
- await page.getByText('Reset to default', {exact: true}).click();
- }
- await expect
- .poll(() => fs.readFileSync(configFile, 'utf8'))
- .not.toContain('toggleMute');
- await expect
- .poll(() => fs.readFileSync(configFile, 'utf8'))
- .not.toContain('toggleLoop');
- await page.keyboard.press('Escape');
- await expect(dialog).toHaveCount(0);
- await page.keyboard.press('m');
- await expect(muteButton).toBeVisible();
- await page.keyboard.press('Shift+L');
- await expect(
- page.getByRole('button', {name: 'Loop', exact: true, pressed: false}),
- ).toBeVisible();
-
- for (const [name, pattern, defaultKey, remappedKey, action] of [
- [
- 'Outlines',
- /^(Show|Hide) outlines$/,
- 'Shift+O',
- 'Shift+U',
- 'toggleOutlines',
- ],
- [
- 'Rulers and guides',
- /^(Show|Hide) rulers and guides$/,
- 'Shift+R',
- 'Shift+Y',
- 'toggleRulersAndGuides',
- ],
- ] as const) {
- const button = page.getByRole('button', {name: pattern});
- if (
- await page.getByRole('button', {name: pattern, pressed: true}).count()
- ) {
- await button.click();
- }
- await page.keyboard.press(defaultKey);
- await expect(
- page.getByRole('button', {name: pattern, pressed: true}),
- ).toBeVisible();
- await expect(dialog).toHaveCount(0);
- await button.hover();
- await expect(page.getByRole('tooltip')).toContainText(
- defaultKey.slice(-1),
- );
-
- await page.getByRole('button', {name: 'Settings', exact: true}).click();
- await dialog
- .getByRole('button', {name: 'Shortcuts', exact: true})
- .click();
- const control = dialog.getByRole('button', {
- name: `Change shortcut for ${name}`,
- exact: true,
- });
- await control.click();
- await page.keyboard.press(remappedKey);
- await expect(control).toContainText(remappedKey.slice(-1));
- await expect
- .poll(() => fs.readFileSync(configFile, 'utf8'))
- .toContain(action);
- await page.keyboard.press('Escape');
- await expect(dialog).toHaveCount(0);
- await page.reload();
- await expect(
- page.getByRole('button', {name: pattern, pressed: true}),
- ).toBeVisible();
- await page.keyboard.press(defaultKey);
- await expect(
- page.getByRole('button', {name: pattern, pressed: true}),
- ).toBeVisible();
- await page.setViewportSize({width: 600, height: 800});
- await page.keyboard.press(remappedKey);
- await page.setViewportSize({width: 1280, height: 800});
- await expect(
- page.getByRole('button', {name: pattern, pressed: false}),
- ).toBeVisible();
- await button.hover();
- await expect(page.getByRole('tooltip')).toContainText(
- remappedKey.slice(-1),
- );
-
- await page.getByRole('button', {name: 'Settings', exact: true}).click();
- await dialog
- .getByRole('button', {name: 'Shortcuts', exact: true})
- .click();
- await dialog
- .getByRole('button', {name: `Actions for ${name}`, exact: true})
- .click();
- await page.getByText('Disable shortcut', {exact: true}).click();
- await expect(control).toHaveText('Unassigned');
- await page.keyboard.press('Escape');
- await expect(dialog).toHaveCount(0);
- await expect(button).not.toHaveAttribute('aria-keyshortcuts');
- await page.keyboard.press(remappedKey);
- await expect(
- page.getByRole('button', {name: pattern, pressed: false}),
- ).toBeVisible();
- await page.getByRole('button', {name: 'Settings', exact: true}).click();
- await dialog
- .getByRole('button', {name: 'Shortcuts', exact: true})
- .click();
- await dialog
- .getByRole('button', {name: `Actions for ${name}`, exact: true})
- .click();
- await page.getByText('Reset to default', {exact: true}).click();
- await expect
- .poll(() => fs.readFileSync(configFile, 'utf8'))
- .not.toContain(action);
- await expect(control).toContainText(defaultKey.slice(-1));
- await page.keyboard.press('Escape');
- await expect(dialog).toHaveCount(0);
- await expect(button).toHaveAttribute(
- 'aria-keyshortcuts',
- `Shift+${defaultKey.slice(-1).toLowerCase()}`,
- );
- await page.keyboard.press(defaultKey);
- await expect(
- page.getByRole('button', {name: pattern, pressed: true}),
- ).toBeVisible();
- }
- } finally {
- fs.writeFileSync(configFile, originalConfig);
- }
- });
-
- test('opens and customizes the Color Picker shortcut', async ({page}) => {
- const configFile = path.join(exampleDir, 'remotion.config.ts');
- const originalConfig = fs.readFileSync(configFile, 'utf8');
- try {
- await page.addInitScript(() => {
- Object.defineProperty(window, 'EyeDropper', {
- configurable: true,
- value: class {
- open() {
- const count = Number(
- localStorage.getItem('color-picker-open-count') ?? 0,
- );
- localStorage.setItem(
- 'color-picker-open-count',
- String(count + 1),
- );
- return Promise.reject(new Error('canceled'));
- }
- },
- });
- });
- await page.goto(`${STUDIO_URL}/schema-test`);
- const getColorPickerOpenCount = () =>
- page.evaluate(() =>
- Number(localStorage.getItem('color-picker-open-count') ?? 0),
- );
- await page.keyboard.press('Shift+C');
- await expect.poll(getColorPickerOpenCount).toBe(1);
-
- await page.getByRole('button', {name: 'Settings', exact: true}).click();
- const dialog = page.getByRole('dialog');
- await dialog
- .getByRole('button', {name: 'Shortcuts', exact: true})
- .click();
- const colorPickerControl = dialog.getByRole('button', {
- name: 'Change shortcut for Color Picker',
- exact: true,
- });
- await expect(colorPickerControl).toContainText('C');
- await colorPickerControl.click();
- await page.keyboard.press('Shift+V');
- await expect(colorPickerControl).toContainText('V');
- await expect
- .poll(() => fs.readFileSync(configFile, 'utf8'))
- .toContain('pickColor');
- await page.keyboard.press('Escape');
- await page.reload();
- await page.keyboard.press('Shift+C');
- await expect.poll(getColorPickerOpenCount).toBe(1);
- await page.keyboard.press('Shift+V');
- await expect.poll(getColorPickerOpenCount).toBe(2);
-
- await page.getByRole('button', {name: 'Settings', exact: true}).click();
- await dialog
- .getByRole('button', {name: 'Shortcuts', exact: true})
- .click();
- await dialog
- .getByRole('button', {
- name: 'Actions for Color Picker',
- exact: true,
- })
- .click();
- await page.getByText('Reset to default', {exact: true}).click();
- await expect
- .poll(() => fs.readFileSync(configFile, 'utf8'))
- .not.toContain('pickColor');
- await page.keyboard.press('Escape');
- await page.reload();
- await page.keyboard.press('Shift+C');
- await expect.poll(getColorPickerOpenCount).toBe(3);
- } finally {
- fs.writeFileSync(configFile, originalConfig);
- }
- });
-
- test('should load the studio without flashing a composition error', async ({
- page,
- }) => {
- await page.addInitScript(() => {
- const state = {compositionNotFoundWasShown: false};
- Object.defineProperty(window, '__remotion_initial_load_test', {
- value: state,
- });
-
- const observer = new MutationObserver(() => {
- if (
- document.body?.innerText.includes(
- 'Composition with ID AnimatedBarChart not found.',
- )
- ) {
- state.compositionNotFoundWasShown = true;
- }
- });
- observer.observe(document, {
- childList: true,
- characterData: true,
- subtree: true,
- });
- });
-
- await page.goto(`${STUDIO_URL}/AnimatedBarChart`);
- await expect(page).toHaveTitle(/Remotion/i, {timeout: 15_000});
- await expect(
- page.locator('.remotion-studio-composition-container'),
- ).toBeVisible();
- expect(
- await page.evaluate(
- () =>
- (
- window as typeof window & {
- __remotion_initial_load_test: {
- compositionNotFoundWasShown: boolean;
- };
- }
- ).__remotion_initial_load_test.compositionNotFoundWasShown,
- ),
- ).toBe(false);
-
- await page.goto(`${STUDIO_URL}/does-not-exist`);
- await expect(
- page.getByText('Composition with ID does-not-exist not found.'),
- ).toBeVisible();
- });
-
- test('should preview media assets as a non-interactive timeline', async ({
- page,
- }) => {
- await page.goto(`${STUDIO_URL}/assets/prores.mov`);
-
- await expect(page.getByTestId('asset-media-preview')).toBeVisible({
- timeout: 15_000,
- });
- const checkerboardToggle = page.getByRole('button', {
- name: /Show transparency as checkerboard/,
- });
- await expect(checkerboardToggle).toBeVisible();
- const checkerboardWasPressed =
- (await checkerboardToggle.getAttribute('aria-pressed')) === 'true';
- await checkerboardToggle.click();
- await expect(checkerboardToggle).toHaveAttribute(
- 'aria-pressed',
- String(!checkerboardWasPressed),
- );
- await checkerboardToggle.click();
-
- const rulersToggle = page.getByRole('button', {
- name: /^(Show|Hide) rulers$/,
- });
- const rulersWerePressed =
- (await rulersToggle.getAttribute('aria-pressed')) === 'true';
- await rulersToggle.click();
- await expect(rulersToggle).toHaveAttribute(
- 'aria-pressed',
- String(!rulersWerePressed),
- );
- if (rulersWerePressed) {
- await rulersToggle.click();
- }
- const horizontalRuler = page.getByLabel('Horizontal ruler', {exact: true});
- await expect(horizontalRuler).toBeVisible();
- await expect(horizontalRuler).toHaveAttribute('aria-readonly', 'true');
- await expect(
- page.getByLabel('Vertical ruler', {exact: true}),
- ).toBeVisible();
- if (!rulersWerePressed) {
- await page
- .getByRole('button', {name: 'Hide rulers', exact: true})
- .click();
- }
-
- const timeline = page.locator('[data-timeline-scrollable]');
- await expect(timeline).toBeVisible();
- const mediaTrack = page.getByTitle('prores.mov').last();
- await expect(mediaTrack).toBeVisible();
- await expect(timeline.locator('canvas').first()).toBeVisible();
- await expect(
- page.getByRole('button', {name: 'Play', exact: true}),
- ).toBeEnabled();
- await expect(
- page.getByText(/Failed to execute getVideoMetadata/),
- ).toHaveCount(0);
-
- await mediaTrack.dblclick();
- await expect(page.getByRole('textbox')).toHaveCount(0);
-
- await page.goto(`${STUDIO_URL}/assets/podcast.wav`);
- await expect(
- page.getByRole('img', {name: 'Audio asset', exact: true}),
- ).toBeVisible();
- await expect(page.getByTestId('asset-media-preview')).not.toBeInViewport();
- await expect(page.locator('[data-timeline-scrollable]')).toBeVisible();
- await expect(page.getByTitle('podcast.wav').last()).toBeVisible();
- await expect(
- page.getByRole('button', {name: 'Play', exact: true}),
- ).toBeEnabled();
- const audioTimelineZoom = page.getByTitle(/^Timeline zoom \(/);
- await expect(audioTimelineZoom).toBeVisible();
- const audioTimelineScrubber = page.locator('[data-timeline-scrubber]');
- const audioTimelineWidthBeforeZoom = await audioTimelineScrubber.evaluate(
- (element) => element.getBoundingClientRect().width,
- );
- await page
- .getByRole('button', {name: 'Zoom in timeline', exact: true})
- .click();
- await expect
- .poll(() =>
- audioTimelineScrubber.evaluate(
- (element) => element.getBoundingClientRect().width,
- ),
- )
- .toBeGreaterThan(audioTimelineWidthBeforeZoom);
- await expect(checkerboardToggle).toHaveCount(0);
- await expect(rulersToggle).toHaveCount(0);
- await expect(horizontalRuler).toHaveCount(0);
- await expect(
- page.locator('.remotion-studio-composition-container'),
- ).toHaveCSS('background-image', 'none');
- await expect(
- page.locator('.remotion-studio-composition-container'),
- ).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)');
-
- await page.goto(`${STUDIO_URL}/assets/blush-2x.mp4`);
- await expect(page.getByTestId('asset-media-preview')).toBeVisible();
- const squarePreview = page.locator(
- '.remotion-studio-composition-container',
- );
- await expect(squarePreview).toBeVisible();
- await expect
- .poll(async () => {
- const outerBox = await squarePreview.boundingBox();
- const mediaBox = await page
- .getByTestId('asset-media-preview')
- .boundingBox();
- if (outerBox === null || mediaBox === null) {
- return null;
- }
-
- return Math.max(
- Math.abs(outerBox.x - mediaBox.x),
- Math.abs(outerBox.y - mediaBox.y),
- Math.abs(outerBox.width - outerBox.height),
- Math.abs(outerBox.width - mediaBox.width),
- Math.abs(outerBox.height - mediaBox.height),
- );
- })
- .toBeLessThan(1);
- });
-
- test('should show negative sequence timing in the frame-zero gutter', async ({
- page,
- }) => {
- await page.goto(`${STUDIO_URL}/timeline-negative-start`);
- await expect(page).toHaveURL(/timeline-negative-start/, {
- timeout: 15_000,
- });
-
- const timelineScrollable = page.locator('[data-timeline-scrollable]');
- const negativeSequence = page.locator(
- '[data-timeline-marquee-item][title="Negative start"]',
- );
- const zeroSequence = page.locator(
- '[data-timeline-marquee-item][title="Zero start"]',
- );
- await expect(negativeSequence).toBeVisible();
- await expect(zeroSequence).toBeVisible();
-
- const [timelineRect, negativeSequenceRect, zeroSequenceRect] =
- await Promise.all([
- timelineScrollable.boundingBox(),
- negativeSequence.boundingBox(),
- zeroSequence.boundingBox(),
- ]);
- expect(timelineRect).not.toBeNull();
- expect(negativeSequenceRect).not.toBeNull();
- expect(zeroSequenceRect).not.toBeNull();
- expect(negativeSequenceRect!.x).toBeGreaterThanOrEqual(timelineRect!.x);
- expect(negativeSequenceRect!.x).toBeLessThan(zeroSequenceRect!.x);
- expect(zeroSequenceRect!.x - negativeSequenceRect!.x).toBeLessThanOrEqual(
- 16,
- );
- });
-
- test('should commit a color drag before the picker closes', async ({
- page,
- }) => {
- const barChartFile = path.join(exampleDir, 'src', 'BarChart.tsx');
- const originalSource = fs.readFileSync(barChartFile, 'utf-8');
-
- try {
- await page.goto(`${STUDIO_URL}/AnimatedBarChart`);
- await expect(page).toHaveURL(/AnimatedBarChart/, {timeout: 15_000});
-
- if (!(await page.getByRole('button', {name: 'Inspector'}).isVisible())) {
- await page.locator('[data-sidebar-toggle="right"]').click();
- }
-
- const colorButton = page
- .getByRole('button', {name: '#000', exact: true})
- .first();
- await expect(async () => {
- await page
- .locator('[data-timeline-marquee-item][title="North bar"]')
- .click();
- await expect(colorButton).toBeVisible({timeout: 1_000});
- }).toPass({timeout: 15_000});
- await colorButton.click();
-
- const hexInput = page.getByRole('textbox', {name: 'Hex'});
- await expect(hexInput).toBeVisible();
- const saturationValueArea = page.locator(
- 'div[style*="cursor: crosshair"]',
- );
- const box = await saturationValueArea.boundingBox();
- if (box === null) {
- throw new Error('Color picker saturation area has no bounding box');
- }
-
- await page.mouse.move(
- box.x + box.width * 0.25,
- box.y + box.height * 0.75,
- );
- await page.mouse.down();
- await page.mouse.move(
- box.x + box.width * 0.75,
- box.y + box.height * 0.25,
- );
- await page.mouse.up();
-
- await expect(hexInput).toBeVisible();
- await expect
- .poll(() => fs.readFileSync(barChartFile, 'utf-8'))
- .toMatch(/position: 'relative',\n\s+color: '#[0-9a-f]{6}'/);
- await expect(page.getByRole('button', {name: /^Undo/})).toBeEnabled();
- await page.keyboard.press('ControlOrMeta+z');
-
- await expect
- .poll(() => fs.readFileSync(barChartFile, 'utf-8'))
- .toBe(originalSource);
- await expect(hexInput).toHaveValue('#000000');
- } finally {
- fs.writeFileSync(barChartFile, originalSource);
- }
- });
-
- test('reveals selected timeline effects and props in the inspector', async ({
- page,
- }) => {
- fs.writeFileSync(
- effectKeyframeE2eFile,
- fs
- .readFileSync(effectKeyframeE2eFile, 'utf-8')
- .replace(
- 'wave({})',
- 'wave({phase: interpolate(frame, [0, 30], [0, 90])})',
- ),
- );
- await page.setViewportSize({width: 1280, height: 720});
- await page.goto(`${STUDIO_URL}/effect-keyframe-e2e`);
- const addEffectButton = page.getByTitle('Add effect', {exact: true});
- if (!(await page.getByRole('button', {name: 'Inspector'}).isVisible())) {
- await page.locator('[data-sidebar-toggle="right"]').click();
- }
- await expect(async () => {
- await page.getByTitle('Scale precision', {exact: true}).first().click();
- await expect(addEffectButton).toBeVisible({timeout: 1000});
- }).toPass({timeout: 15_000});
- const inspector = page
- .locator('.__remotion-vertical-scrollbar')
- .filter({has: addEffectButton});
- const inspectorWave = inspector.getByText('wave()', {exact: true});
- await inspectorWave.click();
- const timelineWave = page
- .getByText('wave()', {exact: true})
- .filter({visible: true})
- .last();
- await expect(page.getByText('wave()', {exact: true})).toHaveCount(2);
- await page.getByTitle('Scale precision', {exact: true}).first().click();
- await inspector.evaluate((element) => {
- element.scrollTop = 0;
- });
- await timelineWave.click();
- await expect(inspectorWave).toBeInViewport();
- await expect
- .poll(() => inspector.evaluate((element) => element.scrollTop))
- .toBeGreaterThan(0);
-
- await inspector
- .getByRole('button', {name: 'Collapse wave() section', exact: true})
- .click();
- await page
- .getByRole('button', {name: 'Expand wave() section', exact: true})
- .last()
- .click();
- await page
- .locator('.css-reset.__remotion-vertical-scrollbar')
- .evaluate((element) => {
- element.scrollTop += 200;
- });
- const timelinePhase = page.getByText('Phase', {exact: true});
- await expect(timelinePhase).toHaveCount(1);
- await inspector.evaluate((element) => {
- element.scrollTop = 0;
- });
- await timelinePhase.click();
- await expect(inspector.getByText('Phase', {exact: true})).toBeInViewport();
- await expect(
- inspector.getByRole('button', {
- name: 'Collapse wave() section',
- exact: true,
- }),
- ).toBeVisible();
- });
-
- test('should keep Effects expanded and preserve the inspector scroll position when adding an effect', async ({
- page,
- }) => {
- await page.goto(`${STUDIO_URL}/effect-keyframe-e2e`);
- await expect(page).toHaveURL(/effect-keyframe-e2e/, {timeout: 15_000});
- const addEffectButton = page.getByTitle('Add effect', {exact: true});
- if (!(await page.getByRole('button', {name: 'Inspector'}).isVisible())) {
- await page.locator('[data-sidebar-toggle="right"]').click();
- }
-
- await expect(async () => {
- await page.getByTitle('Scale precision', {exact: true}).first().click();
- await expect(addEffectButton).toBeVisible({timeout: 1000});
- }).toPass({timeout: 15_000});
- await expect(page.getByText('wave()', {exact: true})).toBeVisible();
- await expect(
- page.getByRole('button', {name: 'Collapse Effects', exact: true}),
- ).toBeVisible();
- const inspector = page
- .locator('.__remotion-vertical-scrollbar')
- .filter({has: addEffectButton});
- await expect(inspector).toHaveCount(1);
- await inspector.evaluate((element) => {
- element.scrollTop = element.scrollHeight;
- });
- await addEffectButton.click();
-
- const scrollTopBefore = await inspector.evaluate(
- (element) => element.scrollTop,
- );
- expect(scrollTopBefore).toBeGreaterThan(0);
- const effectPicker = page.getByRole('dialog');
- await effectPicker.getByPlaceholder('Search effects...').fill('blur');
- await effectPicker.getByText('blur()', {exact: true}).click();
-
- await expect
- .poll(() => fs.readFileSync(effectKeyframeE2eFile, 'utf-8'))
- .toContain("import {blur} from '@remotion/effects/blur';");
- await expect(page.getByText('blur()', {exact: true})).toBeVisible();
- const scrollTopAfter = await inspector.evaluate(
- (element) => element.scrollTop,
- );
- expect(scrollTopAfter).toBeGreaterThan(0);
- });
-
- test('should copy a keyframed property between component types', async ({
- context,
- page,
- }) => {
- await context.grantPermissions(['clipboard-read', 'clipboard-write'], {
- origin: STUDIO_URL,
- });
- await page.goto(`${STUDIO_URL}/effect-keyframe-e2e`);
- await page.bringToFront();
- await page.evaluate(() => navigator.clipboard.writeText(''));
- const sourceRow = page.locator(
- '[data-timeline-marquee-item][title="Copy rotation source"]',
- );
- const targetRow = page.locator(
- '[data-timeline-marquee-item][title="Copy rotation target"]',
- );
- await expect(sourceRow).toBeVisible({timeout: 15_000});
- await expect(targetRow).toBeVisible({timeout: 15_000});
- const rotateButton = page.getByRole('button', {
- name: 'Rotate',
- exact: true,
- });
- await expect(async () => {
- await page
- .getByTitle('Copy rotation source', {exact: true})
- .first()
- .click({button: 'right'});
- await expect(rotateButton).toBeVisible({timeout: 1000});
- }).toPass({timeout: 15_000});
- await rotateButton.click();
- await page.keyboard.press('ControlOrMeta+c');
-
- await expect(async () => {
- await page
- .getByTitle('Copy rotation target', {exact: true})
- .first()
- .click({button: 'right'});
- await expect(rotateButton).toBeVisible({timeout: 1000});
- }).toPass({timeout: 15_000});
- await rotateButton.click();
- await page.keyboard.press('ControlOrMeta+v');
-
- await expect
- .poll(() => {
- const source = fs.readFileSync(effectKeyframeE2eFile, 'utf-8');
- const targetNameIndex = source.indexOf('name="Copy rotation target"');
- const tagStart = source.lastIndexOf('<AbsoluteFill', targetNameIndex);
- const tagEnd = source.indexOf('/>', targetNameIndex);
- return source.slice(tagStart, tagEnd + 2);
- })
- .toContain("rotate: interpolate(frame, [0, 30], ['0deg', '90deg'])");
-
- await page.getByRole('button', {name: /^Undo/}).click();
- await expect
- .poll(() => fs.readFileSync(effectKeyframeE2eFile, 'utf-8'))
- .toContain(
- '<AbsoluteFill name="Copy rotation target" style={{rotate: \'0deg\'}} />',
- );
- });
-
- test('should toggle the visibility of a macOS cursor', async ({page}) => {
- const originalSource = fs.readFileSync(macCursorsFile, 'utf-8');
-
- try {
- await page.goto(`${STUDIO_URL}/mac-cursors`);
- const cursorLabel = page
- .getByText('Hideable cursor', {exact: true})
- .first();
- const visibilityToggle = cursorLabel
- .locator('..')
- .locator('..')
- .locator('[data-timeline-layer-eye]');
- await expect(async () => {
- await expect(cursorLabel).toBeVisible({timeout: 1000});
- await expect(visibilityToggle).toBeVisible({timeout: 1000});
- }).toPass({timeout: 15_000});
-
- await visibilityToggle.click();
- await expect
- .poll(() => {
- const source = fs.readFileSync(macCursorsFile, 'utf-8');
- const cursorNameIndex = source.indexOf('name="Hideable cursor"');
- const tagStart = source.lastIndexOf('<MacOSCursor', cursorNameIndex);
- const tagEnd = source.indexOf('/>', cursorNameIndex);
- return source.slice(tagStart, tagEnd + 2);
- })
- .toContain('hidden');
- } finally {
- fs.writeFileSync(macCursorsFile, originalSource);
- }
- });
-
- test('should preserve property selection while dragging its outline', async ({
- page,
- }) => {
- test.setTimeout(120_000);
- const sourceBefore = fs.readFileSync(outlineSelectionCasesFile, 'utf-8');
-
- try {
- await page.goto(`${STUDIO_URL}/outline-selection-cases`);
- 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('2010');
- await currentFrameInput.press('Enter');
-
- const canvas = page.locator('.remotion-studio-composition-container');
- const target = canvas
- .getByText('Select one of my properties, then drag me', {exact: true})
- .locator('..');
- await expect(target).toBeVisible({timeout: 15_000});
- await expect(page.getByText('Baseline', {exact: true})).toBeVisible();
-
- const timelineItem = page
- .getByTitle('Property-selected sequence', {exact: true})
- .first();
- const offsetProperty = page.getByTitle('Offset', {exact: true});
- await expect(async () => {
- await expect(timelineItem).toBeVisible({timeout: 1000});
- await timelineItem.click();
- await page.keyboard.press('p');
- await expect(offsetProperty).toBeVisible({timeout: 1000});
- }).toPass({timeout: 15_000});
- await offsetProperty.click();
- const offsetSelection = offsetProperty.locator('..');
- await expect(offsetSelection).toHaveCSS(
- 'background-color',
- 'rgba(255, 255, 255, 0.1)',
- );
-
- const outline = canvas.locator(
- '> svg[aria-hidden="true"] polygon[data-remotion-prevent-selection-clear="true"][stroke-opacity="1"]',
- );
- await expect(outline).toHaveCount(1);
-
- const targetBefore = await target.boundingBox();
- const outlineBefore = await outline.boundingBox();
- if (targetBefore === null || outlineBefore === null) {
- throw new Error('Expected the selected outline to have a bounding box');
- }
-
- const dragStart = {
- x: outlineBefore.x + outlineBefore.width / 2,
- y: outlineBefore.y + outlineBefore.height / 2,
- };
- await page.mouse.move(dragStart.x, dragStart.y);
- await page.mouse.down();
- await expect(offsetSelection).toHaveCSS(
- 'background-color',
- 'rgba(255, 255, 255, 0.1)',
- );
- await page.mouse.move(dragStart.x + 60, dragStart.y, {steps: 5});
- await page.mouse.up();
-
- await expect
- .poll(async () => (await target.boundingBox())?.x ?? null)
- .toBeCloseTo(targetBefore.x + 60, 0);
- await expect(offsetSelection).toHaveCSS(
- 'background-color',
- 'rgba(255, 255, 255, 0.1)',
- );
- await expect
- .poll(() => {
- const source = fs.readFileSync(outlineSelectionCasesFile, 'utf-8');
- const targetIndex = source.indexOf(
- 'name="Property-selected sequence"',
- );
- return source
- .slice(targetIndex, targetIndex + 1000)
- .match(/translate: '([^']+)'/)?.[1];
- })
- .not.toBe('0px 0px');
- } finally {
- fs.writeFileSync(outlineSelectionCasesFile, sourceBefore);
- }
- });
-
- test('should compensate DOM measurements with useCurrentScale() on direct load', async ({
- page,
- }) => {
- await page.goto(`${STUDIO_URL}/use-current-scale-on-load`);
- await expect(
- page.getByTestId('use-current-scale-corrected-width'),
- ).toHaveText('100', {timeout: 15_000});
- });
-
- test('should show and search the composition list', async ({page}) => {
- await page.goto(STUDIO_URL);
- await expect(page.getByRole('button', {name: 'Schema'})).toBeVisible({
- timeout: 15_000,
- });
- const firstCompositionItems = await page
- .locator('.__remotion-composition-selector-item')
- .evaluateAll((items) =>
- items.slice(0, 3).map((item) => item.getAttribute('title')),
- );
- expect(firstCompositionItems).toEqual([
- 'use-current-scale-on-load',
- 'Schema',
- 'AnimatedBarChart',
- ]);
- const registeredCompositionItems = await page
- .locator('.__remotion-composition-selector-item[data-compname]')
- .evaluateAll((items) =>
- items.map((item) => item.getAttribute('data-compname') ?? ''),
- );
- const alphabeticalCompositionItems = [...registeredCompositionItems].sort(
- (a, b) => a.localeCompare(b, undefined, {numeric: true}),
- );
- await page.getByRole('button', {name: 'More composition actions'}).click();
- await expect(
- page.getByRole('button', {name: 'New composition...', exact: true}),
- ).toBeVisible();
- await expect(
- page.getByRole('button', {name: 'New folder...', exact: true}),
- ).toBeVisible();
- await expect(page.getByText('Sort', {exact: true})).toBeVisible();
- await page
- .getByRole('button', {name: 'Alphabetically', exact: true})
- .click();
- await expect
- .poll(() =>
- page
- .locator('.__remotion-composition-selector-item[data-compname]')
- .evaluateAll((items) =>
- items.map((item) => item.getAttribute('data-compname') ?? ''),
- ),
- )
- .toEqual(alphabeticalCompositionItems);
- await page.reload();
- await expect(page.getByRole('button', {name: 'Schema'})).toBeVisible({
- timeout: 15_000,
- });
- await expect
- .poll(() =>
- page
- .locator('.__remotion-composition-selector-item[data-compname]')
- .evaluateAll((items) =>
- items.map((item) => item.getAttribute('data-compname') ?? ''),
- ),
- )
- .toEqual(alphabeticalCompositionItems);
- await page.getByRole('button', {name: 'More composition actions'}).click();
- await page
- .getByRole('button', {name: 'New composition...', exact: true})
- .click();
- await page.getByTitle('Folder').click();
- const rootFolderNames = [
- 'Schema',
- 'visual-controls',
- 'lost-node-path',
- 'error-overlay',
- 'hook-order-change',
- ];
- const getVisibleRootFolderOrder = () =>
- page
- .locator('[data-remotion-menu-tree-id]')
- .last()
- .getByRole('button')
- .allTextContents()
- .then((items) =>
- items
- .map((item) => item.trim())
- .filter((item) => rootFolderNames.includes(item)),
- );
- await expect
- .poll(getVisibleRootFolderOrder)
- .toEqual([
- 'error-overlay',
- 'hook-order-change',
- 'lost-node-path',
- 'Schema',
- 'visual-controls',
- ]);
- await page.keyboard.press('Escape');
- await page.keyboard.press('Escape');
-
- await page.getByRole('button', {name: 'More composition actions'}).click();
- await page
- .getByRole('button', {name: 'As registered', exact: true})
- .click();
- await expect
- .poll(() =>
- page
- .locator('.__remotion-composition-selector-item')
- .evaluateAll((items) =>
- items.slice(0, 3).map((item) => item.getAttribute('title')),
- ),
- )
- .toEqual(firstCompositionItems);
-
- await page.getByRole('button', {name: 'More composition actions'}).click();
- await page
- .getByRole('button', {name: 'New composition...', exact: true})
- .click();
- await expect(page.getByPlaceholder('Composition ID')).toBeVisible();
- await page.getByTitle('Folder').click();
- await expect.poll(getVisibleRootFolderOrder).toEqual(rootFolderNames);
- await page.keyboard.press('Escape');
- await page.keyboard.press('Escape');
- await page.getByRole('button', {name: 'More composition actions'}).click();
- await page
- .getByRole('button', {name: 'New folder...', exact: true})
- .click();
- await expect(page.getByPlaceholder('Folder name')).toBeVisible();
- await page.keyboard.press('Escape');
-
- const uploadedFileName = 'explorer-header-upload-e2e.txt';
- const uploadedFileContents = 'Uploaded from the explorer header';
- const uploadedFilePath = path.join(exampleDir, 'public', uploadedFileName);
- fs.rmSync(uploadedFilePath, {force: true});
- try {
- await page.getByRole('button', {name: 'Assets', exact: true}).click();
- await page.getByRole('button', {name: 'More asset actions'}).click();
- const fileChooserPromise = page.waitForEvent('filechooser');
- await page.getByRole('button', {name: 'Upload...', exact: true}).click();
- const fileChooser = await fileChooserPromise;
- await fileChooser.setFiles({
- name: uploadedFileName,
- mimeType: 'text/plain',
- buffer: Buffer.from(uploadedFileContents),
- });
- await expect(
- page.getByText(`Uploaded ${uploadedFileName} to public folder`, {
- exact: true,
- }),
- ).toBeVisible();
- await expect
- .poll(() =>
- fs.existsSync(uploadedFilePath)
- ? fs.readFileSync(uploadedFilePath, 'utf8')
- : null,
- )
- .toBe(uploadedFileContents);
- await expect(
- page.getByText(uploadedFileName, {exact: true}),
- ).toBeVisible();
- } finally {
- fs.rmSync(uploadedFilePath, {force: true});
- }
-
- await page.getByRole('button', {name: 'Compositions', exact: true}).click();
-
- await page.keyboard.press('ControlOrMeta+k');
- const folderSearch = page.getByRole('dialog');
- await folderSearch
- .getByPlaceholder('Search compositions...')
- .fill('visual-controls');
- await expect(
- folderSearch.getByText('visual-controls', {exact: true}),
- ).toHaveCount(2);
- await expect(
- folderSearch.getByText('effect-keyframe-e2e', {exact: true}),
- ).toBeVisible();
- await page.keyboard.press('Enter');
- await expect(page).toHaveURL(/visual-controls/);
-
- await page.keyboard.press('ControlOrMeta+k');
- const compositionSearch = page.getByRole('dialog');
- await compositionSearch
- .getByPlaceholder('Search compositions...')
- .fill('effect-keyframe-e2e');
- await expect(
- compositionSearch.getByText('visual-controls', {exact: true}),
- ).toHaveCount(1);
- await expect(
- compositionSearch.getByText('effect-keyframe-e2e', {exact: true}),
- ).toBeVisible();
- await page.keyboard.press('Escape');
-
- await page.keyboard.press('ControlOrMeta+k');
- await page
- .getByPlaceholder('Search compositions...')
- .fill('timeline virtualization');
- await page.keyboard.press('Enter');
- await expect(page).toHaveURL(/timeline-virtualization-testbed/);
- });
-
- test('should create a subfolder from the folder context menu', async ({
- page,
- }) => {
- const originalSource = fs.readFileSync(rootFile, 'utf-8');
- const newFolderName = 'ContextMenuNested';
-
- try {
- await page.goto(STUDIO_URL);
- const parentFolder = page.locator(
- '.__remotion-composition-selector-item[role="button"][title="visual-controls"]',
- );
- await expect(parentFolder).toBeVisible({timeout: 15_000});
- await expect(parentFolder).toHaveAttribute('aria-expanded', 'false');
- await parentFolder.click({button: 'right'});
- await page
- .getByRole('button', {name: 'New folder...', exact: true})
- .click();
-
- const dialog = page.getByRole('dialog');
- const parentName = dialog.getByText('visual-controls', {exact: true});
- await expect(parentName).toBeVisible();
- await expect(parentName).toHaveCSS('font-size', '13px');
- await dialog.getByPlaceholder('Folder name').fill(newFolderName);
- await dialog.getByRole('button', {name: /Add to .*/}).click();
-
- await expect
- .poll(() => {
- const source = fs.readFileSync(rootFile, 'utf-8');
- const parentStart = source.indexOf('<Folder name="visual-controls">');
- const parentEnd = source.indexOf('</Folder>', parentStart);
- const nestedFolder = source.indexOf(
- `<Folder name="${newFolderName}" />`,
- parentStart,
- );
-
- return (
- parentStart !== -1 &&
- parentEnd !== -1 &&
- nestedFolder > parentStart &&
- nestedFolder < parentEnd
- );
- })
- .toBe(true);
-
- await expect(parentFolder).toHaveAttribute('aria-expanded', 'true');
- const newFolder = page.getByRole('button', {
- name: newFolderName,
- exact: true,
- });
- await expect(newFolder).toBeVisible();
- await expect(newFolder).toHaveAttribute('aria-expanded', 'false');
- } finally {
- fs.writeFileSync(rootFile, originalSource);
- }
- });
-
- test('should play when a composition in the sidebar is focused', async ({
- page,
- }) => {
- await navigateToSchemaTest(page);
-
- const otherComposition = page.getByTitle('AnimatedBarChart', {exact: true});
- await otherComposition.press('Space');
-
- await expect(page.getByRole('button', {name: 'Pause'})).toBeVisible();
- await expect(page).toHaveURL(/schema-test/);
- });
-
- test('should navigate to a newly created composition', async ({page}) => {
- const compositionName = 'Newly Created Composition';
- const compositionId = 'Newly-Created-Composition';
- const rootFile = path.join(exampleDir, 'src', 'E2eTestRoot.tsx');
- const compositionFile = path.join(
- exampleDir,
- 'src/NewlyCreatedComposition.tsx',
- );
- const originalRootSource = fs.readFileSync(rootFile, 'utf8');
-
- try {
- await page.goto(`${STUDIO_URL}/schema-test`);
- await expect(page).toHaveTitle(/schema-test/, {timeout: 15_000});
-
- await page.getByRole('button', {name: 'File', exact: true}).click();
- await page
- .getByRole('button', {name: 'New composition...', exact: true})
- .click();
- const compositionIdInput = page.getByRole('textbox', {
- name: 'Composition ID',
- });
- const slugPreview = page.getByText(`Will be created as ${compositionId}`);
- await compositionIdInput.fill(`${compositionId} `);
- await expect(slugPreview).toBeHidden();
- await compositionIdInput.fill(compositionName);
- await expect(slugPreview).toBeVisible();
- await page.getByTitle('Folder').click();
- const schemaFolderOption = page
- .getByRole('button', {name: 'Schema', exact: true})
- .last();
- const schemaFolderLabel = schemaFolderOption.getByText('Schema', {
- exact: true,
- });
- await expect(schemaFolderLabel).toHaveCSS('font-size', '13px');
- await schemaFolderOption.hover();
- await expect(schemaFolderLabel).toHaveCSS('font-size', '13px');
- await schemaFolderOption.click();
- await expect(page.getByTitle('Folder')).toHaveText('Schema');
-
- const createButton = page.getByRole('button', {
- name: /Add to .*/,
- });
- await expect(createButton).toBeEnabled();
- await createButton.click();
-
- await expect(page).toHaveURL(`${STUDIO_URL}/${compositionId}`, {
- timeout: 5_000,
- });
- await expect(page).toHaveTitle(new RegExp(compositionId), {
- timeout: 5_000,
- });
- const rootContents = fs.readFileSync(rootFile, 'utf8');
- const folderStart = rootContents.indexOf('<Folder name="Schema">');
- const folderEnd = rootContents.indexOf('</Folder>', folderStart);
- if (folderStart === -1 || folderEnd === -1) {
- throw new Error('Could not find the Schema folder in the root file');
- }
-
- const compositionPosition = rootContents.indexOf(`id="${compositionId}"`);
- expect(compositionPosition).toBeGreaterThan(folderStart);
- expect(compositionPosition).toBeLessThan(folderEnd);
- await expect.poll(() => fs.existsSync(compositionFile)).toBe(true);
-
- await page.getByRole('button', {name: /^Undo/}).click();
- await expect(page).toHaveURL(`${STUDIO_URL}/schema-test`, {
- timeout: 15_000,
- });
- await expect(page).toHaveTitle(/schema-test/);
- await expect
- .poll(() => fs.readFileSync(rootFile, 'utf8'))
- .toBe(originalRootSource);
- await expect.poll(() => fs.existsSync(compositionFile)).toBe(false);
-
- await page.getByRole('button', {name: /^Redo/}).click();
- await expect(page).toHaveURL(`${STUDIO_URL}/${compositionId}`, {
- timeout: 15_000,
- });
- await expect(page).toHaveTitle(new RegExp(compositionId));
- await expect
- .poll(() => fs.readFileSync(rootFile, 'utf8'))
- .toContain(`id="${compositionId}"`);
- await expect.poll(() => fs.existsSync(compositionFile)).toBe(true);
- } finally {
- const undoButton = page.getByRole('button', {name: /^Undo/});
- if ((await undoButton.count()) > 0 && (await undoButton.isEnabled())) {
- await undoButton.click();
- await expect.poll(() => fs.existsSync(compositionFile)).toBe(false);
- }
-
- fs.writeFileSync(rootFile, originalRootSource);
- fs.rmSync(compositionFile, {force: true});
- }
- });
-
- test('should collapse programmatically duplicated timeline rows', async ({
- page,
- }) => {
- await page.addInitScript(() => {
- window.localStorage.setItem(
- 'remotion.sidebarRightCollapsing',
- 'expanded',
- );
- });
- await page.goto(`${STUDIO_URL}/AnimatedBarChart`);
-
- const firstGridline = page.getByText('0% gridline', {exact: true});
- await expect(firstGridline).toBeVisible({timeout: 15_000});
- await expect(
- firstGridline
- .locator('..')
- .getByLabel('4 other programmatically duplicated instances are hidden'),
- ).toBeVisible({timeout: 15_000});
- await expect(page.getByText('25% gridline', {exact: true})).toHaveCount(0);
-
- await firstGridline.click();
- const duplicationLabel = page.getByText('5 instances', {
- exact: true,
- });
- await expect(duplicationLabel).toBeVisible();
- await expect(duplicationLabel).toHaveCSS('color', 'rgb(166, 167, 169)');
- await expect(duplicationLabel).toHaveCSS('font-family', 'sans-serif');
- await expect(duplicationLabel).toHaveCSS('font-size', '12px');
- await expect(duplicationLabel).toHaveCSS('font-weight', '400');
- await expect(duplicationLabel).toHaveCSS('line-height', '24px');
- await expect(duplicationLabel).toHaveCSS('margin-top', '2px');
- await expect(duplicationLabel).toHaveCSS('margin-bottom', '2px');
-
- await page
- .locator('[data-timeline-marquee-item][title="0% gridline"]')
- .click({button: 'right'});
- const duplicateMenuItem = page
- .locator('.__remotion-studio-menu-item')
- .filter({hasText: 'Duplicate'});
- await expect(duplicateMenuItem).toHaveCSS('opacity', '0.5');
- await expect(
- page
- .locator('.__remotion-studio-menu-item')
- .filter({hasText: 'Delete all'}),
- ).toBeVisible();
- });
-
- test('should split the right-clicked clip at the playhead from either timeline surface', async ({
- page,
- }) => {
- const sourceBefore = fs.readFileSync(sequenceShiftFile, 'utf-8');
- try {
- fs.writeFileSync(
- sequenceShiftFile,
- `import {Sequence} from 'remotion';
-export const SequenceShiftRepro = () => {
- return (
- <>
- <Sequence name="Split first" from={10} durationInFrames={50}>
- <div />
- </Sequence>
- <Sequence name="Split second" from={10} durationInFrames={50}>
- <div />
- </Sequence>
- </>
- );
-};`,
- );
- await page.goto(`${STUDIO_URL}/sequence-shift-repro`);
- const first = page.getByText('Split first', {exact: true});
- const second = page.getByText('Split second', {exact: true});
- await expect(first).toBeVisible({timeout: 30_000});
- const menu = page.locator('[data-remotion-menu-tree-id]').last();
- const split = menu.getByRole('button', {name: 'Split clip', exact: true});
- await page.keyboard.press('g');
- await page.locator('input:focus').fill('10');
- await page.locator('input:focus').press('Enter');
- await expect(async () => {
- await page.keyboard.press('Escape');
- await first.click({button: 'right'});
- await expect(split.locator('span[title]')).toHaveAttribute(
- 'title',
- 'Cannot split at the sequence start',
- {timeout: 500},
- );
- }).toPass({timeout: 15_000});
- await split.click();
- await expect(split).toBeVisible();
- await page.keyboard.press('Escape');
- await page.keyboard.press('g');
- await page.locator('input:focus').fill('30');
- await page.locator('input:focus').press('Enter');
- await first.click();
- await second.click({modifiers: ['Meta']});
- await second.click({button: 'right'});
- await expect(
- menu.getByRole('button', {name: 'Duplicate selected', exact: true}),
- ).toBeVisible();
- await expect(split).toHaveCount(0);
- await page.keyboard.press('Escape');
- await first.click();
- // Right-click an unselected label: split that clip, not the old selection.
- await second.click({button: 'right'});
- await expect(split.locator('span[title]')).toHaveAttribute(
- 'title',
- 'Split at the playhead',
- );
- await split.click();
- await expect
- .poll(
- () =>
- fs
- .readFileSync(sequenceShiftFile, 'utf-8')
- .match(/name="Split second"/g)?.length,
- )
- .toBe(2);
- await expect(second).toHaveCount(2);
- // The clip bar exposes the same action and timing context.
- await page
- .locator('[data-timeline-marquee-item][title="Split first"]')
- .click({button: 'right'});
- await expect(split.locator('span[title]')).toHaveAttribute(
- 'title',
- 'Split at the playhead',
- );
- await split.click();
- await expect
- .poll(
- () =>
- fs
- .readFileSync(sequenceShiftFile, 'utf-8')
- .match(/name="Split first"/g)?.length,
- )
- .toBe(2);
- const source = fs.readFileSync(sequenceShiftFile, 'utf-8');
- expect(source.match(/durationInFrames=\{20\}/g)).toHaveLength(2);
- expect(source.match(/trimBefore=\{20\}/g)).toHaveLength(2);
- } finally {
- fs.writeFileSync(sequenceShiftFile, sourceBefore);
- }
- });
-
- test('should keep selected canvas outlines visible outside the canvas', async ({
- page,
- }) => {
- await page.goto(`${STUDIO_URL}/AnimatedBarChart`);
-
- const firstGridline = page.getByText('0% gridline', {exact: true});
- await expect(firstGridline).toBeVisible({timeout: 15_000});
-
- const canvas = page.locator('.remotion-studio-composition-container');
- const visibleOutlines = canvas.locator(
- '> svg[aria-hidden="true"] polygon[stroke="#0b84f3"][stroke-opacity="1"]',
- );
- await retryCanvasInteractionUntilOutlineIsVisible({
- interaction: () => canvas.hover(),
- outline: visibleOutlines,
- page,
- });
- await visibleOutlines.first().click({force: true});
- await page.mouse.move(0, 0);
- await expect(visibleOutlines.first()).toBeVisible();
- });
-
- test('should clear selection after context-menu deletion and preserve following interactive elements', async ({
- context,
- page,
- }) => {
- await context.addInitScript(() => {
- type RegisteredTool = {
- readonly name: string;
- readonly execute: (input: Record<string, unknown>) => Promise<unknown>;
- };
- const tools = new Map<string, RegisteredTool>();
- Object.defineProperty(window, '__remotion_webmcp_tools', {
- value: tools,
- });
- Object.defineProperty(document, 'modelContext', {
- value: {
- registerTool: async (
- tool: RegisteredTool,
- options: {readonly signal: AbortSignal},
- ) => {
- tools.set(tool.name, tool);
- options.signal.addEventListener('abort', () => {
- if (tools.get(tool.name) === tool) {
- tools.delete(tool.name);
- }
- });
- },
- },
- });
- });
- await navigateToLostNodePathE2e(page);
- const getWebMcpSelection = () =>
- page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools?: Map<
- string,
- {readonly execute: () => Promise<unknown>}
- >;
- }
- ).__remotion_webmcp_tools;
- if (!tools) {
- return null;
- }
-
- const tool = tools.get('get_selection');
- if (!tool) {
- return null;
- }
-
- return tool.execute();
- });
- const otherPage = await context.newPage();
- await navigateToLostNodePathE2e(otherPage);
- const canvas = page.locator('.remotion-studio-composition-container');
- const otherCanvas = otherPage.locator(
- '.remotion-studio-composition-container',
- );
- await expect(
- canvas.getByText('Performance overview', {exact: true}),
- ).toBeVisible();
- await expect(
- canvas.getByText('Regional growth', {exact: true}),
- ).toHaveCount(1);
- await expect(
- canvas.getByText('Bars remain visible', {exact: true}),
- ).toBeVisible();
- await expect(
- otherCanvas.getByText('Bars remain visible', {exact: true}),
- ).toBeVisible();
- const gridline = page.getByText('0% gridline', {exact: true});
- const gridlineVisibilityToggle = gridline
- .locator('..')
- .locator('..')
- .locator('[data-timeline-layer-eye]');
- const otherGridlineVisibilityToggle = otherPage
- .getByText('0% gridline', {exact: true})
- .locator('..')
- .locator('..')
- .locator('[data-timeline-layer-eye]');
- await expect(gridlineVisibilityToggle).toBeVisible();
- await expect(otherGridlineVisibilityToggle).toBeVisible();
- await page.evaluate(() => {
- const state = window as typeof window & {
- sequenceRemappingBadFrames: string[] | null;
- };
- state.sequenceRemappingBadFrames = [];
- const sample = () => {
- const container = document.querySelector(
- '.remotion-studio-composition-container',
- );
- if (!container) {
- requestAnimationFrame(sample);
- return;
- }
-
- const regionalGrowthElements = [
- ...container.querySelectorAll('*'),
- ].filter((element) =>
- [...element.childNodes].some(
- (child) =>
- child.nodeType === Node.TEXT_NODE &&
- child.textContent?.trim() === 'Regional growth',
- ),
- );
- if (regionalGrowthElements.length > 1) {
- state.sequenceRemappingBadFrames?.push('duplicate-title');
- }
-
- if (
- regionalGrowthElements.some(
- (element) =>
- getComputedStyle(element).textTransform === 'uppercase',
- )
- ) {
- state.sequenceRemappingBadFrames?.push('uppercase-title');
- }
-
- const gridline = [...document.querySelectorAll('div')].find(
- (element) =>
- element.childNodes.length === 1 &&
- element.textContent === '0% gridline',
- );
- const gridlineRow = gridline?.parentElement?.parentElement;
- if (
- gridlineRow &&
- !gridlineRow.querySelector('[data-timeline-layer-eye]')
- ) {
- state.sequenceRemappingBadFrames?.push(
- 'missing-gridline-visibility-toggle',
- );
- }
-
- requestAnimationFrame(sample);
- };
- requestAnimationFrame(sample);
- });
-
- const eyebrow = page.locator(
- '[data-timeline-marquee-item][title="Eyebrow"]',
- );
- await eyebrow.click({button: 'right'});
- await expect.poll(getWebMcpSelection).toEqual(
- expect.objectContaining({
- selectionType: 'sequence',
- selectedSequence: expect.objectContaining({name: 'Eyebrow'}),
- }),
- );
- await page.getByRole('button', {name: 'Delete', exact: true}).click();
-
- await expect
- .poll(() => fs.readFileSync(lostNodePathE2eFile, 'utf-8'))
- .not.toContain('name="Eyebrow"');
- await expect(eyebrow).toHaveCount(0, {timeout: 30_000});
- await expect(
- canvas.getByText('Regional growth', {exact: true}),
- ).toHaveCount(1);
- await expect(
- canvas.getByText('Bars remain visible', {exact: true}),
- ).toBeVisible();
- await expect(
- otherCanvas.getByText('Regional growth', {exact: true}),
- ).toHaveCount(1);
- await expect(
- otherCanvas.getByText('Bars remain visible', {exact: true}),
- ).toBeVisible();
- await expect(
- page.locator('[data-timeline-marquee-item][title="Title"]'),
- ).toBeVisible();
- await expect(
- page.locator('[data-timeline-marquee-item][title="Chart"]'),
- ).toBeVisible();
- await expect(gridlineVisibilityToggle).toBeVisible();
- await expect(otherGridlineVisibilityToggle).toBeVisible();
- await expect.poll(getWebMcpSelection).toEqual(
- expect.objectContaining({
- currentSelection: null,
- selectionType: null,
- selectedSequence: null,
- }),
- );
-
- await page.getByRole('button', {name: /^Undo/}).click();
- await expect
- .poll(() => fs.readFileSync(lostNodePathE2eFile, 'utf-8'))
- .toContain('name="Eyebrow"');
- await expect(eyebrow).toBeVisible({timeout: 30_000});
- await expect(
- canvas.getByText('Performance overview', {exact: true}),
- ).toBeVisible();
- await expect(
- canvas.getByText('Regional growth', {exact: true}),
- ).toHaveCount(1);
- await expect(
- canvas.getByText('Bars remain visible', {exact: true}),
- ).toBeVisible();
- await expect(
- otherCanvas.getByText('Performance overview', {exact: true}),
- ).toBeVisible();
- await expect(
- otherCanvas.getByText('Regional growth', {exact: true}),
- ).toHaveCount(1);
- await expect(
- otherCanvas.getByText('Bars remain visible', {exact: true}),
- ).toBeVisible();
- await expect(gridlineVisibilityToggle).toBeVisible();
- await expect(otherGridlineVisibilityToggle).toBeVisible();
-
- await page.getByRole('button', {name: /^Redo/}).click();
- await expect
- .poll(() => fs.readFileSync(lostNodePathE2eFile, 'utf-8'))
- .not.toContain('name="Eyebrow"');
- await expect(eyebrow).toHaveCount(0, {timeout: 30_000});
- await expect(
- canvas.getByText('Regional growth', {exact: true}),
- ).toHaveCount(1);
- await expect(
- canvas.getByText('Bars remain visible', {exact: true}),
- ).toBeVisible();
- await expect(
- otherCanvas.getByText('Regional growth', {exact: true}),
- ).toHaveCount(1);
- await expect(
- otherCanvas.getByText('Bars remain visible', {exact: true}),
- ).toBeVisible();
- await expect(gridlineVisibilityToggle).toBeVisible();
- await expect(otherGridlineVisibilityToggle).toBeVisible();
- expect(
- await page.evaluate(
- () =>
- (
- window as typeof window & {
- sequenceRemappingBadFrames: string[] | null;
- }
- ).sequenceRemappingBadFrames ?? [],
- ),
- ).toEqual([]);
- });
-
- test('should use an explicit editor or fall back to an installed editor', async ({
- page,
- }) => {
- await page.addInitScript(() => {
- Object.defineProperty(window, 'remotion_editorName', {
- configurable: true,
- get: () => null,
- set: () => undefined,
- });
- });
- await page.route('**/api/default-editor-info', async (route) => {
- await route.fulfill({
- json: {
- success: true,
- data: {
- defaultEditor: null,
- installedEditors: [
- {
- id: 'cursor',
- name: 'Cursor',
- nameWithType: 'Cursor Editor',
- },
- {id: 'vscode', name: 'Code', nameWithType: 'Code'},
- {id: 'zed', name: 'Zed', nameWithType: 'Zed'},
- ],
- },
- },
- });
- });
- await page.route('**/api/default-coding-agent-info', async (route) => {
- await route.fulfill({
- json: {
- success: true,
- data: {
- defaultCodingAgent: null,
- installedCodingAgents: [],
- installedTerminals: [],
- },
- },
- });
- });
- 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 projectLocation = page.getByTitle(exampleDir);
- const primaryOpenInZed = projectLocation.getByRole('button', {
- name: 'Open in Zed',
- exact: true,
- });
- await expect(primaryOpenInZed).toBeVisible({timeout: 15_000});
- await expect(primaryOpenInZed).toBeEnabled();
-
- await projectLocation
- .getByRole('button', {name: 'Open in another app', exact: true})
- .click();
- await expect(
- page.getByRole('button', {name: 'Cursor', exact: true}),
- ).toBeVisible();
- await expect(
- page.getByRole('button', {name: 'Code', exact: true}),
- ).toBeVisible();
- await expect(
- page.getByRole('button', {name: 'Zed', exact: true}),
- ).toHaveCount(0);
-
- await page.getByRole('button', {name: 'Code', exact: true}).click();
- await expect
- .poll(() => openInEditorRequests)
- .toEqual([
- expect.objectContaining({
- editorId: 'vscode',
- }),
- ]);
- await expect(
- page.getByRole('button', {name: 'Cursor', exact: true}),
- ).toBeHidden();
- await primaryOpenInZed.click();
- await expect
- .poll(() => openInEditorRequests)
- .toEqual([
- expect.objectContaining({
- editorId: 'vscode',
- }),
- expect.objectContaining({
- editorId: 'zed',
- }),
- ]);
-
- const timelineGridline = page.locator(
- '[data-timeline-marquee-item][title="0% gridline"]',
- );
- await timelineGridline.click();
- await page.locator('[data-sidebar-toggle="right"]').click();
- const sourceLocation = page
- .getByRole('group', {name: 'Inspector source location'})
- .first();
- await expect(sourceLocation).toBeVisible();
- const sourceLink = sourceLocation.getByRole('button', {
- name: /BarChart\.tsx:\d+/,
- });
- await expect(sourceLink).toBeEnabled();
- await sourceLink.click();
- await expect
- .poll(() => openInEditorRequests)
- .toEqual([
- expect.objectContaining({
- editorId: 'vscode',
- }),
- expect.objectContaining({
- editorId: 'zed',
- }),
- expect.objectContaining({
- editorId: 'zed',
- }),
- ]);
-
- await timelineGridline.click({button: 'right'});
- const sequenceContextMenu = page
- .locator('[data-remotion-menu-tree-id]')
- .last();
- const contextMenuOpenInZed = sequenceContextMenu.getByRole('button', {
- name: 'Open in Zed',
- exact: true,
- });
- await expect(contextMenuOpenInZed).toBeEnabled();
- await contextMenuOpenInZed.click();
- await expect
- .poll(() => openInEditorRequests)
- .toEqual([
- expect.objectContaining({
- editorId: 'vscode',
- }),
- expect.objectContaining({
- editorId: 'zed',
- }),
- expect.objectContaining({
- editorId: 'zed',
- }),
- expect.objectContaining({
- editorId: 'zed',
- }),
- ]);
- });
-
- test('should disable opening when no editor is installed', async ({page}) => {
- await page.addInitScript(() => {
- Object.defineProperty(window, 'remotion_editorName', {
- configurable: true,
- get: () => null,
- set: () => undefined,
- });
- });
- await page.route('**/api/default-editor-info', async (route) => {
- await route.fulfill({
- json: {
- success: true,
- data: {defaultEditor: null, installedEditors: []},
- },
- });
- });
- await page.route('**/api/default-coding-agent-info', async (route) => {
- await route.fulfill({
- json: {
- success: true,
- data: {
- defaultCodingAgent: null,
- installedCodingAgents: [],
- installedTerminals: [],
- },
- },
- });
- });
-
- await page.goto(`${STUDIO_URL}/AnimatedBarChart`);
- const projectLocation = page.getByTitle(exampleDir);
- await projectLocation.hover();
- await expect(
- projectLocation.getByRole('button', {
- name: 'Open in default editor',
- exact: true,
- }),
- ).toBeDisabled({timeout: 15_000});
-
- if (!(await page.getByRole('button', {name: 'Inspector'}).isVisible())) {
- await page.locator('[data-sidebar-toggle="right"]').click();
- }
- const sourceLocation = page
- .getByRole('group', {name: 'Inspector source location'})
- .first();
- await expect(sourceLocation).toBeVisible();
- await expect(
- sourceLocation.getByRole('button', {name: /\.tsx:\d+/}).first(),
- ).toBeDisabled();
- });
-
- test('should use standalone and contextual app names in portaled context menus', async ({
- context,
- page,
- }) => {
- const configFile = path.join(exampleDir, 'remotion.config.ts');
- const configBeforeTest = fs.readFileSync(configFile, 'utf8');
- await context.grantPermissions(['clipboard-read', 'clipboard-write'], {
- origin: STUDIO_URL,
- });
- await page.addInitScript(() => {
- window.localStorage.setItem('remotion.mute', 'false');
- window.localStorage.setItem('remotion.loop', 'true');
- window.localStorage.setItem('remotion.editorShowGuides', 'true');
- window.localStorage.setItem(
- 'remotion.guidesList',
- JSON.stringify([
- {
- id: 'webmcp-vertical-guide',
- orientation: 'vertical',
- position: 320,
- show: true,
- compositionId: 'AnimatedBarChart',
- },
- {
- id: 'webmcp-horizontal-guide',
- orientation: 'horizontal',
- position: 180,
- show: true,
- compositionId: 'AnimatedBarChart',
- },
- {
- id: 'other-composition-guide',
- orientation: 'vertical',
- position: 100,
- show: true,
- compositionId: 'Shapes',
- },
- ]),
- );
- type RegisteredTool = {
- readonly name: string;
- readonly execute: (input: Record<string, unknown>) => Promise<unknown>;
- };
- const tools = new Map<string, RegisteredTool>();
- Object.defineProperty(window, '__remotion_webmcp_tools', {
- value: tools,
- });
- Object.defineProperty(document, 'modelContext', {
- value: {
- registerTool: async (
- tool: RegisteredTool,
- options: {readonly signal: AbortSignal},
- ) => {
- tools.set(tool.name, tool);
- options.signal.addEventListener('abort', () => {
- if (tools.get(tool.name) === tool) {
- tools.delete(tool.name);
- }
- });
- },
- },
- });
- });
- await page.route('**/api/default-editor-info', async (route) => {
- await route.fulfill({
- json: {
- success: true,
- data: {
- defaultEditor: 'cursor',
- installedEditors: [
- {
- id: 'cursor',
- name: 'Cursor',
- nameWithType: 'Cursor Editor',
- },
- {id: 'vscode', name: 'Code', nameWithType: 'Code'},
- ],
- },
- },
- });
- });
- await page.route('**/api/default-coding-agent-info', async (route) => {
- await route.fulfill({
- json: {
- success: true,
- data: {
- defaultCodingAgent: 'cursor',
- installedCodingAgents: [
- {
- id: 'cursor',
- name: 'Cursor',
- nameWithType: 'Cursor Agent',
- },
- {
- id: 'codex',
- name: 'Codex',
- nameWithType: 'Codex',
- },
- ],
- installedTerminals: [
- {id: 'terminal', name: 'Terminal'},
- {id: 'iterm2', name: 'iTerm2'},
- {id: 'windows-terminal', name: 'Windows Terminal'},
- ],
- },
- },
- });
- });
- const launchRequests: Array<{
- readonly codingAgentId: string;
- readonly prompt: string | null;
- }> = [];
- const terminalLaunchRequests: Array<{
- readonly directory: string;
- readonly terminalId: string;
- }> = [];
- await page.route('**/api/open-in-coding-agent', async (route) => {
- launchRequests.push(route.request().postDataJSON());
- await route.fulfill({
- json: {success: true, data: {success: true}},
- });
- });
- await page.route('**/api/open-in-terminal', async (route) => {
- terminalLaunchRequests.push(route.request().postDataJSON());
- await route.fulfill({
- json: {success: true, data: {success: true}},
- });
- });
-
- try {
- await page.goto(`${STUDIO_URL}/AnimatedBarChart`);
- const firstGridline = page.getByText('0% gridline', {exact: true});
- await expect(firstGridline).toBeVisible({timeout: 15_000});
- const projectOpenInAnotherApp = page
- .getByTitle(exampleDir)
- .getByRole('button', {name: 'Open in another app'});
- await projectOpenInAnotherApp.click();
- const terminalButton = page.getByRole('button', {
- name: 'Terminal',
- exact: true,
- });
- const iTermButton = page.getByRole('button', {
- name: 'iTerm2',
- exact: true,
- });
- const windowsTerminalButton = page.getByRole('button', {
- name: 'Windows Terminal',
- exact: true,
- });
- await expect(page.getByText('Editor', {exact: true})).toBeVisible();
- await expect(page.getByText('Agent', {exact: true})).toBeVisible();
- await expect(page.getByText('Terminal', {exact: true})).toHaveCount(2);
- await expect(iTermButton).toBeVisible();
- await expect(windowsTerminalButton).toBeVisible();
- await expect(page.getByText('Editors', {exact: true})).toHaveCount(0);
- await expect(page.getByText('Agents', {exact: true})).toHaveCount(0);
- const terminalIcon = terminalButton.locator(
- 'img[data-terminal-icon="terminal"]',
- );
- await expect(terminalIcon).toHaveAttribute(
- 'src',
- '/api/app-icon/terminal/terminal.png',
- );
- await expect
- .poll(() =>
- terminalIcon.evaluate(
- (image) => (image as HTMLImageElement).naturalWidth,
- ),
- )
- .toBe(72);
- await terminalButton.click();
- await expect
- .poll(() => terminalLaunchRequests)
- .toEqual([{directory: exampleDir, terminalId: 'terminal'}]);
-
- await projectOpenInAnotherApp.click();
- await expect(
- iTermButton.locator('img[data-terminal-icon="iterm2"]'),
- ).toBeVisible();
- await iTermButton.click();
- await expect
- .poll(() => terminalLaunchRequests)
- .toEqual([
- {directory: exampleDir, terminalId: 'terminal'},
- {directory: exampleDir, terminalId: 'iterm2'},
- ]);
-
- await projectOpenInAnotherApp.click();
- await expect(
- windowsTerminalButton.locator(
- 'img[data-terminal-icon="windows-terminal"]',
- ),
- ).toBeVisible();
- await windowsTerminalButton.click();
- await expect
- .poll(() => terminalLaunchRequests)
- .toEqual([
- {directory: exampleDir, terminalId: 'terminal'},
- {directory: exampleDir, terminalId: 'iterm2'},
- {directory: exampleDir, terminalId: 'windows-terminal'},
- ]);
-
- fs.writeFileSync(
- configFile,
- `${configBeforeTest}\nConfig.setDefaultEditor('cursor');\nConfig.setDefaultCodingAgent('cursor');\n`,
- );
- await expect
- .poll(() =>
- page.evaluate(() => window.remotion_studioConfig?.defaultCodingAgent),
- )
- .toBe('cursor');
- await page.evaluate(() => {
- window.remotion_editorName = 'Cursor Editor';
- });
-
- const timelineGridline = page.locator(
- '[data-timeline-marquee-item][title="0% gridline"]',
- );
- await timelineGridline.click({button: 'right'});
- await expect(
- page.getByText('Open in Cursor Editor', {exact: true}),
- ).toBeVisible();
- await page.getByRole('button', {name: 'Open in...', exact: true}).click();
- const cursorAgentButton = page.getByRole('button', {
- name: 'Cursor',
- exact: true,
- });
- await expect(
- cursorAgentButton.locator('img[data-coding-agent-icon="cursor"]'),
- ).toBeVisible();
- await expect(
- page.getByRole('button', {name: 'Open component docs', exact: true}),
- ).toHaveCount(0);
- await cursorAgentButton.click();
- await expect.poll(() => launchRequests.length).toBe(1);
- expect(launchRequests[0]?.codingAgentId).toBe('cursor');
- expect(launchRequests[0]?.prompt).toMatch(
- /^0% gridline in src\/BarChart\.tsx:\d+$/,
- );
- const contextForAgents = launchRequests[0]?.prompt;
- await timelineGridline.click({button: 'right'});
- await page
- .getByRole('button', {name: 'Copy context for agents', exact: true})
- .click();
- await expect
- .poll(() => page.evaluate(() => navigator.clipboard.readText()))
- .toBe(contextForAgents);
- await page.getByRole('button', {name: 'Go to beginning'}).click();
- for (let i = 0; i < 3; i++) {
- await page.getByRole('button', {name: 'Go forward 1 frame'}).click();
- }
- await expect
- .poll(() =>
- page.evaluate(() => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<string, unknown>;
- }
- ).__remotion_webmcp_tools;
- return (
- tools.has('get_compositions') &&
- tools.has('select_composition') &&
- tools.has('get_sequences') &&
- tools.has('select_sequence') &&
- tools.has('get_composition') &&
- tools.has('get_canvas_html') &&
- tools.has('get_outlines') &&
- tools.has('get_playback_state') &&
- tools.has('get_selection') &&
- tools.has('get_guides') &&
- tools.has('set_guides_visible') &&
- tools.has('add_guide') &&
- tools.has('remove_guide') &&
- tools.has('play') &&
- tools.has('pause') &&
- tools.has('mute') &&
- tools.has('unmute') &&
- tools.has('set_timeline_zoom') &&
- tools.has('set_playback_rate') &&
- tools.has('seek_to_frame')
- );
- }),
- )
- .toBe(true);
- const webMcpSelection = await page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {readonly execute: () => Promise<unknown>}
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('get_selection');
- if (!tool) {
- throw new Error('get_selection was not registered');
- }
-
- return tool.execute();
- });
- expect(webMcpSelection).toEqual({
- currentFrame: 3,
- currentSelection: contextForAgents,
- currentContent: {
- type: 'composition',
- compositionId: 'AnimatedBarChart',
- },
- selectionType: 'sequence',
- selectedSequence: expect.objectContaining({
- sequenceId: expect.any(String),
- name: '0% gridline',
- type: 'sequence',
- stack: expect.any(String),
- selectable: true,
- }),
- });
- const selectedSequence = (
- webMcpSelection as {
- readonly selectedSequence: {
- readonly sequenceId: string;
- readonly parentSequenceId: string | null;
- };
- }
- ).selectedSequence;
- const webMcpSequences = await page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {readonly execute: () => Promise<unknown>}
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('get_sequences');
- if (!tool) {
- throw new Error('get_sequences was not registered');
- }
-
- return tool.execute();
- });
- const sequenceList = (
- webMcpSequences as {
- readonly sequences: readonly {
- readonly sequenceId: string;
- readonly selectable: boolean;
- }[];
- }
- ).sequences;
- expect(webMcpSequences).toEqual({
- currentContent: {
- type: 'composition',
- compositionId: 'AnimatedBarChart',
- },
- sequences: expect.arrayContaining([
- expect.objectContaining({
- sequenceId: selectedSequence.sequenceId,
- name: '0% gridline',
- selectable: true,
- }),
- ]),
- });
- const sequenceToSelect = sequenceList.find(
- (sequence) =>
- sequence.selectable &&
- sequence.sequenceId !== selectedSequence.sequenceId,
- );
- expect(sequenceToSelect).toBeDefined();
- const webMcpSelectSequenceResult = await page.evaluate(
- async ({sequenceId}) => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {
- readonly execute: (
- input: Record<string, unknown>,
- ) => Promise<unknown>;
- }
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('select_sequence');
- if (!tool) {
- throw new Error('select_sequence was not registered');
- }
-
- return tool.execute({sequenceId});
- },
- {sequenceId: sequenceToSelect?.sequenceId ?? ''},
- );
- expect(webMcpSelectSequenceResult).toEqual({
- currentContent: {
- type: 'composition',
- compositionId: 'AnimatedBarChart',
- },
- selectedSequence: expect.objectContaining({
- sequenceId: sequenceToSelect?.sequenceId,
- selectable: true,
- }),
- });
- await expect
- .poll(() =>
- page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {readonly execute: () => Promise<unknown>}
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('get_selection');
- const selection = (await tool?.execute()) as {
- readonly selectionType?: string;
- readonly selectedSequence?: {
- readonly sequenceId?: string;
- };
- };
- return {
- selectionType: selection.selectionType,
- sequenceId: selection.selectedSequence?.sequenceId,
- };
- }),
- )
- .toEqual({
- selectionType: 'sequence',
- sequenceId: sequenceToSelect?.sequenceId,
- });
- const webMcpComposition = await page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {readonly execute: () => Promise<unknown>}
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('get_composition');
- if (!tool) {
- throw new Error('get_composition was not registered');
- }
-
- return tool.execute();
- });
- expect(webMcpComposition).toEqual({
- compositionName: 'AnimatedBarChart',
- stack: expect.any(String),
- durationInFrames: 180,
- height: 720,
- width: 1280,
- fps: 30,
- currentFrame: 3,
- });
- const webMcpCanvasHtml = await page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {readonly execute: () => Promise<unknown>}
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('get_canvas_html');
- if (!tool) {
- throw new Error('get_canvas_html was not registered');
- }
-
- return tool.execute();
- });
- const canvasHtml = (
- webMcpCanvasHtml as {
- readonly html: string;
- readonly htmlLength: number;
- }
- ).html;
- expect(webMcpCanvasHtml).toEqual({
- currentContent: {
- type: 'composition',
- compositionId: 'AnimatedBarChart',
- },
- currentFrame: 3,
- html: expect.any(String),
- htmlLength: canvasHtml.length,
- truncated: false,
- });
- expect(canvasHtml).toContain('Performance overview');
- expect(canvasHtml).toContain('Regional growth');
- expect(canvasHtml).not.toContain('Playback rate');
- const webMcpOutlines = await page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {readonly execute: () => Promise<unknown>}
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('get_outlines');
- if (!tool) {
- throw new Error('get_outlines was not registered');
- }
-
- return tool.execute();
- });
- const gridlineOutline = (
- webMcpOutlines as {
- readonly outlines: readonly {
- readonly name: string | null;
- readonly sequenceId: string;
- readonly parentSequenceId: string | null;
- readonly location: {
- readonly filename: string;
- readonly line: number;
- } | null;
- readonly geometry: {
- readonly points: readonly {
- readonly x: number;
- readonly y: number;
- }[];
- readonly boundingBox: {
- readonly x: number;
- readonly y: number;
- readonly width: number;
- readonly height: number;
- };
- };
- }[];
- }
- ).outlines.find((outline) => outline.name === '0% gridline');
- expect(webMcpOutlines).toEqual({
- currentContent: {
- type: 'composition',
- compositionId: 'AnimatedBarChart',
- },
- currentFrame: 3,
- outlines: expect.any(Array),
- });
- expect(gridlineOutline).toEqual({
- sequenceId: selectedSequence.sequenceId,
- parentSequenceId: selectedSequence.parentSequenceId,
- name: '0% gridline',
- location: {
- filename: 'src/BarChart.tsx',
- line: expect.any(Number),
- },
- geometry: {
- points: expect.arrayContaining([
- expect.objectContaining({
- x: expect.any(Number),
- y: expect.any(Number),
- }),
- ]),
- boundingBox: {
- x: expect.any(Number),
- y: expect.any(Number),
- width: expect.any(Number),
- height: expect.any(Number),
- },
- },
- });
- expect(gridlineOutline?.geometry.points).toHaveLength(4);
- expect(gridlineOutline?.geometry.boundingBox.x).toBeGreaterThan(150);
- expect(gridlineOutline?.geometry.boundingBox.x).toBeLessThan(180);
- expect(gridlineOutline?.geometry.boundingBox.y).toBeGreaterThan(550);
- expect(gridlineOutline?.geometry.boundingBox.y).toBeLessThan(610);
- expect(gridlineOutline?.geometry.boundingBox.width).toBeGreaterThan(950);
- expect(gridlineOutline?.geometry.boundingBox.width).toBeLessThan(1030);
- const webMcpCompositions = await page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {readonly execute: () => Promise<unknown>}
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('get_compositions');
- if (!tool) {
- throw new Error('get_compositions was not registered');
- }
-
- return tool.execute();
- });
- expect(webMcpCompositions).toEqual({
- compositions: expect.arrayContaining([
- {
- type: 'folder',
- folderName: 'visual-controls',
- children: [
- {
- type: 'composition',
- compositionName: 'visual-controls',
- },
- {
- type: 'composition',
- compositionName: 'effect-keyframe-e2e',
- },
- ],
- },
- {
- type: 'composition',
- compositionName: 'AnimatedBarChart',
- },
- ]),
- });
- const webMcpSelectCompositionResult = await page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {
- readonly execute: (
- input: Record<string, unknown>,
- ) => Promise<unknown>;
- }
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('select_composition');
- if (!tool) {
- throw new Error('select_composition was not registered');
- }
-
- return tool.execute({compositionName: 'package-absolute-fill'});
- });
- expect(webMcpSelectCompositionResult).toEqual({
- currentContent: {
- type: 'composition',
- compositionId: 'package-absolute-fill',
- },
- });
- await expect
- .poll(() => new URL(page.url()).pathname)
- .toBe('/package-absolute-fill');
- await expect
- .poll(() =>
- page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {readonly execute: () => Promise<unknown>}
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('get_composition');
- const result = (await tool?.execute()) as {
- readonly compositionName?: string;
- };
- return result?.compositionName ?? null;
- }),
- )
- .toBe('package-absolute-fill');
- await page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {
- readonly execute: (
- input: Record<string, unknown>,
- ) => Promise<unknown>;
- }
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('select_composition');
- if (!tool) {
- throw new Error('select_composition was not registered');
- }
-
- await tool.execute({compositionName: 'AnimatedBarChart'});
- });
- await expect
- .poll(() => new URL(page.url()).pathname)
- .toBe('/AnimatedBarChart');
- const webMcpGuides = await page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {
- readonly execute: (
- input: Record<string, unknown>,
- ) => Promise<unknown>;
- }
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('get_guides');
- if (!tool) {
- throw new Error('get_guides was not registered');
- }
-
- return tool.execute({});
- });
- expect(webMcpGuides).toEqual({
- currentContent: {
- type: 'composition',
- compositionId: 'AnimatedBarChart',
- },
- guidesVisible: true,
- guides: [
- {
- id: 'webmcp-vertical-guide',
- orientation: 'vertical',
- position: 320,
- visible: true,
- },
- {
- id: 'webmcp-horizontal-guide',
- orientation: 'horizontal',
- position: 180,
- visible: true,
- },
- ],
- });
- await expect(page.locator('.__remotion_editor_guide')).toHaveCount(2);
- const webMcpHideGuidesResult = await page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {
- readonly execute: (
- input: Record<string, unknown>,
- ) => Promise<unknown>;
- }
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('set_guides_visible');
- if (!tool) {
- throw new Error('set_guides_visible was not registered');
- }
-
- return tool.execute({visible: false});
- });
- expect(webMcpHideGuidesResult).toEqual({
- currentContent: {
- type: 'composition',
- compositionId: 'AnimatedBarChart',
- },
- guidesVisible: false,
- });
- await expect(page.locator('.__remotion_editor_guide')).toHaveCount(0);
- await expect
- .poll(() =>
- page.evaluate(() =>
- localStorage.getItem('remotion.editorShowGuides'),
- ),
- )
- .toBe('false');
- const webMcpShowGuidesResult = await page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {
- readonly execute: (
- input: Record<string, unknown>,
- ) => Promise<unknown>;
- }
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('set_guides_visible');
- if (!tool) {
- throw new Error('set_guides_visible was not registered');
- }
-
- return tool.execute({visible: true});
- });
- expect(webMcpShowGuidesResult).toEqual({
- currentContent: {
- type: 'composition',
- compositionId: 'AnimatedBarChart',
- },
- guidesVisible: true,
- });
- await expect(page.locator('.__remotion_editor_guide')).toHaveCount(2);
- await expect
- .poll(() =>
- page.evaluate(() =>
- localStorage.getItem('remotion.editorShowGuides'),
- ),
- )
- .toBe('true');
- const webMcpAddGuideResult = await page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {
- readonly execute: (
- input: Record<string, unknown>,
- ) => Promise<unknown>;
- }
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('add_guide');
- if (!tool) {
- throw new Error('add_guide was not registered');
- }
-
- return tool.execute({orientation: 'vertical', position: 640});
- });
- expect(webMcpAddGuideResult).toEqual({
- currentContent: {
- type: 'composition',
- compositionId: 'AnimatedBarChart',
- },
- guide: {
- id: expect.any(String),
- orientation: 'vertical',
- position: 640,
- visible: true,
- },
- });
- const addedGuideId = (
- webMcpAddGuideResult as {readonly guide: {readonly id: string}}
- ).guide.id;
- await expect
- .poll(() =>
- page.evaluate(
- ({guideId}) => {
- const guides = JSON.parse(
- localStorage.getItem('remotion.guidesList') ?? '[]',
- ) as {readonly id: string}[];
- return guides.some((guide) => guide.id === guideId);
- },
- {guideId: addedGuideId},
- ),
- )
- .toBe(true);
- await expect(page.locator('.__remotion_editor_guide')).toHaveCount(3);
- const webMcpRemoveGuideResult = await page.evaluate(
- async ({guideId}) => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {
- readonly execute: (
- input: Record<string, unknown>,
- ) => Promise<unknown>;
- }
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('remove_guide');
- if (!tool) {
- throw new Error('remove_guide was not registered');
- }
-
- return tool.execute({guideId});
- },
- {guideId: addedGuideId},
- );
- expect(webMcpRemoveGuideResult).toEqual({
- currentContent: {
- type: 'composition',
- compositionId: 'AnimatedBarChart',
- },
- guideId: addedGuideId,
- removed: true,
- });
- await expect
- .poll(() =>
- page.evaluate(
- ({guideId}) => {
- const guides = JSON.parse(
- localStorage.getItem('remotion.guidesList') ?? '[]',
- ) as {readonly id: string}[];
- return guides.some((guide) => guide.id === guideId);
- },
- {guideId: addedGuideId},
- ),
- )
- .toBe(false);
- await expect(page.locator('.__remotion_editor_guide')).toHaveCount(2);
- const webMcpPlaybackRateResult = await page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {
- readonly execute: (
- input: Record<string, unknown>,
- ) => Promise<unknown>;
- }
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('set_playback_rate');
- if (!tool) {
- throw new Error('set_playback_rate was not registered');
- }
-
- return tool.execute({playbackRate: 1.5});
- });
- expect(webMcpPlaybackRateResult).toEqual({
- currentContent: {
- type: 'composition',
- compositionId: 'AnimatedBarChart',
- },
- playbackRate: 1.5,
- });
- await expect(
- page.getByRole('button', {
- name: 'Playback rate',
- exact: true,
- }),
- ).toContainText('1.5x');
- const webMcpTimelineZoomResult = await page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {
- readonly execute: (
- input: Record<string, unknown>,
- ) => Promise<unknown>;
- }
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('set_timeline_zoom');
- if (!tool) {
- throw new Error('set_timeline_zoom was not registered');
- }
-
- return tool.execute({zoom: 0.5});
- });
- expect(webMcpTimelineZoomResult).toEqual({
- currentContent: {
- type: 'composition',
- compositionId: 'AnimatedBarChart',
- },
- timelineZoom: expect.any(Number),
- });
- const normalizedTimelineZoom = (
- webMcpTimelineZoomResult as {readonly timelineZoom: number}
- ).timelineZoom;
- expect(normalizedTimelineZoom).toBeCloseTo(0.5, 2);
- await expect(
- page.locator('input[type="range"][alt^="Timeline zoom"]'),
- ).toHaveValue(String(Math.round(normalizedTimelineZoom * 1000)));
- const webMcpMaximumTimelineZoomResult = await page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {
- readonly execute: (
- input: Record<string, unknown>,
- ) => Promise<unknown>;
- }
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('set_timeline_zoom');
- if (!tool) {
- throw new Error('set_timeline_zoom was not registered');
- }
-
- return tool.execute({zoom: 1});
- });
- expect(webMcpMaximumTimelineZoomResult).toEqual({
- currentContent: {
- type: 'composition',
- compositionId: 'AnimatedBarChart',
- },
- timelineZoom: 1,
- });
- await expect(
- page.locator('input[type="range"][alt^="Timeline zoom"]'),
- ).toHaveValue('1000');
- const maximumTimelineWidth = await page
- .locator('[data-timeline-scrubber]')
- .evaluate((element) => element.getBoundingClientRect().width);
- expect((maximumTimelineWidth - 32) / 180).toBe(30);
- const webMcpMuteResult = await page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {
- readonly execute: (
- input: Record<string, unknown>,
- ) => Promise<unknown>;
- }
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('mute');
- if (!tool) {
- throw new Error('mute was not registered');
- }
-
- return tool.execute({});
- });
- expect(webMcpMuteResult).toEqual({
- currentContent: {
- type: 'composition',
- compositionId: 'AnimatedBarChart',
- },
- muted: true,
- });
- await expect(
- page.getByRole('button', {name: 'Unmute video', exact: true}),
- ).toBeVisible();
- const webMcpUnmuteResult = await page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {
- readonly execute: (
- input: Record<string, unknown>,
- ) => Promise<unknown>;
- }
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('unmute');
- if (!tool) {
- throw new Error('unmute was not registered');
- }
-
- return tool.execute({});
- });
- expect(webMcpUnmuteResult).toEqual({
- currentContent: {
- type: 'composition',
- compositionId: 'AnimatedBarChart',
- },
- muted: false,
- });
- await expect(
- page.getByRole('button', {name: 'Mute video', exact: true}),
- ).toBeVisible();
- const webMcpPlayResult = await page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {
- readonly execute: (
- input: Record<string, unknown>,
- ) => Promise<unknown>;
- }
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('play');
- if (!tool) {
- throw new Error('play was not registered');
- }
-
- return tool.execute({});
- });
- expect(webMcpPlayResult).toEqual({
- currentContent: {
- type: 'composition',
- compositionId: 'AnimatedBarChart',
- },
- playing: true,
- });
- await expect(
- page.getByRole('button', {name: 'Pause', exact: true}),
- ).toBeVisible();
- const webMcpPauseResult = await page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {
- readonly execute: (
- input: Record<string, unknown>,
- ) => Promise<unknown>;
- }
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('pause');
- if (!tool) {
- throw new Error('pause was not registered');
- }
-
- return tool.execute({});
- });
- expect(webMcpPauseResult).toEqual({
- currentContent: {
- type: 'composition',
- compositionId: 'AnimatedBarChart',
- },
- playing: false,
- });
- await expect(
- page.getByRole('button', {name: 'Play', exact: true}),
- ).toBeVisible();
- const webMcpSeekResult = await page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {
- readonly execute: (
- input: Record<string, unknown>,
- ) => Promise<unknown>;
- }
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('seek_to_frame');
- if (!tool) {
- throw new Error('seek_to_frame was not registered');
- }
-
- return tool.execute({frame: 200});
- });
- expect(webMcpSeekResult).toEqual({
- currentFrame: 179,
- currentContent: {
- type: 'composition',
- compositionId: 'AnimatedBarChart',
- },
- });
- await expect(
- page.getByRole('button', {name: '179', exact: true}),
- ).toBeVisible();
- const webMcpPlaybackState = await page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {readonly execute: () => Promise<unknown>}
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('get_playback_state');
- if (!tool) {
- throw new Error('get_playback_state was not registered');
- }
-
- return tool.execute();
- });
- expect(webMcpPlaybackState).toEqual({
- currentContent: {
- type: 'composition',
- compositionId: 'AnimatedBarChart',
- },
- currentFrame: 179,
- playing: false,
- muted: false,
- volume: 1,
- playbackRate: 1.5,
- looping: true,
- timelineZoom: 1,
- });
-
- fs.writeFileSync(
- configFile,
- `${configBeforeTest}\nConfig.setDefaultEditor('vscode');\nConfig.setDefaultCodingAgent('codex');\n`,
- );
- await expect
- .poll(() =>
- page.evaluate(() => window.remotion_studioConfig?.defaultCodingAgent),
- )
- .toBe('codex');
- await page.evaluate(() => {
- window.remotion_editorName = 'Code';
- });
-
- await timelineGridline.click({button: 'right'});
- await expect(page.getByText('Open in Code', {exact: true})).toBeVisible();
- await page.getByRole('button', {name: 'Open in...', exact: true}).click();
- await expect(
- page.getByRole('button', {name: 'Codex', exact: true}),
- ).toBeVisible();
- const cursorAgentIcon = page.locator(
- 'img[data-coding-agent-icon="cursor"]',
- );
- await expect(cursorAgentIcon).toHaveAttribute(
- 'src',
- '/api/app-icon/coding-agent/cursor.png',
- );
- await expect
- .poll(() =>
- cursorAgentIcon.evaluate(
- (image) => (image as HTMLImageElement).naturalWidth,
- ),
- )
- .toBe(64);
- const finderIcon = page.locator('img[data-file-manager-icon="finder"]');
- await expect(finderIcon).toHaveAttribute(
- 'src',
- '/api/app-icon/file-manager/finder.png',
- );
- await expect
- .poll(() =>
- finderIcon.evaluate(
- (image) => (image as HTMLImageElement).naturalWidth,
- ),
- )
- .toBe(36);
- await expect(
- page.getByRole('button', {name: 'Terminal', exact: true}),
- ).toHaveCount(0);
- await expect(page.getByText('Editor', {exact: true})).toBeVisible();
- await expect(page.getByText('Agent', {exact: true})).toBeVisible();
- await expect(page.getByText('Editors', {exact: true})).toHaveCount(0);
- await expect(page.getByText('Agents', {exact: true})).toHaveCount(0);
- await expect(
- page.getByRole('button', {name: 'Cursor', exact: true}),
- ).toHaveCount(2);
- const gitHubButton = page.getByRole('button', {
- name: 'GitHub.com',
- exact: true,
- });
- await expect(gitHubButton).toBeVisible();
- await expect(gitHubButton.locator('[data-github-icon]')).toBeVisible();
- await page.evaluate(() => {
- document.body.dataset.openedUrl = '';
- window.open = (url) => {
- document.body.dataset.openedUrl = String(url);
- return null;
- };
- });
- await gitHubButton.click();
- await expect
- .poll(() => page.evaluate(() => document.body.dataset.openedUrl ?? ''))
- .toMatch(
- /^https:\/\/github\.com\/remotion-dev\/remotion\/blob\/.+\/packages\/example\/src\/BarChart\.tsx#L\d+$/,
- );
-
- await timelineGridline.click({button: 'right'});
- await page.getByRole('button', {name: 'Open in...', exact: true}).click();
- await page
- .getByRole('button', {name: 'Configure default apps...', exact: true})
- .click();
-
- const settings = page.getByRole('dialog');
- await expect(
- settings.getByTitle('Default editor', {exact: true}),
- ).toBeVisible();
- await expect(
- settings.getByText('Default codec', {exact: true}),
- ).toHaveCount(0);
-
- await page.goto(`${STUDIO_URL}/assets/test.gif`);
- await expect
- .poll(() =>
- page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {readonly execute: () => Promise<unknown>}
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('get_composition');
- return tool?.execute() ?? null;
- }),
- )
- .toEqual({
- compositionName: null,
- stack: null,
- durationInFrames: null,
- height: null,
- width: null,
- fps: null,
- currentFrame: null,
- });
- await expect
- .poll(() =>
- page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {readonly execute: () => Promise<unknown>}
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('get_playback_state');
- return tool?.execute() ?? null;
- }),
- )
- .toEqual({
- currentContent: {type: 'asset', asset: 'test.gif'},
- currentFrame: null,
- playing: null,
- muted: null,
- volume: null,
- playbackRate: null,
- looping: null,
- timelineZoom: null,
- });
- await expect
- .poll(() =>
- page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {readonly execute: () => Promise<unknown>}
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('get_canvas_html');
- return tool?.execute() ?? null;
- }),
- )
- .toEqual({
- currentContent: {type: 'asset', asset: 'test.gif'},
- currentFrame: null,
- html: null,
- htmlLength: null,
- truncated: false,
- });
- await expect
- .poll(() =>
- page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {readonly execute: () => Promise<unknown>}
- >;
- }
- ).__remotion_webmcp_tools;
- const tool = tools.get('get_outlines');
- return tool?.execute() ?? null;
- }),
- )
- .toEqual({
- currentContent: {type: 'asset', asset: 'test.gif'},
- currentFrame: null,
- outlines: [],
- });
- for (const preview of [
- {
- route: '/assets/test.gif',
- content: {type: 'asset', asset: 'test.gif'},
- },
- {
- route: '/outputs/public%2Ftest.gif',
- content: {type: 'output', path: 'public/test.gif'},
- },
- ]) {
- await page.goto(`${STUDIO_URL}${preview.route}`);
- await expect
- .poll(() =>
- page.evaluate(async () => {
- const tools = (
- window as typeof window & {
- readonly __remotion_webmcp_tools: Map<
- string,
- {readonly execute: () => Promise<unknown>}
- >;
- }
- ).__remotion_webmcp_tools;
- return tools.get('get_selection')?.execute() ?? null;
- }),
- )
- .toMatchObject({currentContent: preview.content});
- }
- } finally {
- fs.writeFileSync(configFile, configBeforeTest);
- }
- });
-
- test('should dismiss an overflow menu tree with one outside click', async ({
- page,
- }) => {
- await page.setViewportSize({width: 800, height: 904});
- await page.goto(`${STUDIO_URL}/AnimatedBarChart`);
- await expect(page.getByText('0% gridline', {exact: true})).toBeVisible({
- timeout: 15_000,
- });
-
- await page.evaluate(() => {
- // Keep the menu tree in the interval before the next animation frame to
- // exercise a fast user's outside click deterministically.
- window.requestAnimationFrame = () => 0;
- });
- await page.getByRole('button', {name: 'More actions'}).click();
- const playbackRate = page.getByRole('button', {
- name: 'Playback Rate',
- exact: true,
- });
- await playbackRate.click();
- await expect(
- page.getByRole('button', {name: '1x', exact: true}),
- ).toBeVisible();
-
- await page.mouse.click(10, 100);
- await expect(
- page.getByRole('button', {name: 'Playback Rate', exact: true}),
- ).toBeHidden();
- });
-
- test('should pass the copied inspector context to editable coding agents', async ({
- context,
- page,
- }) => {
- await context.grantPermissions(['clipboard-read', 'clipboard-write'], {
- origin: STUDIO_URL,
- });
- await page.route('**/api/default-coding-agent-info', async (route) => {
- await route.fulfill({
- json: {
- success: true,
- data: {
- defaultCodingAgent: null,
- installedCodingAgents: [
- {
- id: 'codex',
- name: 'Codex',
- nameWithType: 'Codex',
- },
- {
- id: 'copilot',
- name: 'GitHub Copilot',
- nameWithType: 'GitHub Copilot',
- },
- ],
- installedTerminals: [],
- },
- },
- });
- });
-
- const launchRequests: unknown[] = [];
- await page.route('**/api/open-in-coding-agent', async (route) => {
- launchRequests.push(route.request().postDataJSON());
- await route.fulfill({
- json: {success: true, data: {success: true}},
- });
- });
-
- await page.goto(`${STUDIO_URL}/schema-test`);
- await page.locator('[data-sidebar-toggle="right"]').click();
- const sourceLocation = page
- .getByRole('group', {name: 'Inspector source location'})
- .first();
- await expect(sourceLocation).toBeVisible({timeout: 15_000});
- await sourceLocation.hover();
-
- await sourceLocation
- .getByRole('button', {name: 'Copy context for agents'})
- .click();
- const copiedContext = await page.evaluate(() =>
- navigator.clipboard.readText(),
- );
- expect(copiedContext.length).toBeGreaterThan(0);
-
- const openInAnotherApp = sourceLocation.getByRole('button', {
- name: 'Open in another app',
- });
- await openInAnotherApp.click();
- await page.getByRole('button', {name: 'Codex', exact: true}).click();
- await expect.poll(() => launchRequests.length).toBe(1);
- expect(launchRequests[0]).toEqual({
- codingAgentId: 'codex',
- prompt: copiedContext,
- });
-
- await openInAnotherApp.click();
- await page
- .getByRole('button', {name: 'GitHub Copilot', exact: true})
- .click();
- await expect.poll(() => launchRequests.length).toBe(2);
- expect(launchRequests[1]).toEqual({
- codingAgentId: 'copilot',
- prompt: null,
- });
- });
-
- test('should open submenus toward the side with more space', async ({
- page,
- }) => {
- await page.setViewportSize({width: 500, height: 904});
- await page.goto(STUDIO_URL);
- await expect(page).toHaveTitle(/Remotion/i, {timeout: 15_000});
-
- await page.locator('.__remotion-studio-menu-initiator').first().click();
- const compositionItem = page.getByRole('button', {
- name: 'Composition',
- exact: true,
- });
- await compositionItem.hover();
-
- const subMenuItem = page.getByRole('button', {name: 'Copy file location'});
- await expect(subMenuItem).toBeVisible();
-
- const [compositionBox, subMenuItemBox] = await Promise.all([
- compositionItem.boundingBox(),
- subMenuItem.boundingBox(),
- ]);
-
- expect(compositionBox).not.toBeNull();
- expect(subMenuItemBox).not.toBeNull();
- expect(subMenuItemBox!.x).toBeGreaterThan(compositionBox!.x);
- });
-
- test('should not subscribe to package-owned sequence props', async ({
- page,
- }) => {
- const subscriptionSources: string[] = [];
- page.on('request', (request) => {
- if (!request.url().includes('/api/subscribe-to-sequence-props')) {
- return;
- }
-
- const body = request.postDataJSON() as {fileName: string};
- subscriptionSources.push(body.fileName);
- });
-
- await page.goto(`${STUDIO_URL}/package-absolute-fill`);
- await expect
- .poll(
- () =>
- subscriptionSources.filter((source) =>
- source.startsWith('./src/LightLeak/'),
- ).length,
- {timeout: 15_000},
- )
- .toBeGreaterThan(0);
-
- await page.waitForTimeout(500);
- expect(subscriptionSources.some((source) => source.startsWith('../'))).toBe(
- false,
- );
- });
-
- test('should seek in read-only Studio', async ({page}) => {
- await page.addInitScript(() => {
- Object.defineProperty(window, 'remotion_isReadOnlyStudio', {
- configurable: false,
- get: () => true,
- set: () => undefined,
- });
- });
-
- await page.goto(`${STUDIO_URL}/schema-test`);
- await expect(
- page.getByRole('button', {name: '0', exact: true}),
- ).toBeVisible({timeout: 15_000});
- const currentTime = page
- .getByRole('button')
- .filter({hasText: /^\d\d:\d\d\.\d\d/});
-
- await page.locator('[data-timeline-scrubber]').click();
-
- await expect(currentTime).not.toHaveAttribute('aria-label', '0');
- });
-
- test('should select an added composition before the codemod response arrives', async ({
- page,
- }) => {
- await page.goto(`${STUDIO_URL}/effect-keyframe-e2e`);
- await expect(
- page.getByRole('button', {name: '0', exact: true}),
- ).toBeVisible({timeout: 15_000});
- if (!(await page.getByRole('button', {name: 'Inspector'}).isVisible())) {
- await page.locator('[data-sidebar-toggle="right"]').click();
- }
-
- let releaseResponse = () => undefined;
- const responseCanBeReleased = new Promise<void>((resolve) => {
- releaseResponse = resolve;
- });
- let markResponseAsHeld = () => undefined;
- const responseIsHeld = new Promise<void>((resolve) => {
- markResponseAsHeld = resolve;
- });
- let markResponseAsReleased = () => undefined;
- const responseIsReleased = new Promise<void>((resolve) => {
- markResponseAsReleased = resolve;
- });
- await page.route('**/api/insert-jsx-element', async (route) => {
- const response = await route.fetch();
- markResponseAsHeld();
- await responseCanBeReleased;
- await route.fulfill({response});
- markResponseAsReleased();
- });
-
- try {
- await page.getByRole('button', {name: 'Add composition...'}).click();
- await page
- .getByPlaceholder('Search compositions...')
- .fill('package-absolute-fill');
- await page.keyboard.press('Enter');
- await responseIsHeld;
-
- await expect(
- page.locator(
- '[data-timeline-marquee-item][title="package-absolute-fill"]',
- ),
- ).toHaveCSS('opacity', '1', {timeout: 30_000});
- } finally {
- releaseResponse();
- await responseIsReleased;
- await page.unroute('**/api/insert-jsx-element');
- }
- });
-});
diff --git a/packages/example/e2e/timeline-right-edge.test.mts b/packages/example/e2e/timeline-right-edge.test.mts
deleted file mode 100644
index a5720c62c7..0000000000
--- a/packages/example/e2e/timeline-right-edge.test.mts
+++ /dev/null
@@ -1,412 +0,0 @@
-import fs from 'fs';
-import {expect, test} from '@playwright/test';
-import {rootFile, STUDIO_URL} from './constants.mts';
-import {startStudio, stopStudio} from './studio-server.mts';
-
-test('handles timeline layer edge geometry and interactions', async ({
- page,
-}) => {
- await startStudio();
- try {
- const openInEditorRequests: unknown[] = [];
- await page.route('**/api/default-editor-info', async (route) => {
- await route.fulfill({
- json: {
- success: true,
- data: {
- defaultEditor: 'vscode',
- installedEditors: [
- {
- id: 'vscode',
- name: 'Code',
- nameWithType: 'VS Code',
- },
- ],
- },
- },
- });
- });
- await page.route('**/api/open-in-editor', async (route) => {
- openInEditorRequests.push(route.request().postDataJSON());
- await route.fulfill({json: {success: true, data: {success: true}}});
- });
- fs.writeFileSync(
- rootFile,
- `
-import React from 'react';
-import {Audio, Video} from '@remotion/media';
-import {AbsoluteFill, Composition, Sequence, Solid, staticFile} from 'remotion';
-const src = staticFile('sine-wave.wav'); // Exactly one second, or 30 frames.
-const Layers = () => <>
- <AbsoluteFill name="Fill available time" />
- <AbsoluteFill name="Explicit fill cutoff" durationInFrames={30} />
- <AbsoluteFill name="Explicit composition match" durationInFrames={180} />
- <AbsoluteFill name="Fill clipped before own cutoff" durationInFrames={240} />
- <Sequence name="Fill parent" durationInFrames={30}>
- <AbsoluteFill name="Inherited fill" />
- <AbsoluteFill name="Explicit parent match" durationInFrames={30} />
- <AbsoluteFill name="Child clipped before own cutoff" durationInFrames={60} />
- </Sequence>
- <Solid name="Solid cutoff" color="gray" width={100} height={100} from={27} durationInFrames={9} trimBefore={27} />
- <Audio name="Natural end" src={src} durationInFrames={30} />
- <Audio name="Duration cutoff" src={src} durationInFrames={15} />
- <Sequence name="Short parent" durationInFrames={15}>
- <Audio name="Parent cutoff" src={src} />
- </Sequence>
- <Sequence name="Matching parent" durationInFrames={30}>
- <Audio name="Matching child" src={src} />
- </Sequence>
- <Audio name="Trimmed start" src={src} trimBefore={10} durationInFrames={20} />
- <Audio name="Trimmed end" src={src} trimAfter={20} />
- <Audio name="Fast media" src={src} playbackRate={2} durationInFrames={15} />
- <Audio name="Slow media" src={src} playbackRate={0.5} durationInFrames={60} />
- <Audio name="Loop" src={src} loop durationInFrames={60} />
- <Audio name="Frozen" src={src} freeze={0} durationInFrames={30} />
- <Audio name="Loop without cutoff" src={src} loop />
- <Audio name="Freeze without cutoff" src={src} freeze={0} />
- <Audio name="Composition cutoff" src={src} from={165} />
- <Audio name="Composition match" src={src} from={150} />
- <Video name="Video natural end" src={staticFile('blush-1x.webm')} durationInFrames={80} muted />
- <Video name="Video cutoff" src={staticFile('blush-1x.webm')} durationInFrames={79} muted />
- <Video name="Video without cutoff" src={staticFile('blush-1x.webm')} muted />
- <Video name="Video trimmed start" src={staticFile('blush-1x.webm')} from={20} trimBefore={20} muted />
- <Video name="Video shifted start" src={staticFile('blush-1x.webm')} from={20} muted />
- <Video name="Video fast trimmed start" src={staticFile('blush-1x.webm')} from={20} trimBefore={20} playbackRate={2} muted />
- <Video name="Video held frame" src={staticFile('blush-1x.webm')} durationInFrames={120} muted />
-</>;
-export const E2eTestRoot = () => <Composition id="timeline-edges" component={Layers} durationInFrames={180} fps={30} width={640} height={360} />;
-`,
- );
- await page.setViewportSize({width: 1440, height: 2000});
- await page.goto(`${STUDIO_URL}/timeline-edges`);
- for (const [name, radius] of [
- ['Fill available time', '2px'],
- ['Explicit fill cutoff', '0px'],
- ['Explicit composition match', '2px'],
- ['Fill clipped before own cutoff', '2px'],
- ['Fill parent', '0px'],
- ['Inherited fill', '2px'],
- ['Explicit parent match', '2px'],
- ['Child clipped before own cutoff', '2px'],
- ['Natural end', '2px'],
- ['Solid cutoff', '0px'],
- ['Duration cutoff', '0px'],
- ['Short parent', '0px'],
- ['Parent cutoff', '2px'],
- ['Matching parent', '0px'],
- ['Matching child', '2px'],
- ['Trimmed start', '2px'],
- ['Trimmed end', '0px'],
- ['Fast media', '2px'],
- ['Slow media', '2px'],
- ['Loop', '0px'],
- ['Frozen', '0px'],
- ['Loop without cutoff', '2px'],
- ['Freeze without cutoff', '2px'],
- ['Composition cutoff', '2px'],
- ['Composition match', '2px'],
- ['Video natural end', '2px'],
- ['Video cutoff', '0px'],
- ['Video held frame', '0px'],
- ['Video without cutoff', '2px'],
- ]) {
- const layer = page.locator(
- `[data-timeline-marquee-item][title="${name}"]`,
- );
- await layer.scrollIntoViewIfNeeded();
- await expect(layer).toHaveCSS('border-top-right-radius', radius);
- await expect(layer).toHaveCSS('border-bottom-right-radius', radius);
- }
- for (const [name, radius] of [
- ['Video trimmed start', '0px'],
- ['Video shifted start', '2px'],
- ['Video fast trimmed start', '0px'],
- ['Trimmed start', '0px'],
- ['Natural end', '2px'],
- ]) {
- const layer = page.locator(
- `[data-timeline-marquee-item][title="${name}"]`,
- );
- await layer.scrollIntoViewIfNeeded();
- await expect(layer).toHaveCSS('border-top-left-radius', radius);
- await expect(layer).toHaveCSS('border-bottom-left-radius', radius);
- }
-
- const movableLayer = page.locator(
- '[data-timeline-marquee-item][title="Natural end"]',
- );
- const movableLayerLabel = page.locator(
- '[data-remotion-sequence-reorder-row] [title="Natural end"]',
- );
- await movableLayerLabel.dblclick();
- await expect.poll(() => openInEditorRequests.length).toBe(1);
-
- await movableLayer.click({button: 'right', position: {x: 30, y: 10}});
- const contextMenu = page.locator('[data-remotion-menu-tree-id]').last();
- await expect(contextMenu).toBeVisible();
- await movableLayer.click({position: {x: 30, y: 10}});
- await expect(contextMenu).not.toBeVisible();
- expect(openInEditorRequests).toHaveLength(1);
- await movableLayer.dblclick({position: {x: 30, y: 10}});
- await expect.poll(() => openInEditorRequests.length).toBe(2);
-
- const rightEdgeLayer = page.locator(
- '[data-timeline-marquee-item][title="Explicit fill cutoff"]',
- );
- await expect(rightEdgeLayer).toHaveCSS('opacity', '0.75');
- const rightEdgeHandle = rightEdgeLayer.locator(
- '[title="Drag to change duration"]',
- );
-
- await rightEdgeHandle.hover();
- await page.mouse.down();
- try {
- await expect(rightEdgeLayer).toHaveCSS('opacity', '0.75');
- } finally {
- await page.mouse.up();
- }
-
- await expect(rightEdgeLayer).toHaveCSS('opacity', '1');
-
- const leftEdgeLayer = page.locator(
- '[data-timeline-marquee-item][title="Solid cutoff"]',
- );
- await expect(leftEdgeLayer).toHaveCSS('opacity', '0.75');
- const leftEdgeHandle = leftEdgeLayer.locator(
- '[title="Drag to trim start"]',
- );
- const leftEdgeHandleBox = await leftEdgeHandle.boundingBox();
- if (leftEdgeHandleBox === null) {
- throw new Error('Expected left timeline edge to have a bounding box');
- }
-
- await page.mouse.move(
- leftEdgeHandleBox.x + leftEdgeHandleBox.width - 1,
- leftEdgeHandleBox.y + leftEdgeHandleBox.height / 2,
- );
- await page.mouse.down();
- try {
- await expect(leftEdgeLayer).toHaveCSS('opacity', '0.75');
- await expect(rightEdgeLayer).toHaveCSS('opacity', '1');
- } finally {
- await page.mouse.up();
- }
-
- await expect(leftEdgeLayer).toHaveCSS('opacity', '1');
- await expect(rightEdgeLayer).toHaveCSS('opacity', '0.75');
-
- const dragHandle = async ({
- handle,
- deltaX,
- }: {
- readonly handle: ReturnType<typeof page.locator>;
- readonly deltaX: number;
- }) => {
- const box = await handle.boundingBox();
- if (box === null) {
- throw new Error(
- 'Expected timeline resize handle 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 + deltaX,
- box.y + box.height / 2,
- {
- steps: 5,
- },
- );
- } finally {
- await page.mouse.up();
- }
- };
-
- const getSequenceNumberProp = (
- source: string,
- name: string,
- prop: 'durationInFrames' | 'from',
- ) => {
- const match = source.match(
- new RegExp(
- `<[A-Za-z]+\\b(?=[^>]*name="${name}")(?=[^>]*${prop}=\\{(\\d+)\\})[^>]*>`,
- ),
- );
- return match ? Number(match[1]) : null;
- };
-
- const rightResizeA = page.locator(
- '[data-timeline-marquee-item][title="Explicit fill cutoff"]',
- );
- const rightResizeB = page.locator(
- '[data-timeline-marquee-item][title="Duration cutoff"]',
- );
- await rightResizeA.scrollIntoViewIfNeeded();
- await rightResizeA.click();
- await expect(rightResizeA).toHaveCSS('opacity', '1');
- await expect(rightResizeB).toHaveCSS('opacity', '0.75');
- await dragHandle({
- handle: rightResizeB.locator('[title="Drag to change duration"]'),
- deltaX: -40,
- });
- await expect(rightResizeA).toHaveCSS('opacity', '1');
- await expect(rightResizeB).toHaveCSS('opacity', '0.75');
- await expect
- .poll(() => {
- const source = fs.readFileSync(rootFile, 'utf-8');
- return [
- getSequenceNumberProp(
- source,
- 'Explicit fill cutoff',
- 'durationInFrames',
- ),
- getSequenceNumberProp(source, 'Duration cutoff', 'durationInFrames'),
- ];
- })
- .toEqual([30, 9]);
-
- await rightResizeB
- .locator('[title="Drag to change duration"]')
- .click({modifiers: ['Meta']});
- await expect(rightResizeA).toHaveCSS('opacity', '1');
- await expect(rightResizeB).toHaveCSS('opacity', '1');
- await dragHandle({
- handle: rightResizeB.locator('[title="Drag to change duration"]'),
- deltaX: 40,
- });
- await expect
- .poll(() => {
- const source = fs.readFileSync(rootFile, 'utf-8');
- return [
- getSequenceNumberProp(
- source,
- 'Explicit fill cutoff',
- 'durationInFrames',
- ),
- getSequenceNumberProp(source, 'Duration cutoff', 'durationInFrames'),
- ];
- })
- .toEqual([36, 15]);
-
- const leftResizeA = page.locator(
- '[data-timeline-marquee-item][title="Explicit composition match"]',
- );
- const leftResizeB = page.locator(
- '[data-timeline-marquee-item][title="Fill clipped before own cutoff"]',
- );
- await leftResizeA.scrollIntoViewIfNeeded();
- await leftResizeA.click();
- await expect(leftResizeA).toHaveCSS('opacity', '1');
- await expect(leftResizeB).toHaveCSS('opacity', '0.75');
- await dragHandle({
- handle: leftResizeB.locator('[title="Drag to trim start"]'),
- deltaX: 40,
- });
- await expect(leftResizeA).toHaveCSS('opacity', '1');
- await expect(leftResizeB).toHaveCSS('opacity', '0.75');
- await expect
- .poll(() => {
- const source = fs.readFileSync(rootFile, 'utf-8');
- const fromA = getSequenceNumberProp(
- source,
- 'Explicit composition match',
- 'from',
- );
- const fromB = getSequenceNumberProp(
- source,
- 'Fill clipped before own cutoff',
- 'from',
- );
- return [
- fromA,
- fromB,
- getSequenceNumberProp(
- source,
- 'Explicit composition match',
- 'durationInFrames',
- ),
- getSequenceNumberProp(
- source,
- 'Fill clipped before own cutoff',
- 'durationInFrames',
- ),
- ];
- })
- .toEqual([null, 6, 180, 174]);
-
- await leftResizeB
- .locator('[title="Drag to trim start"]')
- .click({modifiers: ['Meta']});
- await expect(leftResizeA).toHaveCSS('opacity', '1');
- await expect(leftResizeB).toHaveCSS('opacity', '1');
- await dragHandle({
- handle: leftResizeB.locator('[title="Drag to trim start"]'),
- deltaX: 40,
- });
- await expect
- .poll(() => {
- const source = fs.readFileSync(rootFile, 'utf-8');
- const fromA = getSequenceNumberProp(
- source,
- 'Explicit composition match',
- 'from',
- );
- const fromB = getSequenceNumberProp(
- source,
- 'Fill clipped before own cutoff',
- 'from',
- );
- return [
- fromA,
- fromB,
- getSequenceNumberProp(
- source,
- 'Explicit composition match',
- 'durationInFrames',
- ),
- getSequenceNumberProp(
- source,
- 'Fill clipped before own cutoff',
- 'durationInFrames',
- ),
- ];
- })
- .toEqual([6, 12, 174, 168]);
-
- const durationLayerLabel = page.locator(
- '[data-remotion-sequence-reorder-row] [title="Duration cutoff"]',
- );
- await movableLayerLabel.scrollIntoViewIfNeeded();
- await durationLayerLabel.scrollIntoViewIfNeeded();
- const movableLayerLabelBox = await movableLayerLabel.boundingBox();
- const durationLayerLabelBox = await durationLayerLabel.boundingBox();
- if (movableLayerLabelBox === null || durationLayerLabelBox === null) {
- throw new Error('Expected reorderable timeline labels to be visible');
- }
-
- await page.mouse.move(
- movableLayerLabelBox.x + movableLayerLabelBox.width / 2,
- movableLayerLabelBox.y + movableLayerLabelBox.height / 2,
- );
- await page.mouse.down();
- await page.mouse.move(
- durationLayerLabelBox.x + durationLayerLabelBox.width / 2,
- durationLayerLabelBox.y + durationLayerLabelBox.height * 0.75,
- {steps: 5},
- );
- await page.mouse.up();
- await expect
- .poll(() => {
- const source = fs.readFileSync(rootFile, 'utf-8');
- return (
- source.indexOf('name="Natural end"') >
- source.indexOf('name="Duration cutoff"')
- );
- })
- .toBe(true);
- } finally {
- await stopStudio();
- }
-});