Niedzielski has uploaded a new change for review. https://gerrit.wikimedia.org/r/248091
Change subject: WIP: Add Spoon ...................................................................... WIP: Add Spoon Not ready for review. Just needed to test some changes in https://gerrit.wikimedia.org/r/#/c/248056/1 Change-Id: I1ae94d279003efeb629d24cfc7c2b585036029db --- M app/build.gradle A app/src/androidTest/java/org/wikipedia/page/leadimages/LeadImagesHandlerTest.java M build.gradle M config/quality.gradle 4 files changed, 75 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia refs/changes/91/248091/1 diff --git a/app/build.gradle b/app/build.gradle index fd75a82..109e7c7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -165,14 +165,16 @@ } compile 'net.hockeyapp.android:HockeySDK:3.6.2' - androidTestCompile('com.android.support.test:runner:0.4') - // Required by com.android.support.test:runner. - androidTestCompile 'com.android.support:support-annotations:23.1.0' - testCompile 'junit:junit:4.12' testCompile 'org.mockito:mockito-core:1.9.5' testCompile 'org.robolectric:robolectric:3.0-rc3' testCompile 'com.squareup.okhttp:mockwebserver:2.4.0' + + // Required by com.android.support.test:runner. + androidTestCompile 'com.android.support:support-annotations:23.1.0' + androidTestCompile 'com.android.support.test:rules:0.4.1' + androidTestCompile 'com.android.support.test:runner:0.4.1' + androidTestCompile 'com.squareup.spoon:spoon-client:1.2.0' } private setSigningConfigKey(config, Properties props) { diff --git a/app/src/androidTest/java/org/wikipedia/page/leadimages/LeadImagesHandlerTest.java b/app/src/androidTest/java/org/wikipedia/page/leadimages/LeadImagesHandlerTest.java new file mode 100644 index 0000000..f508e43 --- /dev/null +++ b/app/src/androidTest/java/org/wikipedia/page/leadimages/LeadImagesHandlerTest.java @@ -0,0 +1,59 @@ +package org.wikipedia.page.leadimages; + +import android.support.test.rule.ActivityTestRule; +import android.support.test.runner.AndroidJUnit4; + +import com.squareup.spoon.Spoon; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.wikipedia.Site; +import org.wikipedia.history.HistoryEntry; +import org.wikipedia.page.PageActivity; +import org.wikipedia.page.PageTitle; +import org.wikipedia.staticdata.MainPageNameData; + +import java.util.Arrays; +import java.util.List; + +@RunWith(AndroidJUnit4.class) +public class LeadImagesHandlerTest { + @Rule public ActivityTestRule<PageActivity> activityRule = new ActivityTestRule<>(PageActivity.class); + + private static final String LANG = "en"; + private static final Site SITE = Site.forLanguage(LANG); + private static final List<String> ARTICLE_TITLES = Arrays.asList( + "Mercury", + "Venus", + "Earth", + "Mars", + "Jupiter", + "Saturn", + "Uranus", + "Neptune" + ); + + @Test public void testSnappy() throws InterruptedException { + for (String title : ARTICLE_TITLES) { + loadArticle(title); + Thread.sleep(4000); + snappy(title); + } + } + + private void loadArticle(String title) { + PageTitle pageTitle = new PageTitle(title, SITE); + HistoryEntry historyEntry = new HistoryEntry(pageTitle, HistoryEntry.SOURCE_RANDOM); + getActivity().displayNewPage(pageTitle, historyEntry); + } + + private void snappy(String tag) { + Spoon.screenshot(getActivity(), tag); + } + + private PageActivity getActivity() { + return activityRule.getActivity(); + } +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index a1e3afb..94263c7 100644 --- a/build.gradle +++ b/build.gradle @@ -6,9 +6,10 @@ } dependencies { classpath 'com.android.tools.build:gradle:1.3.1' - classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0' - classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1' classpath 'org.gradle.api.plugins:gradle-nexus-plugin:0.7.1' + classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1' + classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0' + classpath 'com.stanfy.spoon:spoon-gradle-plugin:1.0.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/config/quality.gradle b/config/quality.gradle index c0f7c1c..1a23880 100644 --- a/config/quality.gradle +++ b/config/quality.gradle @@ -1,6 +1,7 @@ // see also http://stackoverflow.com/questions/17050654/get-android-gradle-plugin-checkstyle-working-together-command-line-usage apply plugin: 'checkstyle' +apply plugin: 'spoon' check.dependsOn 'checkstyle' @@ -51,3 +52,9 @@ // Add testAll task for all configurations. addTestAllTask('testAll', 'test', 'connectedAndroidTest') // --- /testAll --- + +spoon { + if (project.hasProperty('spoonClassName')) { + className = project.spoonClassName + } +} \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/248091 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1ae94d279003efeb629d24cfc7c2b585036029db Gerrit-PatchSet: 1 Gerrit-Project: apps/android/wikipedia Gerrit-Branch: master Gerrit-Owner: Niedzielski <sniedziel...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits