Skip to content

Commit

Permalink
update dialog prettify, delete step file, remove video files
Browse files Browse the repository at this point in the history
  • Loading branch information
soloPi committed Jul 19, 2019
1 parent c911e41 commit 0502227
Show file tree
Hide file tree
Showing 14 changed files with 113 additions and 27 deletions.
10 changes: 10 additions & 0 deletions NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,16 @@ limitations under the License.

> Apache License 2.0: http://www.apache.org/licenses/LICENSE-2.0
## commonmark-java

> https://github.com/atlassian/commonmark-java
Copyright (c) 2015-2019 Atlassian and others.

BSD (2-clause) licensed, see LICENSE.txt file.

> BSD (2-clause): https://opensource.org/licenses/BSD-2-Clause
## logger

> https://github.com/orhanobut/logger
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@

![录制回放](assets/replay.gif)

**[游戏录制回放使用视频](videos/游戏自动化.mp4)**
**[游戏录制回放使用视频](https://gw.alipayobjects.com/mdn/rms_e29b5f/afts/file/A*ym07T6nACDIAAAAAAAAAAABkARQnAQ)**

**[Native应用录制回放使用视频](videos/垃圾邮件处理.mov)**
**[Native应用录制回放使用视频](https://gw.alipayobjects.com/os/basement_prod/3472d35c-bd57-4c82-8112-5dcde42fcb32.mov)**

Soloπ拥有录制操作的能力,用户只需要通过Soloπ执行用例步骤,Soloπ就能够将用户的操作记录下来,并且支持在各个设备上进行回放,这一切都能够在手机上独立完成。详见[录制回放](../../wikis/RecordCase)一篇。

#### 性能工具

![性能工具](assets/performance.gif)

**[性能工具使用视频](videos/性能工具.mov)**
**[性能工具使用视频](https://gw.alipayobjects.com/os/basement_prod/1996390b-9ec8-4046-8ce8-459afa05d6c5.mov)**

**[响应耗时计算使用视频](videos/响应耗时计算.mov)**
**[响应耗时计算使用视频](https://gw.alipayobjects.com/os/basement_prod/4e82ca85-13fc-4de2-82ff-a9079344f5ef.mov)**

Soloπ能够记录待测应用的各项指标,你可以在悬浮窗中观察实时更新的数据,也可以对性能数据进行录制,在录制结束后查看图表;同时,Soloπ还支持性能加压,能够对CPU、内存与网络环境进行限制,复现应用在性能较差、网络环境不佳场景下的表现。

Expand All @@ -33,7 +33,7 @@ Soloπ能够记录待测应用的各项指标,你可以在悬浮窗中观察

![一机多控](assets/oneToMany.gif)

**[一机多控使用视频](videos/一机多控.mov)**
**[一机多控使用视频](https://gw.alipayobjects.com/os/basement_prod/971b5467-3db0-4781-86e3-15b3907323f6.mov)**

Soloπ支持通过操作一台主机设备来控制多台从机设备,不需要在各个设备上分别进行重复冗杂的兼容性测试,能够极大提升兼容性测试的效率。详见[一机多控](../../wikis/OneToMany)一篇。

Expand Down
23 changes: 23 additions & 0 deletions licenses/COPY.BSD2CLAUSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Copyright (c) 2015-2016, Atlassian Pty Ltd
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1 change: 1 addition & 0 deletions src/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ dependencies {
implementation 'com.liulishuo.filedownloader:library:1.7.6'
implementation 'com.hyman:flowlayout-lib:1.1.2'
implementation 'com.yydcdut:sdlv:0.7.6'
implementation 'com.atlassian.commonmark:commonmark:0.13.0'

implementation('com.theartofdev.edmodo:android-image-cropper:2.5.1') {
exclude group: "com.android.support"
Expand Down
20 changes: 10 additions & 10 deletions src/app/src/main/assets/NOTICE.html

Large diffs are not rendered by default.

38 changes: 35 additions & 3 deletions src/app/src/main/java/com/alipay/hulu/activity/IndexActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;
Expand All @@ -42,7 +44,7 @@
import com.alipay.hulu.common.service.SPService;
import com.alipay.hulu.common.tools.BackgroundExecutor;
import com.alipay.hulu.common.utils.ClassUtil;
import com.alipay.hulu.common.utils.DeviceInfoUtil;
import com.alipay.hulu.common.utils.ContextUtil;
import com.alipay.hulu.common.utils.FileUtils;
import com.alipay.hulu.common.utils.LogUtil;
import com.alipay.hulu.common.utils.PermissionUtil;
Expand All @@ -54,6 +56,10 @@
import com.alipay.hulu.util.UpgradeUtil;
import com.alipay.hulu.util.ZipUtil;

import org.commonmark.node.Node;
import org.commonmark.parser.Parser;
import org.commonmark.renderer.html.HtmlRenderer;

import java.io.File;
import java.io.FileFilter;
import java.io.FilenameFilter;
Expand Down Expand Up @@ -100,13 +106,39 @@ public void onNoUpdate() {

@Override
public void onNewUpdate(final GithubReleaseBean release) {
Parser parser = Parser.builder().build();
Node document = parser.parse(release.getBody());

// text size 16dp
int px = ContextUtil.dip2px(IndexActivity.this, 16);
HtmlRenderer renderer = HtmlRenderer.builder().build();
String css = "<html><header><style type=\"text/css\"> img {" +
"width:100%;" +
"height:auto;" +
"}" +
"body {" +
"margin-right:30px;" +
"margin-left:30px;" +
"margin-top:30px;" +
"font-size:" + px + "px;" +
"word-wrap:break-word;"+
"}" +
"</style></header>";
final String content = css + renderer.render(document) + "</html>";

runOnUiThread(new Runnable() {
@Override
public void run() {
WebView webView = new WebView(IndexActivity.this);
WebSettings webSettings = webView.getSettings();
webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true);
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
webView.loadData(content, null, null);
new AlertDialog.Builder(IndexActivity.this).setTitle("发现新版本: " + release.getTag_name())
.setMessage(release.getBody())
.setView(webView)
.setPositiveButton("前往更新", new DialogInterface.OnClickListener() {
@Override

public void onClick(DialogInterface dialog, int which) {
Uri uri = Uri.parse(release.getHtml_url());
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import com.alipay.hulu.common.utils.LogUtil;
import com.alipay.hulu.common.utils.MiscUtil;
import com.alipay.hulu.common.utils.PermissionUtil;
import com.alipay.hulu.common.utils.StringUtil;
import com.alipay.hulu.replay.OperationStepProvider;
import com.alipay.hulu.replay.RepeatStepProvider;
import com.alipay.hulu.service.CaseReplayManager;
Expand Down Expand Up @@ -250,20 +251,38 @@ private void editCase(int position) {
private void deleteCase(final int position) {
AlertDialog dialog = new AlertDialog.Builder(getContext(), R.style.SimpleDialogTheme)
.setCancelable(false)
.setMessage("删除此用例?")
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
.setMessage(R.string.replay__delete_case)
.setPositiveButton(R.string.constant__confirm, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
public void onClick(final DialogInterface dialog, int which) {
final RecordCaseInfo recordCaseInfo = (RecordCaseInfo) mAdapter.getItem(position);
if (recordCaseInfo == null) {
return;
}
GreenDaoManager.getInstance().getRecordCaseInfoDao().deleteByKey(recordCaseInfo.getId());
InjectorService.g().pushMessage(NewRecordActivity.NEED_REFRESH_LOCAL_CASES_LIST);

dialog.dismiss();
// delete step file
BackgroundExecutor.execute(new Runnable() {
@Override
public void run() {
String operationLog = recordCaseInfo.getOperationLog();
if (!StringUtil.isEmpty(operationLog)) {
GeneralOperationLogBean logBean = JSON.parseObject(operationLog, GeneralOperationLogBean.class);
if (logBean != null && !StringUtil.isEmpty(logBean.getStorePath())) {
File steps = new File(logBean.getStorePath());
if (steps.exists()) {
FileUtils.deleteFile(steps);
}
}
}
GreenDaoManager.getInstance().getRecordCaseInfoDao().deleteByKey(recordCaseInfo.getId());
InjectorService.g().pushMessage(NewRecordActivity.NEED_REFRESH_LOCAL_CASES_LIST);

dialog.dismiss();
}
});

}
}).setNegativeButton("取消", new DialogInterface.OnClickListener() {
}).setNegativeButton(R.string.constant__cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
Expand Down Expand Up @@ -404,7 +423,7 @@ public void onPermissionResult(final boolean result, String reason) {
private void initEmptyView(View view) {
mEmptyView = view.findViewById(R.id.empty_view_container);
mEmptyTextView = (TextView) view.findViewById(R.id.empty_text);
mEmptyTextView.setText("您还没有录制用例哦");
mEmptyTextView.setText(R.string.record__no_local_case);
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,5 @@
<string name="record__case_name_empty">用例名不能为空</string>
<string name="record__name">录制回放</string>
<string name="index__disclaimer">免责声明</string>
<string name="replay__delete_case">删除此用例?</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ private static String execSafeCmd(String cmd, int retryCount) {
if (ERROR_NO_CONNECTION.equals(result) || ERROR_CONNECTION_ILLEGAL_STATE.equals(result)) {
generateConnection();
MiscUtil.sleep(2000);
} else if (ERROR_CONNECTION_COMMON_EXCEPTION.equals("result")) {
} else if (ERROR_CONNECTION_COMMON_EXCEPTION.equals(result)) {
MiscUtil.sleep(2000);
} else {
break;
Expand Down
Binary file removed videos/一机多控.mov
Binary file not shown.
Binary file removed videos/响应耗时计算.mov
Binary file not shown.
Binary file removed videos/垃圾邮件处理.mov
Binary file not shown.
Binary file removed videos/性能工具.mov
Binary file not shown.
Binary file removed videos/游戏自动化.mp4
Binary file not shown.

0 comments on commit 0502227

Please sign in to comment.