Add support for testfairy plugin

Change-Id: I09226dc3bee88b4c1ecb6649ff7b971fce2541c7
Signed-off-by: Kien Ha <kienha9922@gmail.com>
This commit is contained in:
Kien Ha 2015-12-25 20:14:25 -05:00
parent e8424c9c64
commit 17bf636afa
14 changed files with 382 additions and 1 deletions

View File

@ -438,6 +438,40 @@ def append_git_revision_config(parent, config_def):
XML.SubElement(params, 'combineQueuedCommits').text = combine_commits
def test_fairy_common(xml_element, data):
xml_element.set('plugin', 'TestFairy')
mappings = [
# General
('apikey', 'apiKey', None),
('appfile', 'appFile', None),
('tester-groups', 'testersGroups', ''),
('notify-testers', 'notifyTesters', True),
('autoupdate', 'autoUpdate', True),
# Session
('max-duration', 'maxDuration', '10m'),
('record-on-background', 'recordOnBackground', False),
('data-only-wifi', 'dataOnlyWifi', False),
# Video
('video-enabled', 'isVideoEnabled', True),
('screenshot-interval', 'screenshotInterval', '1'),
('video-quality', 'videoQuality', 'high'),
# Metrics
('cpu', 'cpu', True),
('memory', 'memory', True),
('logs', 'logs', True),
('network', 'network', False),
('phone-signal', 'phoneSignal', False),
('wifi', 'wifi', False),
('gps', 'gps', False),
('battery', 'battery', False),
('opengl', 'openGl', False),
# Advanced options
('advanced-options', 'advancedOptions', '')
]
convert_mapping_to_xml(xml_element, data, mappings, fail_required=True)
def convert_mapping_to_xml(parent, data, mapping, fail_required=False):
"""Convert mapping to XML

View File

@ -48,9 +48,10 @@ from jenkins_jobs.modules.helpers import cloudformation_init
from jenkins_jobs.modules.helpers import cloudformation_region_dict
from jenkins_jobs.modules.helpers import cloudformation_stack
from jenkins_jobs.modules.helpers import config_file_provider_settings
from jenkins_jobs.modules.helpers import convert_mapping_to_xml
from jenkins_jobs.modules.helpers import findbugs_settings
from jenkins_jobs.modules.helpers import get_value_from_yaml_or_config_file
from jenkins_jobs.modules.helpers import convert_mapping_to_xml
from jenkins_jobs.modules.helpers import test_fairy_common
def archive(parser, xml_parent, data):
@ -2812,6 +2813,106 @@ def artifactory(parser, xml_parent, data):
artifactory_env_vars_patterns(artifactory, data)
def test_fairy(parser, xml_parent, data):
"""yaml: test-fairy
This plugin helps you to upload Android APKs or iOS IPA files to
www.testfairy.com.
Requires the Jenkins :jenkins-wiki:`Test Fairy Plugin
<TestFairy+Plugin>`.
:arg str platform: Select platform to upload to, **android** or **ios**
(required)
Android Only:
:arg str proguard-file: Path to Proguard file. Path of mapping.txt from
your proguard output directory. (default: '')
:arg str storepass: Password for the keystore (default: android)
:arg str alias: alias for key (default: androiddebugkey)
:arg str keypass: password for the key (default: '')
:arg str keystorepath: Path to Keystore file (required)
IOS Only:
:arg str dSYM-file: Path to .dSYM.zip file (default: '')
All:
:arg str apikey: TestFairy API_KEY. Find it in your TestFairy account
settings (required)
:arg str appfile: Path to App file (.apk) or (.ipa). For example:
$WORKSPACE/[YOUR_FILE_NAME].apk or full path to the apk file.
(required)
:arg str tester-groups: Tester groups to notify (default: '')
:arg bool notify-testers: Send email with changelogs to testers
(default: False)
:arg bool autoupdate: Automatic update (default False)
:arg str max-duration: Duration of the session (default: 10m)
:arg bool record-on-background: Record on background (default: False)
:arg bool data-only-wifi: Record data only in wifi (default: False)
:arg bool video-enabled: Record video (default: True)
:arg str screenshot-interval: Time interval between screenshots
(default: 1)
:arg str video-quality: Video quality (default: high)
:arg bool cpu: Enable CPU metrics (default: True)
:arg bool memory: Enable memory metrics (default: True)
:arg bool logs: Enable logs metrics (default: True)
:arg bool network: Enable network metrics (default: False)
:arg bool phone-signal: Enable phone signal metrics (default: False)
:arg bool wifi: Enable wifi metrics (default: False)
:arg bool gps: Enable gps metrics (default: False)
:arg bool battery: Enable battery metrics (default: False)
:arg bool opengl: Enable opengl metrics (default: False)
Example:
.. literalinclude::
/../../tests/publishers/fixtures/test-fairy-android-minimal.yaml
:language: yaml
.. literalinclude::
/../../tests/publishers/fixtures/test-fairy-android001.yaml
:language: yaml
.. literalinclude::
/../../tests/publishers/fixtures/test-fairy-ios-minimal.yaml
:language: yaml
.. literalinclude::
/../../tests/publishers/fixtures/test-fairy-ios001.yaml
:language: yaml
"""
platform = data.get('platform')
valid_platforms = ['android', 'ios']
if 'platform' not in data:
raise MissingAttributeError('platform')
if platform == 'android':
root = XML.SubElement(
xml_parent,
'org.jenkinsci.plugins.testfairy.TestFairyAndroidRecorder')
test_fairy_common(root, data)
mappings = [
('proguard-file', 'mappingFile', ''),
('keystorepath', 'keystorePath', None),
('storepass', 'storepass', 'android'),
('alias', 'alias', 'androiddebugkey'),
('keypass', 'keypass', '')]
convert_mapping_to_xml(root, data, mappings, fail_required=True)
elif platform == 'ios':
root = XML.SubElement(
xml_parent, 'org.jenkinsci.plugins.testfairy.TestFairyIosRecorder')
test_fairy_common(root, data)
mappings = [('dSYM-file', 'mappingFile', '')]
convert_mapping_to_xml(root, data, mappings, fail_required=True)
else:
raise InvalidAttributeError('platform', platform, valid_platforms)
def text_finder(parser, xml_parent, data):
"""yaml: text-finder
This plugin lets you search keywords in the files you specified and

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<org.jenkinsci.plugins.testfairy.TestFairyAndroidRecorder plugin="TestFairy">
<apiKey>apikey</apiKey>
<appFile>/tmp/appfile.apk</appFile>
<testersGroups/>
<notifyTesters>true</notifyTesters>
<autoUpdate>true</autoUpdate>
<maxDuration>10m</maxDuration>
<recordOnBackground>false</recordOnBackground>
<dataOnlyWifi>false</dataOnlyWifi>
<isVideoEnabled>true</isVideoEnabled>
<screenshotInterval>1</screenshotInterval>
<videoQuality>high</videoQuality>
<cpu>true</cpu>
<memory>true</memory>
<logs>true</logs>
<network>false</network>
<phoneSignal>false</phoneSignal>
<wifi>false</wifi>
<gps>false</gps>
<battery>false</battery>
<openGl>false</openGl>
<advancedOptions/>
<mappingFile/>
<keystorePath>/tmp/keystorefile</keystorePath>
<storepass>android</storepass>
<alias>androiddebugkey</alias>
<keypass/>
</org.jenkinsci.plugins.testfairy.TestFairyAndroidRecorder>
</publishers>
</project>

View File

@ -0,0 +1,6 @@
publishers:
- test-fairy:
platform: android
apikey: apikey
appfile: /tmp/appfile.apk
keystorepath: /tmp/keystorefile

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<org.jenkinsci.plugins.testfairy.TestFairyAndroidRecorder plugin="TestFairy">
<apiKey>apikey</apiKey>
<appFile>/tmp/appfile.apk</appFile>
<testersGroups>testergroups</testersGroups>
<notifyTesters>true</notifyTesters>
<autoUpdate>true</autoUpdate>
<maxDuration>10m</maxDuration>
<recordOnBackground>false</recordOnBackground>
<dataOnlyWifi>false</dataOnlyWifi>
<isVideoEnabled>true</isVideoEnabled>
<screenshotInterval>1</screenshotInterval>
<videoQuality>high</videoQuality>
<cpu>true</cpu>
<memory>true</memory>
<logs>true</logs>
<network>false</network>
<phoneSignal>false</phoneSignal>
<wifi>false</wifi>
<gps>false</gps>
<battery>false</battery>
<openGl>false</openGl>
<advancedOptions/>
<mappingFile>/tmp/proguardfile</mappingFile>
<keystorePath>/tmp/keystorefile</keystorePath>
<storepass>android</storepass>
<alias>androiddebugkey</alias>
<keypass>keypass</keypass>
</org.jenkinsci.plugins.testfairy.TestFairyAndroidRecorder>
</publishers>
</project>

View File

@ -0,0 +1,13 @@
publishers:
- test-fairy:
platform: android
apikey: apikey
appfile: /tmp/appfile.apk
proguard-file: /tmp/proguardfile
keystorepath: /tmp/keystorefile
storepass: android
alias: androiddebugkey
keypass: keypass
tester-groups: testergroups
notify-testers: true
autoupdate: true

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<org.jenkinsci.plugins.testfairy.TestFairyAndroidRecorder plugin="TestFairy">
<apiKey>apikey</apiKey>
<appFile>/tmp/appfile.apk</appFile>
<testersGroups/>
<notifyTesters>false</notifyTesters>
<autoUpdate>false</autoUpdate>
<maxDuration>10m</maxDuration>
<recordOnBackground>false</recordOnBackground>
<dataOnlyWifi>false</dataOnlyWifi>
<isVideoEnabled>true</isVideoEnabled>
<screenshotInterval>1</screenshotInterval>
<videoQuality>high</videoQuality>
<cpu>false</cpu>
<memory>false</memory>
<logs>false</logs>
<network>true</network>
<phoneSignal>true</phoneSignal>
<wifi>true</wifi>
<gps>true</gps>
<battery>true</battery>
<openGl>true</openGl>
<advancedOptions/>
<mappingFile/>
<keystorePath>/tmp/keystorefile</keystorePath>
<storepass>android</storepass>
<alias>androiddebugkey</alias>
<keypass/>
</org.jenkinsci.plugins.testfairy.TestFairyAndroidRecorder>
</publishers>
</project>

View File

@ -0,0 +1,17 @@
publishers:
- test-fairy:
platform: android
apikey: apikey
appfile: /tmp/appfile.apk
keystorepath: /tmp/keystorefile
notify-testers: false
autoupdate: false
cpu: false
memory: false
logs: false
network: true
phone-signal: true
wifi: true
gps: true
battery: true
opengl: true

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<org.jenkinsci.plugins.testfairy.TestFairyIosRecorder plugin="TestFairy">
<apiKey>apikey</apiKey>
<appFile>/tmp/appfile.ipa</appFile>
<testersGroups/>
<notifyTesters>true</notifyTesters>
<autoUpdate>true</autoUpdate>
<maxDuration>10m</maxDuration>
<recordOnBackground>false</recordOnBackground>
<dataOnlyWifi>false</dataOnlyWifi>
<isVideoEnabled>true</isVideoEnabled>
<screenshotInterval>1</screenshotInterval>
<videoQuality>high</videoQuality>
<cpu>true</cpu>
<memory>true</memory>
<logs>true</logs>
<network>false</network>
<phoneSignal>false</phoneSignal>
<wifi>false</wifi>
<gps>false</gps>
<battery>false</battery>
<openGl>false</openGl>
<advancedOptions/>
<mappingFile/>
</org.jenkinsci.plugins.testfairy.TestFairyIosRecorder>
</publishers>
</project>

View File

@ -0,0 +1,5 @@
publishers:
- test-fairy:
platform: ios
apikey: apikey
appfile: /tmp/appfile.ipa

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<org.jenkinsci.plugins.testfairy.TestFairyIosRecorder plugin="TestFairy">
<apiKey>apikey</apiKey>
<appFile>/tmp/appfile.ipa</appFile>
<testersGroups>testergroups</testersGroups>
<notifyTesters>true</notifyTesters>
<autoUpdate>true</autoUpdate>
<maxDuration>10m</maxDuration>
<recordOnBackground>false</recordOnBackground>
<dataOnlyWifi>false</dataOnlyWifi>
<isVideoEnabled>true</isVideoEnabled>
<screenshotInterval>1</screenshotInterval>
<videoQuality>high</videoQuality>
<cpu>true</cpu>
<memory>true</memory>
<logs>true</logs>
<network>false</network>
<phoneSignal>false</phoneSignal>
<wifi>false</wifi>
<gps>false</gps>
<battery>false</battery>
<openGl>false</openGl>
<advancedOptions/>
<mappingFile>/tmp/dsym.zip</mappingFile>
</org.jenkinsci.plugins.testfairy.TestFairyIosRecorder>
</publishers>
</project>

View File

@ -0,0 +1,9 @@
publishers:
- test-fairy:
platform: ios
apikey: apikey
appfile: /tmp/appfile.ipa
dSYM-file: /tmp/dsym.zip
tester-groups: testergroups
notify-testers: true
autoupdate: true

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<org.jenkinsci.plugins.testfairy.TestFairyIosRecorder plugin="TestFairy">
<apiKey>apikey</apiKey>
<appFile>/tmp/appfile.ipa</appFile>
<testersGroups/>
<notifyTesters>false</notifyTesters>
<autoUpdate>false</autoUpdate>
<maxDuration>10m</maxDuration>
<recordOnBackground>false</recordOnBackground>
<dataOnlyWifi>false</dataOnlyWifi>
<isVideoEnabled>true</isVideoEnabled>
<screenshotInterval>1</screenshotInterval>
<videoQuality>high</videoQuality>
<cpu>false</cpu>
<memory>false</memory>
<logs>false</logs>
<network>false</network>
<phoneSignal>false</phoneSignal>
<wifi>false</wifi>
<gps>false</gps>
<battery>false</battery>
<openGl>false</openGl>
<advancedOptions/>
<mappingFile/>
</org.jenkinsci.plugins.testfairy.TestFairyIosRecorder>
</publishers>
</project>

View File

@ -0,0 +1,10 @@
publishers:
- test-fairy:
platform: ios
apikey: apikey
appfile: /tmp/appfile.ipa
notify-testers: false
autoupdate: false
cpu: false
memory: false
logs: false