diff --git a/.github/workflows/UI-Test.yml b/.github/workflows/UI-Test.yml index 1808488f..70346777 100644 --- a/.github/workflows/UI-Test.yml +++ b/.github/workflows/UI-Test.yml @@ -31,8 +31,20 @@ jobs: - name: Make gradlew executable run: chmod +x ./gradlew +# - name: Make launch script executable +# run: chmod +x ./launch.sh +# +# - name: Run launch script +# run: ./launch.sh + - name: run tests uses: reactivecircus/android-emulator-runner@v2 #boots up emulator and perform UI tests with: api-level: 29 - script: ./gradlew connectedCheck \ No newline at end of file + script: ./gradlew clean connectedCheck + +# - name: Make stop script executable +# run: chmod +x ./stop.sh +# +# - name: Run stop script +# run: ./stop.sh \ No newline at end of file diff --git a/app/src/androidTest/java/org/xwiki/android/sync/auth/AuthenticatorActivityTest.kt b/app/src/androidTest/java/org/xwiki/android/sync/auth/AuthenticatorActivityTest.kt index 98b147f4..e8118660 100644 --- a/app/src/androidTest/java/org/xwiki/android/sync/auth/AuthenticatorActivityTest.kt +++ b/app/src/androidTest/java/org/xwiki/android/sync/auth/AuthenticatorActivityTest.kt @@ -49,24 +49,27 @@ class AuthenticatorActivityTest : LifecycleObserver { @Test fun testServerUrl () { - activityScenario.onActivity { - it.showViewFlipper(0) + activityScenario.moveToState(Lifecycle.State.RESUMED) + activityScenario.use { _ -> + activityScenario.onActivity { + it.showViewFlipper(0) + } } - activityScenario.close() } @Test fun testSignUp() { + activityScenario.moveToState(Lifecycle.State.RESUMED) activityScenario.onActivity { it.showViewFlipper(1) it.signUp(it.binding.viewFlipper[1]) } - activityScenario.moveToState(Lifecycle.State.STARTED) activityScenario.close() } @Test fun testSignIn() { + activityScenario.moveToState(Lifecycle.State.RESUMED) activityScenario.onActivity { it.showViewFlipper(0) } @@ -98,6 +101,7 @@ class AuthenticatorActivityTest : LifecycleObserver { Log.e("Test", e.localizedMessage) } }) + assert(false) { "Here it will be failed specially" } } @After diff --git a/launch.sh b/launch.sh new file mode 100644 index 00000000..8f919106 --- /dev/null +++ b/launch.sh @@ -0,0 +1,36 @@ +#! /bin/bash + +function assert_success() { + "${@}" + local status=${?} + if [ ${status} -ne 0 ]; then + echo "### Error ${status} at: ${BASH_LINENO[*]} ###" + exit ${status} + fi +} + +xwiki_version="$XWIKI_VERSION" # for case if it will be set up from environment variable +if [ -z "$xwiki_version" ]; then + xwiki_version="11.10.5" +fi + +url="https://maven.xwiki.org/releases/org/xwiki/platform/xwiki-platform-distribution-flavor-jetty-hsqldb/$xwiki_version/xwiki-platform-distribution-flavor-jetty-hsqldb-$xwiki_version.zip" +filename="xwiki-platform-distribution-flavor-jetty-hsqldb-$xwiki_version" +checkAddress=http://127.0.0.1:8080/xwiki/bin/get/Main + +assert_success mkdir xwiki +assert_success cd xwiki + +assert_success curl "$url" -o xwiki.zip +assert_success unzip xwiki.zip + +assert_success cd "$filename" +assert_success chmod +x start_xwiki.sh + +assert_success ./start_xwiki.sh & + +echo "XWiki has been started and curl after 60 seconds" + +sleep 60 + +assert_success curl --retry 5 --retry-delay 10 "$checkAddress" diff --git a/stop.sh b/stop.sh new file mode 100644 index 00000000..12505cd1 --- /dev/null +++ b/stop.sh @@ -0,0 +1,26 @@ +#! /bin/bash + +function assert_success() { + "${@}" + local status=${?} + if [ ${status} -ne 0 ]; then + echo "### Error ${status} at: ${BASH_LINENO[*]} ###" + exit ${status} + fi +} + +xwiki_version="$XWIKI_VERSION" # for case if it will be set up from environment variable +if [ -z "$xwiki_version" ]; then + xwiki_version="11.10.5" +fi + +filename="xwiki-platform-distribution-flavor-jetty-hsqldb-$xwiki_version" + +assert_success cd xwiki +assert_success cd "$filename" + +assert_success chmod +x stop_xwiki.sh + +assert_success ./stop_xwiki.sh + +echo "XWiki has been stopped" \ No newline at end of file