Skip to content

Commit

Permalink
Merge pull request #289 from SDPepe/fix/fix-test
Browse files Browse the repository at this point in the history
Fix/fix test
  • Loading branch information
ADGLY authored Jun 4, 2021
2 parents 72f04d7 + c432ed7 commit c02f511
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 172 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The main feature which distinguishes this idea from a basic apartment market pla

How to use :

We strongly suggest you use an emulator with the google-apis (not the google playstore), with API level 29. This is what we have on cirrus, and some tests are built around this.
We strongly suggest you use an emulator with the google-apis (not the google playstore), with API level 29. This is what we have on cirrus, and some tests are built around this. Indeed, the StepCounterActivityTest only works on API 29.

This app doesn't need any particular installation to run. However, if you want to be able to run the LoginTest and the DatabaseTest java classes, you will need the firebase emulators.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class AdCreationUITest {
/* Used to grant camera permission always */
@Rule
public GrantPermissionRule mRuntimePermissionRule =
GrantPermissionRule.grant(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION);
GrantPermissionRule.grant(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE);


@BindValue
Expand Down
155 changes: 0 additions & 155 deletions app/src/androidTest/java/ch/epfl/sdp/appart/CameraUITest.java

This file was deleted.

8 changes: 4 additions & 4 deletions app/src/androidTest/java/ch/epfl/sdp/appart/MapUITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@
@HiltAndroidTest
public class MapUITest {

@Rule(order = 0)
@Rule(order = 1)
public HiltAndroidRule hiltRule = new HiltAndroidRule(this);

@Rule(order = 1)
@Rule(order = 2)
public ActivityScenarioRule<MapActivity> mapActivityRule =
new ActivityScenarioRule<>(MapActivity.class);

@Rule(order = 2)
@Rule(order = 0)
public GrantPermissionRule mRuntimePermissionRule =
GrantPermissionRule.grant(Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.INTERNET);

Expand Down Expand Up @@ -97,7 +97,7 @@ public void markerTest() throws InterruptedException {
UiDevice device =
UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());

boolean foundMap = device.wait(Until.hasObject(By.desc("MAP READY")),
boolean foundMap = device.wait(Until.hasObject(By.descContains("MAP READY")),
10000);
assertThat(foundMap, is(true));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ public class MapUIWithAddressFailsTest {
intent.putExtra(InstrumentationRegistry.getInstrumentation().getTargetContext().getString(R.string.intentLocationForMap), intentExtra);
}

@Rule(order = 0)
@Rule(order = 1)
public HiltAndroidRule hiltRule = new HiltAndroidRule(this);

@Rule(order = 1)
@Rule(order = 2)
public ActivityScenarioRule<MapActivity> mapActivityRule =
new ActivityScenarioRule<>(intent);

@Rule(order = 2)
@Rule(order = 0)
public GrantPermissionRule mRuntimePermissionRule =
GrantPermissionRule.grant(Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.INTERNET);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ public class MapUIWithAddressTest {
intent.putExtra(InstrumentationRegistry.getInstrumentation().getTargetContext().getString(R.string.intentLocationForMap), intentExtra);
}

@Rule(order = 0)
@Rule(order = 1)
public HiltAndroidRule hiltRule = new HiltAndroidRule(this);

@Rule(order = 1)
@Rule(order = 2)
public ActivityScenarioRule<MapActivity> mapActivityRule =
new ActivityScenarioRule<>(intent);

@Rule(order = 2)
@Rule(order = 0)
public GrantPermissionRule mRuntimePermissionRule =
GrantPermissionRule.grant(Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.INTERNET);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ public class StepCounterActivityTest {
DatabaseService db = new MockDatabaseService();

/* Used to grant permission always */
@Rule
/*@Rule
public GrantPermissionRule mRuntimePermissionRule =
GrantPermissionRule.grant(Manifest.permission.ACTIVITY_RECOGNITION);
GrantPermissionRule.grant(Manifest.permission.ACTIVITY_RECOGNITION);*/

@Test
public void stepCounterActivityTest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public class UserProfileActivityTest {
/* Used to grant camera permission always */
@Rule
public GrantPermissionRule mRuntimePermissionRule =
GrantPermissionRule.grant(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION);
GrantPermissionRule.grant(Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE);

@BindValue
DatabaseService database = new MockDatabaseService();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ public class UserProfileExceptionallyTest {
/* Used to grant camera permission always */
@Rule
public GrantPermissionRule mRuntimePermissionRule =
GrantPermissionRule.grant(Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION);
GrantPermissionRule.grant();

@BindValue
DatabaseService database = new MockDatabaseService();
Expand Down

0 comments on commit c02f511

Please sign in to comment.