diff --git a/.gitlab-ci-files/html2xml-reports.py b/.gitlab-ci-files/html2xml-reports.py
new file mode 100755
index 000000000..1fbeaa94b
--- /dev/null
+++ b/.gitlab-ci-files/html2xml-reports.py
@@ -0,0 +1,88 @@
+import argparse
+import os
+from bs4 import BeautifulSoup
+from junit_xml import TestSuite, TestCase
+
+parser = argparse.ArgumentParser('screport',description='screport - The comparison tool to check and manage the conform display of any app')
+parser.add_argument('-p', '--reports-path',
+ help='The path to search for reports files',
+ required=False,
+ dest='path')
+args = parser.parse_args()
+
+path = "" if args.path == None else args.path
+
+def findDiv(content,divText):
+ tabs = content.find("div", {"id": "tabs"})
+ tablinks = tabs.find("ul", {"class": "tabLinks"})
+ tabIndex = tablinks.find("a",text=divText)["href"]
+ div = content.find("div", {"id": tabIndex[1:]})
+ return div
+
+with open(os.path.join(path,"index.html")) as fp:
+ indexContent = BeautifulSoup(fp, "html.parser")
+
+classes = findDiv(indexContent,"Classes")
+classNames = [a["href"] for a in classes.find_all("a")]
+
+#name,state,time
+Tests = {}
+for file in classNames:
+ with open(os.path.join(path,file)) as fp:
+ classContent = BeautifulSoup(fp, "html.parser")
+ fileName = ".".join(file.split(".")[:-1])
+ Tests[fileName] = {}
+
+ tests = findDiv(classContent,"Tests")
+ for thead in tests.find_all("thead"):
+ thead.decompose()
+ tests = tests.find_all("tr")
+ for test in tests:
+ testTd = test.find("td",{"class": None})
+ testName = testTd.text
+ testTd.decompose()
+ testState = test.find("td")["class"][0]
+ testTime = float(test.find("td").text.split("(")[1].split("s")[0])
+ Tests[fileName][testName] = [testState,testTime,None,None]
+
+ try:
+ failures = findDiv(classContent,"Failed tests").find_all("div",{"class":"test"})
+
+ for failure in failures:
+ testName = failure.find("a")["name"]
+ message = failure.find("pre")
+ images = []
+ for img in message.find_all("img"):
+ images.append(img["src"])
+ img.decompose()
+ for div in message.find_all("div"):
+ div.decompose()
+ Tests[fileName][testName][2] = message.text
+ Tests[fileName][testName][3] = " ".join(images)
+ except:
+ pass
+
+testSuites = []
+for testClass in Tests:
+ testCases = []
+ failures = 0
+ for testCase in Tests[testClass]:
+ test = Tests[testClass][testCase]
+ testCase = TestCase(testCase,testClass,test[1],test[3],status=test[0])
+ if test[2] != None:
+ failures += 1
+ testCase.add_failure_info(test[2])
+ testCases.append(testCase)
+ testSuites.append(TestSuite(testClass,testCases))
+
+data = TestSuite.to_xml_string(testSuites)
+
+file = open(os.path.join(path,"result.xml"),"w")
+file.write(data)
+file.close()
+
+
+
+
+
+
diff --git a/.gitlab-ci-files/job-uitests.yml b/.gitlab-ci-files/job-uitests.yml
index 1156e97e6..6a90598d7 100644
--- a/.gitlab-ci-files/job-uitests.yml
+++ b/.gitlab-ci-files/job-uitests.yml
@@ -1,5 +1,5 @@
#dependencies:
- #install 'Java SE Development Kit' https://www.oracle.com/java/technologies/downloads/
+ #install 'Java SE Development Kit 11' https://www.oracle.com/ca-en/java/technologies/javase/jdk11-archive-downloads.html
#install 'Android Studio' https://developer.android.com/studio
#install 'Android SDK Build-Tools', 'Android SDK Command-line Tools', 'Android Emulator', 'Android SDK Platform-Tools' from :
#Android Studio > Tools > SDK Manager > SDK Tools
@@ -28,17 +28,17 @@ job-android-uitests:
- echo no | ${ANDROID_HOME}/cmdline-tools/latest/bin/avdmanager --verbose create avd --force --name $emulator_name --package $android_system_image --tag google_$emulator_type --abi $system_architecture --device $emulator_device > emulatorCreation.log
- ${ANDROID_HOME}/platform-tools/adb start-server
- ${ANDROID_HOME}/emulator/emulator -avd $emulator_name &
- - ${UTILS}/wait-for-android-emulator
+ - .gitlab-ci-files/wait-for-android-emulator
script:
- - ./gradlew -Pandroid.testInstrumentationRunnerArguments.class=org.linphone.call.OutgoingCallUITests -PscreportAutoClose=true connectedAndroidTest
+ - ./gradlew -Pandroid.testInstrumentationRunnerArguments.class=org.linphone.testsuites.CallTestSuite -PscreportAutoClose=true connectedAndroidTest
- ${ANDROID_HOME}/platform-tools/adb -s emulator-5554 emu kill
- ${ANDROID_HOME}/platform-tools/adb -s emulator-5554 emu kill
- ${ANDROID_HOME}/platform-tools/adb kill-server
after_script:
- - ${UTILS}/html2xml-report -p app/build/reports/androidTests/connected/
- mkdir results && mv app/build/reports/androidTests/connected/* results
+ - python3 .gitlab-ci-files/html2xml-report.py -p results
artifacts:
paths:
diff --git a/.gitlab-ci-files/wait-for-android-emulator b/.gitlab-ci-files/wait-for-android-emulator
new file mode 100755
index 000000000..e706c2afd
--- /dev/null
+++ b/.gitlab-ci-files/wait-for-android-emulator
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# Originally written by Ralf Kistner , but placed in the public domain
+
+set +e
+
+bootanim=""
+failcounter=0
+timeout_in_sec=360
+
+until [[ "$bootanim" =~ "stopped" ]]; do
+ bootanim=`adb -e shell getprop init.svc.bootanim 2>&1 &`
+ if [[ "$bootanim" =~ "device not found" || "$bootanim" =~ "device offline"
+ || "$bootanim" =~ "running" ]]; then
+ let "failcounter += 1"
+ if [[ $failcounter = 1 ]]; then
+ echo -n "Waiting for emulator to start"; else
+ echo -n "."
+ fi
+ if [[ $failcounter -gt timeout_in_sec ]]; then
+ echo "Timeout ($timeout_in_sec seconds) reached; failed to start emulator"
+ exit 1
+ fi
+ fi
+ sleep 1
+done
+
+echo "Emulator is ready"