mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-01 08:13:37 +00:00
Merge branch 'main' into refactor/frontend
This commit is contained in:
@@ -779,7 +779,7 @@ test.describe("Worktree Integration Tests", () => {
|
||||
expect(featureData.worktreePath).toBeUndefined();
|
||||
});
|
||||
|
||||
test("should store branch name when adding feature with new branch (worktree created at execution)", async ({
|
||||
test("should store branch name when adding feature with new branch (worktree created when adding feature)", async ({
|
||||
page,
|
||||
}) => {
|
||||
await setupProjectWithPath(page, testRepo.path);
|
||||
@@ -788,7 +788,7 @@ test.describe("Worktree Integration Tests", () => {
|
||||
await waitForBoardView(page);
|
||||
|
||||
// Use a branch name that doesn't exist yet
|
||||
// Note: Worktrees are now created at execution time, not when adding to backlog
|
||||
// Note: Worktrees are now created when features are added/edited, not at execution time
|
||||
const branchName = "feature/auto-create-worktree";
|
||||
|
||||
// Verify branch does NOT exist before we create the feature
|
||||
@@ -799,20 +799,28 @@ test.describe("Worktree Integration Tests", () => {
|
||||
await clickAddFeature(page);
|
||||
|
||||
// Fill in the feature details with the new branch
|
||||
await fillAddFeatureDialog(page, "Feature that should auto-create worktree", {
|
||||
branch: branchName,
|
||||
category: "Testing",
|
||||
});
|
||||
await fillAddFeatureDialog(
|
||||
page,
|
||||
"Feature that should auto-create worktree",
|
||||
{
|
||||
branch: branchName,
|
||||
category: "Testing",
|
||||
}
|
||||
);
|
||||
|
||||
// Confirm
|
||||
await confirmAddFeature(page);
|
||||
|
||||
// Wait for feature to be saved
|
||||
await page.waitForTimeout(1000);
|
||||
// Wait for feature to be saved and worktree to be created
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// Verify branch was NOT created when adding feature (created at execution time)
|
||||
// Verify branch WAS created when adding feature (worktrees are created when features are added/edited)
|
||||
const branchesAfter = await listBranches(testRepo.path);
|
||||
expect(branchesAfter).not.toContain(branchName);
|
||||
expect(branchesAfter).toContain(branchName);
|
||||
|
||||
// Verify worktree was created
|
||||
const worktreePath = getWorktreePath(testRepo.path, branchName);
|
||||
expect(fs.existsSync(worktreePath)).toBe(true);
|
||||
|
||||
// Verify feature was created with correct branch name stored
|
||||
const featuresDir = path.join(testRepo.path, ".automaker", "features");
|
||||
@@ -831,13 +839,9 @@ test.describe("Worktree Integration Tests", () => {
|
||||
|
||||
const featureFilePath = path.join(featuresDir, featureDir!, "feature.json");
|
||||
const featureData = JSON.parse(fs.readFileSync(featureFilePath, "utf-8"));
|
||||
|
||||
|
||||
// Verify branch name is stored
|
||||
expect(featureData.branchName).toBe(branchName);
|
||||
|
||||
// Verify worktreePath is NOT set (worktrees are created at execution time)
|
||||
expect(featureData.worktreePath).toBeUndefined();
|
||||
|
||||
// Verify feature is in backlog status
|
||||
expect(featureData.status).toBe("backlog");
|
||||
});
|
||||
@@ -896,7 +900,7 @@ test.describe("Worktree Integration Tests", () => {
|
||||
|
||||
let featureFilePath = path.join(featuresDir, featureDir!, "feature.json");
|
||||
let featureData = JSON.parse(fs.readFileSync(featureFilePath, "utf-8"));
|
||||
|
||||
|
||||
// Verify feature was created with the branch name stored
|
||||
expect(featureData.branchName).toBe(branchName);
|
||||
// Verify worktreePath is NOT set (worktrees are created at execution time, not when adding)
|
||||
@@ -1080,7 +1084,9 @@ test.describe("Worktree Integration Tests", () => {
|
||||
// When a worktree is selected, "Use current selected branch" should be selected
|
||||
// and the branch name should be shown in the label
|
||||
const currentBranchLabel = page.locator('label[for="feature-current"]');
|
||||
await expect(currentBranchLabel).toContainText(branchName, { timeout: 5000 });
|
||||
await expect(currentBranchLabel).toContainText(branchName, {
|
||||
timeout: 5000,
|
||||
});
|
||||
|
||||
// Close dialog
|
||||
await page.keyboard.press("Escape");
|
||||
@@ -1271,11 +1277,7 @@ test.describe("Worktree Integration Tests", () => {
|
||||
expect(featureDir).toBeDefined();
|
||||
|
||||
// Read the feature data
|
||||
const featureFilePath = path.join(
|
||||
featuresDir,
|
||||
featureDir!,
|
||||
"feature.json"
|
||||
);
|
||||
const featureFilePath = path.join(featuresDir, featureDir!, "feature.json");
|
||||
const featureData = JSON.parse(fs.readFileSync(featureFilePath, "utf-8"));
|
||||
expect(featureData.status).toBe("backlog");
|
||||
|
||||
@@ -1292,9 +1294,7 @@ test.describe("Worktree Integration Tests", () => {
|
||||
|
||||
// Wait for the feature to move to in_progress column
|
||||
await expect(async () => {
|
||||
const updatedData = JSON.parse(
|
||||
fs.readFileSync(featureFilePath, "utf-8")
|
||||
);
|
||||
const updatedData = JSON.parse(fs.readFileSync(featureFilePath, "utf-8"));
|
||||
expect(updatedData.status).toBe("in_progress");
|
||||
}).toPass({ timeout: 10000 });
|
||||
|
||||
@@ -1907,7 +1907,10 @@ test.describe("Worktree Integration Tests", () => {
|
||||
await apiCreateWorktree(page, testRepo.path, branchName);
|
||||
|
||||
// Add a file and commit in the worktree
|
||||
fs.writeFileSync(path.join(worktreePath, "merge-file.txt"), "merge content");
|
||||
fs.writeFileSync(
|
||||
path.join(worktreePath, "merge-file.txt"),
|
||||
"merge content"
|
||||
);
|
||||
await execAsync("git add merge-file.txt", { cwd: worktreePath });
|
||||
await execAsync('git commit -m "Add file for merge test"', {
|
||||
cwd: worktreePath,
|
||||
@@ -2061,9 +2064,9 @@ test.describe("Worktree Integration Tests", () => {
|
||||
|
||||
// Verify the worktree has the file from develop
|
||||
const worktreePath = getWorktreePath(testRepo.path, "feature/from-develop");
|
||||
expect(
|
||||
fs.existsSync(path.join(worktreePath, "develop-only.txt"))
|
||||
).toBe(true);
|
||||
expect(fs.existsSync(path.join(worktreePath, "develop-only.txt"))).toBe(
|
||||
true
|
||||
);
|
||||
const content = fs.readFileSync(
|
||||
path.join(worktreePath, "develop-only.txt"),
|
||||
"utf-8"
|
||||
@@ -2096,10 +2099,9 @@ test.describe("Worktree Integration Tests", () => {
|
||||
|
||||
// Verify the worktree starts from the same commit as main
|
||||
const worktreePath = getWorktreePath(testRepo.path, "feature/from-head");
|
||||
const { stdout: worktreeHash } = await execAsync(
|
||||
"git rev-parse HEAD~0",
|
||||
{ cwd: worktreePath }
|
||||
);
|
||||
const { stdout: worktreeHash } = await execAsync("git rev-parse HEAD~0", {
|
||||
cwd: worktreePath,
|
||||
});
|
||||
|
||||
// The worktree's initial commit should be the same as main's HEAD
|
||||
// (Since it was just created, we check the parent commit)
|
||||
@@ -2391,15 +2393,15 @@ test.describe("Worktree Integration Tests", () => {
|
||||
let featureData = JSON.parse(fs.readFileSync(featureFilePath, "utf-8"));
|
||||
|
||||
// Initially, the feature should be on main or have no branch set
|
||||
expect(
|
||||
!featureData.branchName || featureData.branchName === "main"
|
||||
).toBe(true);
|
||||
expect(!featureData.branchName || featureData.branchName === "main").toBe(
|
||||
true
|
||||
);
|
||||
|
||||
// The new branch we want to assign
|
||||
const newBranchName = "feature/edited-branch";
|
||||
const expectedWorktreePath = getWorktreePath(testRepo.path, newBranchName);
|
||||
|
||||
// Verify worktree does NOT exist before editing (worktrees are created at execution time)
|
||||
// Verify worktree does NOT exist before editing
|
||||
expect(fs.existsSync(expectedWorktreePath)).toBe(false);
|
||||
|
||||
// Find and click the edit button on the feature card
|
||||
@@ -2424,7 +2426,7 @@ test.describe("Worktree Integration Tests", () => {
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
// Type the new branch name
|
||||
const commandInput = page.locator('[cmdk-input]');
|
||||
const commandInput = page.locator("[cmdk-input]");
|
||||
await commandInput.fill(newBranchName);
|
||||
|
||||
// Press Enter to select/create the branch
|
||||
@@ -2435,22 +2437,19 @@ test.describe("Worktree Integration Tests", () => {
|
||||
const saveButton = page.locator('[data-testid="confirm-edit-feature"]');
|
||||
await saveButton.click();
|
||||
|
||||
// Wait for the dialog to close
|
||||
// Wait for the dialog to close and worktree to be created
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// Verify worktree was NOT created during editing (worktrees are created at execution time)
|
||||
expect(fs.existsSync(expectedWorktreePath)).toBe(false);
|
||||
// Verify worktree WAS created during editing (worktrees are now created when features are added/edited)
|
||||
expect(fs.existsSync(expectedWorktreePath)).toBe(true);
|
||||
|
||||
// Verify branch was NOT created (created at execution time)
|
||||
// Verify branch WAS created (worktrees are created when features are added/edited)
|
||||
const branches = await listBranches(testRepo.path);
|
||||
expect(branches).not.toContain(newBranchName);
|
||||
expect(branches).toContain(newBranchName);
|
||||
|
||||
// Verify feature was updated with correct branchName only
|
||||
// Note: worktreePath is no longer stored - worktrees are created server-side at execution time
|
||||
// Verify feature was updated with correct branchName
|
||||
featureData = JSON.parse(fs.readFileSync(featureFilePath, "utf-8"));
|
||||
expect(featureData.branchName).toBe(newBranchName);
|
||||
// worktreePath should not exist in the feature data
|
||||
expect(featureData.worktreePath).toBeUndefined();
|
||||
});
|
||||
|
||||
test("should not create worktree when editing a feature and selecting main branch", async ({
|
||||
@@ -2518,7 +2517,7 @@ test.describe("Worktree Integration Tests", () => {
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
// Type "main" to change to main branch
|
||||
const commandInput = page.locator('[cmdk-input]');
|
||||
const commandInput = page.locator("[cmdk-input]");
|
||||
await commandInput.fill("main");
|
||||
await commandInput.press("Enter");
|
||||
await page.waitForTimeout(200);
|
||||
@@ -2576,7 +2575,7 @@ test.describe("Worktree Integration Tests", () => {
|
||||
await branchInput.click();
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
const commandInput = page.locator('[cmdk-input]');
|
||||
const commandInput = page.locator("[cmdk-input]");
|
||||
await commandInput.fill(existingBranch);
|
||||
await commandInput.press("Enter");
|
||||
await page.waitForTimeout(200);
|
||||
|
||||
Reference in New Issue
Block a user