Skip to content

Commit

Permalink
better split editor verification
Browse files Browse the repository at this point in the history
  • Loading branch information
midleman committed Jan 16, 2025
1 parent 3ab2329 commit ba42338
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions test/e2e/tests/editor-action-bar/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,39 @@ import { Application } from '../../infra';
// --- SHARED HELPERS ---

export async function verifySplitEditor(page, tabName: string) {
await test.step(`Verify "split editor" opens another tab`, async () => {

await test.step(`Verify "split editor" opens another tab and ensure tabs are correctly aligned`, async () => {
// Split editor right
await page.getByLabel('Split Editor Right', { exact: true }).click();
await expect(page.getByRole('tab', { name: tabName })).toHaveCount(2);

// Verify tabs are on the same X plane
const rightSplitTabs = page.getByRole('tab', { name: tabName });
const firstTabBox = await rightSplitTabs.nth(0).boundingBox();
const secondTabBox = await rightSplitTabs.nth(1).boundingBox();

expect(firstTabBox).not.toBeNull();
expect(secondTabBox).not.toBeNull();
expect(firstTabBox!.y).toBeCloseTo(secondTabBox!.y, 1);
expect(firstTabBox!.x).not.toBeCloseTo(secondTabBox!.x, 1);

// Close one tab
await page.getByRole('tab', { name: tabName }).getByLabel('Close').first().click();
await rightSplitTabs.first().getByLabel('Close').click();

// Split editor down
await page.keyboard.down('Alt');
await page.getByLabel('Split Editor Down').click();
await page.keyboard.up('Alt');
await expect(page.getByRole('tab', { name: tabName })).toHaveCount(2);

// Verify tabs are on the same Y plane
const downSplitTabs = page.getByRole('tab', { name: tabName });
const firstDownTabBox = await downSplitTabs.nth(0).boundingBox();
const secondDownTabBox = await downSplitTabs.nth(1).boundingBox();

expect(firstDownTabBox).not.toBeNull();
expect(secondDownTabBox).not.toBeNull();
expect(firstDownTabBox!.x).toBeCloseTo(secondDownTabBox!.x, 1);
expect(firstDownTabBox!.y).not.toBeCloseTo(secondDownTabBox!.y, 1);
});
}

Expand Down

0 comments on commit ba42338

Please sign in to comment.