Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
macaca-java-biz-sample
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
马博
macaca-java-biz-sample
Commits
b5166d7d
Commit
b5166d7d
authored
Aug 14, 2017
by
mabo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parents
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
693 additions
and
0 deletions
+693
-0
App.java
src/main/java/com/javademo/autoui/App.java
+13
-0
AppTest.java
src/test/java/com/javademo/autoui/AppTest.java
+38
-0
BaseTest.java
src/test/java/com/javademo/cases/BaseTest.java
+113
-0
SampleTest.java
src/test/java/com/javademo/cases/SampleTest.java
+134
-0
test.java
src/test/java/com/javademo/cases/test.java
+89
-0
BaiDuPage.java
src/test/java/com/javademo/pages/BaiDuPage.java
+23
-0
HomeListPage.java
src/test/java/com/javademo/pages/HomeListPage.java
+43
-0
HomePage.java
src/test/java/com/javademo/pages/HomePage.java
+46
-0
LoginPage.java
src/test/java/com/javademo/pages/LoginPage.java
+20
-0
PersonalPage.java
src/test/java/com/javademo/pages/PersonalPage.java
+21
-0
WebviewPage.java
src/test/java/com/javademo/pages/WebviewPage.java
+33
-0
BaiDuPageUI.java
src/test/java/com/javademo/pageuis/BaiDuPageUI.java
+13
-0
HomeListPageUI.java
src/test/java/com/javademo/pageuis/HomeListPageUI.java
+12
-0
HomePageUI.java
src/test/java/com/javademo/pageuis/HomePageUI.java
+16
-0
LoginPageUI.java
src/test/java/com/javademo/pageuis/LoginPageUI.java
+14
-0
PersonalPageUI.java
src/test/java/com/javademo/pageuis/PersonalPageUI.java
+11
-0
WebviewPageUI.java
src/test/java/com/javademo/pageuis/WebviewPageUI.java
+15
-0
Config.java
src/test/java/com/javademo/utils/Config.java
+39
-0
No files found.
src/main/java/com/javademo/autoui/App.java
0 → 100644
View file @
b5166d7d
package
com
.
javademo
.
autoui
;
/**
* Hello world!
*
*/
public
class
App
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
"Hello World!"
);
}
}
src/test/java/com/javademo/autoui/AppTest.java
0 → 100644
View file @
b5166d7d
package
com
.
javademo
.
autoui
;
import
junit.framework.Test
;
import
junit.framework.TestCase
;
import
junit.framework.TestSuite
;
/**
* Unit test for simple App.
*/
public
class
AppTest
extends
TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public
AppTest
(
String
testName
)
{
super
(
testName
);
}
/**
* @return the suite of tests being tested
*/
public
static
Test
suite
()
{
return
new
TestSuite
(
AppTest
.
class
);
}
/**
* Rigourous Test :-)
*/
public
void
testApp
()
{
assertTrue
(
true
);
}
}
src/test/java/com/javademo/cases/BaseTest.java
0 → 100644
View file @
b5166d7d
package
com
.
javademo
.
cases
;
import
java.io.File
;
import
org.junit.After
;
import
org.junit.Before
;
import
macaca.java.biz.BaseErrorType
;
import
macaca.java.biz.BaseMacacaClient
;
import
macaca.java.biz.ResultGenerator
;
import
macaca.java.biz.BaseMacacaClient.PlatformType
;
import
com.javademo.utils.Config
;
import
com.alibaba.fastjson.JSONObject
;
public
class
BaseTest
{
// 屏幕截图的数目,为了实现递增的顺序
private
int
screenNum
=
1
;
BaseMacacaClient
driver
=
new
BaseMacacaClient
();
@Before
public
void
setUp
()
throws
Exception
{
// 清除日志记录
ResultGenerator
.
clearOldData
();
//清理截图重新记录
File
file
=
new
File
(
Config
.
ScreenshotPath
);
deleteOldScreen
(
file
);
// 初始化应用基础信息
JSONObject
props
=
new
JSONObject
();
if
(
Config
.
PLATFORM
.
equals
(
"ios"
))
{
// 创建ios实例
props
.
put
(
"app"
,
Config
.
IOS_APP
);
props
.
put
(
"platformName"
,
Config
.
IOS_PLATFORM_NAME
);
props
.
put
(
"deviceName"
,
Config
.
IOS_DEVICE_NAME
);
// props.put("udid", Config.IOS_UDID);
driver
.
setCurPlatform
(
PlatformType
.
IOS
);
}
else
{
//创建安卓实例
props
.
put
(
"app"
,
Config
.
ADR_APP
);
props
.
put
(
"platformName"
,
Config
.
ADR_PLATFORM_NAME
);
driver
.
setCurPlatform
(
PlatformType
.
ANDROID
);
}
// 覆盖安装
props
.
put
(
"reuse"
,
Config
.
REUSE
);
JSONObject
desiredCapabilities
=
new
JSONObject
();
desiredCapabilities
.
put
(
"desiredCapabilities"
,
props
);
driver
.
initDriver
(
desiredCapabilities
);
}
@After
public
void
tearDown
()
throws
Exception
{
try
{
driver
.
quit
();
}
catch
(
Exception
e
)
{
// TODO: handle exception
ResultGenerator
.
fail
(
"quit fail"
,
""
,
BaseErrorType
.
FUNCTION_FAILED
);
}
}
/**
* 保存当前屏幕截图-生成的截图会按照截图的先后顺序生成有序的名称
* @param fileName 图片名称,默认为.png格式,图片默认保存在screenShot目录下
*/
public
void
saveScreen
(
String
fileName
)
{
try
{
// 判断是否存在对应目录,不存在的话则创建
File
file
=
new
File
(
Config
.
ScreenshotPath
);
if
(!
file
.
exists
()
||
!
file
.
isDirectory
())
{
// 没有目录 创建截屏目录
System
.
out
.
println
(
"没有screenshot目录,创建目录"
);
boolean
isMkdirSucc
=
file
.
mkdir
();
if
(
isMkdirSucc
)
{
System
.
out
.
println
(
"创建screenshot目录成功"
);
}
else
{
System
.
out
.
println
(
"创建screenshot目录失败"
);
}
}
else
{
System
.
out
.
println
(
"存在screenshot目录"
);
}
driver
.
saveScreenshot
(
Config
.
ScreenshotPath
+
File
.
separator
+
screenNum
+
"_"
+
fileName
+
".png"
);
screenNum
++;
}
catch
(
Exception
e
)
{
// TODO: handle exception
ResultGenerator
.
fail
(
"截屏异常"
,
""
,
BaseErrorType
.
FUNCTION_FAILED
);
}
}
//删除screenshot目录下旧的截图
public
void
deleteOldScreen
(
File
oldScreen
)
{
if
(
oldScreen
.
exists
()
&&
oldScreen
.
isDirectory
())
{
File
[]
files
=
oldScreen
.
listFiles
();
for
(
File
file
:
files
)
{
deleteOldScreen
(
file
);
}
}
else
{
oldScreen
.
delete
();
}
}
}
src/test/java/com/javademo/cases/SampleTest.java
0 → 100644
View file @
b5166d7d
package
com
.
javademo
.
cases
;
import
com.alibaba.fastjson.JSONObject
;
import
macaca.client.commands.Element
;
import
macaca.client.common.GetElementWay
;
import
org.junit.Test
;
import
macaca.java.biz.ResultGenerator
;
import
com.javademo.pages.BaiDuPage
;
import
com.javademo.pages.HomeListPage
;
import
com.javademo.pages.HomePage
;
import
com.javademo.pages.LoginPage
;
import
com.javademo.pages.PersonalPage
;
import
com.javademo.pages.WebviewPage
;
import
com.javademo.pageuis.BaiDuPageUI
;
import
com.javademo.pageuis.HomeListPageUI
;
import
com.javademo.pageuis.HomePageUI
;
import
com.javademo.pageuis.LoginPageUI
;
import
com.javademo.pageuis.PersonalPageUI
;
import
com.javademo.pageuis.WebviewPageUI
;
public
class
SampleTest
extends
BaseTest
{
@Test
public
void
test
()
throws
Exception
{
// 处理登录
LoginPage
loginPage
=
new
LoginPage
(
"登录页"
);
loginPage
.
setDriver
(
driver
);
if
(
loginPage
.
hasPageShown
(
LoginPageUI
.
LOGIN_BTN
))
{
saveScreen
(
loginPage
.
pageDesc
);
ResultGenerator
.
loadPageSucc
(
loginPage
);
loginPage
.
login
(
"test"
,
"123"
);
}
else
{
ResultGenerator
.
loadPageFail
(
loginPage
);
}
// 测试首页
HomePage
homePage
=
new
HomePage
(
"首页"
);
homePage
.
setDriver
(
driver
);
if
(
homePage
.
hasPageShown
(
HomePageUI
.
HOME_TAB
))
{
saveScreen
(
homePage
.
pageDesc
);
ResultGenerator
.
loadPageSucc
(
homePage
);
// 进入list
homePage
.
goToList
();
}
else
{
// 首页没有加载成功,后面的用例都不用执行了,return
ResultGenerator
.
loadPageFail
(
homePage
);
return
;
}
// 首页List页
HomeListPage
homeListPage
=
new
HomeListPage
(
"首页列表页"
);
homeListPage
.
setDriver
(
driver
);
if
(
homeListPage
.
hasPageShown
(
HomeListPageUI
.
LIST_VIEW
))
{
saveScreen
(
homeListPage
.
pageDesc
);
ResultGenerator
.
loadPageSucc
(
homeListPage
);
// 滑动
homeListPage
.
scroll
();
// 点击第一个cell
// homeListPage.onclickOneCell(0);
// driver.sleep(2000);
//
// // 回到list页
// driver.customBack();
// driver.sleep(2000);
// 回到首页
driver
.
customBack
();
}
driver
.
sleep
(
1000
);
// 测试webView Tab
homePage
.
tabWebView
();
WebviewPage
webviewPage
=
new
WebviewPage
(
"webviewPage"
);
webviewPage
.
setDriver
(
driver
);
if
(
webviewPage
.
hasPageShown
(
WebviewPageUI
.
WEB_VIEW_TITLE
))
{
saveScreen
(
webviewPage
.
pageDesc
);
ResultGenerator
.
loadPageSucc
(
webviewPage
);
// Push view
webviewPage
.
pushView
();
driver
.
sleep
(
1000
);
driver
.
customBack
();
// 修改标题
webviewPage
.
setTitle
();
saveScreen
(
webviewPage
.
pageDesc
+
"_newTitle"
);
}
else
{
ResultGenerator
.
loadPageFail
(
webviewPage
);
}
driver
.
sleep
(
1000
);
// 测试浏览器
homePage
.
tabBaiDu
();
BaiDuPage
baiDuPage
=
new
BaiDuPage
(
"百度"
);
baiDuPage
.
setDriver
(
driver
);
if
(
baiDuPage
.
hasPageShown
(
BaiDuPageUI
.
SEARCH_BTN
))
{
saveScreen
(
baiDuPage
.
pageDesc
);
ResultGenerator
.
loadPageSucc
(
baiDuPage
);
// 搜索
// baiDuPage.search("Macaca");
// driver.sleep(2000);
}
else
{
ResultGenerator
.
loadPageFail
(
baiDuPage
);
}
driver
.
sleep
(
1000
);
// 测试Personal
homePage
.
tabPersonal
();
PersonalPage
personalPage
=
new
PersonalPage
(
"个人主页"
);
personalPage
.
setDriver
(
driver
);
if
(
personalPage
.
hasPageShown
(
PersonalPageUI
.
LOG_OUT_BTN
))
{
saveScreen
(
personalPage
.
pageDesc
);
ResultGenerator
.
loadPageSucc
(
personalPage
);
// logout
personalPage
.
logout
();
}
else
{
ResultGenerator
.
loadPageFail
(
personalPage
);
}
}
}
src/test/java/com/javademo/cases/test.java
0 → 100644
View file @
b5166d7d
package
com
.
javademo
.
cases
;
import
org.junit.Test
;
import
com.alibaba.fastjson.JSONObject
;
import
com.javademo.utils.Config
;
import
macaca.client.MacacaClient
;
import
macaca.client.common.GetElementWay
;
import
macaca.java.biz.BaseMacacaClient.PlatformType
;
public
class
test
{
@Test
public
void
androidTest
()
throws
Exception
{
MacacaClient
driver
=
new
MacacaClient
();
// 初始化应用基础信息
JSONObject
props
=
new
JSONObject
();
props
.
put
(
"app"
,
Config
.
ADR_APP
);
//app路径
props
.
put
(
"platformName"
,
"Android"
);
//平台
props
.
put
(
"reuse"
,
Config
.
REUSE
);
// 覆盖安装
JSONObject
desiredCapabilities
=
new
JSONObject
();
desiredCapabilities
.
put
(
"desiredCapabilities"
,
props
);
//初始化driver
driver
.
initDriver
(
desiredCapabilities
);
//输入账号
driver
.
getElement
(
GetElementWay
.
ID
,
"com.github.android_app_bootstrap:id/mobileNoEditText"
).
sendKeys
(
"test"
);
//输入密码
driver
.
getElement
(
GetElementWay
.
NAME
,
"please input password"
).
sendKeys
(
"123"
);
//点击登陆
driver
.
getElement
(
GetElementWay
.
ID
,
"com.github.android_app_bootstrap:id/login_button"
).
click
();
}
@Test
public
void
iosTest
()
throws
Exception
{
MacacaClient
driver
=
new
MacacaClient
();
// 初始化应用基础信息
JSONObject
props
=
new
JSONObject
();
props
.
put
(
"app"
,
Config
.
IOS_APP
);
//app路径
props
.
put
(
"platformName"
,
"iOS"
);
//平台
props
.
put
(
"deviceName"
,
Config
.
IOS_DEVICE_NAME
);
//设备名称
props
.
put
(
"reuse"
,
Config
.
REUSE
);
//覆盖安装
JSONObject
desiredCapabilities
=
new
JSONObject
();
desiredCapabilities
.
put
(
"desiredCapabilities"
,
props
);
//初始化driver
driver
.
initDriver
(
desiredCapabilities
);
//输入账号
driver
.
getElement
(
GetElementWay
.
ID
,
"please input username"
).
sendKeys
(
"test"
);
//输入密码
driver
.
getElement
(
GetElementWay
.
NAME
,
"please input password"
).
sendKeys
(
"123"
);
//点击登陆
driver
.
getElement
(
GetElementWay
.
NAME
,
"Login"
).
click
();
}
@Test
public
void
webTest
()
throws
Exception
{
MacacaClient
driver
=
new
MacacaClient
();
// 初始化应用基础信息
JSONObject
props
=
new
JSONObject
();
props
.
put
(
"browserName"
,
"electron"
);
//浏览器名称
props
.
put
(
"platformName"
,
"desktop"
);
//平台
JSONObject
desiredCapabilities
=
new
JSONObject
();
desiredCapabilities
.
put
(
"desiredCapabilities"
,
props
);
//初始化driver
driver
.
initDriver
(
desiredCapabilities
);
driver
.
get
(
"http://www.baidu.com"
);
driver
.
elementById
(
"kw"
).
sendKeys
(
"macaca"
);
driver
.
quit
();
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
}
}
src/test/java/com/javademo/pages/BaiDuPage.java
0 → 100644
View file @
b5166d7d
package
com
.
javademo
.
pages
;
import
macaca.java.biz.BasePage
;
import
com.javademo.pageuis.BaiDuPageUI
;
public
class
BaiDuPage
extends
BasePage
{
public
BaiDuPage
(
String
pageDesc
)
{
super
(
pageDesc
);
// TODO Auto-generated constructor stub
}
/**
* 按照关键字搜索
* @param keywords 关键字
*/
public
void
search
(
String
keywords
){
driver
.
inputBean
(
BaiDuPageUI
.
SEARCH_FIELD
,
keywords
);
driver
.
onclickBean
(
BaiDuPageUI
.
SEARCH_BTN
);
}
}
src/test/java/com/javademo/pages/HomeListPage.java
0 → 100644
View file @
b5166d7d
package
com
.
javademo
.
pages
;
import
javax.naming.directory.DirContext
;
import
com.alibaba.fastjson.JSONObject
;
import
com.javademo.pageuis.HomeListPageUI
;
import
macaca.java.biz.BasePage
;
public
class
HomeListPage
extends
BasePage
{
public
HomeListPage
(
String
pageDesc
)
{
super
(
pageDesc
);
// TODO Auto-generated constructor stub
}
/**
* 上下滑动
* @throws Exception
*/
public
void
scroll
()
throws
Exception
{
JSONObject
windowSize
=
driver
.
getWindowSize
();
int
windowWidth
=
windowSize
.
getIntValue
(
"width"
);
int
windowHeight
=
windowSize
.
getIntValue
(
"height"
);
int
centerX
=(
int
)
windowWidth
/
2
;
// driver.swipe(centerX,(int)windowHeight-100, centerX, 300, 500);
driver
.
drag
(
centerX
,
(
int
)
windowHeight
-
100
,
centerX
,
300
,
0.05
);
driver
.
sleep
(
1000
);
// driver.swipe(centerX, 300, centerX, (int)windowHeight-100, 500);
driver
.
drag
(
centerX
,
300
,
centerX
,
(
int
)
windowHeight
-
100
,
0.05
);
}
/**
* 点击指定的cell
* @param index 要点击的cell的index,限可视区域
*/
public
void
onclickOneCell
(
int
index
)
throws
Exception
{
driver
.
onclickBeanAtIndex
(
HomeListPageUI
.
CELL
,
index
);
}
}
src/test/java/com/javademo/pages/HomePage.java
0 → 100644
View file @
b5166d7d
package
com
.
javademo
.
pages
;
import
macaca.java.biz.BasePage
;
import
com.javademo.pageuis.HomePageUI
;
public
class
HomePage
extends
BasePage
{
public
HomePage
(
String
pageDesc
)
{
super
(
pageDesc
);
// TODO Auto-generated constructor stub
}
/**
* 点击home tab
*/
public
void
tabHome
()
{
driver
.
onclickBean
(
HomePageUI
.
HOME_TAB
);
}
/**
* 点击webView tab
*/
public
void
tabWebView
(){
driver
.
onclickBean
(
HomePageUI
.
WEBVIEW_TAB
);
}
/**
* 点击百度
*/
public
void
tabBaiDu
(){
driver
.
onclickBean
(
HomePageUI
.
BAIDU_TAB
);
}
/**
* 点击Personal tab
*/
public
void
tabPersonal
()
{
driver
.
onclickBean
(
HomePageUI
.
PERSONAL_TAB
);
}
/**
* 进入List页
*/
public
void
goToList
(){
driver
.
onclickBean
(
HomePageUI
.
LIST_BTN
);
}
}
src/test/java/com/javademo/pages/LoginPage.java
0 → 100644
View file @
b5166d7d
package
com
.
javademo
.
pages
;
import
macaca.java.biz.BasePage
;
import
com.javademo.pageuis.LoginPageUI
;
public
class
LoginPage
extends
BasePage
{
public
LoginPage
(
String
pageDesc
)
{
super
(
pageDesc
);
// TODO Auto-generated constructor stub
}
// 登录操作
public
void
login
(
String
username
,
String
password
){
driver
.
inputBean
(
LoginPageUI
.
USER_NAME
,
username
);
driver
.
inputBean
(
LoginPageUI
.
PASSWORD
,
password
);
driver
.
onclickBean
(
LoginPageUI
.
KEY_BOARD
);
driver
.
onclickBean
(
LoginPageUI
.
LOGIN_BTN
);
}
}
src/test/java/com/javademo/pages/PersonalPage.java
0 → 100644
View file @
b5166d7d
package
com
.
javademo
.
pages
;
import
macaca.java.biz.BasePage
;
import
com.javademo.pageuis.PersonalPageUI
;
public
class
PersonalPage
extends
BasePage
{
public
PersonalPage
(
String
pageDesc
)
{
super
(
pageDesc
);
// TODO Auto-generated constructor stub
}
/**
* 执行登出操作
* @throws Exception
*/
public
void
logout
()
throws
Exception
{
driver
.
onclickBean
(
PersonalPageUI
.
LOG_OUT_BTN
);
}
}
src/test/java/com/javademo/pages/WebviewPage.java
0 → 100644
View file @
b5166d7d
package
com
.
javademo
.
pages
;
import
macaca.java.biz.BasePage
;
import
com.javademo.pageuis.WebviewPageUI
;
public
class
WebviewPage
extends
BasePage
{
public
WebviewPage
(
String
pageDesc
)
{
super
(
pageDesc
);
// TODO Auto-generated constructor stub
}
/**
* 点击pushView
*/
public
void
pushView
()
{
driver
.
onclickBean
(
WebviewPageUI
.
PUSH_VIEW
);
}
/**
* 点击popView
*/
public
void
popView
()
{
driver
.
onclickBean
(
WebviewPageUI
.
POP_VIEW
);
}
/**
* 修改标题
*/
public
void
setTitle
()
{
driver
.
onclickBean
(
WebviewPageUI
.
SET_TITLE
);
}
}
src/test/java/com/javademo/pageuis/BaiDuPageUI.java
0 → 100644
View file @
b5166d7d
package
com
.
javademo
.
pageuis
;
import
macaca.java.biz.BasePageUI
;
import
macaca.java.biz.CommonUIBean
;
import
macaca.client.common.GetElementWay
;
public
class
BaiDuPageUI
extends
BasePageUI
{
public
static
final
CommonUIBean
SEARCH_FIELD
=
new
CommonUIBean
(
GetElementWay
.
CLASS_NAME
,
"android.widget.EditText"
,
GetElementWay
.
CLASS_NAME
,
"TextField"
,
"搜索框"
);
public
static
final
CommonUIBean
SEARCH_BTN
=
new
CommonUIBean
(
GetElementWay
.
CLASS_NAME
,
"android.widget.Button"
,
GetElementWay
.
NAME
,
"百度一下"
,
"搜索按钮"
);
}
\ No newline at end of file
src/test/java/com/javademo/pageuis/HomeListPageUI.java
0 → 100644
View file @
b5166d7d
package
com
.
javademo
.
pageuis
;
import
macaca.java.biz.BasePageUI
;
import
macaca.java.biz.CommonUIBean
;
import
macaca.client.common.GetElementWay
;
public
class
HomeListPageUI
extends
BasePageUI
{
public
static
final
CommonUIBean
LIST_VIEW
=
new
CommonUIBean
(
GetElementWay
.
ID
,
"com.github.android_app_bootstrap:id/listview"
,
GetElementWay
.
CLASS_NAME
,
"XCUIElementTypeTable"
,
"list view"
);
public
static
final
CommonUIBean
CELL
=
new
CommonUIBean
(
GetElementWay
.
CLASS_NAME
,
"android.widget.TextView"
,
GetElementWay
.
CLASS_NAME
,
"Cell"
,
"CELL"
);
}
src/test/java/com/javademo/pageuis/HomePageUI.java
0 → 100644
View file @
b5166d7d
package
com
.
javademo
.
pageuis
;
import
macaca.java.biz.BasePageUI
;
import
macaca.java.biz.CommonUIBean
;
import
macaca.client.common.GetElementWay
;
public
class
HomePageUI
extends
BasePageUI
{
public
static
final
CommonUIBean
HOME_TAB
=
new
CommonUIBean
(
GetElementWay
.
NAME
,
"HOME"
,
"HOME TAB"
);
public
static
final
CommonUIBean
WEBVIEW_TAB
=
new
CommonUIBean
(
GetElementWay
.
NAME
,
"Webview"
,
"WEBVIEW TAB"
);
public
static
final
CommonUIBean
BAIDU_TAB
=
new
CommonUIBean
(
GetElementWay
.
NAME
,
"Baidu"
,
"BAIDU TAB"
);
public
static
final
CommonUIBean
PERSONAL_TAB
=
new
CommonUIBean
(
GetElementWay
.
NAME
,
"PERSONAL"
,
"PERSONAL TAB"
);
public
static
final
CommonUIBean
LIST_BTN
=
new
CommonUIBean
(
GetElementWay
.
NAME
,
"list"
,
"首页list按钮"
);
}
src/test/java/com/javademo/pageuis/LoginPageUI.java
0 → 100644
View file @
b5166d7d
package
com
.
javademo
.
pageuis
;
import
macaca.java.biz.BasePageUI
;
import
macaca.java.biz.CommonUIBean
;
import
macaca.client.common.GetElementWay
;
public
class
LoginPageUI
extends
BasePageUI
{
public
static
final
CommonUIBean
USER_NAME
=
new
CommonUIBean
(
GetElementWay
.
ID
,
"com.github.android_app_bootstrap:id/mobileNoEditText"
,
GetElementWay
.
NAME
,
"please input username"
,
"登录用户名输入框"
);
public
static
final
CommonUIBean
PASSWORD
=
new
CommonUIBean
(
GetElementWay
.
ID
,
"com.github.android_app_bootstrap:id/codeEditText"
,
GetElementWay
.
NAME
,
"please input password"
,
"登录密码输入框"
);
public
static
final
CommonUIBean
LOGIN_BTN
=
new
CommonUIBean
(
GetElementWay
.
ID
,
"com.github.android_app_bootstrap:id/login_button"
,
GetElementWay
.
NAME
,
"Login"
,
"登录按钮"
);
public
static
final
CommonUIBean
KEY_BOARD
=
new
CommonUIBean
(
GetElementWay
.
NAME
,
"Done"
,
"键盘完成按钮"
);
}
src/test/java/com/javademo/pageuis/PersonalPageUI.java
0 → 100644
View file @
b5166d7d
package
com
.
javademo
.
pageuis
;
import
macaca.java.biz.BasePageUI
;
import
macaca.java.biz.CommonUIBean
;
import
macaca.client.common.GetElementWay
;
public
class
PersonalPageUI
extends
BasePageUI
{
public
static
final
CommonUIBean
LOG_OUT_BTN
=
new
CommonUIBean
(
GetElementWay
.
NAME
,
"Logout"
,
"logout按钮"
);
}
src/test/java/com/javademo/pageuis/WebviewPageUI.java
0 → 100644
View file @
b5166d7d
package
com
.
javademo
.
pageuis
;
import
macaca.java.biz.BasePageUI
;
import
macaca.java.biz.CommonUIBean
;
import
macaca.client.common.GetElementWay
;
public
class
WebviewPageUI
extends
BasePageUI
{
public
static
final
CommonUIBean
WEB_VIEW_TITLE
=
new
CommonUIBean
(
GetElementWay
.
ID
,
"com.github.android_app_bootstrap:id/title_text"
,
GetElementWay
.
NAME
,
"pushView"
,
"webViewTitle"
);
public
static
final
CommonUIBean
PUSH_VIEW
=
new
CommonUIBean
(
GetElementWay
.
ID
,
"pushView"
,
GetElementWay
.
NAME
,
"pushView"
,
"pushview"
);
public
static
final
CommonUIBean
POP_VIEW
=
new
CommonUIBean
(
GetElementWay
.
ID
,
"popView"
,
GetElementWay
.
NAME
,
"popView"
,
"popView"
);
public
static
final
CommonUIBean
SET_TITLE
=
new
CommonUIBean
(
GetElementWay
.
ID
,
"setTitle"
,
GetElementWay
.
NAME
,
"setTitle"
,
"setTitle"
);
}
src/test/java/com/javademo/utils/Config.java
0 → 100644
View file @
b5166d7d
package
com
.
javademo
.
utils
;
import
java.io.File
;
public
class
Config
{
// 根目录
public
static
final
String
RootPath
=
System
.
getProperty
(
"user.dir"
);
//截图保存目录
public
static
final
String
ScreenshotPath
=
RootPath
+
File
.
separator
+
"screenshot"
;
//结果日志保存文件
public
static
final
String
ResultLogPath
=
RootPath
+
File
.
separator
+
"result.log"
;
// 用户名
public
static
final
String
USER_NAME
=
"username"
;
// 密码
public
static
final
String
PASSWORD
=
"password"
;
// 目标平台- ios android
public
static
final
String
PLATFORM
=
"android"
;
//"ios";
// 是否覆盖安装 3-覆盖安装
public
static
final
String
REUSE
=
"3"
;
// ios平台相关信息 各参数含义参考 https://macacajs.github.io/macaca/desired-caps.html
public
static
final
String
IOS_PLATFORM_NAME
=
"iOS"
;
public
static
final
String
IOS_DEVICE_NAME
=
"iPhone 6"
;
public
static
final
String
IOS_APP
=
RootPath
+
File
.
separator
+
"app/ios-app-bootstrap.zip"
;
public
static
final
String
IOS_UDID
=
"6FB69785-8E9B-4F56-8BC0-DFBE1ECD3F3B"
;
// 安卓平台相关信息
public
static
final
String
ADR_PLATFORM_NAME
=
"Android"
;
public
static
final
String
ADR_APP
=
RootPath
+
File
.
separator
+
"app/android-app-bootstrap.zip"
;
// 多台设备时,如果指定某一台设备可以在这里指定udid
public
static
final
String
ADR_UDID
=
""
;
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment