Compare commits
1 Commits
main
...
feat/andro
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4508f6cc1c |
@@ -141,6 +141,7 @@ android {
|
||||
versionCode 15
|
||||
versionName "2.0.3"
|
||||
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
if (isNewArchitectureEnabled()) {
|
||||
// We configure the CMake build only if you decide to opt-in for the New Architecture.
|
||||
@@ -281,6 +282,21 @@ dependencies {
|
||||
exclude group:'com.facebook.flipper'
|
||||
}
|
||||
|
||||
// fastlane screengrab, falcon is a dependency of screengrab
|
||||
androidTestImplementation 'com.jraska:falcon:2.2.0'
|
||||
androidTestImplementation "tools.fastlane:screengrab:2.1.0"
|
||||
// Espresso dependencies
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
// Hamcrest library
|
||||
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
|
||||
|
||||
// Core library
|
||||
androidTestImplementation 'androidx.test:core:1.4.0'
|
||||
|
||||
// AndroidJUnitRunner and JUnit Rules
|
||||
androidTestImplementation 'androidx.test:runner:1.4.0'
|
||||
androidTestImplementation 'androidx.test:rules:1.4.0'
|
||||
|
||||
if (enableHermes) {
|
||||
//noinspection GradleDynamicVersion
|
||||
implementation("com.facebook.react:hermes-engine:+") { // From node_modules
|
||||
|
||||
105
android/app/src/androidTest/java/ScreenshotTest.java
Normal file
105
android/app/src/androidTest/java/ScreenshotTest.java
Normal file
@@ -0,0 +1,105 @@
|
||||
package nl.moeilijkedingen.jellyfinaudioplayer;
|
||||
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
|
||||
import nl.moeilijkedingen.jellyfinaudioplayer.R;
|
||||
import org.junit.AfterClass;
|
||||
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 java.util.Arrays;
|
||||
|
||||
import tools.fastlane.screengrab.Screengrab;
|
||||
import tools.fastlane.screengrab.UiAutomatorScreenshotStrategy;
|
||||
import tools.fastlane.screengrab.cleanstatusbar.BluetoothState;
|
||||
import tools.fastlane.screengrab.cleanstatusbar.CleanStatusBar;
|
||||
import tools.fastlane.screengrab.cleanstatusbar.MobileDataType;
|
||||
import tools.fastlane.screengrab.locale.LocaleTestRule;
|
||||
|
||||
import androidx.test.espresso.NoMatchingViewException;
|
||||
|
||||
import static androidx.test.espresso.Espresso.onView;
|
||||
import static androidx.test.espresso.action.ViewActions.click;
|
||||
import static androidx.test.espresso.action.ViewActions.typeText;
|
||||
import static androidx.test.espresso.assertion.ViewAssertions.matches;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withContentDescription;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
||||
|
||||
import static org.hamcrest.core.AllOf.allOf;
|
||||
|
||||
@RunWith(JUnit4.class)
|
||||
public class ScreenshotTest {
|
||||
@ClassRule
|
||||
public static final LocaleTestRule localeTestRule = new LocaleTestRule();
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<MainActivity> activityRule = new ActivityTestRule<>(MainActivity.class);
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeAll() {
|
||||
Screengrab.setDefaultScreenshotStrategy(new UiAutomatorScreenshotStrategy());
|
||||
CleanStatusBar.enableWithDefaults();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterAll() {
|
||||
CleanStatusBar.disable();
|
||||
}
|
||||
|
||||
/*
|
||||
Custom wait function. In order to make sure each button press yields a
|
||||
desirable screen, we use the wait function to delay further actions until
|
||||
the current one has achieved its purpose.
|
||||
|
||||
`duration` indicates the amount of milli-seconds to wait. The value of
|
||||
`duration` is acquired by emperical trial-and-error.
|
||||
*/
|
||||
public void wait(int duration) {
|
||||
try {
|
||||
Thread.sleep(duration);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void inputText(Integer id, String text) {
|
||||
try {
|
||||
onView(allOf(withId(id))).perform(typeText(text));
|
||||
} catch (NoMatchingViewException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTakeScreenshot() {
|
||||
System.out.println("AVAILABLE IDS:" + Arrays.toString(R.id.class.getFields()));
|
||||
// wait(10000);
|
||||
|
||||
// Screengrab.screenshot("04RecentAlbums");
|
||||
// onView(allOf(withId(R.id.all_albums))).perform(click());
|
||||
// wait(5000);
|
||||
// Screengrab.screenshot("05AlbumsScreen");
|
||||
|
||||
// onView(allOf(withId(R.id.search_tab))).perform(click());
|
||||
// wait(5000);
|
||||
// onView(allOf(withId(R.id.search_input_container))).perform(click());
|
||||
// wait(5000);
|
||||
// onView(allOf(withId(R.id.search_input_textinput))).perform(typeText("bicep"));
|
||||
// wait(5000);
|
||||
|
||||
// onView(allOf(withId(R.id.search_result_a644f8d23821601d2feb86ddae5e64f4))).perform(click());
|
||||
// wait(5000);
|
||||
// Screengrab.screenshot("02AlbumScreen");
|
||||
|
||||
// onView(allOf(withId(R.id.play_album))).perform(click());
|
||||
// wait(5000);
|
||||
// onView(allOf(withId(R.id.open_player_modal))).perform(click());
|
||||
// wait(5000);
|
||||
// Screengrab.screenshot("01PlayModal");
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,18 @@
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
||||
<uses-permission android:name="android.permission.DUMP"/>
|
||||
|
||||
<!-- 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:networkSecurityConfig="@xml/react_native_config"
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
|
||||
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
|
||||
org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=512m
|
||||
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
|
||||
@@ -124,4 +124,22 @@ platform :android do
|
||||
)
|
||||
upload_to_play_store
|
||||
end
|
||||
|
||||
lane :screenshots do
|
||||
gradle(task: 'clean', project_dir: 'android/')
|
||||
gradle(
|
||||
task: 'assemble',
|
||||
build_type: 'Debug',
|
||||
project_dir: 'android/',
|
||||
)
|
||||
gradle(
|
||||
task: 'assemble',
|
||||
build_type: 'AndroidTest',
|
||||
project_dir: 'android/',
|
||||
)
|
||||
capture_android_screenshots(
|
||||
app_apk_path: "android/app/build/outputs/apk/debug/app-debug.apk",
|
||||
tests_apk_path: "android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -68,6 +68,14 @@ Generate beta build
|
||||
|
||||
|
||||
|
||||
### android screenshots
|
||||
|
||||
```sh
|
||||
[bundle exec] fastlane android screenshots
|
||||
```
|
||||
|
||||
|
||||
|
||||
----
|
||||
|
||||
This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.
|
||||
|
||||
Reference in New Issue
Block a user