Merge pull request #1603 from nextcloud/screenshots

Screenshots with fastlane screengrab
This commit is contained in:
Tobias Kaminsky 2018-01-05 10:39:50 +01:00 committed by GitHub
commit 6c8993e632
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 570 additions and 0 deletions

View file

@ -231,11 +231,14 @@ dependencies {
// Espresso core
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.1'
// UIAutomator - for cross-app UI tests, and to grant screen is turned on in Espresso tests
//androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
// fix conflict in dependencies; see http://g.co/androidstudio/app-test-app-conflict for details
//androidTestImplementation "com.android.support:support-annotations:${supportLibraryVersion}"
implementation 'org.jetbrains:annotations:15.0'
androidTestCompile 'tools.fastlane:screengrab:1.0.0'
}
configurations.all {

2
fastlane/Appfile Normal file
View file

@ -0,0 +1,2 @@
json_key_file "~/.gradle/Google\ Play\ Android\ Developer-Fastlane.json"
package_name "com.nextcloud.client"

6
fastlane/Fastfile Normal file
View file

@ -0,0 +1,6 @@
# This is the minimum version number required.
fastlane_version "2.58.0"
lane :screenshots do
screengrab
end

11
fastlane/Screengrabfile Normal file
View file

@ -0,0 +1,11 @@
app_package_name 'com.nextcloud.client'
use_tests_in_packages ['com.owncloud.android.screenshots']
app_apk_path 'build/outputs/apk/generic/debug/android2-generic-debug.apk'
tests_apk_path 'build/outputs/apk/androidTest/generic/debug/android2-generic-debug-androidTest.apk'
# locales ['en-US']
locales ['en-US', 'de-DE', 'en-GB', 'fr-FR', 'it-IT', 'pt-BR', 'pt-PT', 'sv-SE', 'sq-AL', 'sq-MK', 'iw-IL', 'ar-AR', 'bg-BG', 'da-DK', 'fi-FI', 'gl-ES', 'hu-HU', 'tr-TR', 'uk-UK', 'vi-VI', 'ro-RO', 'ru-RU', 'sr-SR', 'pl-PL', 'el-GR', 'ko-KR', 'nl-NL', 'ja-JP', 'no-NO', 'eu-ES', 'lt-LT', 'es-ES', 'es-419', 'zh-HK', 'zk-CN', 'is-IS', 'sr-SR', 'id-ID', 'cs-CZ', 'sl-SL', 'fa-FA' ]
# clear all previously generated screenshots in your local output directory before creating new ones
clear_previous_screenshots true

View file

@ -7,6 +7,8 @@
<issue id="UnusedResources">
<ignore regexp="store_short_desc|store_full_desc|store_short_dev_desc|store_full_dev_desc" />
<ignore
regexp="screenshot_01_gridView|screenshot_02_listView|screenshot_03_drawer|screenshot_04_accounts|screenshot_05_autoUpload|screenshot_06_davdroid"/>
</issue>
<issue id="MissingQuantity">

View file

@ -0,0 +1,40 @@
#!/bin/bash
cd scripts/screenshots/
for i in $(find ../../fastlane | grep png) ; do
device=$(echo $i | cut -d"/" -f8 | sed s'#Screenshots##')
textID=$(echo $i | cut -d"/" -f9 | cut -d"_" -f1,2)
locale=$(echo $i | cut -d"/" -f6)
# handle some locales different
case $locale in
"en-US")
locale=""
;;
"de-DE")
locale="-de"
;;
*)
locale="-"$locale
esac
if [ -e ../../src/main/res/values$locale/strings.xml ] ; then
text=$(grep $textID ../../src/main/res/values$locale/strings.xml | cut -d">" -f2 | cut -d"<" -f1 | sed s'#\&amp;#\\&#')
else
text=""
fi
# fallback to english if there is not translation
if [ -n $text ]; then
text=$(grep $textID ../../src/main/res/values/strings.xml | cut -d">" -f2 | cut -d"<" -f1 | sed s'#\&amp;#\\&#')
fi
sed "s#{image}#$i#;s#{text}#$text#g" $device.svg > temp.svg
if [ $textID == "06_davdroid" ] ; then
sed "s#display:none#display:visible#" -i temp.svg
fi
inkscape temp.svg -e $i
done

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 KiB

View file

@ -0,0 +1,175 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="483.30557mm"
height="800mm"
viewBox="0 0 483.30556 800.00003"
version="1.1"
id="svg4553"
inkscape:version="0.92.1 r"
sodipodi:docname="phone.svg">
<defs
id="defs4547">
<linearGradient
inkscape:collect="always"
id="linearGradient832">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop828"/>
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop830"/>
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient832"
id="radialGradient836"
cx="2564.2764"
cy="7303.2788"
fx="2564.2764"
fy="7303.2788"
r="115.44445"
gradientTransform="matrix(1,0,0,0.37896268,0,4535.6086)"
gradientUnits="userSpaceOnUse"/>
<filter
inkscape:collect="always"
style="color-interpolation-filters:sRGB"
id="filter888"
x="-0.016423529"
width="1.0328471"
y="-0.044553191"
height="1.0891064">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="1.5541406"
id="feGaussianBlur890"/>
</filter>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#0082c9"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="1"
inkscape:pageshadow="2"
inkscape:zoom="0.32"
inkscape:cx="1173.7175"
inkscape:cy="1426.1712"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
fit-margin-top="80"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1600"
inkscape:window-height="835"
inkscape:window-x="1600"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:measure-start="0,0"
inkscape:measure-end="0,0"/>
<metadata
id="metadata4550">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<dc:title/>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Ebene 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-454.12732,1199.2512)">
<image
sodipodi:absref="/home/tobi/Daten/arbeit/nextcloud/SourceCode/android4/scripts/screenshots/{image}"
xlink:href="{image}"
width="382.17361"
height="679.41968"
preserveAspectRatio="none"
id="image4495"
x="502.9848"
y="-928.13586"/>
<rect
style="color:#000000;display:none;overflow:visible;visibility:visible;opacity:0.75;vector-effect:none;fill:#808080;fill-opacity:1;stroke:none;stroke-width:843.95349121;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
id="rect4493-5"
width="382.17361"
height="458.69916"
x="502.9848"
y="-751.86719"/>
<image
sodipodi:absref="/home/tobi/Daten/arbeit/nextcloud/SourceCode/android4/scripts/screenshots/phone.png"
xlink:href="phone.png"
width="483.30557"
height="893.9389"
preserveAspectRatio="none"
id="image10"
x="454.12732"
y="-1028.6078"/>
<flowRoot
transform="matrix(0.26458333,0,0,0.26458333,17.310326,-3047.5107)"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:96px;line-height:125%;font-family:Helvetica;-inkscape-font-specification:Helvetica;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:3.77952761;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;opacity:0.5;filter:url(#filter888);"
id="flowRoot846"
xml:space="preserve"><flowRegion
style="text-align:center;text-anchor:middle;fill:#000000;stroke-width:3.77952761;stroke-miterlimit:4;stroke-dasharray:none;stroke:none;stroke-opacity:1;fill-opacity:1;"
id="flowRegion840"><rect
style="text-align:center;text-anchor:middle;fill:#000000;stroke-width:3.77952761;stroke-miterlimit:4;stroke-dasharray:none;stroke:none;stroke-opacity:1;fill-opacity:1;"
y="7244.0518"
x="1654.2856"
height="298.32639"
width="1820.0288"
id="rect838" /></flowRegion><flowPara
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-family:'Open Sans';-inkscape-font-specification:'Open Sans Light';text-align:center;text-anchor:middle;fill:#000000;stroke-width:3.77952761;stroke-miterlimit:4;stroke-dasharray:none;stroke:none;stroke-opacity:1;fill-opacity:1;"
id="flowPara842">{text}</flowPara><flowPara
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-family:'Open Sans';-inkscape-font-specification:'Open Sans Light';text-align:center;text-anchor:middle;fill:#000000;stroke-width:3.77952761;stroke-miterlimit:4;stroke-dasharray:none;stroke:none;stroke-opacity:1;fill-opacity:1;"
id="flowPara844" /></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot5145"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:96px;line-height:125%;font-family:Helvetica;-inkscape-font-specification:Helvetica;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:3.77952766;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
transform="matrix(0.26458333,0,0,0.26458333,17.310326,-3047.5107)"><flowRegion
id="flowRegion5147"
style="text-align:center;text-anchor:middle;fill:#ffffff;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"><rect
id="rect5149"
width="1820.0288"
height="298.32639"
x="1654.2856"
y="7244.0518"
style="text-align:center;text-anchor:middle;fill:#ffffff;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /></flowRegion><flowPara
id="flowPara5151"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-family:'Open Sans';-inkscape-font-specification:'Open Sans Light';text-align:center;text-anchor:middle;fill:#ffffff;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1">{text}</flowPara><flowPara
id="flowPara5153"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-family:'Open Sans';-inkscape-font-specification:'Open Sans Light';text-align:center;text-anchor:middle;fill:#ffffff;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot5174"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:20px;line-height:125%;font-family:Helvetica;-inkscape-font-specification:Helvetica;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"><flowRegion
id="flowRegion5176"><rect
id="rect5178"
width="5.7142859"
height="57.142857"
x="177.14285"
y="480.14975" /></flowRegion><flowPara
id="flowPara5180" /></flowRoot>
<rect
style="color:#000000;display:none;overflow:visible;visibility:visible;opacity:0.75;vector-effect:none;fill:#808080;fill-opacity:1;stroke:none;stroke-width:430.52496338;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
id="rect4493"
width="382.17358"
height="119.36794"
x="502.9848"
y="-965.70728"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 9.1 KiB

View file

@ -0,0 +1,175 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="939.90002mm"
height="519mm"
viewBox="0 0 939.9 519.00002"
version="1.1"
id="svg4553"
inkscape:version="0.92.1 r"
sodipodi:docname="sevenInch.svg">
<defs
id="defs4547">
<linearGradient
inkscape:collect="always"
id="linearGradient832">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop828"/>
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop830"/>
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient832"
id="radialGradient836"
cx="2564.2764"
cy="7303.2788"
fx="2564.2764"
fy="7303.2788"
r="115.44445"
gradientTransform="matrix(1,0,0,0.37896268,0,4535.6086)"
gradientUnits="userSpaceOnUse"/>
<filter
inkscape:collect="always"
style="color-interpolation-filters:sRGB"
id="filter888"
x="-0.016423529"
width="1.032847"
y="-0.04455319"
height="1.0891064">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="1.5541406"
id="feGaussianBlur890"/>
</filter>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#0082c9"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="1"
inkscape:pageshadow="2"
inkscape:zoom="0.22627418"
inkscape:cx="1294.096"
inkscape:cy="109.62556"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
fit-margin-top="80"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1600"
inkscape:window-height="835"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:measure-start="0,0"
inkscape:measure-end="0,0"/>
<metadata
id="metadata4550">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<dc:title/>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Ebene 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-205.9464,1011.8911)">
<image
sodipodi:absref="/home/tobi/Daten/arbeit/nextcloud/SourceCode/android4/scripts/screenshots/{image}"
xlink:href="{image}"
y="-829.59448"
x="335.71039"
id="image4525"
preserveAspectRatio="none"
height="425.23251"
width="680.37207"/>
<flowRoot
transform="matrix(0.26458333,0,0,0.26458333,-2.5683677,-2878.1763)"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:96px;line-height:125%;font-family:Helvetica;-inkscape-font-specification:Helvetica;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;opacity:0.5;fill:#000000;fill-opacity:1;stroke:none;stroke-width:3.77952766;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter888)"
id="flowRoot846"
xml:space="preserve"><flowRegion
style="text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="flowRegion840"><rect
style="text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
y="7244.0518"
x="1654.2856"
height="298.32639"
width="1820.0288"
id="rect838" /></flowRegion><flowPara
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-family:'Open Sans';-inkscape-font-specification:'Open Sans Light';text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="flowPara842">{text}</flowPara><flowPara
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-family:'Open Sans';-inkscape-font-specification:'Open Sans Light';text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="flowPara844" /></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot5145"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:96px;line-height:125%;font-family:Helvetica;-inkscape-font-specification:Helvetica;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:3.77952766;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
transform="matrix(0.26458333,0,0,0.26458333,-2.5683681,-2878.1763)"><flowRegion
id="flowRegion5147"
style="text-align:center;text-anchor:middle;fill:#ffffff;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"><rect
id="rect5149"
width="1820.0288"
height="298.32639"
x="1654.2856"
y="7244.0518"
style="text-align:center;text-anchor:middle;fill:#ffffff;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /></flowRegion><flowPara
id="flowPara5151"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-family:'Open Sans';-inkscape-font-specification:'Open Sans Light';text-align:center;text-anchor:middle;fill:#ffffff;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1">{text}</flowPara><flowPara
id="flowPara5153"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-family:'Open Sans';-inkscape-font-specification:'Open Sans Light';text-align:center;text-anchor:middle;fill:#ffffff;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot5174"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:20px;line-height:125%;font-family:Helvetica;-inkscape-font-specification:Helvetica;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"><flowRegion
id="flowRegion5176"><rect
id="rect5178"
width="5.7142859"
height="57.142857"
x="177.14285"
y="480.14975" /></flowRegion><flowPara
id="flowPara5180" /></flowRoot>
<image
sodipodi:absref="/home/tobi/Daten/arbeit/nextcloud/SourceCode/android4/scripts/screenshots/tablet.png"
xlink:href="tablet.png"
width="977.90002"
height="521.75836"
preserveAspectRatio="none"
id="image4514"
x="186.9464"
y="-871.77393"/>
<rect
style="color:#000000;display:none;overflow:visible;visibility:visible;opacity:0.75;vector-effect:none;fill:#808080;fill-opacity:1;stroke:none;stroke-width:490.07928467;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
id="rect4493-2"
width="677.90411"
height="87.199898"
x="335.71039"
y="-829.59448"/>
<rect
style="color:#000000;display:none;overflow:visible;visibility:visible;opacity:0.75;vector-effect:none;fill:#808080;fill-opacity:1;stroke:none;stroke-width:794.79553223;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
id="rect4493-2-0"
width="677.90411"
height="229.34755"
x="335.71039"
y="-667.80133"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 765 KiB

View file

@ -0,0 +1,131 @@
package com.owncloud.android.screenshots;
import android.content.Intent;
import android.support.test.espresso.Espresso;
import android.support.test.espresso.action.ViewActions;
import android.support.test.espresso.contrib.DrawerActions;
import android.support.test.espresso.matcher.PreferenceMatchers;
import android.support.test.rule.ActivityTestRule;
import com.owncloud.android.R;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.ui.activity.Preferences;
import junit.framework.Assert;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import tools.fastlane.screengrab.Screengrab;
import tools.fastlane.screengrab.UiAutomatorScreenshotStrategy;
import tools.fastlane.screengrab.locale.LocaleTestRule;
import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.Matchers.anything;
import static org.hamcrest.core.AnyOf.anyOf;
@RunWith(JUnit4.class)
public class ScreenshotsIT {
@ClassRule
public static final LocaleTestRule localeTestRule = new LocaleTestRule();
@Rule
public ActivityTestRule<FileDisplayActivity> fileDisplayRule = new ActivityTestRule<>(FileDisplayActivity.class);
@Rule
public ActivityTestRule<Preferences> preferencesRule = new ActivityTestRule<>(Preferences.class, true, false);
@BeforeClass
public static void beforeAll() {
Screengrab.setDefaultScreenshotStrategy(new UiAutomatorScreenshotStrategy());
}
@Test
public void gridViewScreenshot() throws InterruptedException {
fileDisplayRule.launchActivity(new Intent());
Espresso.openContextualActionModeOverflowMenu();
onView(anyOf(withText(R.string.action_switch_grid_view), withId(R.id.action_switch_view))).perform(click());
Thread.sleep(1000);
Screengrab.screenshot("01_gridView");
Espresso.openContextualActionModeOverflowMenu();
onView(anyOf(withText(R.string.action_switch_list_view), withId(R.id.action_switch_view))).perform(click());
Assert.assertTrue(true); // if we reach this, everything is ok
}
@Test
public void listViewScreenshot() throws InterruptedException {
fileDisplayRule.launchActivity(new Intent());
// go into work folder
onData(anything()).inAdapterView(withId(R.id.list_root)).atPosition(0).perform(click());
Screengrab.screenshot("02_listView");
Assert.assertTrue(true); // if we reach this, everything is ok
}
@Test
public void drawerScreenshot() throws InterruptedException {
fileDisplayRule.launchActivity(new Intent());
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
Screengrab.screenshot("03_drawer");
onView(withId(R.id.drawer_layout)).perform(DrawerActions.close());
Assert.assertTrue(true); // if we reach this, everything is ok
}
@Test
public void multipleAccountsScreenshot() throws InterruptedException {
fileDisplayRule.launchActivity(new Intent());
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
onView(withId(R.id.drawer_active_user)).perform(click());
Screengrab.screenshot("04_accounts");
onView(withId(R.id.drawer_layout)).perform(DrawerActions.close());
Assert.assertTrue(true); // if we reach this, everything is ok
}
@Test
public void autoUploadScreenshot() throws InterruptedException {
fileDisplayRule.launchActivity(new Intent());
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
onView(anyOf(withText(R.string.drawer_synced_folders), withId(R.id.nav_synced_folders))).perform(click());
Screengrab.screenshot("05_autoUpload");
Assert.assertTrue(true); // if we reach this, everything is ok
}
@Test
public void davdroidScreenshot() throws InterruptedException {
preferencesRule.launchActivity(new Intent());
onData(PreferenceMatchers.withTitle(R.string.prefs_category_more)).perform(ViewActions.scrollTo());
Thread.sleep(1000);
Screengrab.screenshot("06_davdroid");
Assert.assertTrue(true); // if we reach this, everything is ok
}
}

View file

@ -0,0 +1,18 @@
<manifest xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Allows unlocking your device and activating its screen so UI tests can succeed -->
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<!-- Allows for storing and retrieving screenshots -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<!-- Allows changing locales -->
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION"/>
<application
android:testOnly="false"
android:allowBackup="false"
tools:ignore="GoogleAppIndexingWarning"/>
</manifest>

View file

@ -727,4 +727,11 @@
<string name="send">Send</string>
<string name="share">Share</string>
<string name="link">Link</string>
<string name="screenshot_01_gridView">A safe home for all your data</string>
<string name="screenshot_02_listView">Browse and share your files easily</string>
<string name="screenshot_03_drawer">Quickly access activity, shares, offline files and more</string>
<string name="screenshot_04_accounts">Connect to different accounts</string>
<string name="screenshot_05_autoUpload">Automatically upload your photos &amp; videos</string>
<string name="screenshot_06_davdroid">Sync Calendar &amp; Contacts with DAVdroid</string>
</resources>