Skip to content

Commit

Permalink
1. 统一用例编辑页面。
Browse files Browse the repository at this point in the history
2. 支持测试系统应用(开关在Soloπ设置中)
3. 支持设置自定义数据存放路径。
4. 支持设置性能录制导出编码,默认编码为GBK。
5. 支持批量回放设置执行顺序。
7. 支持保存用例回放结果。
8. 扩充响应耗时对比差异度。
  • Loading branch information
soloPi committed Jul 18, 2019
1 parent e8e84d6 commit 389e0dc
Show file tree
Hide file tree
Showing 68 changed files with 2,127 additions and 839 deletions.
1 change: 0 additions & 1 deletion src/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ dependencies {
implementation 'com.alibaba:fastjson:1.1.71.android'
implementation 'org.greenrobot:greendao:3.2.2'
implementation 'com.squareup.okhttp3:okhttp:3.12.3'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'com.dlazaro66.qrcodereaderview:qrcodereaderview:2.0.3'
implementation 'com.liulishuo.filedownloader:library:1.7.6'
implementation 'com.hyman:flowlayout-lib:1.1.2'
Expand Down
20 changes: 8 additions & 12 deletions src/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,6 @@ void *(**On*Event);
# OkHttp platform used only on JVM and when Conscrypt dependency is available.
-dontwarn okhttp3.internal.platform.ConscryptPlatform

#eventbus
-keepclassmembers class ** {
@org.greenrobot.eventbus.Subscribe <methods>;
}

# injector
-keepclassmembers class ** {
@com.alipay.hulu.common.injector.param.Subscriber <methods>;
Expand Down Expand Up @@ -227,7 +222,9 @@ public static java.lang.String TABLENAME;
public *;
}

-keep class ** implements com.alipay.hulu.shared.display.items.base.Displayable {*;}
-keep class ** implements com.alipay.hulu.shared.display.items.base.Displayable {
public void clear();
}

-keep interface com.alipay.hulu.common.service.base.ExportService { *; }
-keep @interface com.alipay.hulu.common.service.base.LocalService {*;}
Expand All @@ -238,19 +235,18 @@ public com.alipay.hulu.common.utils.patch.PatchContext getContext();

-keep interface ** extends com.alipay.hulu.common.service.base.ExportService { *; }

-keep enum org.greenrobot.eventbus.ThreadMode { *; }
# Only required if you use AsyncExecutor
-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
<init>(java.lang.Throwable);
}

-dontwarn android.support.v4.**
-keep class android.support.** {*;}
-keepattributes Exceptions,InnerClasses,Signature
#视频直播混淆
#fastjson
-dontwarn com.alibaba.fastjson.**
-keep class com.alibaba.fastjson.** { *; }

# 性能数据上报混淆
-keep class com.alipay.hulu.util.RecordUtil$RecordUploadData { *; }
-keep class com.alipay.hulu.util.RecordUtil$UploadData { *; }

# fresco
-dontwarn javax.annotation.**
#保留混淆mapping文件
Expand Down
16 changes: 5 additions & 11 deletions src/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
~ limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.alipay.hulu"
android:versionCode="25"
android:versionName="0.1.0">
android:versionCode="26"
android:versionName="0.9.1">


<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
Expand Down Expand Up @@ -49,7 +50,8 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
tools:replace="android:theme">

<activity
android:name=".activity.SplashActivity"
Expand Down Expand Up @@ -108,11 +110,6 @@
android:label="扫码"
android:launchMode="singleInstance"
android:screenOrientation="portrait"/>
<activity
android:name=".shared.node.utils.activity.DownloadActivity"
android:label="下载"
android:launchMode="singleTask"
android:screenOrientation="portrait"/>

<activity android:name=".activity.BatchExecutionActivity"
android:label="批量执行"
Expand All @@ -124,9 +121,6 @@
<activity android:name=".activity.LicenseActivity"
android:label="版权声明"
android:screenOrientation="portrait" />
<activity android:name=".activity.CaseStepEditActivity"
android:label="用例编辑"
android:screenOrientation="portrait"/>
<activity android:name=".screenRecord.RecorderConfigActivity" />

<service android:name=".service.FloatWinService"/>
Expand Down
36 changes: 18 additions & 18 deletions src/app/src/main/assets/NOTICE.html

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions src/app/src/main/java/com/alipay/hulu/activity/BaseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
Expand All @@ -30,6 +32,9 @@
import com.alipay.hulu.common.utils.DeviceInfoUtil;
import com.alipay.hulu.common.utils.LogUtil;

import java.util.HashSet;
import java.util.Set;

/**
* Created by lezhou.wyl on 2018/1/28.
*/
Expand All @@ -39,6 +44,8 @@ public abstract class BaseActivity extends AppCompatActivity {

private boolean canShowDialog;

private Set<String> fragmentTags = new HashSet<>();

private static Toast toast;

private ProgressDialog progressDialog;
Expand Down Expand Up @@ -212,4 +219,30 @@ private void getScreenSizeInfo() {
getWindowManager().getDefaultDisplay().getSize(DeviceInfoUtil.curScreenSize);
getWindowManager().getDefaultDisplay().getMetrics(DeviceInfoUtil.metrics);
}

/**
* 添加Fragment tag信息
* @param tag
*/
public void addFragmentTag(String tag) {
fragmentTags.add(tag);
}

public Set<String> getAllFragmentTags() {
return new HashSet<>(fragmentTags);
}

/**
* 根据tag查找fragment
* @param tag
* @return
*/
public Fragment getFragmentByTag(String tag) {
FragmentManager supported = getSupportFragmentManager();
if (supported != null) {
return supported.findFragmentByTag(tag);
}

return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,52 @@
package com.alipay.hulu.activity;

import android.os.Bundle;
import android.provider.Settings;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.TextView;

import com.alipay.hulu.R;
import com.alipay.hulu.adapter.BatchExecutionListAdapter;
import com.alipay.hulu.common.application.LauncherApplication;
import com.alipay.hulu.common.utils.MiscUtil;
import com.alipay.hulu.common.utils.PermissionUtil;
import com.alipay.hulu.fragment.BatchExecutionFragment;
import com.alipay.hulu.replay.BatchStepProvider;
import com.alipay.hulu.service.CaseReplayManager;
import com.alipay.hulu.shared.io.bean.RecordCaseInfo;
import com.alipay.hulu.ui.HeadControlPanel;
import com.alipay.hulu.common.utils.MiscUtil;
import com.zhy.view.flowlayout.FlowLayout;
import com.zhy.view.flowlayout.TagAdapter;
import com.zhy.view.flowlayout.TagFlowLayout;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
* Created by lezhou.wyl on 2018/8/19.
*/

public class BatchExecutionActivity extends BaseActivity {
public class BatchExecutionActivity extends BaseActivity
implements BatchExecutionListAdapter.Delegate , TagFlowLayout.OnTagClickListener{

private ViewPager mPager;
private CheckBox mRestartApp;
private TabLayout mTabLayout;
private HeadControlPanel mHeadPanel;
private TagFlowLayout tagGroup;
private final List<RecordCaseInfo> currentCases = new ArrayList<>();
private TagAdapter<RecordCaseInfo> tagAdapter;

private Button startExecutionBtn;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
Expand All @@ -57,8 +79,7 @@ public void onClick(View v) {
finish();
}
});
//FIXME 暂时不显示Header
mHeadPanel.setVisibility(View.GONE);

mPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(mTabLayout));
mTabLayout.setupWithViewPager(mPager);
mTabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
Expand All @@ -71,11 +92,78 @@ public void run() {
}
});

// 选择项
currentCases.clear();
tagAdapter = new TagAdapter<RecordCaseInfo>(currentCases) {
@Override
public View getView(FlowLayout parent, int position, RecordCaseInfo o) {
View tag = LayoutInflater.from(BatchExecutionActivity.this).inflate(R.layout.item_batch_execute_tag, parent, false);
TextView title = (TextView) tag.findViewById(R.id.batch_execute_tag_name);
title.setText(o.getCaseName());
return tag;
}
};
tagGroup = (TagFlowLayout) findViewById(R.id.batch_execute_tag_group);
tagGroup.setMaxSelectCount(0);
tagGroup.setAdapter(tagAdapter);
tagGroup.setOnTagClickListener(this);

CustomPagerAdapter pagerAdapter = new CustomPagerAdapter(getSupportFragmentManager());
mPager.setAdapter(pagerAdapter);
mRestartApp = (CheckBox) findViewById(R.id.batch_execute_restart);

startExecutionBtn = (Button) findViewById(R.id.batch_execute_start_btn);

startExecutionBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (currentCases.size() == 0) {
toastShort("请选择用例");
return;
}

PermissionUtil.OnPermissionCallback callback = new PermissionUtil.OnPermissionCallback() {
@Override
public void onPermissionResult(boolean result, String reason) {
if (result) {
BatchStepProvider provider = new BatchStepProvider(new ArrayList<>(currentCases), mRestartApp.isChecked());
CaseReplayManager manager = LauncherApplication.getInstance().findServiceByName(CaseReplayManager.class.getName());
manager.start(provider, MyApplication.MULTI_REPLAY_LISTENER);
}
}
};
checkPermissions(callback);
}
});

}

@Override
public void onItemAdd(RecordCaseInfo caseInfo) {
currentCases.add(caseInfo);
updateExecutionTag();
}

public void updateExecutionTag() {
tagAdapter.notifyDataChanged();
}

@Override
public boolean onTagClick(View view, int position, FlowLayout parent) {
currentCases.remove(position);
updateExecutionTag();
return false;
}

/**
* 检察权限
* @param callback
*/
private void checkPermissions(PermissionUtil.OnPermissionCallback callback) {
// 高权限,悬浮窗权限判断
PermissionUtil.requestPermissions(Arrays.asList("adb", Settings.ACTION_ACCESSIBILITY_SETTINGS),
this, callback);
}

private static class CustomPagerAdapter extends FragmentPagerAdapter {

Expand All @@ -99,7 +187,4 @@ public int getCount() {
return PAGES.length;
}
}



}

0 comments on commit 389e0dc

Please sign in to comment.