File tree Expand file tree Collapse file tree
src/androidTest/java/org/gnucash/android/test/ui Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -178,24 +178,6 @@ afterEvaluate {
178178 initCrashlyticsPropertiesIfNeeded()
179179}
180180
181- android. productFlavors. all { flavour ->
182- def applicationId = flavour. applicationId
183- def adb = android. getAdbExe(). toString()
184-
185- def grantPermissionsTask = tasks. create(" grant${ flavour.name.capitalize()} Permissions" ) << {
186- " ${ adb} shell pm grant ${ applicationId} android.permission.WRITE_EXTERNAL_STORAGE" . execute()
187- " ${ adb} shell pm grant ${ applicationId} android.permission.SET_ANIMATION_SCALE" . execute()
188- }
189- grantPermissionsTask. description = " Grants permissions for Marshmallow"
190-
191- tasks. whenTaskAdded { theTask ->
192- def assemblePattern = ~" assemble${flavour.name.capitalize()}DebugAndroidTest"
193- if (assemblePattern. matcher(theTask. name). matches()) {
194- theTask. dependsOn grantPermissionsTask. name
195- }
196- }
197- }
198-
199181
200182def androidSupportVersion = " 26.0.1"
201183def androidEspressoVersion = " 3.0.0"
Original file line number Diff line number Diff line change 1616
1717package org .gnucash .android .test .ui ;
1818
19+ import android .Manifest ;
1920import android .annotation .TargetApi ;
2021import android .content .Context ;
2122import android .content .Intent ;
2728import android .support .test .espresso .Espresso ;
2829import android .support .test .espresso .matcher .ViewMatchers ;
2930import android .support .test .rule .ActivityTestRule ;
31+ import android .support .test .rule .GrantPermissionRule ;
3032import android .support .test .runner .AndroidJUnit4 ;
3133import android .support .v4 .app .Fragment ;
3234import android .util .Log ;
@@ -116,6 +118,9 @@ public AccountsActivityTest() {
116118// super(AccountsActivity.class);
117119 }
118120
121+
122+ @ Rule public GrantPermissionRule animationPermissionsRule = GrantPermissionRule .grant (Manifest .permission .SET_ANIMATION_SCALE );
123+
119124 @ ClassRule public static DisableAnimationsRule disableAnimationsRule = new DisableAnimationsRule ();
120125
121126 @ Rule
Original file line number Diff line number Diff line change 1616
1717package org .gnucash .android .test .ui ;
1818
19+ import android .Manifest ;
1920import android .content .Intent ;
2021import android .database .SQLException ;
2122import android .database .sqlite .SQLiteDatabase ;
2223import android .support .test .rule .ActivityTestRule ;
24+ import android .support .test .rule .GrantPermissionRule ;
2325import android .support .test .runner .AndroidJUnit4 ;
2426import android .util .Log ;
2527
@@ -72,6 +74,9 @@ public class CalculatorEditTextTest {
7274 public CalculatorEditTextTest () {
7375 }
7476
77+
78+ @ Rule public GrantPermissionRule animationPermissionsRule = GrantPermissionRule .grant (Manifest .permission .SET_ANIMATION_SCALE );
79+
7580 @ ClassRule
7681 public static DisableAnimationsRule disableAnimationsRule = new DisableAnimationsRule ();
7782
Original file line number Diff line number Diff line change 2828import android .support .test .espresso .Espresso ;
2929import android .support .test .espresso .contrib .DrawerActions ;
3030import android .support .test .espresso .matcher .ViewMatchers ;
31+ import android .support .test .rule .GrantPermissionRule ;
3132import android .support .test .runner .AndroidJUnit4 ;
3233import android .support .v7 .preference .PreferenceManager ;
3334import android .test .ActivityInstrumentationTestCase2 ;
5960import org .junit .After ;
6061import org .junit .Before ;
6162import org .junit .FixMethodOrder ;
63+ import org .junit .Rule ;
6264import org .junit .Test ;
6365import org .junit .runner .RunWith ;
6466import org .junit .runners .MethodSorters ;
@@ -95,7 +97,9 @@ public class ExportTransactionsTest extends
9597
9698 private AccountsActivity mAcccountsActivity ;
9799
98- public ExportTransactionsTest () {
100+ @ Rule public GrantPermissionRule animationPermissionsRule = GrantPermissionRule .grant (Manifest .permission .SET_ANIMATION_SCALE );
101+
102+ public ExportTransactionsTest () {
99103 super (AccountsActivity .class );
100104 }
101105
Original file line number Diff line number Diff line change 1515 */
1616package org .gnucash .android .test .ui ;
1717
18+ import android .Manifest ;
1819import android .database .SQLException ;
1920import android .database .sqlite .SQLiteDatabase ;
2021import android .support .test .InstrumentationRegistry ;
22+ import android .support .test .rule .GrantPermissionRule ;
2123import android .support .test .runner .AndroidJUnit4 ;
2224import android .test .ActivityInstrumentationTestCase2 ;
2325import android .util .Log ;
3133import org .gnucash .android .model .BaseModel ;
3234import org .gnucash .android .ui .wizard .FirstRunWizardActivity ;
3335import org .junit .Before ;
36+ import org .junit .Rule ;
3437import org .junit .Test ;
3538import org .junit .runner .RunWith ;
3639
@@ -56,6 +59,9 @@ public class FirstRunWizardActivityTest extends ActivityInstrumentationTestCase2
5659 private SplitsDbAdapter mSplitsDbAdapter ;
5760
5861 FirstRunWizardActivity mActivity ;
62+
63+ @ Rule public GrantPermissionRule animationPermissionsRule = GrantPermissionRule .grant (Manifest .permission .SET_ANIMATION_SCALE );
64+
5965 public FirstRunWizardActivityTest () {
6066 super (FirstRunWizardActivity .class );
6167 }
Original file line number Diff line number Diff line change 1515 */
1616package org .gnucash .android .test .ui ;
1717
18+ import android .Manifest ;
1819import android .support .test .espresso .contrib .DrawerActions ;
1920import android .support .test .espresso .intent .Intents ;
2021import android .support .test .espresso .intent .rule .IntentsTestRule ;
22+ import android .support .test .rule .GrantPermissionRule ;
2123import android .support .test .runner .AndroidJUnit4 ;
2224
2325import org .gnucash .android .R ;
@@ -54,6 +56,8 @@ public class MultiBookTest {
5456
5557 private static BooksDbAdapter mBooksDbAdapter ;
5658
59+ @ Rule public GrantPermissionRule animationPermissionsRule = GrantPermissionRule .grant (Manifest .permission .SET_ANIMATION_SCALE );
60+
5761 @ ClassRule
5862 public static DisableAnimationsRule disableAnimationsRule = new DisableAnimationsRule ();
5963
Original file line number Diff line number Diff line change 1616
1717package org .gnucash .android .test .ui ;
1818
19+ import android .Manifest ;
1920import android .content .Context ;
2021import android .content .SharedPreferences ;
2122import android .database .SQLException ;
2526import android .support .test .espresso .Espresso ;
2627import android .support .test .espresso .contrib .DrawerActions ;
2728import android .support .test .rule .ActivityTestRule ;
29+ import android .support .test .rule .GrantPermissionRule ;
2830import android .support .test .runner .AndroidJUnit4 ;
2931import android .test .ActivityInstrumentationTestCase2 ;
3032import android .util .Log ;
@@ -97,6 +99,8 @@ public class OwnCloudExportTest {
9799 AccountsActivity .class );
98100
99101
102+ @ Rule public GrantPermissionRule animationPermissionsRule = GrantPermissionRule .grant (Manifest .permission .SET_ANIMATION_SCALE );
103+
100104 @ Before
101105 public void setUp () throws Exception {
102106
Original file line number Diff line number Diff line change 1616
1717package org .gnucash .android .test .ui ;
1818
19+ import android .Manifest ;
1920import android .content .Context ;
2021import android .support .test .espresso .ViewAction ;
2122import android .support .test .espresso .action .CoordinatesProvider ;
2223import android .support .test .espresso .action .GeneralClickAction ;
2324import android .support .test .espresso .action .Press ;
2425import android .support .test .espresso .action .Tap ;
2526import android .support .test .rule .ActivityTestRule ;
27+ import android .support .test .rule .GrantPermissionRule ;
2628import android .support .test .runner .AndroidJUnit4 ;
2729import android .view .View ;
2830
@@ -101,6 +103,8 @@ public class PieChartReportTest {
101103 @ Rule
102104 public ActivityTestRule <ReportsActivity > mActivityRule = new ActivityTestRule <>(ReportsActivity .class );
103105
106+ @ Rule public GrantPermissionRule animationPermissionsRule = GrantPermissionRule .grant (Manifest .permission .SET_ANIMATION_SCALE );
107+
104108 @ ClassRule
105109 public static DisableAnimationsRule disableAnimationsRule = new DisableAnimationsRule ();
106110
Original file line number Diff line number Diff line change 1616
1717package org .gnucash .android .test .ui ;
1818
19+ import android .Manifest ;
1920import android .content .ContentValues ;
2021import android .content .Context ;
2122import android .content .Intent ;
2223import android .content .SharedPreferences ;
2324import android .content .SharedPreferences .Editor ;
2425import android .support .test .espresso .Espresso ;
2526import android .support .test .rule .ActivityTestRule ;
27+ import android .support .test .rule .GrantPermissionRule ;
2628import android .support .test .runner .AndroidJUnit4 ;
2729
2830import org .gnucash .android .R ;
@@ -97,6 +99,8 @@ public class TransactionsActivityTest {
9799 private static SplitsDbAdapter mSplitsDbAdapter ;
98100 private TransactionsActivity mTransactionsActivity ;
99101
102+ @ Rule public GrantPermissionRule animationPermissionsRule = GrantPermissionRule .grant (Manifest .permission .SET_ANIMATION_SCALE );
103+
100104 @ ClassRule
101105 public static DisableAnimationsRule disableAnimationsRule = new DisableAnimationsRule ();
102106
You can’t perform that action at this time.
0 commit comments