Skip to content

🎥 Make videos programmatically with React

Fix Studio tests after title attribute removal

JonnyBurger1698a7c79cd1
diff --git a/packages/example/e2e/affine-frame-clock.test.mts b/packages/example/e2e/affine-frame-clock.test.mts
index 46954b88ec..c9d477a70c 100644
--- a/packages/example/e2e/affine-frame-clock.test.mts
+++ b/packages/example/e2e/affine-frame-clock.test.mts
@@ -69,16 +69,18 @@ test.describe('affine frame clock keyframes', () => {
);
const affineFrameClock = page.locator(
- '[data-timeline-marquee-item][title="Affine frame clock"]',
+ '[data-timeline-marquee-item][aria-label="Affine frame clock"]',
);
- const rotation = page.getByTitle('Rotation', {exact: true}).first();
+ const rotation = page
+ .getByRole('group', {name: 'Rotation', exact: true})
+ .first();
await expect(async () => {
await affineFrameClock.click();
await expect(rotation).toBeVisible({timeout: 1_000});
}).toPass({timeout: 30_000});
await rotation.click();
const firstKeyframe = page
- .getByTitle('Keyframe at frame 0', {exact: true})
+ .getByRole('button', {name: 'Select keyframe at frame 0', exact: true})
.last();
await expect(firstKeyframe).toBeVisible({timeout: 15_000});
await firstKeyframe.click();
@@ -126,7 +128,9 @@ test.describe('affine frame clock keyframes', () => {
await currentFrameInput.fill('50');
await currentFrameInput.press('Enter');
- const offset = page.getByTitle('Offset', {exact: true}).first();
+ const offset = page
+ .getByRole('group', {name: 'Offset', exact: true})
+ .first();
await offset.click();
const offsetRow = offset.locator(
'xpath=ancestor::div[.//button[@aria-label="Add keyframe"]][1]',
diff --git a/packages/example/e2e/captions-inspector.test.mts b/packages/example/e2e/captions-inspector.test.mts
index 3d8ec84070..c90d9d52c3 100644
--- a/packages/example/e2e/captions-inspector.test.mts
+++ b/packages/example/e2e/captions-inspector.test.mts
@@ -106,7 +106,7 @@ test.describe('captions inspector', () => {
);
const defaultCaptionsSequence = page
- .getByTitle('Moving Pill Captions', {exact: true})
+ .getByRole('group', {name: 'Moving Pill Captions', exact: true})
.first();
const defaultCaption = page.getByRole('textbox', {name: 'Caption 1'});
await expect(async () => {
diff --git a/packages/example/e2e/effect-keyframes.test.mts b/packages/example/e2e/effect-keyframes.test.mts
index a054a9238d..753fb3fbb2 100644
--- a/packages/example/e2e/effect-keyframes.test.mts
+++ b/packages/example/e2e/effect-keyframes.test.mts
@@ -30,7 +30,10 @@ const selectScalePrecisionAndWaitFor = async ({
readonly locator: Locator;
}) => {
await expect(async () => {
- await page.getByTitle('Scale precision', {exact: true}).first().click();
+ await page
+ .getByRole('group', {name: 'Scale precision', exact: true})
+ .first()
+ .click();
await expect(locator).toBeVisible({timeout: 1_000});
}).toPass({timeout: 15_000});
};
@@ -60,7 +63,7 @@ test.describe('effect keyframes', () => {
const opacity = page.getByText('Opacity', {exact: true});
await expect(async () => {
await page
- .getByTitle('Timeline expansion', {exact: true})
+ .getByRole('group', {name: 'Timeline expansion', exact: true})
.first()
.click();
await expect(opacity).toHaveCount(1, {timeout: 1_000});
@@ -168,7 +171,7 @@ test.describe('effect keyframes', () => {
.poll(() => fs.readFileSync(effectKeyframeE2eFile, 'utf-8'))
.toMatch(/interpolate\(\s*frame,\s*\[0,\s*40,\s*60,\s*89\]/);
await expect(
- page.getByTitle('Back to property', {exact: true}),
+ page.getByRole('button', {name: 'Back to property', exact: true}),
).toHaveCount(0);
await expect(opacity).toHaveCount(2);
@@ -188,7 +191,7 @@ test.describe('effect keyframes', () => {
.poll(() => fs.readFileSync(effectKeyframeE2eFile, 'utf-8'))
.toMatch(/interpolate\(\s*frame,\s*\[0,\s*60,\s*89\]/);
await expect(
- page.getByTitle('Back to property', {exact: true}),
+ page.getByRole('button', {name: 'Back to property', exact: true}),
).toHaveCount(0);
await expect(opacity).toHaveCount(2);
@@ -205,7 +208,7 @@ test.describe('effect keyframes', () => {
.poll(() => fs.readFileSync(effectKeyframeE2eFile, 'utf-8'))
.toMatch(/interpolate\(\s*frame,\s*\[0,\s*89\]/);
await expect(
- page.getByTitle('Back to property', {exact: true}),
+ page.getByRole('button', {name: 'Back to property', exact: true}),
).toHaveCount(0);
await expect(opacity).toHaveCount(2);
@@ -216,7 +219,9 @@ test.describe('effect keyframes', () => {
.not.toContain('opacity:');
await page.reload();
await expect(
- page.getByTitle('Timeline expansion', {exact: true}).first(),
+ page
+ .getByRole('group', {name: 'Timeline expansion', exact: true})
+ .first(),
).toBeVisible();
await expect(keyframes).toHaveCount(0);
});
@@ -236,7 +241,7 @@ test.describe('effect keyframes', () => {
const factorDragger = page.getByRole('button', {name: '0.75', exact: true});
await expect(async () => {
await page
- .getByTitle('Effect scale precision', {exact: true})
+ .getByRole('group', {name: 'Effect scale precision', exact: true})
.first()
.click();
await expect(page.getByText('Factor', {exact: true})).toBeVisible({
@@ -289,7 +294,7 @@ test.describe('effect keyframes', () => {
await page.reload();
await expect(async () => {
await page
- .getByTitle('Effect scale precision', {exact: true})
+ .getByRole('group', {name: 'Effect scale precision', exact: true})
.first()
.click();
await expect(
@@ -306,7 +311,7 @@ test.describe('effect keyframes', () => {
const opacityRow = page.getByText('Opacity', {exact: true});
await expect(async () => {
await page
- .getByTitle('Timeline expansion', {exact: true})
+ .getByRole('group', {name: 'Timeline expansion', exact: true})
.first()
.click();
await expect(opacityRow).toHaveCount(1, {timeout: 1_000});
@@ -328,7 +333,10 @@ test.describe('effect keyframes', () => {
const waveRow = page.getByText('wave()', {exact: true});
await expect(async () => {
- await page.getByTitle('Scale precision', {exact: true}).first().click();
+ await page
+ .getByRole('group', {name: 'Scale precision', exact: true})
+ .first()
+ .click();
await expect(waveRow).toHaveCount(1, {timeout: 1_000});
}).toPass({timeout: 15_000});
diff --git a/packages/example/e2e/sequence-playback-rate.test.mts b/packages/example/e2e/sequence-playback-rate.test.mts
index fbe9783c07..57b4f1fd0e 100644
--- a/packages/example/e2e/sequence-playback-rate.test.mts
+++ b/packages/example/e2e/sequence-playback-rate.test.mts
@@ -16,10 +16,12 @@ test('retimed nested sequences preserve local frames when trimming, moving, and
try {
await page.goto(`${STUDIO_URL}/sequence-playback-rate`);
const row = page.locator(
- '[data-timeline-marquee-item][title="Retimed child"]',
+ '[data-timeline-marquee-item][aria-label="Retimed child"]',
);
await expect(
- page.getByTitle('Double speed parent', {exact: true}).first(),
+ page
+ .getByRole('group', {name: 'Double speed parent', exact: true})
+ .first(),
).toBeVisible({timeout: 30_000});
await page.keyboard.press('g');
const frameInput = page.locator('input:focus');
@@ -30,7 +32,9 @@ test('retimed nested sequences preserve local frames when trimming, moving, and
page.getByText('Local frame: 14', {exact: true}),
).toBeVisible();
- const rotation = page.getByTitle('Rotation', {exact: true}).first();
+ const rotation = page
+ .getByRole('group', {name: 'Rotation', exact: true})
+ .first();
await expect(async () => {
await row.click();
await expect(rotation).toBeVisible({timeout: 1_000});
@@ -47,10 +51,10 @@ test('retimed nested sequences preserve local frames when trimming, moving, and
// Child duration 100 parent frames occupies 50 composition frames.
await row.click();
const trim = page
- .getByTitle('Drag to trim start', {exact: true})
+ .getByRole('separator', {name: 'Drag to trim start', exact: true})
.filter({visible: true});
const duration = page
- .getByTitle('Drag to change duration', {exact: true})
+ .getByRole('separator', {name: 'Drag to change duration', exact: true})
.filter({visible: true});
const trimBox = await trim.last().boundingBox();
const durationBox = await duration.last().boundingBox();
diff --git a/packages/example/e2e/studio-protocol.test.mts b/packages/example/e2e/studio-protocol.test.mts
index 85a517e82b..c3312038b7 100644
--- a/packages/example/e2e/studio-protocol.test.mts
+++ b/packages/example/e2e/studio-protocol.test.mts
@@ -344,7 +344,7 @@ const CloseupPlaceholder = () => {
await officialLibraryItem.click();
const officialElementsIframe = studioPage.locator(
- 'iframe[title="Remotion Elements library"]',
+ 'iframe[aria-label="Remotion Elements library"]',
);
await expect(officialElementsIframe).toBeVisible();
expect(officialLibraryRequests).toEqual([
@@ -367,7 +367,7 @@ const CloseupPlaceholder = () => {
).toBeVisible({timeout: 30_000});
await externalLibraryItem.click();
const elementsIframe = studioPage.locator(
- `iframe[title="${externalLibraryLabel} library"]`,
+ `iframe[aria-label="${externalLibraryLabel} library"]`,
);
await expect(elementsIframe).toBeVisible();
await expect(elementsIframe).toHaveAttribute(
@@ -380,7 +380,7 @@ const CloseupPlaceholder = () => {
]);
expect(context.pages()).toHaveLength(2);
const elementsFrame = studioPage.frameLocator(
- `iframe[title="${externalLibraryLabel} library"]`,
+ `iframe[aria-label="${externalLibraryLabel} library"]`,
);
await expect(
elementsFrame.getByText('Inside Remotion Studio', {exact: true}),
@@ -735,7 +735,7 @@ const CloseupPlaceholder = () => {
await newCompositionDialog
.getByPlaceholder('Composition ID')
.fill('ProtocolElementScene');
- await newCompositionDialog.getByTitle('Folder').click();
+ await newCompositionDialog.getByRole('button', {name: 'Folder'}).click();
await studioPage
.getByRole('button', {name: 'Closeup', exact: true})
.last()
diff --git a/packages/it-tests/src/bundle/bundle-studio.test.ts b/packages/it-tests/src/bundle/bundle-studio.test.ts
index 16cda58fb5..07b6d2f235 100644
--- a/packages/it-tests/src/bundle/bundle-studio.test.ts
+++ b/packages/it-tests/src/bundle/bundle-studio.test.ts
@@ -144,7 +144,9 @@ test(
expect(sourceLocation.toString()).toMatch(/Root\.tsx:\d+/);
expect(sourceLocation.toString()).toMatch(/WidthHeightSequences\.tsx:\d+/);
const sequenceSourceLocation = await tab.evaluateHandle(async () => {
- const label = document.querySelector<HTMLElement>('[title="<Sequence>"]');
+ const label = document.querySelector<HTMLElement>(
+ '[aria-label="<Sequence>"]',
+ );
label?.parentElement?.parentElement?.dispatchEvent(
new PointerEvent('pointerdown', {bubbles: true, button: 0}),
);
diff --git a/packages/studio/src/components/InspectorPanel/ElementLibraryButton.tsx b/packages/studio/src/components/InspectorPanel/ElementLibraryButton.tsx
index f84a559eb6..526bfb2f07 100644
--- a/packages/studio/src/components/InspectorPanel/ElementLibraryButton.tsx
+++ b/packages/studio/src/components/InspectorPanel/ElementLibraryButton.tsx
@@ -85,7 +85,7 @@ export const ElementLibraryButton: React.FC = () => {
const elementLibraryDropdownSegments = useMemo<SegmentedButtonSegment[]>(
() => [
{
- ariaLabel: 'Choose an Element Library to browse inside Studio.',
+ ariaLabel: 'Browse Elements',
buttonId: null,
disabled: false,
idleColor: LIGHT_TEXT,
diff --git a/packages/studio/src/test/transcription-modal.test.tsx b/packages/studio/src/test/transcription-modal.test.tsx
index 3be7724c06..9347a150d5 100644
--- a/packages/studio/src/test/transcription-modal.test.tsx
+++ b/packages/studio/src/test/transcription-modal.test.tsx
@@ -155,10 +155,14 @@ test('serializes transcription modal settings into caption jobs', async () => {
screen.getByRole('dialog', {
name: 'Transcribe interview.wav',
});
+ await waitFor(() => {
+ const buttons = screen.getAllByRole('button', {name: /^Transcribe$/});
+ expect(buttons).toHaveLength(2);
+ expect((buttons[0] as HTMLButtonElement).disabled).toBe(false);
+ });
const [submit] = screen.getAllByRole('button', {
name: /^Transcribe$/,
}) as HTMLButtonElement[];
- await waitFor(() => expect(submit.disabled).toBe(false));
expect(
screen.queryByText('Runs locally as a background job using WebGPU'),
).toBeNull();
@@ -168,7 +172,9 @@ test('serializes transcription modal settings into caption jobs', async () => {
outputLabel.compareDocumentPosition(modelLabel) &
Node.DOCUMENT_POSITION_FOLLOWING,
).not.toBe(0);
- const outputHelp = screen.getByTitle('Learn more about Output in public/');
+ const outputHelp = screen.getByRole('button', {
+ name: 'Learn more about Output in public/',
+ });
expect(screen.queryByText('Caption[]')).toBeNull();
fireEvent.pointerUp(outputHelp);
const captionType = screen.getByText('Caption[]');
@@ -179,12 +185,18 @@ test('serializes transcription modal settings into caption jobs', async () => {
expect(
screen.queryByRole('checkbox', {name: 'Force full sequences'}),
).toBeNull();
- expect(screen.queryByTitle('Task')).toBeNull();
+ expect(screen.queryByRole('button', {name: 'Task'})).toBeNull();
- await selectComboboxItem(screen.getByTitle('Whisper model'), /^tiny ·/);
- await selectComboboxItem(screen.getByTitle('Spoken language'), 'German');
await selectComboboxItem(
- screen.getByRole('button', {name: 'Task: Transcribe'}),
+ screen.getByRole('button', {name: 'Whisper model'}),
+ /^tiny ·/,
+ );
+ await selectComboboxItem(
+ screen.getByRole('button', {name: 'Spoken language'}),
+ 'German',
+ );
+ await selectComboboxItem(
+ screen.getByRole('button', {name: 'Task'}),
'Task: Translate to English',
);
const taskLabel = screen.getByText('Translate to English', {
@@ -216,15 +228,23 @@ test('serializes transcription modal settings into caption jobs', async () => {
target: {value: 'captions/interview.json'},
});
screen.getByText('Exists, will be overwritten');
- screen.getByTitle(/^Open in (Finder|File Explorer|File Manager)$/);
+ screen.getByRole('button', {
+ name: /^Open in (Finder|File Explorer|File Manager)$/,
+ });
fireEvent.click(screen.getByRole('button', {name: 'Advanced'}));
- screen.getByTitle('Learn more about Chunk length');
- screen.getByTitle('Learn more about Stride length');
- screen.getByTitle('Learn more about Force full sequences');
- screen.getByTitle('Learn more about Use sampling');
- screen.getByTitle('Learn more about Repetition penalty');
- screen.getByTitle('Learn more about No-repeat n-gram size');
+ screen.getByRole('button', {name: 'Learn more about Chunk length'});
+ screen.getByRole('button', {name: 'Learn more about Stride length'});
+ screen.getByRole('button', {
+ name: 'Learn more about Force full sequences',
+ });
+ screen.getByRole('button', {name: 'Learn more about Use sampling'});
+ screen.getByRole('button', {
+ name: 'Learn more about Repetition penalty',
+ });
+ screen.getByRole('button', {
+ name: 'Learn more about No-repeat n-gram size',
+ });
const forceFullSequences = screen.getByRole('checkbox', {
name: 'Force full sequences',
@@ -244,8 +264,8 @@ test('serializes transcription modal settings into caption jobs', async () => {
act(() => forceFullSequences.click());
act(() => useSampling.click());
- screen.getByTitle('Learn more about Temperature');
- screen.getByTitle('Learn more about Top K');
+ screen.getByRole('button', {name: 'Learn more about Temperature'});
+ screen.getByRole('button', {name: 'Learn more about Top K'});
setNumberSetting(/^Chunk length:/, 22);
setNumberSetting(/^Stride length:/, 4);