forked from pocmo/Yaaic
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ScenarioHelper.connectToServer(): Don't just wait for connection but …
…for successful server login.
- Loading branch information
Showing
1 changed file
with
31 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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() | ||
|
@@ -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() | ||
|
@@ -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() | ||
|
@@ -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 | ||
*/ | ||
|