Skip to content

Commit

Permalink
ScenarioHelper.connectToServer(): Don't just wait for connection but …
Browse files Browse the repository at this point in the history
…for successful server login.
  • Loading branch information
pocmo committed Nov 6, 2012
1 parent 369fa7f commit be49f40
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions test/src/org/yaaic/test/scenario/ScenarioHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,78 +31,78 @@

/**
* Scenario helper for performing common actions
*
*
* @author Sebastian Kaspari <[email protected]>
*/
public class ScenarioHelper
{
private Solo solo;

public ScenarioHelper(Solo solo)
{
this.solo = solo;
}

/**
* Create a test server (RobotiumTest)
*
*
* Starting Point: ServersActivity
* Ending Point: ServersActivity
*
*
* @param solo
*/
public void createTestServer()
{
if (!solo.searchText("RobotiumTest")) {
solo.assertCurrentActivity("Starting at ServersActivity", "ServersActivity");

View view = solo.getView(R.id.add);
assert view != null;

solo.clickOnView(view);

solo.waitForActivity("AddServerActivity");
solo.assertCurrentActivity("Switched to AddServerActivity", "AddServerActivity");

solo.enterText(0, "RobotiumTest");
solo.enterText(1, "irc.epd-me.net");

solo.enterText(4, "YaaicBotium");

// Somehow robotium doesn't detect the field when using index 5
EditText realname = (EditText) solo.getView(R.id.realname);
solo.enterText(realname, "Robotium and Yaaic");

solo.clickOnButton(solo.getString(R.string.server_save));

solo.waitForActivity("ServersActivity", 2000);
}
}

/**
* Connect to the test server
*
*
* Starting Point: ServersActivity
* Ending Point: ConversationsActivity
*
*
* @param solo
*/
public void connectToServer()
{
solo.clickOnText("RobotiumTest");

solo.waitForActivity("ConversationActivity", 3000);
solo.assertCurrentActivity("Assert is ConversationActivity", ConversationActivity.class);
solo.waitForText("Connected to RobotiumTest");

solo.waitForText(solo.getString(R.string.message_login_done));
}

/**
* Disconnect from the test server
*
*
* Starting Point: ConversationsActivity
* Ending Point: ServersActivity
*
*
* @param solo
*/
public void disconnectFromServer()
Expand All @@ -115,17 +115,17 @@ public void disconnectFromServer()
// Disconnect
solo.clickLongOnText("RobotiumTest");
solo.clickOnText("Disconnect");

solo.waitForActivity("ServersActivity", 1000);
solo.assertCurrentActivity("Assert is ServersActivity", ServersActivity.class);
}

/**
* Delete the test server (RobotiumTest)
*
*
* Starting Point: ServersActivity
* Ending Point: ServersActivity
*
*
* @param solo
*/
public void deleteTestServer()
Expand All @@ -134,18 +134,18 @@ public void deleteTestServer()
// Delete server again
solo.clickLongOnText("RobotiumTest");
solo.clickOnText("Delete");

solo.waitForActivity("ServersActivity", 1000);
solo.assertCurrentActivity("Assert is ServersActivity", ServersActivity.class);
}
}

/**
* Join the test channel
*
*
* Starting Point: ConversationsActivity
* Ending Point: ConversationsActivity
*
*
* @param solo
*/
public void joinTestChannel()
Expand All @@ -156,13 +156,13 @@ public void joinTestChannel()
// Wait for channel joined
solo.waitForText("#yaaic-test");
}

/**
* Send a message via the command line
*
*
* Starting Point: ConversationsActivity
* Ending Point: ConversationsActivity
*
*
* @param solo
* @param message
*/
Expand Down

0 comments on commit be49f40

Please sign in to comment.