Skip to content

Commit

Permalink
lint + forgot to update flags in yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
carzh committed Sep 17, 2024
1 parent 4cd317e commit 1a2ae52
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ jobs:
cd tools/python
pip install requests
python upload_and_run_browserstack_tests.py \
--test_platform espresso \
--id $(browserstack_username) \
--token $(browserstack_access_key) \
--app_apk_path "$(Build.BinariesDirectory)/android_test/android/app/build/outputs/apk/debug/app-debug.apk" \
Expand Down
17 changes: 11 additions & 6 deletions tools/python/upload_and_run_browserstack_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@
parser.add_argument("--test_platform", type=str, help="Testing platform, i.e., XCUITest or Espresso")
parser.add_argument("--app_apk_path", type=str, help="Path to the app APK")
parser.add_argument("--test_apk_path", type=str, help="Path to the test suite APK")
parser.add_argument("--devices", type=str, nargs="+", help="List of devices to run the tests on. For more info, " +
"see https://www.browserstack.com/docs/app-automate/espresso/specify-devices")
parser.add_argument(
"--devices",
type=str,
nargs="+",
help="List of devices to run the tests on. For more info, "
"see https://www.browserstack.com/docs/app-automate/espresso/specify-devices",
)

args = parser.parse_args()


def post_response_to_json(response):
if len(response) == 0:
raise Exception("No response from BrowserStack")
Expand All @@ -37,10 +43,10 @@ def upload_apk_parse_json(post_url, apk_path):


upload_app_json = upload_apk_parse_json(
"https://api-cloud.browserstack.com/app-automate/{test_platform}/v2/app".format(test_platform = args.test_platform), args.app_apk_path
f"https://api-cloud.browserstack.com/app-automate/{args.test_platform}/v2/app", args.app_apk_path
)
upload_test_json = upload_apk_parse_json(
"https://api-cloud.browserstack.com/app-automate/{test_platform}/v2/test-suite".format(test_platform = args.test_platform), args.test_apk_path
f"https://api-cloud.browserstack.com/app-automate/{args.test_platform}/v2/test-suite", args.test_apk_path
)

headers = {}
Expand Down Expand Up @@ -68,8 +74,7 @@ def upload_apk_parse_json(post_url, apk_path):
time.sleep(30)
test_response = requests.get(
"https://api-cloud.browserstack.com/app-automate/{test_platform}/v2/builds/{build_id}".format(
test_platform = args.test_platform,
build_id=build_response_json["build_id"]
test_platform=args.test_platform, build_id=build_response_json["build_id"]
),
auth=(args.id, args.token),
)
Expand Down

0 comments on commit 1a2ae52

Please sign in to comment.