2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00
iceraven-browser/automation/taskcluster/upload_apk_nimbledroid.py
Emma Malysz f7d91c6343 [fenix] For perf-frontend-issueshttps://github.com/mozilla-mobile/fenix/issues/16: switch device_config parameter for Nimbledroid to be Android7 (https://github.com/mozilla-mobile/fenix/pull/6985)
* For perf-frontend-issueshttps://github.com/mozilla-mobile/fenix/issues/16: specify device_config parameter to be 'android7' when running Nimbledroid tests. This will switch the tests from running Android5 to Android7, which is a better representation of our user's experience

* Ensure we can test with both Android5 and Android7
2019-12-18 08:40:35 -08:00

43 lines
1.1 KiB
Python

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
This script talks to the taskcluster secrets service to obtain the
Nimbledroid account key and upload Klar and Focus apk to Nimbledroid for perf analysis.
"""
import requests
import json
import urllib2
import os
import sys
url = "https://nimbledroid.com/api/v2/apks"
def uploadApk(apk,key):
headers = {"Accept":"*/*"}
payload = {'auto_scenarios':'false', 'device_config': 'android5,android7'}
response = requests.post(url, auth=(key, ''), headers=headers, files=apk, data=payload)
if response.status_code != 201:
print('Status:', response.status_code, 'Headers:', response.headers, 'Error Response:',response.json())
exit(1)
# Print Response Details
print 'Response Status Code:', response.status_code
print ''
print('Reponse Payload:')
print json.dumps(response.json(), indent=4)
apk_path = sys.argv[1]
token_file = sys.argv[2]
with open(token_file) as f:
key = f.read()
with open(apk_path) as apk_file:
uploadApk({'apk': apk_file}, key)