mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-18 03:48:08 +00:00
update gitlab-ci
This commit is contained in:
parent
945d444c47
commit
4e2663779d
3 changed files with 120 additions and 4 deletions
88
.gitlab-ci-files/html2xml-reports.py
Executable file
88
.gitlab-ci-files/html2xml-reports.py
Executable file
|
|
@ -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()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -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:
|
||||
|
|
|
|||
28
.gitlab-ci-files/wait-for-android-emulator
Executable file
28
.gitlab-ci-files/wait-for-android-emulator
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Originally written by Ralf Kistner <ralf@embarkmobile.com>, 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"
|
||||
Loading…
Add table
Reference in a new issue