// alice reviews bob's pull into tally: a comment on a line it adds, the // review approved, then the pull merged from its page, squashed into one // commit on her protected main. import { film } from '../camera.mjs'; export default { as: 'alice', start: (world) => `${world.views['pull-open']}/files`, film: async ({ page, world, size, take }) => { const pull = world.base + world.views['pull-open']; const shot = await film(take, page, size); try { await shot.open(`${pull}/files`); await shot.hold(900); shot.mark('files'); // The line the pull adds that reads `--json`, with the button that comments on it. const row = page .locator('tr', { has: page.locator('button[aria-label^="Comment on line"]') }) .filter({ hasText: '"--json"' }) .first(); await shot.point(row); await shot.hold(300); await shot.click(row.locator('button[aria-label^="Comment on line"]')); const box = page.getByRole('textbox', { name: /^Comment on line/ }); await shot.type(box, 'Could this say `--format json`, to leave room for others?', { delay: 40 }); await shot.hold(300); await shot.click(page.getByRole('button', { name: 'Start a review' })); await page.locator('.pending-line').waitFor(); shot.mark('commented'); await shot.hold(700); await shot.click(page.locator('.review-menu > summary')); shot.mark('finish'); const menu = page.locator('.review-menu .menu'); await shot.type(menu.getByPlaceholder('Leave a comment'), 'Looks good with that.', { delay: 45 }); await shot.click(menu.getByText('Approve', { exact: true })); await shot.hold(250); await shot.click(menu.getByRole('button', { name: 'Approve', exact: true })); await page.locator('.review-menu .menu').waitFor({ state: 'hidden' }); shot.mark('approved'); await shot.hold(900); await shot.open(pull); await shot.hold(700); const box2 = page.locator('.merge-box'); await box2.scrollIntoViewIfNeeded(); shot.mark('merge'); await shot.click(box2.getByRole('button', { name: 'Merge pull' })); await page.locator('.event', { hasText: 'Merged as' }).waitFor({ timeout: 30_000 }); await page.locator('.event', { hasText: 'Merged as' }).scrollIntoViewIfNeeded(); shot.mark('merged'); await shot.hold(2200); } finally { await shot.cut(); } } };