Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [swtbot-dev] random test failures and SWTBot timing parameters

I just fixed http://bugs.eclipse.org/299201 for this to proceed.

Attached is a patch against be23d88 :)

You'll need to download the latest swtbot from the update site in order for this to work.

I'm unable to push the patch to egit.eclipse.org as my Contributor Agreement is not verified. Anyone who could resolve this ?

-- Ketan

On 1/10/10 9:55 AM, Ketan Padegaonkar wrote:
On 1/10/10 3:05 AM, Robin Rosenberg wrote:
 > söndagen den 10 januari 2010 06.25.33 skrev Ketan Padegaonkar:
 > Not at all. I have one fix to one of the tests which was wrong
because, I
 > assume, it tested the wizard before the page flip occurred.

I followed the instructions on
http://wiki.eclipse.org/EGit/Contributor_Guide to get the workspace up
and running and I'm unable to get my workspace up and running.

git clone, maven, download the internet, convert to PDE projects and
still a few runtime errors to start with.

I do see 4 errors -- all of them with incorrect error message assertions
in the import wizard. I suspect the test is looking at the wrong place
for the message.


 > I updated the patch regarding some of the review feedback, still with
the old
 > SWTBot seeming available nowhere. Besides the issue above, making no
tests
 > working anymore, I cannot re-run single tests if I JUnit4-ify the
tests and
 > JUnit3 doesn't find the tests with the org.eclipse version. Why?

JUnit3 runner will not find the JUnit4 tests, there's some issue with
class cast exceptions between different versions of junit I've seen at
times. I'd recommend sticking to junit 4.

I'm unsure which versions of swtbot you are currently running on. The
older versions of swtbot are available on the archive download url:
http://download.eclipse.org/technology/swtbot/archives/

-- Ketan

>From 35660c2b69e6cde9db6c3357a76c6f93945f785b Mon Sep 17 00:00:00 2001
From: Ketan Padegaonkar <KetanPadegaonkar@xxxxxxxxx>
Date: Sun, 10 Jan 2010 16:22:50 -0800
Subject: [PATCH] * Refactored existing test case
 * Moved to using page objects
 * (http://code.google.com/p/webdriver/wiki/PageObjects)

Other (minor) changes:
- removed dependency on junit 3.x (this should have been a plugin
  dependency, not a project dependency)
- moved to junit 4.x
---
 org.eclipse.egit.ui.test/.classpath                |    1 -
 org.eclipse.egit.ui.test/META-INF/MANIFEST.MF      |   13 +-
 .../org.eclipse.egit.ui--All tests.launch          |   19 +-
 .../ui/internal/sharing/GitCloneWizardTest.java    |  425 --------------------
 .../src/org/eclipse/egit/ui/test/AllTests.java     |   12 +
 .../src/org/eclipse/egit/ui/test/Eclipse.java      |   70 ++++
 .../egit/ui/wizards/clone/GitCloneWizardTest.java  |  329 +++++++++++++++
 .../egit/ui/wizards/clone/GitImportRepoWizard.java |   23 +
 .../egit/ui/wizards/clone/RepoPropertiesPage.java  |   63 +++
 .../ui/wizards/clone/RepoRemoteBranchesPage.java   |   67 +++
 .../egit/ui/wizards/clone/WorkingCopyPage.java     |   54 +++
 11 files changed, 634 insertions(+), 442 deletions(-)
 delete mode 100644 org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/sharing/GitCloneWizardTest.java
 create mode 100644 org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/AllTests.java
 create mode 100644 org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/Eclipse.java
 create mode 100644 org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/GitCloneWizardTest.java
 create mode 100644 org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/GitImportRepoWizard.java
 create mode 100644 org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/RepoPropertiesPage.java
 create mode 100644 org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/RepoRemoteBranchesPage.java
 create mode 100644 org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/WorkingCopyPage.java

diff --git a/org.eclipse.egit.ui.test/.classpath b/org.eclipse.egit.ui.test/.classpath
index 13116da..64c5e31 100644
--- a/org.eclipse.egit.ui.test/.classpath
+++ b/org.eclipse.egit.ui.test/.classpath
@@ -3,6 +3,5 @@
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
diff --git a/org.eclipse.egit.ui.test/META-INF/MANIFEST.MF b/org.eclipse.egit.ui.test/META-INF/MANIFEST.MF
index e3554e4..1df71f5 100644
--- a/org.eclipse.egit.ui.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.egit.ui.test/META-INF/MANIFEST.MF
@@ -6,14 +6,17 @@ Bundle-Version: 0.6.0.qualifier
 Bundle-Activator: org.eclipse.egit.ui.test.Activator
 Require-Bundle: org.eclipse.core.runtime,
  org.eclipse.egit.ui;bundle-version="0.6.0",
- net.sf.swtbot.eclipse.finder;bundle-version="2.0.0",
- net.sf.swtbot.eclipse.spy;bundle-version="2.0.0",
- net.sf.swtbot.eclipse.ui;bundle-version="2.0.0",
- net.sf.swtbot.finder;bundle-version="2.0.0",
+ org.eclipse.swtbot.eclipse.finder;bundle-version="2.0.0",
+ org.eclipse.swtbot.eclipse.spy;bundle-version="2.0.0",
+ org.eclipse.swtbot.eclipse.ui;bundle-version="2.0.0",
+ org.eclipse.swtbot.swt.finder;bundle-version="2.0.0",
  org.eclipse.swt;bundle-version="3.4.0",
  org.eclipse.ui;bundle-version="3.4.0",
  org.eclipse.core.resources;bundle-version="3.4.0",
  org.eclipse.jgit;bundle-version="0.6.0",
- org.apache.log4j;bundle-version="1.2.13"
+ org.apache.log4j;bundle-version="1.2.13",
+ org.hamcrest;bundle-version="1.1.0",
+ org.junit;bundle-version="4.3.1",
+ org.eclipse.swtbot.junit4_x;bundle-version="2.0.0"
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/org.eclipse.egit.ui.test/org.eclipse.egit.ui--All tests.launch b/org.eclipse.egit.ui.test/org.eclipse.egit.ui--All tests.launch
index fc6c1f8..bee8799 100644
--- a/org.eclipse.egit.ui.test/org.eclipse.egit.ui--All tests.launch	
+++ b/org.eclipse.egit.ui.test/org.eclipse.egit.ui--All tests.launch	
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <launchConfiguration type="org.eclipse.swtbot.eclipse.ui.launcher.JunitLaunchConfig">
 <booleanAttribute key="append.args" value="true"/>
 <booleanAttribute key="askclear" value="false"/>
@@ -14,25 +14,22 @@
 <booleanAttribute key="includeOptional" value="true"/>
 <stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
 <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/org.eclipse.egit.ui.test"/>
+<listEntry value="/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/AllTests.java"/>
 </listAttribute>
 <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="4"/>
+<listEntry value="1"/>
 </listAttribute>
-<mapAttribute key="org.eclipse.debug.core.environmentVariables">
-<mapEntry key="LANG" value="en_US"/>
-</mapAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=org.eclipse.egit.ui.test"/>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
 <booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
 <stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
-<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl en_US"/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.egit.ui.test.AllTests"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.egit.ui.test"/>
 <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
 <stringAttribute key="pde.version" value="3.3"/>
 <stringAttribute key="product" value="org.eclipse.sdk.ide"/>
+<booleanAttribute key="run_in_ui_thread" value="true"/>
 <booleanAttribute key="show_selected_only" value="false"/>
 <booleanAttribute key="tracing" value="false"/>
 <booleanAttribute key="useDefaultConfig" value="true"/>
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/sharing/GitCloneWizardTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/sharing/GitCloneWizardTest.java
deleted file mode 100644
index 4b4e197..0000000
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/sharing/GitCloneWizardTest.java
+++ /dev/null
@@ -1,425 +0,0 @@
-package org.eclipse.egit.ui.internal.sharing;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import net.sf.swtbot.eclipse.finder.SWTBotEclipseTestCase;
-import net.sf.swtbot.wait.Conditions;
-import net.sf.swtbot.widgets.SWTBotShell;
-import net.sf.swtbot.widgets.SWTBotTree;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jgit.lib.Repository;
-
-/**
- * UI Tests for the Git import wizard.
- * <p>
- * Only UI aspects are interesting.
- * <p>
- * TODO:
- * <ul>
- * <li>Failure at fetch step
- * <li>Failure during fetch step
- * <li>Failure post fetch step (bad repo?)
- * </ul>
- */
-public class GitCloneWizardTest extends SWTBotEclipseTestCase {
-	/**
-	 * Test that defaults and derived values in dialogs are set properly and
-	 * that cloning starts and stops properly for a normal run. It also samples
-	 * the cloned repository to see that a clone and checkout has occurred.
-	 * <p>
-	 * The clone is backgrounded so no import to the workspace, nor any sharing
-	 * occurs.
-	 *
-	 * @throws Exception
-	 */
-	public void testClone() throws Exception {
-		goToImportGitRepository();
-		bot.textWithLabel("URI:").setText("git://repo.or.cz/egit.git");
-		assertSourceParams(null, "repo.or.cz", "/egit.git", "git", "", true, "",
-				"", false, false);
-		bot.button("Next >").click();
-
-		assertEquals("historical/pre-eclipse", bot.table().getTableItem(0).getText());
-		assertTrue(bot.table().getTableItem(0).isChecked());
-		bot.button("Next >").click();
-
-		File destRepo = new File(new File(ResourcesPlugin.getWorkspace()
-				.getRoot().getLocation().toFile().getParent(),
-				"junit-workspace"), "egit");
-		assertEquals(destRepo.toString(), bot.textWithLabel("Directory:")
-				.getText());
-		assertEquals("master", bot.comboBoxWithLabel("Initial branch:")
-				.getText());
-		assertEquals("origin", bot.textWithLabel("Remote name:").getText());
-		bot.checkBox("Import projects after clone").deselect();
-		bot.button("Finish").click();
-
-		SWTBotShell shell2 = bot.shell("Cloning from git://repo.or.cz/egit.git");
-
-		// This is not a performance test. Allow lots of time to complete
-		bot.waitUntil(Conditions.shellCloses(shell2), 120000);
-
-		// Some random sampling to see we got something. We do not test
-		// the integrity of the repository here. Only a few basic properties
-		// we'd expect from a clone made this way, that would possibly
-		// not hold true given other parameters in the GUI.
-		Repository repository = new Repository(new File(destRepo, ".git"));
-		// we always have an origin/master
-		assertNotNull(repository.resolve("origin/master"));
-		// and a local master initialized from origin/master (default!)
-		assertEquals(repository.resolve("origin/master"), repository
-				.resolve("origin/master"));
-		// A well known tag
-		assertEquals("90b818e596660b813b6fcf68f1e9e9b62c615130", repository
-				.resolve("refs/tags/v0.4.0").name());
-		// lots of refs
-		assertTrue(repository.getAllRefs().size() >= 10);
-		// and a README in the working dir
-		assertTrue(new File(destRepo, "README").exists());
-		assertFalse(repository.getIndex().isChanged());
-		assertFalse(repository.getIndex().getEntry("README").isModified(
-				destRepo));
-		// No project have been imported
-		assertEquals(0,
-				ResourcesPlugin.getWorkspace().getRoot().getProjects().length);
-	}
-
-	private void goToImportGitRepository() {
-		bot.view("Package Explorer").show();
-		bot.menu("File").click();
-		bot.menu("File").menu("Import...").click();
-		bot.shell("Import");
-
-		SWTBotTree tree = bot.tree(0);
-		tree.expandNode("Git").select("Git Repository");
-
-		bot.button("Next >").click();
-		bot.shell("Import Git Repository");
-	}
-
-	/**
-	 * Basically the same as testClone, but using the same parameters will not
-	 * work because the destination already exists and so the UI will not let
-	 * the user finish the operation. This tests that case for default
-	 * parameters.
-	 *
-	 * @throws Exception
-	 */
-	public void testCloneDestExists() throws Exception {
-		File destRepo = new File(new File(ResourcesPlugin.getWorkspace()
-				.getRoot().getLocation().toFile().getParent(),
-				"junit-workspace"), "egit");
-		if (!destRepo.exists()) {
-			if (!destRepo.mkdirs())
-				throw new IOException("Ooops, failed to create " + destRepo);
-			new FileOutputStream(new File(destRepo, "afile")).close();
-		}
-		goToImportGitRepository();
-		bot.textWithLabel("URI:").setText("git://repo.or.cz/egit.git");
-		bot.button("Next >").click();
-
-		bot.button("Next >").click();
-
-		bot.checkBox("Import projects after clone").deselect();
-		assertEquals(" " + bot.textWithLabel("Directory:").getText()
-				+ " is not an empty directory.", bot.text(2/* ! */).getText());
-		assertFalse(bot.button("Finish").isEnabled()); // Due to the error
-
-		// Need to close or no other test can be performed
-		bot.activeShell().close();
-	}
-
-	/**
-	 * Alter some parameters during clone
-	 * @throws IOException
-	 */
-	public void testCloneChangeSomeParameters() throws IOException {
-		goToImportGitRepository();
-		bot.textWithLabel("URI:").setText("git://repo.or.cz/egit.git");
-		assertSourceParams(null, "repo.or.cz", "/egit.git", "git", "", true, "",
-				"", false, false);
-		bot.button("Next >").click();
-
-		// Select only two branches
-		for (int i = 0; i < bot.table().rowCount(); ++i)
-			bot.table().getTableItem(i).uncheck();
-		assertEquals(" At least one branch must be selected.", bot.text(0)
-				.getText());
-		assertFalse(bot.button("Next >").isEnabled());
-		bot.table().getTableItem("historical/pre-eclipse").check(); // will enable
-		assertTrue(bot.button("Next >").isEnabled());
-		bot.button("Next >").click();
-
-		File destRepo = new File(new File(ResourcesPlugin.getWorkspace()
-				.getRoot().getLocation().toFile().getParent(),
-				"junit-workspace"), "EGIT2");
-		bot.textWithLabel("Directory:").setText(destRepo.toString());
-		assertEquals("historical/pre-eclipse", bot.comboBoxWithLabel("Initial branch:")
-				.getText());
-		bot.comboBoxWithLabel("Initial branch:").setSelection("historical/pre-eclipse");
-		assertEquals("origin", bot.textWithLabel("Remote name:").getText());
-		bot.textWithLabel("Remote name:").setText("src");
-		bot.checkBox("Import projects after clone").deselect();
-		bot.button("Finish").click();
-
-		SWTBotShell shell2 = bot.shell("Cloning from git://repo.or.cz/egit.git");
-
-		// This is not a performance test. Allow lots of time to complete
-		bot.waitUntil(Conditions.shellCloses(shell2), 120000);
-
-		// Some random sampling to see we got something. We do not test
-		// the integrity of the repo here. Only a few basic properties
-		// we'd expect from a clone made this way, that would possibly
-		// not hold true given othe parameters in the GUI.
-		Repository repository = new Repository(new File(destRepo, ".git"));
-		assertNotNull(repository.resolve("src/historical/pre-eclipse"));
-		// we didn't clone that one
-		assertNull(repository.resolve("src/master"));
-		// and a local master initialized from origin/master (default!)
-		assertEquals(repository.resolve("stable"), repository
-				.resolve("src/stable"));
-		// A well known tag
-		assertEquals("90b818e596660b813b6fcf68f1e9e9b62c615130", repository
-				.resolve("refs/tags/v0.4.0").name());
-		// lots of refs
-		assertTrue(repository.getAllRefs().size() >= 10);
-
-		// Skip testing working dir, we did that in #testClone
-	}
-
-	/**
-	 * Exercise editing of fields and verify that derived fields are updated and
-	 * enabled/disabled properly along with a proper error message when needed.
-	 * No clone is actually made.
-	 */
-	public void testParameterEditing() {
-		goToImportGitRepository();
-		// Start the test now
-		bot.textWithLabel("URI:").setText("git://www.jgit.org/EGIT");
-		assertSourceParams(null, "www.jgit.org", "/EGIT", "git", "", true, "",
-				"", false, false);
-
-		bot.textWithLabel("URI:").typeText("X");
-		assertSourceParams(null, "www.jgit.org", "/EGITX", "git", "", true, "",
-				"", false, false);
-
-		bot.textWithLabel("URI:").setText("git://www.jgit.org/EGIT");
-		assertSourceParams(null, "www.jgit.org", "/EGIT", "git", "", true, "",
-				"", false, false);
-
-		bot.textWithLabel("URI:").setText("git://user:hi@xxxxxxxxxxxx/EGIT");
-		assertSourceParams(" User not supported on git protocol.",
-				"www.jgit.org", "/EGIT", "git", "", true, "user", "hi", false,
-				false);
-		// UI doesn't change URI even when password is entered in clear text as
-		// part of URI. Opinions on this may vary.
-		assertEquals("git://user:hi@xxxxxxxxxxxx/EGIT", bot.textWithLabel(
-				"URI:").getText());
-
-		bot.textWithLabel("URI:").setText("ssh://user@xxxxxxxxxxxx/EGIT");
-		assertSourceParams(null, "www.jgit.org", "/EGIT", "git+ssh", "", true,
-				"user", "", true, true);
-
-		bot.textWithLabel("URI:").setText("ssh://user@xxxxxxxxxxxx/EGIT");
-		assertSourceParams(null, "www.jgit.org", "/EGIT", "git+ssh", "", true,
-				"user", "", true, true);
-
-		bot.textWithLabel("URI:").setText("ssh://user:hi@xxxxxxxxxxxx:33/EGIT");
-		assertSourceParams(null, "www.jgit.org", "/EGIT", "git+ssh", "33",
-				true, "user", "hi", true, true);
-
-		bot.textWithLabel("URI:").setText("ssh:///EGIT");
-		assertSourceParams(" Host required for ssh protocol.", "", "/EGIT",
-				"git+ssh", "", true, "", "", true, true);
-
-		bot.textWithLabel("URI:").setText("file:///some/place");
-		if (Platform.getOS().equals(Platform.OS_WIN32))
-			assertSourceParams(" " + System.getProperty("user.dir")
-					+ "\\.\\some\\place does not exist.", "", "/some/place",
-					"file", "", false, "", "", false, false);
-		else
-			assertSourceParams(" /some/place does not exist.", "",
-					"/some/place", "file", "", false, "", "", false, false);
-
-		// Now try changing some fields other than URI and see how the URI field
-		// gets changed
-		bot.textWithLabel("URI:").setText("ssh://user@xxxxxxxxxxxx/EGIT");
-
-		// ..change host
-		bot.textWithLabel("Host:").setText("example.com");
-		assertEquals("ssh://user@xxxxxxxxxxx/EGIT", bot.textWithLabel("URI:")
-				.getText());
-		assertSourceParams(null, "example.com", "/EGIT", "git+ssh", "", true,
-				"user", "", true, true);
-
-		// ..change user
-		bot.textWithLabel("User:").setText("gitney");
-		assertEquals("ssh://gitney@xxxxxxxxxxx/EGIT", bot.textWithLabel("URI:")
-				.getText());
-		assertSourceParams(null, "example.com", "/EGIT", "git+ssh", "", true,
-				"gitney", "", true, true);
-
-		// ..change password
-		bot.textWithLabel("Password:").setText("fsck");
-		// Password is not written into the URL here!
-		assertEquals("ssh://gitney@xxxxxxxxxxx/EGIT", bot.textWithLabel("URI:")
-				.getText());
-		assertSourceParams(null, "example.com", "/EGIT", "git+ssh", "", true,
-				"gitney", "fsck", true, true);
-
-		// change port number
-		bot.textWithLabel("Port:").setText("99");
-		assertEquals("ssh://gitney@xxxxxxxxxxx:99/EGIT", bot.textWithLabel(
-				"URI:").getText());
-		assertSourceParams(null, "example.com", "/EGIT", "git+ssh", "99", true,
-				"gitney", "fsck", true, true);
-
-		// change protocol to another with user/password capability
-		bot.comboBoxWithLabel("Protocol:").setSelection("ftp");
-		assertEquals("ftp://gitney@xxxxxxxxxxx:99/EGIT";, bot.textWithLabel(
-				"URI:").getText());
-		assertSourceParams(null, "example.com", "/EGIT", "ftp", "99", true,
-				"gitney", "fsck", true, true);
-
-		// change protocol to one without user/password capability
-		bot.comboBoxWithLabel("Protocol:").setSelection("git");
-		assertEquals("git://gitney@xxxxxxxxxxx:99/EGIT", bot.textWithLabel(
-				"URI:").getText());
-		assertSourceParams(" User not supported on git protocol.",
-				"example.com", "/EGIT", "git", "99", true, "gitney", "fsck",
-				false, false);
-
-		// change protocol to one without host capability
-		bot.comboBoxWithLabel("Protocol:").setSelection("file");
-		assertEquals("file://gitney@xxxxxxxxxxx:99/EGIT", bot.textWithLabel(
-				"URI:").getText());
-		assertSourceParams(" Host not supported on file protocol.",
-				"example.com", "/EGIT", "file", "99", false, "gitney", "fsck",
-				false, false);
-
-		// Local protocol with file: prefix. We need to make sure the
-		// local path exists as a directory so we choose user.home as
-		// that one should exist.
-		if (Platform.getOS().equals(Platform.OS_WIN32))
-			bot.textWithLabel("URI:").setText(
-					"file:///" + System.getProperty("user.home"));
-		else
-			bot.textWithLabel("URI:").setText(
-					"file://" + System.getProperty("user.home"));
-		assertSourceParams(null, "", System.getProperty("user.home").replace(
-				'\\', '/'), "file", "", false, "", "", false, false);
-
-		// Local protocol without file: prefix
-		bot.textWithLabel("URI:").setText(System.getProperty("user.home"));
-		assertSourceParams(null, "", System.getProperty("user.home").replace(
-				'\\', '/'), "file", "", false, "", "", false, false);
-
-		// On windows the use can choose forward or backward slashes, so add
-		// a case for forward slashes using the non prefixed local protocol.
-		if (Platform.getOS().equals(Platform.OS_WIN32)) {
-			bot.textWithLabel("URI:").setText(
-					System.getProperty("user.home").replace('\\', '/'));
-			assertSourceParams(null, "", System.getProperty("user.home")
-					.replace('\\', '/'), "file", "", false, "", "", false,
-					false);
-		}
-		bot.button("Cancel").click();
-	}
-
-	/**
-	 * Try not giving a hostname that does not exist. Should yield an error and
-	 * disable the next/finish buttons.
-	 */
-	public void testNoSuchHost() {
-		goToImportGitRepository();
-		bot.textWithLabel("URI:").setText("git://no.example.com/EGIT");
-		assertSourceParams(null, "no.example.com", "/EGIT", "git", "", true,
-				"", "", false, false);
-		bot.button("Next >").click();
-		assertEquals(" git://no.example.com/EGIT: unknown host", bot.text(0)
-				.getText());
-		assertTrue(bot.button("Cancel").isEnabled());
-		assertTrue(bot.button("< Back").isEnabled());
-		assertFalse(bot.button("Next >").isEnabled());
-		assertFalse(bot.button("Finish").isEnabled());
-		bot.button("Cancel").click();
-	}
-
-	/**
-	 * Try connecting to a non-git socket.
-	 */
-	public void testWrongSocket() {
-		goToImportGitRepository();
-		bot.textWithLabel("URI:").setText("git://www.jgit.org:80/EGIT");
-		assertSourceParams(null, "www.jgit.org", "/EGIT", "git", "80", true,
-				"", "", false, false);
-		bot.button("Next >").click();
-		assertEquals(" git://www.jgit.org:80/EGIT: not found.", bot.text(0)
-				.getText());
-		assertTrue(bot.button("Cancel").isEnabled());
-		assertTrue(bot.button("< Back").isEnabled());
-		assertFalse(bot.button("Next >").isEnabled());
-		assertFalse(bot.button("Finish").isEnabled());
-		bot.button("Cancel").click();
-	}
-
-	/**
-	 * Firewalled socket, no response.
-	 */
-	public void testTimeoutToHost() {
-		goToImportGitRepository();
-		bot.textWithLabel("URI:").setText("git://www.example.com/EGIT");
-		assertSourceParams(null, "www.example.com", "/EGIT", "git", "", true,
-				"", "", false, false);
-		bot.button("Next >").click();
-		// Timeout messages are platform and locale dependent it seems. This
-		// test has only been tried on Linux and Windows. We assume
-		// that the test is run with an english locale for this test to pass.
-		// -nl en_US and environment LC_ALL=en_US (or possibly the "C" locale).
-		assertStartsWith(" git://www.example.com/EGIT: Connection timed out",
-				bot.text(0).getText());
-		assertTrue(bot.button("Cancel").isEnabled());
-		assertTrue(bot.button("< Back").isEnabled());
-		assertFalse(bot.button("Next >").isEnabled());
-		assertFalse(bot.button("Finish").isEnabled());
-		bot.button("Cancel").click();
-	}
-
-	private void assertStartsWith(String expect, String actual) {
-		if (actual.length() < expect.length())
-			assertEquals("Wrong start of message", expect, actual);
-		else
-			assertEquals("Wrong start of message", expect, actual.substring(0,
-					expect.length()));
-	}
-
-	private void assertSourceParams(String message, String expectHost,
-			String expectPath, String expectProtocol, String expectPort,
-			boolean enablePort, String expectUser, String expectPassword,
-			boolean enabledUser, boolean enabledPass) {
-		if (message != null) {
-			assertEquals(message, bot.text(6).getText());
-			assertFalse(bot.button("Next >").isEnabled());
-		} else {
-			assertEquals("Enter the location of the source repository.", bot
-					.text(6).getText());
-			assertTrue(bot.button("Next >").isEnabled());
-		}
-		assertEquals(expectHost, bot.textWithLabel("Host:").getText());
-		assertEquals(expectPath, bot.textWithLabel("Repository path:")
-				.getText());
-		assertEquals(expectProtocol, bot.comboBoxWithLabel("Protocol:")
-				.getText());
-		assertEquals(expectPort, bot.textWithLabel("Port:").getText());
-		assertEquals(enablePort, bot.textWithLabel("Port:").isEnabled());
-		assertEquals(expectUser, bot.textWithLabel("User:").getText());
-		assertEquals(expectPassword, bot.textWithLabel("Password:").getText());
-		assertEquals(enabledUser, bot.textWithLabel("User:").isEnabled());
-		assertEquals(enabledPass, bot.label("Password:").isEnabled());
-		assertEquals(enabledPass, bot.textWithLabel("Password:").isEnabled());
-	}
-}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/AllTests.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/AllTests.java
new file mode 100644
index 0000000..d32455f
--- /dev/null
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/AllTests.java
@@ -0,0 +1,12 @@
+package org.eclipse.egit.ui.test;
+
+import org.eclipse.egit.ui.wizards.clone.GitCloneWizardTest;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses({ GitCloneWizardTest.class })
+public class AllTests {
+	// empty class, don't need anything here
+}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/Eclipse.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/Eclipse.java
new file mode 100644
index 0000000..6c5fdb1
--- /dev/null
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/Eclipse.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (C) 2010, Ketan Padegaonkar <KetanPadegaonkar@xxxxxxxxx>
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.egit.ui.test;
+
+import java.util.List;
+
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.finders.WorkbenchContentsFinder;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.BoolResult;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+
+public class Eclipse {
+
+	private final SWTWorkbenchBot bot;
+
+	public Eclipse() {
+		this.bot = new SWTWorkbenchBot();
+	}
+
+	/**
+	 * Save and close all editors. Close all dialogs.
+	 */
+	public void reset() {
+		saveAll();
+		closeAllEditors();
+		closeAllShells();
+	}
+
+	private void closeAllShells() {
+		SWTBotShell[] shells = bot.shells();
+		for (SWTBotShell shell : shells) {
+			if (!isEclipseShell(shell)) {
+				shell.close();
+			}
+		}
+	}
+
+	public static boolean isEclipseShell(final SWTBotShell shell) {
+		return UIThreadRunnable.syncExec(new BoolResult() {
+
+			public Boolean run() {
+				return new WorkbenchContentsFinder().activeWorkbenchWindow()
+						.getShell() == shell.widget;
+			}
+		});
+	}
+
+	public void closeAllEditors() {
+		List<? extends SWTBotEditor> editors = bot.editors();
+		for (SWTBotEditor editor : editors) {
+			editor.close();
+		}
+	}
+
+	public void saveAll() {
+		List<? extends SWTBotEditor> editors = bot.editors();
+		for (SWTBotEditor editor : editors) {
+			editor.save();
+		}
+	}
+
+}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/GitCloneWizardTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/GitCloneWizardTest.java
new file mode 100644
index 0000000..35018ab
--- /dev/null
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/GitCloneWizardTest.java
@@ -0,0 +1,329 @@
+package org.eclipse.egit.ui.wizards.clone;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.egit.ui.test.Eclipse;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(SWTBotJunit4ClassRunner.class)
+public class GitCloneWizardTest {
+	static {
+		System.setProperty("org.eclipse.swtbot.playback.delay", "50");
+	}
+
+	private static final SWTWorkbenchBot bot = new SWTWorkbenchBot();
+
+	private GitImportRepoWizard importWizard;
+
+	@Test
+	public void updatesParameterFieldsInImportDialogWhenURIIsUpdated()
+			throws Exception {
+
+		RepoPropertiesPage propertiesPage = importWizard.openWizard();
+
+		propertiesPage.setURI("git://www.jgit.org/EGIT");
+		propertiesPage.assertSourceParams(null, "www.jgit.org", "/EGIT", "git",
+				"", true, "", "", false, false);
+
+		propertiesPage.appendToURI("X");
+
+		propertiesPage.assertSourceParams(null, "www.jgit.org", "/EGITX",
+				"git", "", true, "", "", false, false);
+
+		propertiesPage.setURI("git://www.jgit.org/EGIT");
+		propertiesPage.assertSourceParams(null, "www.jgit.org", "/EGIT", "git",
+				"", true, "", "", false, false);
+
+		propertiesPage.setURI("git://user:hi@xxxxxxxxxxxx/EGIT");
+		propertiesPage.assertSourceParams(
+				" User not supported on git protocol.", "www.jgit.org",
+				"/EGIT", "git", "", true, "user", "hi", false, false);
+
+		// UI doesn't change URI even when password is entered in clear text as
+		// part of URI. Opinions on this may vary.
+		propertiesPage.assertURI("git://user:hi@xxxxxxxxxxxx/EGIT");
+
+		propertiesPage.setURI("ssh://user@xxxxxxxxxxxx/EGIT");
+		propertiesPage.assertSourceParams(null, "www.jgit.org", "/EGIT",
+				"git+ssh", "", true, "user", "", true, true);
+
+		propertiesPage.setURI("ssh://user@xxxxxxxxxxxx/EGIT");
+		propertiesPage.assertSourceParams(null, "www.jgit.org", "/EGIT",
+				"git+ssh", "", true, "user", "", true, true);
+
+		propertiesPage.setURI("ssh://user:hi@xxxxxxxxxxxx:33/EGIT");
+		propertiesPage.assertSourceParams(null, "www.jgit.org", "/EGIT",
+				"git+ssh", "33", true, "user", "hi", true, true);
+
+		propertiesPage.setURI("ssh:///EGIT");
+		propertiesPage.assertSourceParams(" Host required for ssh protocol.",
+				"", "/EGIT", "git+ssh", "", true, "", "", true, true);
+
+		propertiesPage.setURI("file:///some/place");
+		if (Platform.getOS().equals(Platform.OS_WIN32))
+			propertiesPage.assertSourceParams(" "
+					+ System.getProperty("user.dir")
+					+ "\\.\\some\\place does not exist.", "", "/some/place",
+					"file", "", false, "", "", false, false);
+		else
+			propertiesPage.assertSourceParams(" /some/place does not exist.",
+					"", "/some/place", "file", "", false, "", "", false, false);
+
+		// Now try changing some fields other than URI and see how the URI field
+		// gets changed
+		propertiesPage.setURI("ssh://user@xxxxxxxxxxxx/EGIT");
+
+		// ..change host
+		bot.textWithLabel("Host:").setText("example.com");
+		propertiesPage.assertURI("ssh://user@xxxxxxxxxxx/EGIT");
+
+		propertiesPage.assertSourceParams(null, "example.com", "/EGIT",
+				"git+ssh", "", true, "user", "", true, true);
+
+		// ..change user
+		bot.textWithLabel("User:").setText("gitney");
+		propertiesPage.assertURI("ssh://gitney@xxxxxxxxxxx/EGIT");
+		propertiesPage.assertSourceParams(null, "example.com", "/EGIT",
+				"git+ssh", "", true, "gitney", "", true, true);
+
+		// ..change password
+		bot.textWithLabel("Password:").setText("fsck");
+		// Password is not written into the URL here!
+		propertiesPage.assertURI("ssh://gitney@xxxxxxxxxxx/EGIT");
+		propertiesPage.assertSourceParams(null, "example.com", "/EGIT",
+				"git+ssh", "", true, "gitney", "fsck", true, true);
+
+		// change port number
+		bot.textWithLabel("Port:").setText("99");
+		propertiesPage.assertURI("ssh://gitney@xxxxxxxxxxx:99/EGIT");
+		propertiesPage.assertSourceParams(null, "example.com", "/EGIT",
+				"git+ssh", "99", true, "gitney", "fsck", true, true);
+
+		// change protocol to another with user/password capability
+		bot.comboBoxWithLabel("Protocol:").setSelection("ftp");
+		propertiesPage.assertURI("ftp://gitney@xxxxxxxxxxx:99/EGIT";);
+		propertiesPage.assertSourceParams(null, "example.com", "/EGIT", "ftp",
+				"99", true, "gitney", "fsck", true, true);
+
+		// change protocol to one without user/password capability
+		bot.comboBoxWithLabel("Protocol:").setSelection("git");
+		propertiesPage.assertURI("git://gitney@xxxxxxxxxxx:99/EGIT");
+		propertiesPage.assertSourceParams(
+				" User not supported on git protocol.", "example.com", "/EGIT",
+				"git", "99", true, "gitney", "fsck", false, false);
+
+		// change protocol to one without host capability
+		bot.comboBoxWithLabel("Protocol:").setSelection("file");
+		propertiesPage.assertURI("file://gitney@xxxxxxxxxxx:99/EGIT");
+		propertiesPage.assertSourceParams(
+				" Host not supported on file protocol.", "example.com",
+				"/EGIT", "file", "99", false, "gitney", "fsck", false, false);
+
+		// Local protocol with file: prefix. We need to make sure the
+		// local path exists as a directory so we choose user.home as
+		// that one should exist.
+		if (Platform.getOS().equals(Platform.OS_WIN32))
+			propertiesPage.setURI("file:///" + System.getProperty("user.home"));
+		else
+			propertiesPage.setURI("file://" + System.getProperty("user.home"));
+		propertiesPage.assertSourceParams(null, "", System.getProperty(
+				"user.home").replace('\\', '/'), "file", "", false, "", "",
+				false, false);
+
+		// Local protocol without file: prefix
+		propertiesPage.setURI(System.getProperty("user.home"));
+		propertiesPage.assertSourceParams(null, "", System.getProperty(
+				"user.home").replace('\\', '/'), "file", "", false, "", "",
+				false, false);
+
+		// On windows the use can choose forward or backward slashes, so add
+		// a case for forward slashes using the non prefixed local protocol.
+		if (Platform.getOS().equals(Platform.OS_WIN32)) {
+			propertiesPage.setURI(System.getProperty("user.home").replace('\\',
+					'/'));
+			propertiesPage.assertSourceParams(null, "", System.getProperty(
+					"user.home").replace('\\', '/'), "file", "", false, "", "",
+					false, false);
+		}
+		bot.button("Cancel").click();
+	}
+
+	@Test
+	public void canCloneARemoteRepo() throws Exception {
+		File destRepo = new File(new File(ResourcesPlugin.getWorkspace()
+				.getRoot().getLocation().toFile().getParent(),
+				"junit-workspace"), "egit");
+
+		RepoPropertiesPage propertiesPage = importWizard.openWizard();
+
+		RepoRemoteBranchesPage remoteBranches = propertiesPage
+				.nextToRemoteBranches("git://repo.or.cz/egit.git");
+
+		remoteBranches.assertRemoteBranches("historical/pre-eclipse", "master");
+		remoteBranches.selectBranches("historical/pre-eclipse");
+
+		WorkingCopyPage workingCopy = remoteBranches.nextToWorkingCopy();
+
+		workingCopy.assertDirectory(destRepo.toString());
+		workingCopy.assertBranch("master");
+		workingCopy.assertRemoteName("origin");
+		workingCopy.doNotImportProjectsAfterClone();
+		workingCopy.waitForCreate();
+
+		// Some random sampling to see we got something. We do not test
+		// the integrity of the repository here. Only a few basic properties
+		// we'd expect from a clone made this way, that would possibly
+		// not hold true given other parameters in the GUI.
+		Repository repository = new Repository(new File(destRepo, ".git"));
+		// we always have an origin/master
+		assertNotNull(repository.resolve("origin/master"));
+		// and a local master initialized from origin/master (default!)
+		assertEquals(repository.resolve("origin/master"), repository
+				.resolve("origin/master"));
+		// A well known tag
+		assertEquals("90b818e596660b813b6fcf68f1e9e9b62c615130", repository
+				.resolve("refs/tags/v0.4.0").name());
+		// lots of refs
+		assertTrue(repository.getAllRefs().size() >= 10);
+		// and a README in the working dir
+		assertTrue(new File(destRepo, "README").exists());
+		assertFalse(repository.getIndex().isChanged());
+		assertFalse(repository.getIndex().getEntry("README").isModified(
+				destRepo));
+		// No project have been imported
+		assertEquals(0,
+				ResourcesPlugin.getWorkspace().getRoot().getProjects().length);
+
+	}
+
+	@Test
+	public void clonedRepositoryShouldExistOnFileSystem() throws Exception {
+		RepoPropertiesPage repoProperties = importWizard.openWizard();
+		RepoRemoteBranchesPage remoteBranches = repoProperties
+				.nextToRemoteBranches("git://repo.or.cz/egit.git");
+		WorkingCopyPage workingCopy = remoteBranches.nextToWorkingCopy();
+		workingCopy.assertWorkingCopyExists();
+	}
+
+	@Test
+	public void alteringSomeParametersDuringClone() throws Exception {
+
+		File destRepo = new File(new File(ResourcesPlugin.getWorkspace()
+				.getRoot().getLocation().toFile().getParent(),
+				"junit-workspace"), "EGIT2");
+
+		RepoPropertiesPage repoProperties = importWizard.openWizard();
+		RepoRemoteBranchesPage remoteBranches = repoProperties
+				.nextToRemoteBranches("git://repo.or.cz/egit.git");
+		remoteBranches.deselectAllBranches();
+		remoteBranches
+				.assertErrorMessage("At least one branch must be selected.");
+		remoteBranches.assertNextIsDisabled();
+
+		remoteBranches.selectBranches("historical/pre-eclipse");
+		remoteBranches.assertNextIsEnabled();
+
+		WorkingCopyPage workingCopy = remoteBranches.nextToWorkingCopy();
+		workingCopy.setDirectory(destRepo.toString());
+		workingCopy.assertBranch("historical/pre-eclipse");
+		workingCopy.setRemoteName("src");
+		workingCopy.doNotImportProjectsAfterClone();
+		workingCopy.waitForCreate();
+
+		// Some random sampling to see we got something. We do not test
+		// the integrity of the repo here. Only a few basic properties
+		// we'd expect from a clone made this way, that would possibly
+		// not hold true given othe parameters in the GUI.
+		Repository repository = new Repository(new File(destRepo, ".git"));
+		assertNotNull(repository.resolve("src/historical/pre-eclipse"));
+		// we didn't clone that one
+		assertNull(repository.resolve("src/master"));
+		// and a local master initialized from origin/master (default!)
+		assertEquals(repository.resolve("stable"), repository
+				.resolve("src/stable"));
+		// A well known tag
+		assertEquals("90b818e596660b813b6fcf68f1e9e9b62c615130", repository
+				.resolve("refs/tags/v0.4.0").name());
+		// lots of refs
+		assertTrue(repository.getAllRefs().size() >= 10);
+	}
+
+	@Test
+	public void invalidHostnameFreezesDialog() throws Exception {
+		RepoPropertiesPage repoProperties = importWizard.openWizard();
+		RepoRemoteBranchesPage remoteBranches = repoProperties
+				.nextToRemoteBranches("git://no.example.com/EGIT");
+		remoteBranches
+				.assertErrorMessage("git://no.example.com/EGIT: unknown host");
+		remoteBranches.assertCannotProceed();
+		remoteBranches.cancel();
+	}
+
+	// TODO: Broken, seems that this takes forever and does not come back with
+	// an error. Perhaps set a higher timeout for this test ?
+	@Ignore
+	public void invalidPortFreezesDialog() throws Exception {
+		RepoPropertiesPage repoProperties = importWizard.openWizard();
+		RepoRemoteBranchesPage remoteBranches = repoProperties
+				.nextToRemoteBranches("git://localhost:80/EGIT");
+		remoteBranches
+				.assertErrorMessage("git://localhost:80/EGIT: not found.");
+		remoteBranches.assertCannotProceed();
+		remoteBranches.cancel();
+	}
+
+	// TODO: Broken, seems that this takes forever and does not come back with
+	// an error. Perhaps set a higher timeout for this test ?
+	@Ignore
+	public void timeoutToASocketFreezesDialog() throws Exception {
+		RepoPropertiesPage repoProperties = importWizard.openWizard();
+		RepoRemoteBranchesPage remoteBranches = repoProperties
+				.nextToRemoteBranches("git://www.example.com/EGIT");
+		remoteBranches
+				.assertErrorMessage("git://www.example.com/EGIT: Connection timed out");
+		remoteBranches.assertCannotProceed();
+		remoteBranches.cancel();
+	}
+
+	@Before
+	public void setupViews() {
+		bot.viewByTitle("Package Explorer").show();
+		importWizard = new GitImportRepoWizard();
+	}
+
+	// TODO: push this in the junit class runner. This can then be shared across
+	// all tests.
+	@BeforeClass
+	public static void closeWelcomePage() {
+		try {
+			bot.viewByTitle("Welcome").close();
+		} catch (WidgetNotFoundException e) {
+			// somebody else probably closed it, lets not feel bad about it.
+		}
+	}
+
+	// TODO: push this in the junit class runner. This can then be shared across
+	// all tests.
+	@After
+	public void resetWorkbench() {
+		new Eclipse().reset();
+	}
+
+}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/GitImportRepoWizard.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/GitImportRepoWizard.java
new file mode 100644
index 0000000..78faa71
--- /dev/null
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/GitImportRepoWizard.java
@@ -0,0 +1,23 @@
+package org.eclipse.egit.ui.wizards.clone;
+
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+
+public class GitImportRepoWizard {
+
+	private static final SWTWorkbenchBot bot = new SWTWorkbenchBot();
+
+	// TODO: speed it up by calling the wizard using direct eclipse API.
+	public RepoPropertiesPage openWizard() {
+		bot.menu("File").menu("Import...").click();
+		bot.shell("Import").activate();
+
+		bot.tree().expandNode("Git").select("Git Repository");
+
+		bot.button("Next >").click();
+
+		bot.shell("Import Git Repository").activate();
+
+		return new RepoPropertiesPage();
+	}
+
+}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/RepoPropertiesPage.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/RepoPropertiesPage.java
new file mode 100644
index 0000000..abf29a7
--- /dev/null
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/RepoPropertiesPage.java
@@ -0,0 +1,63 @@
+package org.eclipse.egit.ui.wizards.clone;
+
+import static org.eclipse.swtbot.swt.finder.SWTBotAssert.assertEnabled;
+import static org.eclipse.swtbot.swt.finder.SWTBotAssert.assertNotEnabled;
+import static org.eclipse.swtbot.swt.finder.SWTBotAssert.assertText;
+import static org.junit.Assert.assertEquals;
+
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
+
+public class RepoPropertiesPage {
+
+	private static final SWTWorkbenchBot bot = new SWTWorkbenchBot();
+
+	public void setURI(String uri) {
+		uri().setText(uri);
+	}
+
+	public void appendToURI(String toAppend) {
+		SWTBotText uri = uri();
+		uri.setText(uri.getText() + toAppend);
+	}
+
+	public void assertSourceParams(String message, String expectHost,
+			String expectPath, String expectProtocol, String expectPort,
+			boolean enablePort, String expectUser, String expectPassword,
+			boolean enabledUser, boolean enabledPass) {
+		if (message != null) {
+			// TODO: magic number, looks dangerous!
+			assertText(message, bot.text(6));
+			assertNotEnabled(bot.button("Next >"));
+		} else {
+			assertEquals("Enter the location of the source repository.", bot
+					.text(6).getText());
+			assertEnabled(bot.button("Next >"));
+		}
+		assertText(expectHost, bot.textWithLabel("Host:"));
+		assertText(expectPath, bot.textWithLabel("Repository path:"));
+		assertText(expectProtocol, bot.comboBoxWithLabel("Protocol:"));
+		assertText(expectPort, bot.textWithLabel("Port:"));
+		assertText(expectUser, bot.textWithLabel("User:"));
+		assertText(expectPassword, bot.textWithLabel("Password:"));
+
+		assertEquals(enablePort, bot.textWithLabel("Port:").isEnabled());
+		assertEquals(enabledUser, bot.textWithLabel("User:").isEnabled());
+		assertEquals(enabledPass, bot.label("Password:").isEnabled());
+		assertEquals(enabledPass, bot.textWithLabel("Password:").isEnabled());
+	}
+
+	public void assertURI(String expected) {
+		assertText(expected, uri());
+	}
+
+	private SWTBotText uri() {
+		return bot.textWithLabel("URI:");
+	}
+
+	public RepoRemoteBranchesPage nextToRemoteBranches(String string) {
+		setURI(string);
+		bot.button("Next >").click();
+		return new RepoRemoteBranchesPage();
+	}
+}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/RepoRemoteBranchesPage.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/RepoRemoteBranchesPage.java
new file mode 100644
index 0000000..31972c1
--- /dev/null
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/RepoRemoteBranchesPage.java
@@ -0,0 +1,67 @@
+package org.eclipse.egit.ui.wizards.clone;
+
+import static org.eclipse.swtbot.swt.finder.SWTBotAssert.assertEnabled;
+import static org.eclipse.swtbot.swt.finder.SWTBotAssert.assertNotEnabled;
+import static org.eclipse.swtbot.swt.finder.waits.Conditions.widgetIsEnabled;
+
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
+
+public class RepoRemoteBranchesPage {
+	private static final SWTWorkbenchBot bot = new SWTWorkbenchBot();
+
+	public void assertRemoteBranches(String... branches) {
+		SWTBotTable table = bot.table();
+		bot.waitUntil(widgetIsEnabled(table));
+		for (String branch : branches) {
+			table.getTableItem(branch);
+		}
+	}
+
+	public void selectBranches(String... branches) {
+		SWTBotTable table = bot.table();
+		bot.waitUntil(widgetIsEnabled(table));
+		for (String branch : branches) {
+			table.getTableItem(branch).check();
+		}
+	}
+
+	public WorkingCopyPage nextToWorkingCopy() {
+		bot.button("Next >").click();
+		return new WorkingCopyPage();
+	}
+
+	public void deselectAllBranches() {
+		SWTBotTable table = bot.table();
+
+		bot.waitUntil(widgetIsEnabled(table));
+
+		int rowCount = table.rowCount();
+		for (int i = 0; i < rowCount; i++) {
+			table.getTableItem(i).uncheck();
+		}
+	}
+
+	public void assertErrorMessage(String errorMessage) {
+		bot.text(" " + errorMessage);
+	}
+
+	public void assertNextIsDisabled() {
+		assertNotEnabled(bot.button("Next >"));
+	}
+
+	public void assertNextIsEnabled() {
+		assertEnabled(bot.button("Next >"));
+	}
+
+	public void assertCannotProceed() {
+		assertEnabled(bot.button("Cancel"));
+		assertEnabled(bot.button("< Back"));
+		assertNotEnabled(bot.button("Next >"));
+		assertNotEnabled(bot.button("Finish"));
+	}
+
+	public void cancel() {
+		bot.button("Cancel").click();
+	}
+}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/WorkingCopyPage.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/WorkingCopyPage.java
new file mode 100644
index 0000000..c3ef29c
--- /dev/null
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/WorkingCopyPage.java
@@ -0,0 +1,54 @@
+package org.eclipse.egit.ui.wizards.clone;
+
+import static org.eclipse.swtbot.swt.finder.SWTBotAssert.assertText;
+import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellCloses;
+
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+
+public class WorkingCopyPage {
+
+	private static final SWTWorkbenchBot bot = new SWTWorkbenchBot();
+
+	public void assertDirectory(String localDir) {
+		assertText(localDir, bot.textWithLabel("Directory:"));
+	}
+
+	public void assertBranch(String branch) {
+		assertText(branch, bot.comboBoxWithLabel("Initial branch:"));
+	}
+
+	public void assertRemoteName(String remoteName) {
+		assertText(remoteName, bot.textWithLabel("Remote name:"));
+	}
+
+	public void doNotImportProjectsAfterClone() {
+		bot.checkBox("Import projects after clone").deselect();
+	}
+
+	public void waitForCreate() {
+		bot.button("Finish").click();
+
+		// TODO: pass the repo url in via the constructor from the first page.
+		SWTBotShell shell = bot.shell("Cloning from git://repo.or.cz/egit.git");
+
+		// This is not a performance test. Allow lots of time to complete
+		bot.waitUntil(shellCloses(shell), 120000);
+	}
+
+	public void assertWorkingCopyExists() {
+		String dirName = bot.textWithLabel("Directory:").getText();
+		String message = " " + dirName + " is not an empty directory.";
+		// check if the text box exists
+		bot.text(message);
+	}
+
+	public void setRemoteName(String string) {
+		bot.textWithLabel("Remote name:").setText(string);
+	}
+
+	public void setDirectory(String string) {
+		bot.textWithLabel("Directory:").setText(string);
+	}
+
+}
-- 
1.6.6


Back to the top