diff --git a/test/src/org/yaaic/test/scenario/ConnectionScenarios.java b/test/src/org/yaaic/test/scenario/ConnectionScenarios.java
new file mode 100644
index 0000000..6e3e3d8
--- /dev/null
+++ b/test/src/org/yaaic/test/scenario/ConnectionScenarios.java
@@ -0,0 +1,98 @@
+/*
+Yaaic - Yet Another Android IRC Client
+
+Copyright 2009-2010 Sebastian Kaspari
+
+This file is part of Yaaic.
+
+Yaaic is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+Yaaic is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Yaaic. If not, see .
+*/
+package org.yaaic.test.scenario;
+
+
+
+import android.test.ActivityInstrumentationTestCase2;
+
+import com.jayway.android.robotium.solo.Solo;
+
+/**
+ * Test scenarios including connecting to a server
+ *
+ * @author Sebastian Kaspari
+ */
+@SuppressWarnings("rawtypes")
+public class ConnectionScenarios extends ActivityInstrumentationTestCase2
+{
+ private ScenarioHelper helper;
+ private Solo solo;
+
+ /**
+ * Create a new ConnectionScenario instance
+ *
+ * @throws ClassNotFoundException
+ */
+ @SuppressWarnings("unchecked")
+ public ConnectionScenarios() throws ClassNotFoundException
+ {
+ super(
+ "org.yaaic",
+ Class.forName("org.yaaic.activity.ServersActivity")
+ );
+ }
+
+ /**
+ * Setup test case
+ */
+ @Override
+ protected void setUp()
+ {
+ solo = new Solo(getInstrumentation(), getActivity());
+ helper = new ScenarioHelper(solo);
+
+ helper.createTestServer();
+ helper.connectToServer();
+ }
+
+ /**
+ * Cleanup after test
+ */
+ @Override
+ protected void tearDown()
+ {
+ helper.disconnectFromServer();
+ helper.deleteTestServer();
+
+ solo.sleep(500);
+ }
+
+ /**
+ * Scenario: Join a channel
+ *
+ * - Connect to server
+ * - Enter command: /j #yaaic-test
+ * - A new conversation with text #yaaic-test appears
+ * - Disconnect
+ */
+ public void testJoiningChannel()
+ {
+ // Join channel
+ solo.enterText(0, "/j #yaaic-test");
+ solo.sendKey(Solo.ENTER);
+
+ solo.sleep(1000);
+
+ // Assert channel joined
+ assertTrue(solo.searchText("#yaaic-test"));
+ }
+}
diff --git a/test/src/org/yaaic/test/scenario/ServerListScenarios.java b/test/src/org/yaaic/test/scenario/ServerListScenarios.java
index 751cc9e..a3c0354 100644
--- a/test/src/org/yaaic/test/scenario/ServerListScenarios.java
+++ b/test/src/org/yaaic/test/scenario/ServerListScenarios.java
@@ -20,6 +20,8 @@ along with Yaaic. If not, see .
*/
package org.yaaic.test.scenario;
+
+
import com.jayway.android.robotium.solo.Solo;
import android.test.ActivityInstrumentationTestCase2;
@@ -32,7 +34,13 @@ import android.test.ActivityInstrumentationTestCase2;
public class ServerListScenarios extends ActivityInstrumentationTestCase2
{
private Solo solo;
+ private ScenarioHelper helper;
+ /**
+ * Create a new ServerListScenarios instance
+ *
+ * @throws ClassNotFoundException
+ */
@SuppressWarnings("unchecked")
public ServerListScenarios() throws ClassNotFoundException
{
@@ -42,9 +50,13 @@ public class ServerListScenarios extends ActivityInstrumentationTestCase2
);
}
+ /**
+ * Setup test case
+ */
protected void setUp()
{
- solo = new Solo(getInstrumentation(), getActivity());
+ solo = new Solo(getInstrumentation(), getActivity());
+ helper = new ScenarioHelper(solo);
}
/**
@@ -63,6 +75,9 @@ public class ServerListScenarios extends ActivityInstrumentationTestCase2
*/
public void testAddingAndRemovingServer()
{
+ // Delete Testserver if already exists
+ helper.deleteTestServer();
+
int numberOfServersBefore = solo.getCurrentListViews().get(0).getCount();
// Add server