Skip to content

Commit

Permalink
fix: optimize report and add appium test report
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoweii committed Jan 9, 2024
1 parent 52f221d commit a87dcd3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,17 @@ jobs:
if: success() || failure()
with:
report_paths: 'integrationtest/devicefarm/report/*.xml'
require_tests: true
detailed_summary: true
update_check: true
include_passed: true
fail_on_failure: true
job_name: logcat test
- name: Upload test result
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test-result
path: |
integrationtest/devicefarm/report/
integrationtest/devicefarm/MyAndroidAppTest-*/**
require_tests: true
detailed_summary: true
update_check: true
include_passed: true
fail_on_failure: true
integrationtest/devicefarm/MyAndroidAppTest-*/**
16 changes: 16 additions & 0 deletions integrationtest/devicefarm/automate_device_farm.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import boto3
import requests
import yaml
import zipfile
import shutil

# The following script runs a test through Device Farm
client = boto3.client('devicefarm')
Expand Down Expand Up @@ -139,10 +141,24 @@ def download_artifacts(jobs_response, save_path):
with open(artifact_save_path, 'wb') as fn, \
requests.get(artifact['url'], allow_redirects=True) as request:
fn.write(request.content)
if str(filename).endswith(".zip"):
unzip_and_copy(filename)
return logcat_paths


def save_logcat_path(logcat_paths):
with open('path.yaml', 'w') as file:
yaml.dump(logcat_paths, file, default_flow_style=False)
print("Logcat paths saved successful")


def unzip_and_copy(zip_path):
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
zip_ref.extractall(os.path.dirname(zip_path))
origin_path = os.path.dirname(zip_path) + "/Host_Machine_Files/$DEVICEFARM_LOG_DIR/junitreport.xml"
rename_path = os.path.dirname(origin_path) + "/" + os.path.basename(
os.path.dirname(zip_path)) + " appium junitreport.xml"
os.rename(origin_path, rename_path)
report_path = os.path.dirname(os.path.dirname(os.path.dirname(zip_path))) + "/report/"
os.makedirs(report_path)
shutil.copy(rename_path, report_path)

0 comments on commit a87dcd3

Please sign in to comment.