mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-31 06:42:03 +00:00
simplify the e2e tests
This commit is contained in:
60
apps/ui/tests/git/worktree-integration.spec.ts
Normal file
60
apps/ui/tests/git/worktree-integration.spec.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* Worktree Integration E2E Test
|
||||
*
|
||||
* Happy path: Display worktree selector with main branch
|
||||
*/
|
||||
|
||||
import { test, expect } from '@playwright/test';
|
||||
import * as fs from 'fs';
|
||||
import {
|
||||
waitForNetworkIdle,
|
||||
createTestGitRepo,
|
||||
cleanupTempDir,
|
||||
createTempDirPath,
|
||||
setupProjectWithPath,
|
||||
waitForBoardView,
|
||||
} from '../utils';
|
||||
|
||||
const TEST_TEMP_DIR = createTempDirPath('worktree-tests');
|
||||
|
||||
interface TestRepo {
|
||||
path: string;
|
||||
cleanup: () => Promise<void>;
|
||||
}
|
||||
|
||||
test.describe('Worktree Integration', () => {
|
||||
let testRepo: TestRepo;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
if (!fs.existsSync(TEST_TEMP_DIR)) {
|
||||
fs.mkdirSync(TEST_TEMP_DIR, { recursive: true });
|
||||
}
|
||||
});
|
||||
|
||||
test.beforeEach(async () => {
|
||||
testRepo = await createTestGitRepo(TEST_TEMP_DIR);
|
||||
});
|
||||
|
||||
test.afterEach(async () => {
|
||||
if (testRepo) {
|
||||
await testRepo.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
cleanupTempDir(TEST_TEMP_DIR);
|
||||
});
|
||||
|
||||
test('should display worktree selector with main branch', async ({ page }) => {
|
||||
await setupProjectWithPath(page, testRepo.path);
|
||||
await page.goto('/');
|
||||
await waitForNetworkIdle(page);
|
||||
await waitForBoardView(page);
|
||||
|
||||
const branchLabel = page.getByText('Branch:');
|
||||
await expect(branchLabel).toBeVisible({ timeout: 10000 });
|
||||
|
||||
const mainBranchButton = page.locator('[data-testid="worktree-branch-main"]');
|
||||
await expect(mainBranchButton).toBeVisible({ timeout: 15000 });
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user