sillsdev / StoryProducer

Story Producer app
Other
5 stars 11 forks source link
android-app story-producer videos

Story Producer (SP app)

Purpose: to enable end users to orally translate still-picture audio-narrated stories with community help, then dramatize, publish and digitally share new local language videos.

End users and target audience: speakers of (minority) languages, some of whom are bilingual in a major language.

End recipients of videos produced: members of local language communities

Developers:

Translate and produce stories (starting with templates in a major language made up of images, audio and text) by working through these phases:

Creating a signed APK

To install onto a device, an APK needs to be signed. When uploading to Google Play, it has to be signed by the same keystore that was used on the initial upload. For testing on a device using side loading, it can be signed with any keystore. We do not want to check in a keystore to the repo, so developers can either download a pre-made set of files or create their own.

To download pre-made set of files:

To create the set of files:

Installing the application

Unit Tests

Organization

Running the Unit Tests

From the command line:
  1. Navigate to the root directory of the repository.
  2. Run ./gradlew test (on Linux) or gradlew.bat test(on Windows). Note: You may need to run the gradle wrapper with sudo or make the gradle wrapper executable with sudo chmod +x ./gradlew
    From Android Studio:
  3. Open the Story Producer project (StoryProducer.iml) in Android Studio.
  4. Set the "Project" tool window to show "Local Unit Tests" (or just navigate a the folder containing unit tests).
  5. Right click on one of the files or directories that contains some unit tests (this can be the "app" directory, a specific folder, or a single test file.).
  6. Click "Run 'All Tests'" (or a more specific option if you chose a folder or file).
  7. The "Run" tool window shows the results of the tests. Note: If no tests appear in the "Run" window, you may need to toggle the visibility of passing tests. Currently, the toggle button looks like green checkmark inside of a circle.

Espresso Tests (UI Tests)

Organization

Before You Run the Espresso Tests:

The Espresso tests make a couple of assumptions about the state of the emulator/device that they run on. In order for the tests to pass, you must do the following:

  1. Create a directory on the phone to act as the Story Producer workspace. The path needs to match the "pathToWorkspaceDirectory" constant defined in app\src\androidTest\java\org\sil\storyproducer\androidtest\utilities\Constants.kt
  2. Create a directory on the phone to store resource files that the Espresso tests use. The path needs to match the "pathToEspressoResourceDirectory" value defined in app\src\androidTest\java\org\sil\storyproducer\androidtest\utilities\Constants.kt
  3. Copy the "Lost Coin" story template into the espresso resource directory you created in step #2. The name of the directory needs to match the "nameOfTestStoryDirectory" value defined in app\src\androidTest\java\org\sil\storyproducer\androidtest\utilities\Constants.kt
  4. Copy an .mp4 video file (the particular length or content doesn't matter) into the espresso resource directory. The name of the .mp4 file needs to match the "nameOfSampleExportVideo" value defined in app\src\androidTest\java\org\sil\storyproducer\androidtest\utilities\Constants.kt
  5. Launch your emulator device (or connect a physical one via adb).
  6. Run ./gradlew :app:assembleDebug :app:assembleDebugAndroidTest :app:installDebug :app:installDebugAndroidTest from the root directory of the repository.
  7. Run adb shell am instrument -w -e debug false -e package 'org.sil.storyproducer.androidtest.runfirst' org.sil.storyproducer.test/androidx.test.runner.AndroidJUnitRunner from the root directory of the repository. (Note that the folder containing ADB must be in your path for this command to work.)

Why is this necessary? The Espresso tests rely on the presence of the "Lost Coin" template as a sample with which to exercise the features of the app. The Espresso Tests also require the workspace to have been set up, but Espresso is not capable interacting with the operating system's file picker, so the WorkspaceSetter class uses UIAutomator to select the workspace.

Running the Espresso Tests

From the command line:
  1. Ensure that you have set up your Android device according to the previous section, "Before You Run the Tests." (The device/emulator should be running.)
  2. Navigate to the root directory of the repository.
  3. Run adb shell am instrument -w -e debug false org.sil.storyproducer.test/androidx.test.runner.AndroidJUnitRunner.
    From Android Studio:
  4. Ensure that you have set up your Android device according to the previous section, "Before You Run the Tests."
  5. Open the Story Producer project (StoryProducer.iml) in Android Studio.
  6. Set the "Project" tool window to show "Android Instrumented Tests" (or just navigate to a directory containing Espresso tests).
  7. Right click on one of the directories that contains some Espresso tests (this can be the "app" directory, a specific folder, or a single test file.).
  8. Click "Run 'Tests in org.sil.storyproducer...'".
  9. The "Run" tool window shows the results of the tests. Note: If no tests appear in the "Run" window, you may need to toggle the visibility of passing tests. Currently, the toggle button looks like green checkmark inside of a circle.

Word Links (WL)