blob: 55fd87aeac12ed0a5ae59dd72c128c9fcd2c62b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
package se.leap.bitmaskclient.test;
import java.io.IOException;
import se.leap.bitmaskclient.AboutActivity;
import se.leap.bitmaskclient.ConfigurationWizard;
import se.leap.bitmaskclient.ProviderDetailFragment;
import se.leap.bitmaskclient.R;
import android.test.ActivityInstrumentationTestCase2;
import android.widget.ListView;
import com.jayway.android.robotium.solo.Solo;
public class testConfigurationWizard extends ActivityInstrumentationTestCase2<ConfigurationWizard> {
private Solo solo;
private static int added_providers;
public testConfigurationWizard() {
super(ConfigurationWizard.class);
}
@Override
protected void setUp() throws Exception {
super.setUp();
solo = new Solo(getInstrumentation(), getActivity());
}
@Override
protected void tearDown() throws Exception {
solo.finishOpenedActivities();
}
public void testListProviders() throws IOException {
assertEquals(solo.getCurrentViews(ListView.class).size(), 1);
int number_of_available_providers = solo.getCurrentViews(ListView.class).get(0).getCount();
assertEquals("Number of available providers differ", solo.getCurrentActivity().getAssets().list("urls").length + added_providers, number_of_available_providers);
}
public void testSelectProvider() {
solo.clickOnText("bitmask");
assertTrue("Provider details dialog did not appear", solo.waitForFragmentByTag(ProviderDetailFragment.TAG, 60*1000));
}
public void testAddNewProvider() {
solo.clickOnActionBarItem(R.id.new_provider);
solo.enterText(0, "dev.bitmask.net");
solo.clickOnCheckBox(0);
solo.clickOnText(solo.getString(R.string.save));
added_providers = added_providers+1;
assertTrue("Provider details dialog did not appear", solo.waitForFragmentByTag(ProviderDetailFragment.TAG, 60*1000));
solo.goBack();
}
public void testShowAbout() {
solo.clickOnMenuItem(solo.getString(R.string.about));
assertTrue("Provider details dialog did not appear", solo.waitForActivity(AboutActivity.class));
}
public void testShowSettings() {
//TODO We still don't have the settings button
}
}
|