[git] Add widget tests for empty state

GitOrigin-RevId: ff352a397db8ba39acb1ca3c88b2a308584feb94
This commit is contained in:
Ilia.Shulgin
2025-05-14 19:26:18 +00:00
committed by intellij-monorepo-bot
parent af254d7834
commit bfc452c911
4 changed files with 56 additions and 0 deletions
@@ -0,0 +1,9 @@
-Update Project...
-Commit…
-Push…
------
-New Branch…
-Checkout Tag or Revision…
------
-bro-repo
-project
@@ -0,0 +1,12 @@
-Update Project...
-Commit…
-Push…
------
-New Branch…
-Checkout Tag or Revision…
------
-bro-repo
-project
------
-Local Branches in project
master [icons/currentBranchFavoriteLabel.svg]
@@ -0,0 +1,9 @@
-Update Project...
-Commit…
-Push…
------
-New Branch…
-Checkout Tag or Revision…
------
-Local
master [icons/currentBranchFavoriteLabel.svg]
@@ -8,10 +8,12 @@ import com.intellij.openapi.vcs.Executor.cd
import com.intellij.testFramework.PlatformTestUtil
import com.intellij.testFramework.TestDataPath
import com.intellij.testFramework.assertions.Assertions
import com.intellij.testFramework.utils.io.deleteRecursively
import com.intellij.ui.SeparatorWithText
import com.intellij.ui.tree.TreeTestUtil
import com.intellij.ui.treeStructure.Tree
import com.intellij.vcs.git.shared.repo.GitRepositoriesFrontendHolder
import git4idea.GitUtil
import git4idea.config.GitVcsSettings
import git4idea.repo.GitRepository
import git4idea.test.*
@@ -178,6 +180,30 @@ class GitWidgetTreeStructureTest : GitPlatformTest() {
compareWithSnapshot(buildTestTree("group"))
}
fun testSingleFreshRepo() {
resetToFreshState(repo)
compareWithSnapshot(buildTestTree())
}
fun testMultipleFreshRepos() {
resetToFreshState(repo)
registerBroRepo().also { resetToFreshState(it) }
compareWithSnapshot(buildTestTree())
}
fun testMultipleFreshReposNoSync() {
settings.syncSetting = DvcsSyncSettings.Value.DONT_SYNC
resetToFreshState(repo)
registerBroRepo().also { resetToFreshState(it) }
compareWithSnapshot(buildTestTree())
}
private fun resetToFreshState(repo: GitRepository) {
repo.root.toNioPath().resolve(GitUtil.DOT_GIT).deleteRecursively()
repo.git("init")
}
private fun createRefs(repo: GitRepository, ensureTags: Boolean = false) {
listOf("test", "group/test", "another/group/test").forEach {
repo.branch(it)