Skip to content

Commit acfc90e

Browse files
committed
test: integ test for git global and file history command
1 parent 383f894 commit acfc90e

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

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

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,7 @@ define(function (require, exports, module) {
310310
}, `History list to be visible: ${visible}`);
311311
}
312312

313-
async function testHistoryToggle(whichHistory) {
314-
const $historyToggleButton = $gitPanel.find(whichHistory);
315-
316-
$historyToggleButton.trigger("click");
317-
await waitForHistoryVisible(true);
318-
313+
function _verifyHistoryCommits() {
319314
const $historyList = $gitPanel.find("#git-history-list");
320315

321316
// Check if the first and second commits are displayed
@@ -325,6 +320,15 @@ define(function (require, exports, module) {
325320
// Verify the content of the first and second commits
326321
expect($historyCommits.eq(0).text().trim()).toBe("second commit");
327322
expect($historyCommits.eq(1).text().trim()).toBe("first commit");
323+
}
324+
325+
async function testHistoryToggle(whichHistory) {
326+
const $historyToggleButton = $gitPanel.find(whichHistory);
327+
328+
$historyToggleButton.trigger("click");
329+
await waitForHistoryVisible(true);
330+
331+
_verifyHistoryCommits();
328332

329333
$historyToggleButton.trigger("click");
330334
await waitForHistoryVisible(false);
@@ -338,6 +342,20 @@ define(function (require, exports, module) {
338342
await testHistoryToggle(".git-file-history");
339343
});
340344

345+
it("should show history commands work as expected", async () => {
346+
await waitForHistoryVisible(false);
347+
348+
await __PR.execCommand(Commands.CMD_GIT_HISTORY_GLOBAL);
349+
await waitForHistoryVisible(true);
350+
_verifyHistoryCommits();
351+
await __PR.execCommand(Commands.CMD_GIT_TOGGLE_PANEL);
352+
await waitForHistoryVisible(false);
353+
354+
await __PR.execCommand(Commands.CMD_GIT_HISTORY_FILE);
355+
await waitForHistoryVisible(true);
356+
_verifyHistoryCommits();
357+
});
358+
341359
async function waitForHistoryViewerVisible(visible) {
342360
await awaitsFor(() => {
343361
return $("#history-viewer").is(":visible") === visible;

0 commit comments

Comments
 (0)