Skip to content

Commit 818b908

Browse files
committed
test: git branch switch tests
1 parent ab2dd74 commit 818b908

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

test/spec/Extn-Git-integ-test.js

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,36 @@ define(function (require, exports, module) {
456456
}, "no files in modified files list", 10000);
457457
});
458458

459-
});
459+
const createdBranch = "createdBranch";
460+
async function waitForBranchNameDropdown(expectedName) {
461+
await awaitsFor(()=>{
462+
return $("#git-branch").text().trim().includes(expectedName);
463+
}, `branch ${expectedName} to show in project`);
464+
}
460465

466+
it("should be able to create a new branch", async () => {
467+
$("#git-branch-dropdown-toggle").click();
468+
await awaitsFor(()=>{
469+
return $(".git-branch-new").is(":visible");
470+
}, "branch dropdown to show");
471+
$(".git-branch-new").click();
472+
await __PR.waitForModalDialog(".git");
473+
$('input[name="branch-name"]').val(createdBranch);
474+
__PR.clickDialogButtonID(__PR.Dialogs.DIALOG_BTN_OK);
475+
await waitForBranchNameDropdown(createdBranch);
476+
});
477+
478+
it("should be able to switch branch", async () => {
479+
await waitForBranchNameDropdown(createdBranch);
480+
$("#git-branch-dropdown-toggle").click();
481+
await awaitsFor(()=>{
482+
return $(".git-branch-new").is(":visible");
483+
}, "branch dropdown to show");
484+
485+
expect($(".switch-branch").text()).toContain("master");
486+
$(".switch-branch").click();
487+
await waitForBranchNameDropdown("master");
488+
});
489+
});
461490
});
462491
});

0 commit comments

Comments
 (0)