From cd57ab0297ba961f10aae415a63ebad76593a76d Mon Sep 17 00:00:00 2001 From: Alexandru Smarandache Date: Fri, 26 Jul 2024 15:00:48 +0300 Subject: [PATCH] EXM-53137: Fixed TCs --- .../oxygenxml/git/service/GitCheckoutConflict2Test.java | 9 +++++++-- .../oxygenxml/git/service/GitCheckoutConflictTest.java | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/oxygenxml/git/service/GitCheckoutConflict2Test.java b/src/test/java/com/oxygenxml/git/service/GitCheckoutConflict2Test.java index 9c8cf70b..00ed6ca9 100644 --- a/src/test/java/com/oxygenxml/git/service/GitCheckoutConflict2Test.java +++ b/src/test/java/com/oxygenxml/git/service/GitCheckoutConflict2Test.java @@ -43,6 +43,7 @@ import com.oxygenxml.git.view.dialog.OKOtherAndCancelDialog; import com.oxygenxml.git.view.event.GitController; import com.oxygenxml.git.view.event.PullType; +import com.oxygenxml.git.view.progress.OperationProgressManager; import com.oxygenxml.git.view.refresh.PanelsRefreshSupport; import ro.sync.exml.workspace.api.PluginWorkspaceProvider; @@ -184,6 +185,9 @@ public Void answer(InvocationOnMock invocation) throws Throwable { // Dummy icon Mockito.doReturn(null).when(imageUtilities).loadIcon((URL)Mockito.any()); Mockito.when(pluginWSMock.getImageUtilities()).thenReturn(imageUtilities); + + OperationProgressManager.init(new GitController(gitAccess)); + } @Override @@ -242,7 +246,6 @@ public void testCheckoutNewBranchWhenRepoInConflict_checkoutConflict_1() throws writeToFile(new File(SECOND_LOCAL_TEST_REPOSITORY + "/test.txt"), "altfel");; gitAccess.add(new FileStatus(GitChangeType.ADD, "test.txt")); gitAccess.commit("commit on ew branch"); - // move to main branch gitAccess.setBranch(GitAccess.DEFAULT_BRANCH_NAME); @@ -268,6 +271,7 @@ public void testCheckoutNewBranchWhenRepoInConflict_checkoutConflict_1() throws abstractAction.actionPerformed(null); }); + ((OKOtherAndCancelDialog) findDialog(Tags.REPOSITORY_OUTDATED)).getOKButton().doClick(); JDialog createBranchDialog = findDialog(translator.getTranslation(Tags.CREATE_BRANCH)); JCheckBox checkoutBranchCheckBox = findCheckBox(createBranchDialog, Tags.CHECKOUT_BRANCH); assertNotNull(checkoutBranchCheckBox); @@ -371,6 +375,7 @@ public void testCheckoutNewBranchWhenRepoInConflict_checkoutConflict_2() throws abstractAction.actionPerformed(null); }); + ((OKOtherAndCancelDialog) findDialog(Tags.REPOSITORY_OUTDATED)).getOKButton().doClick(); JDialog createBranchDialog = findDialog(translator.getTranslation(Tags.CREATE_BRANCH)); JCheckBox checkoutBranchCheckBox = findCheckBox(createBranchDialog, Tags.CHECKOUT_BRANCH); assertNotNull(checkoutBranchCheckBox); @@ -504,7 +509,7 @@ public String get() { } }; - Awaitility.waitAtMost(500, TimeUnit.MILLISECONDS).until(() -> + Awaitility.waitAtMost(1250, TimeUnit.MILLISECONDS).until(() -> "a_new_day".equals(branchName.get())); assertEquals("a_new_day", gitAccess.getRepository().getBranch()); diff --git a/src/test/java/com/oxygenxml/git/service/GitCheckoutConflictTest.java b/src/test/java/com/oxygenxml/git/service/GitCheckoutConflictTest.java index 2d1bb19e..e0024af8 100644 --- a/src/test/java/com/oxygenxml/git/service/GitCheckoutConflictTest.java +++ b/src/test/java/com/oxygenxml/git/service/GitCheckoutConflictTest.java @@ -36,6 +36,7 @@ import com.oxygenxml.git.view.branches.BranchTreeMenuActionsProvider; import com.oxygenxml.git.view.event.GitController; import com.oxygenxml.git.view.event.PullType; +import com.oxygenxml.git.view.progress.OperationProgressManager; import com.oxygenxml.git.view.refresh.PanelsRefreshSupport; import com.oxygenxml.git.view.staging.BranchSelectionCombo; @@ -190,6 +191,7 @@ protected void setUp() throws Exception { Mockito.doReturn(imageUtilities).when(pluginWSMock).getImageUtilities(); PluginWorkspaceProvider.setPluginWorkspace(pluginWSMock); + OperationProgressManager.init(new GitController(gitAccess)); } @Override