From f341245f21ef19f33e9ae0e392d0b82eee4f95c2 Mon Sep 17 00:00:00 2001 From: somenath sarkar Date: Wed, 17 Jun 2020 08:44:02 +0530 Subject: [PATCH 01/10] Added shell scripts --- .github/workflows/UI-Test.yml | 14 ++++++++++++- launch.sh | 37 +++++++++++++++++++++++++++++++++++ stop.sh | 26 ++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 launch.sh create mode 100644 stop.sh diff --git a/.github/workflows/UI-Test.yml b/.github/workflows/UI-Test.yml index 3a77e45e..da427317 100644 --- a/.github/workflows/UI-Test.yml +++ b/.github/workflows/UI-Test.yml @@ -16,6 +16,12 @@ jobs: - name: checkout uses: actions/checkout@v2 + - name: Make launch script executable + run: chmod +x ./launch.sh + + - name: Run launch script + run: ./launch.sh + - name: Make gradlew executable run: chmod +x ./gradlew @@ -23,4 +29,10 @@ jobs: 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 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/launch.sh b/launch.sh new file mode 100644 index 00000000..68775b73 --- /dev/null +++ b/launch.sh @@ -0,0 +1,37 @@ +#! /bin/bash + +function assert_success() { + "${@}" + local status=${?} + if [ ${status} -ne 0 ]; then + send_notification "### 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 & +assert_success curl --retry 5 --retry-delay 10 "$checkAddress" + +echo "XWiki has been started" + +sleep 60 + +assert_success curl "$checkAddress" diff --git a/stop.sh b/stop.sh new file mode 100644 index 00000000..e70c8871 --- /dev/null +++ b/stop.sh @@ -0,0 +1,26 @@ +#! /bin/bash + +function assert_success() { + "${@}" + local status=${?} + if [ ${status} -ne 0 ]; then + send_notification "### 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 From 049b5b01575e438cda978844348556358ecfbccb Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 21 Jun 2020 19:55:09 +0600 Subject: [PATCH 02/10] Update launch.sh --- launch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launch.sh b/launch.sh index 68775b73..7774f384 100644 --- a/launch.sh +++ b/launch.sh @@ -4,7 +4,7 @@ function assert_success() { "${@}" local status=${?} if [ ${status} -ne 0 ]; then - send_notification "### Error ${status} at: ${BASH_LINENO[*]} ###" + echo "### Error ${status} at: ${BASH_LINENO[*]} ###" exit ${status} fi } From 21b3bd940e316ba115ab3bedcf57547d1dfd16f0 Mon Sep 17 00:00:00 2001 From: somenath sarkar Date: Tue, 23 Jun 2020 10:05:25 +0530 Subject: [PATCH 03/10] curl only once --- launch.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/launch.sh b/launch.sh index 7774f384..8f919106 100644 --- a/launch.sh +++ b/launch.sh @@ -28,10 +28,9 @@ assert_success cd "$filename" assert_success chmod +x start_xwiki.sh assert_success ./start_xwiki.sh & -assert_success curl --retry 5 --retry-delay 10 "$checkAddress" -echo "XWiki has been started" +echo "XWiki has been started and curl after 60 seconds" sleep 60 -assert_success curl "$checkAddress" +assert_success curl --retry 5 --retry-delay 10 "$checkAddress" From 6b022798d93095203b034a3228fae47a9e9d8bc8 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 25 Jun 2020 23:33:23 +0600 Subject: [PATCH 04/10] check --- .github/workflows/UI-Test.yml | 2 +- .../org/xwiki/android/sync/auth/AuthenticatorActivityTest.kt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/UI-Test.yml b/.github/workflows/UI-Test.yml index da427317..1a8c94dc 100644 --- a/.github/workflows/UI-Test.yml +++ b/.github/workflows/UI-Test.yml @@ -29,7 +29,7 @@ jobs: uses: reactivecircus/android-emulator-runner@v2 #boots up emulator and perform UI tests with: api-level: 29 - script: ./gradlew connectedCheck + script: ./gradlew connectedAndroidTest - name: Make stop script executable run: chmod +x ./stop.sh 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 027ab320..24427824 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 @@ -98,6 +98,7 @@ class AuthenticatorActivityTest : LifecycleObserver { Log.e("Test", e.localizedMessage) } }) + assert(false) { "Here it will be failed specially" } } @After From 0da4b138cfa6f790b8594d74539e8f094f798094 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 26 Jun 2020 10:30:04 +0600 Subject: [PATCH 05/10] fixes --- .github/workflows/UI-Test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/UI-Test.yml b/.github/workflows/UI-Test.yml index 65676ba5..01835eaf 100644 --- a/.github/workflows/UI-Test.yml +++ b/.github/workflows/UI-Test.yml @@ -41,7 +41,7 @@ jobs: uses: reactivecircus/android-emulator-runner@v2 #boots up emulator and perform UI tests with: api-level: 29 - script: ./gradlew connectedAndroidTest + script: adb shell input keyevent 82 && ./gradlew clean connectedCheck - name: Make stop script executable run: chmod +x ./stop.sh From 7771ae9011e6ff8ba1bfdc2df047d18753a0e4d2 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 26 Jun 2020 10:38:30 +0600 Subject: [PATCH 06/10] temporary remove launching of test instance --- .github/workflows/UI-Test.yml | 10 +++++----- .../android/sync/auth/AuthenticatorActivityTest.kt | 7 ++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/UI-Test.yml b/.github/workflows/UI-Test.yml index 01835eaf..155b4dba 100644 --- a/.github/workflows/UI-Test.yml +++ b/.github/workflows/UI-Test.yml @@ -31,11 +31,11 @@ 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: 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 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 8dd08337..47c6fe31 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,10 +49,11 @@ class AuthenticatorActivityTest : LifecycleObserver { @Test fun testServerUrl () { - activityScenario.onActivity { - it.showViewFlipper(0) + activityScenario.use { _ -> + activityScenario.onActivity { + it.showViewFlipper(0) + } } - activityScenario.close() } @Test From babe26e36950f2ca2be25daa823ec1378473c0e2 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 26 Jun 2020 10:38:42 +0600 Subject: [PATCH 07/10] temporary remove launching of test instance --- .github/workflows/UI-Test.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/UI-Test.yml b/.github/workflows/UI-Test.yml index 155b4dba..f2dcf285 100644 --- a/.github/workflows/UI-Test.yml +++ b/.github/workflows/UI-Test.yml @@ -43,8 +43,8 @@ jobs: api-level: 29 script: adb shell input keyevent 82 && ./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 +# - name: Make stop script executable +# run: chmod +x ./stop.sh +# +# - name: Run stop script +# run: ./stop.sh \ No newline at end of file From fd17bddf450c2ee8bcf14b32752e1bf5ba4e1657 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 26 Jun 2020 10:49:50 +0600 Subject: [PATCH 08/10] make assembling before unlocking of screen --- .github/workflows/UI-Test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/UI-Test.yml b/.github/workflows/UI-Test.yml index f2dcf285..9d36a3ef 100644 --- a/.github/workflows/UI-Test.yml +++ b/.github/workflows/UI-Test.yml @@ -41,7 +41,7 @@ jobs: uses: reactivecircus/android-emulator-runner@v2 #boots up emulator and perform UI tests with: api-level: 29 - script: adb shell input keyevent 82 && ./gradlew clean connectedCheck + script: ./gradlew clean assemble && adb shell input keyevent 82 && ./gradlew connectedCheck # - name: Make stop script executable # run: chmod +x ./stop.sh From 1223a56641542539d29656170b403efb8f28709e Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 26 Jun 2020 10:52:32 +0600 Subject: [PATCH 09/10] fixes for state of activity --- .github/workflows/UI-Test.yml | 2 +- .../org/xwiki/android/sync/auth/AuthenticatorActivityTest.kt | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/UI-Test.yml b/.github/workflows/UI-Test.yml index 9d36a3ef..70346777 100644 --- a/.github/workflows/UI-Test.yml +++ b/.github/workflows/UI-Test.yml @@ -41,7 +41,7 @@ jobs: uses: reactivecircus/android-emulator-runner@v2 #boots up emulator and perform UI tests with: api-level: 29 - script: ./gradlew clean assemble && adb shell input keyevent 82 && ./gradlew connectedCheck + script: ./gradlew clean connectedCheck # - name: Make stop script executable # run: chmod +x ./stop.sh 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 47c6fe31..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,6 +49,7 @@ class AuthenticatorActivityTest : LifecycleObserver { @Test fun testServerUrl () { + activityScenario.moveToState(Lifecycle.State.RESUMED) activityScenario.use { _ -> activityScenario.onActivity { it.showViewFlipper(0) @@ -58,16 +59,17 @@ class AuthenticatorActivityTest : LifecycleObserver { @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) } From 3259dcd98c4bd6056db5120faddf1028cd5bf57f Mon Sep 17 00:00:00 2001 From: somenath sarkar Date: Fri, 26 Jun 2020 13:05:45 +0530 Subject: [PATCH 10/10] Replace send_notification with echo in stop script --- stop.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stop.sh b/stop.sh index e70c8871..12505cd1 100644 --- a/stop.sh +++ b/stop.sh @@ -4,7 +4,7 @@ function assert_success() { "${@}" local status=${?} if [ ${status} -ne 0 ]; then - send_notification "### Error ${status} at: ${BASH_LINENO[*]} ###" + echo "### Error ${status} at: ${BASH_LINENO[*]} ###" exit ${status} fi }