mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-22 00:42:16 -05:00
ServerListScenarios.testAddingAndRemovingServer(): Don't assert on number of items in list (because of "add server" item) but on existing or non-existing server name in list.
This commit is contained in:
parent
be49f407bb
commit
e2eb4a39f0
@ -20,12 +20,10 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
package org.yaaic.test.scenario;
|
package org.yaaic.test.scenario;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import org.yaaic.R;
|
import org.yaaic.R;
|
||||||
|
import org.yaaic.activity.ServersActivity;
|
||||||
|
|
||||||
import android.test.ActivityInstrumentationTestCase2;
|
import android.test.ActivityInstrumentationTestCase2;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
|
||||||
@ -50,10 +48,7 @@ public class ServerListScenarios extends ActivityInstrumentationTestCase2
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public ServerListScenarios() throws ClassNotFoundException
|
public ServerListScenarios() throws ClassNotFoundException
|
||||||
{
|
{
|
||||||
super(
|
super("org.yaaic", ServersActivity.class);
|
||||||
"org.yaaic",
|
|
||||||
Class.forName("org.yaaic.activity.ServersActivity")
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -95,9 +90,10 @@ public class ServerListScenarios extends ActivityInstrumentationTestCase2
|
|||||||
{
|
{
|
||||||
// Delete Testserver if already exists
|
// Delete Testserver if already exists
|
||||||
helper.deleteTestServer();
|
helper.deleteTestServer();
|
||||||
|
|
||||||
int numberOfServersBefore = solo.getCurrentListViews().get(0).getCount();
|
// Assert server does not exist
|
||||||
|
assertFalse(solo.searchText("RobotiumTest"));
|
||||||
|
|
||||||
// Add server
|
// Add server
|
||||||
View view = solo.getView(R.id.add);
|
View view = solo.getView(R.id.add);
|
||||||
assert view != null;
|
assert view != null;
|
||||||
@ -122,21 +118,14 @@ public class ServerListScenarios extends ActivityInstrumentationTestCase2
|
|||||||
solo.assertCurrentActivity("Switched back to ServersActivity", "ServersActivity");
|
solo.assertCurrentActivity("Switched back to ServersActivity", "ServersActivity");
|
||||||
|
|
||||||
// Assert new server exists
|
// Assert new server exists
|
||||||
int numberOfServersAfter = solo.getCurrentListViews().get(0).getCount();
|
|
||||||
assertEquals(numberOfServersBefore + 1, numberOfServersAfter);
|
|
||||||
assertTrue(solo.searchText("RobotiumTest"));
|
assertTrue(solo.searchText("RobotiumTest"));
|
||||||
|
|
||||||
// Remove new server again
|
// Remove new server again
|
||||||
solo.clickLongOnText("RobotiumTest");
|
solo.clickLongOnText("RobotiumTest");
|
||||||
|
|
||||||
solo.clickOnText("Delete");
|
solo.clickOnText("Delete");
|
||||||
|
|
||||||
solo.waitForActivity("ServersActivity", 1000);
|
solo.waitForActivity("ServersActivity", 1000);
|
||||||
solo.assertCurrentActivity("Switched back to ServersActivity", "ServersActivity");
|
solo.assertCurrentActivity("Switched back to ServersActivity", "ServersActivity");
|
||||||
|
|
||||||
// Assert server is gone again
|
|
||||||
numberOfServersAfter = solo.getCurrentListViews().get(0).getCount();
|
|
||||||
assertEquals(numberOfServersBefore, numberOfServersAfter);
|
|
||||||
assertFalse(solo.searchText("RobotiumTest"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user