提交 a8d98d6b 编写于 作者: D DCloud_LXH

chore: remove associated with MP

# Conflicts:
#	docs/collocation/pages.md
上级 7ecc3113
......@@ -31,18 +31,6 @@
<div class="contact-smg">
<div>论坛</div>
</div>
</a>
<a href="https://uniad.dcloud.net.cn" target="_blank" class="contact-item">
<img src="https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-uni-app-doc/765d9820-4f2d-11eb-bd01-97bc1429a9ff.png" width="20" height="20"/>
<div class="contact-smg">
<div>uniAD</div>
</div>
</a>
<a href="https://tongji.dcloud.net.cn/" target="_blank" class="contact-item">
<img src="https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-uni-app-doc/77159d80-4f2d-11eb-a16f-5b3e54966275.png" width="20" height="20"/>
<div class="contact-smg">
<div>uni统计</div>
</div>
</a>
<div class="contact-item">
<img src="https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-uni-app-doc/74cda950-4f2d-11eb-a16f-5b3e54966275.png" width="20" height="20"/>
......@@ -52,53 +40,4 @@
</div>
</div>
</div>
<div class="contact-item">
<img src="https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-uni-app-doc/759713d0-4f2d-11eb-a16f-5b3e54966275.png" width="20" height="20"/>
<div class="contact-smg">
<div>官方QQ交流群</div>
<div>群8:695442854 &nbsp;<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=ojVbbaSsh9pdCVIgFcruPk1mcbxzG8co&jump_from=webapi">点此加入</a></div>
<div>群35:713420817(2000人已满)</div>
<div>群34:530305531(2000人已满)</div>
<div>群33:498071674(2000人已满)</div>
<div>群32:166188631(2000人已满)</div>
<div>群31:567471669(2000人已满)</div>
<div>群30:371046920(2000人已满)</div>
<div>群29:202965481(2000人已满)</div>
<div>群28:166188776(2000人已满)</div>
<div>群27:811363410(2000人已满)</div>
<div>群26:147867597(2000人已满)</div>
<div>群25:165297000(2000人已满)</div>
<div>群24:672494800(2000人已满)</div>
<div>群23:599958679(2000人已满)</div>
<div>群22:687186952(2000人已满)</div>
<div>群21:717019120(2000人已满)</div>
<div>群20:165796402(2000人已满)</div>
<div>群19:165657124(2000人已满)</div>
<div>群18:698592271(2000人已满)</div>
<div>群17:951348804(2000人已满)</div>
<div>群16:719211033(2000人已满)</div>
<div>群15:516984120(2000人已满)</div>
<div>群14:465953250(2000人已满)</div>
<div>群13:699478442(2000人已满)</div>
<div>群12:884860657(2000人已满)</div>
<div>群11:296811328(2000人已满)</div>
<div>群10:959059626(2000人已满)</div>
<div>群9:775128777(2000人已满)</div>
<!-- <div>群8:695442854(2000人已满)</div> -->
<div>群7:942061423(2000人已满)</div>
<div>群6:697264024(2000人已满)</div>
<div>群5:731951419(2000人已满)</div>
<div>群4:942702595(2000人已满)</div>
<div>群3:773794803(2000人已满) </div>
<div>群2:901474938(2000人已满) </div>
<div>群1:531031261(2000人已满)</div>
</div>
</div>
<div class="contact-item">
<img src="https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-uni-app-doc/77df7d30-4f2d-11eb-bd01-97bc1429a9ff.png" width="20" height="20"/>
<div class="contact-smg">
<div>关注微信公众号</div>
<img src="https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-uni-app-doc/78a8e7b0-4f2d-11eb-8ff1-d5dcf8779628.jpg" width="90" height="90"/>
</div>
</div>
</div>
......@@ -753,84 +753,79 @@ element.slideTo
#### program(全局对象)
|方法 |APP-NVUE |APP-VUE|H5 |微信小程序 |百度小程序 |说明 |
|-- |-- |-- |-- |-- |-- |-- |
|pageStack |√ |√ |√ |√ |√ |获取小程序页面堆栈 |
|navigateTo |√ |√ |√ |√ |√ |保留当前页面,跳转到应用内的某个页面,同`uni.navigateTo` |
|redirectTo |√ |√ |√ |√ |√ |关闭当前页面,跳转到应用内的某个页面,同`uni.redirectTo` |
|navigateBack |√ |√ |√ |√ |√ |关闭当前页面,返回上一页面,同`uni.navigateBack` |
|reLaunch |√ |√ |√ |√ |√ |关闭所有页面,打开到应用内的某个页面,同`uni.reLaunch` |
|switchTab |√ |√ |√ |√ |√ |跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面,同`uni.switchTab`|
|currentPage |√ |√ |√ |√ |√ |获取当前页面 |
|systemInfo |√ |√ |√ |√ |√ |获取系统信息,同`uni.getSystemInfo` |
|pageScrollTo |x |√ |√ |√ |√ |将页面滚动到目标位置,同`uni.pageScrollTo` |
|callUniMethod |√ |√ |√ |√ |√ |调用 uni 对象上的指定方法 |
|screenshot |√ |√ |√ |√ |x |对当前页面截图,目前只有开发者工具模拟器支持,客户端无法使用 |
|mockUniMethod |√ |√ |√ |√ |√ |覆盖 uni 对象上指定方法的调用结果 |
|restoreUniMethod |√ |√ |√ |√ |√ |重置 uni 指定方法,消除 mockUniMethod 调用的影响 |
|testAccounts |x |x |x |√ |x |获取多账号调试中已添加的用户列表 |
|evaluate |x |x |x |√ |x |注入代码片段并返回执行结果 |
|exposeFunction |x |x |x |√ |x |在全局暴露方法,供小程序侧调用测试脚本中的方法 |
|方法 |APP-NVUE |APP-VUE|H5 |说明 |
|-- |-- |-- |-- |-- |
|pageStack |√ |√ |√ |获取页面堆栈 |
|navigateTo |√ |√ |√ |保留当前页面,跳转到应用内的某个页面,同`uni.navigateTo` |
|redirectTo |√ |√ |√ |关闭当前页面,跳转到应用内的某个页面,同`uni.redirectTo` |
|navigateBack |√ |√ |√ |关闭当前页面,返回上一页面,同`uni.navigateBack` |
|reLaunch |√ |√ |√ |关闭所有页面,打开到应用内的某个页面,同`uni.reLaunch` |
|switchTab |√ |√ |√ |跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面,同`uni.switchTab`|
|currentPage |√ |√ |√ |获取当前页面 |
|systemInfo |√ |√ |√ |获取系统信息,同`uni.getSystemInfo` |
|pageScrollTo |x |√ |√ |将页面滚动到目标位置,同`uni.pageScrollTo` |
|callUniMethod |√ |√ |√ |调用 uni 对象上的指定方法 |
|screenshot |√ |√ |√ |对当前页面截图,目前只有开发者工具模拟器支持,客户端无法使用 |
|mockUniMethod |√ |√ |√ |覆盖 uni 对象上指定方法的调用结果 |
|restoreUniMethod |√ |√ |√ |重置 uni 指定方法,消除 mockUniMethod 调用的影响 |
#### Page
|属性 |APP-NVUE |APP-VUE|H5 |微信小程序 |百度小程序 |说明 |
|-- |-- |-- |-- |-- |-- |-- |
|path |√ |√ |√ |√ |√ |页面路径 |
|query|√ |√ |√ |√ |√ |页面参数 |
|方法 |APP-NVUE |APP-VUE|H5 |微信小程序 |百度小程序 |说明 |
|-- |-- |-- |-- |-- |-- |-- |
|$ |√ |√ |√ |√ |√ |获取页面元素 |
|$$ |√ |√ |√ |√ |√ |获取页面元素数组 |
|waitFor |√ |√ |√ |√ |√ |等待直到指定条件成立 |
|data |√ |√ |√ |√ |√ |获取页面渲染数据 |
|setData |√ |√ |√ |√ |√ |设置页面渲染数据 |
|size |√ |√ |√ |√ |√ |获取页面大小(width,height) |
|scrollTop |√ |√ |√ |√ |√ |获取页面滚动位置 |
|callMethod |√ |√ |√ |√ |√ |调用页面指定方法 |
|属性 |APP-NVUE |APP-VUE|H5 |说明 |
|-- |-- |-- |-- |-- |
|path |√ |√ |√ |页面路径 |
|query|√ |√ |√ |页面参数 |
|方法 |APP-NVUE |APP-VUE|H5 |说明 |
|-- |-- |-- |-- |-- |
|$ |√ |√ |√ |获取页面元素 |
|$$ |√ |√ |√ |获取页面元素数组 |
|waitFor |√ |√ |√ |等待直到指定条件成立 |
|data |√ |√ |√ |获取页面渲染数据 |
|setData |√ |√ |√ |设置页面渲染数据 |
|size |√ |√ |√ |获取页面大小(width,height) |
|scrollTop |√ |√ |√ |获取页面滚动位置 |
|callMethod |√ |√ |√ |调用页面指定方法 |
#### Element
|属性 |APP-NVUE |APP-VUE|H5 |微信小程序 |百度小程序 |说明 |
|-- |-- |-- |-- |-- |-- |-- |
|tagName|√ |√ |√ |√ |√ |标签名,小写 |
|方法 |APP-NVUE |APP-VUE|H5 |微信小程序 |百度小程序 |说明 |
|-- |-- |-- |-- |-- |-- |-- |
|$ |√ |√ |√ |√ |√ |在元素范围内获取元素 |
|$$ |√ |√ |√ |√ |√ |在元素范围内获取元素数组 |
|size |√ |√ |√ |√ |√ |获取元素大小(width,height) |
|offset |√ |√ |√ |√ |√ |获取元素绝对位置(left,top) |
|text |√ |√ |√ |√ |√ |获取元素文本 |
|attribute |√ |√ |√ |√ |√ |获取元素特性 |
|style |√ |√ |√ |√ |√ |获取元素样式值 |
|tap |√ |√ |√ |√ |√ |点击元素 |
|value |√ |√ |√ |√ |√ |获取元素值 |
|callMethod |√ |√ |√ |√ |√ |调用组件实例指定方法,仅自定义组件可以使用 |
|html |√ |√ |√ |√ |√ |获取元素 HTML |
|outerHtml |√ |√ |√ |√ |√ |同 html,只是会获取到元素本身 |
|data |√ |√ |√ |√ |√ |获取组件实例渲染数据,仅自定义组件可以使用 |
|setData |√ |√ |√ |√ |√ |设置组件实例渲染数据,仅自定义组件可以使用 |
|property |√ |√ |√ |√ |x |获取元素属性 |
|touchstart |√ |√ |√ |√ |x |手指开始触摸元素 |
|touchmove |√ |√ |√ |√ |x |手指触摸元素后移动 |
|touchend |√ |√ |√ |√ |x |手指结束触摸元素 |
|longpress |√ |√ |√ |√ |x |获取元素文本 |
|trigger |√ |√ |√ |√ |x |触发元素事件 |
|input |√ |√ |√ |√ |x |输入文本,仅 input、textarea 组件可以使用 |
|callContextMethod|x |x |x |√ |x |调用上下文 Context 对象方法,仅 video 组件可以使用 |
|scrollWidth |x |√ |√ |√ |x |获取滚动宽度,仅 scroll-view 组件可以使用 |
|scrollHeight |x |√ |√ |√ |x |获取滚动高度,仅 scroll-view 组件可以使用 |
|scrollTo |x |√ |√ |√ |x |滚动到指定位置,仅 scroll-view 组件可以使用 |
|swipeTo |√ |√ |√ |√ |x |滑动到指定滑块,仅 swiper 组件可以使用 |
|moveTo |√ |√ |√ |√ |x |移动视图容器,仅 movable-view 组件可以使用 |
|slideTo |√ |√ |√ |√ |x |滑动到指定数值,仅 slider 组件可以使用 |
|属性 |APP-NVUE |APP-VUE|H5 |说明 |
|-- |-- |-- |-- |-- |
|tagName|√ |√ |√ |标签名,小写 |
|方法 |APP-NVUE |APP-VUE|H5 |说明 |
|-- |-- |-- |-- |-- |
|$ |√ |√ |√ |在元素范围内获取元素 |
|$$ |√ |√ |√ |在元素范围内获取元素数组 |
|size |√ |√ |√ |获取元素大小(width,height) |
|offset |√ |√ |√ |获取元素绝对位置(left,top) |
|text |√ |√ |√ |获取元素文本 |
|attribute |√ |√ |√ |获取元素特性 |
|style |√ |√ |√ |获取元素样式值 |
|tap |√ |√ |√ |点击元素 |
|value |√ |√ |√ |获取元素值 |
|callMethod |√ |√ |√ |调用组件实例指定方法,仅自定义组件可以使用 |
|html |√ |√ |√ |获取元素 HTML |
|outerHtml |√ |√ |√ |同 html,只是会获取到元素本身 |
|data |√ |√ |√ |获取组件实例渲染数据,仅自定义组件可以使用 |
|setData |√ |√ |√ |设置组件实例渲染数据,仅自定义组件可以使用 |
|property |√ |√ |√ |获取元素属性 |
|touchstart |√ |√ |√ |手指开始触摸元素 |
|touchmove |√ |√ |√ |手指触摸元素后移动 |
|touchend |√ |√ |√ |手指结束触摸元素 |
|longpress |√ |√ |√ |获取元素文本 |
|trigger |√ |√ |√ |触发元素事件 |
|input |√ |√ |√ |输入文本,仅 input、textarea 组件可以使用 |
|callContextMethod|x |x |x |调用上下文 Context 对象方法,仅 video 组件可以使用 |
|scrollWidth |x |√ |√ |获取滚动宽度,仅 scroll-view 组件可以使用 |
|scrollHeight |x |√ |√ |获取滚动高度,仅 scroll-view 组件可以使用 |
|scrollTo |x |√ |√ |滚动到指定位置,仅 scroll-view 组件可以使用 |
|swipeTo |√ |√ |√ |滑动到指定滑块,仅 swiper 组件可以使用 |
|moveTo |√ |√ |√ |移动视图容器,仅 movable-view 组件可以使用 |
|slideTo |√ |√ |√ |滑动到指定数值,仅 slider 组件可以使用 |
#### 测试平台判断
```
if (process.env.UNI_PLATFORM === "h5") {}
if (process.env.UNI_PLATFORM === "app-plus") {}
if (process.env.UNI_PLATFORM === "mp-weixin") {}
if (process.env.UNI_PLATFORM === "mp-baidu") {}
```
......@@ -15,9 +15,9 @@ uni-app提供了一批API,这些API可以操控uni-app应用,包括运行、
**平台差异说明**
|App|H5|微信小程序|支付宝小程序|百度小程序|字节跳动小程序|QQ小程序|快应用|快手小程序|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|√(ios仅支持模拟器)|√|√|x|x|x|x|x|x|
|App|H5|
|:-:|:-:|
|√(ios仅支持模拟器)|√|
目前仅 [cli](https://uniapp.dcloud.net.cn/quickstart?id=_2-通过vue-cli命令行) 工程支持。有利于持续集成。
......@@ -25,7 +25,6 @@ uni-app提供了一批API,这些API可以操控uni-app应用,包括运行、
[HBuilderX uniapp自动化测试插件](https://ext.dcloud.net.cn/plugin?id=5708), 支持在HBuilderX内对uniapp普通项目、cli项目进行自动化测试。此插件简化了测试环境安装、测试用例创建、测试运行、测试设备选择等步骤。
推荐使用方式:研发提交源码到版本库后,持续集成系统自动拉取源码,自动运行自动化测试。
暂不支持百度,先忽略百度相关测试代码
创建 `cli` 工程
```
......@@ -50,9 +49,7 @@ npm install @dcloudio/uni-automator --save-dev
```
"test:h5": "cross-env UNI_PLATFORM=h5 jest -i",
"test:android": "cross-env UNI_PLATFORM=app-plus UNI_OS_NAME=android jest -i",
"test:ios": "cross-env UNI_PLATFORM=app-plus UNI_OS_NAME=ios jest -i",
"test:mp-weixin": "cross-env UNI_PLATFORM=mp-weixin jest -i",
"test:mp-baidu": "cross-env UNI_PLATFORM=mp-baidu jest -i"
"test:ios": "cross-env UNI_PLATFORM=app-plus UNI_OS_NAME=ios jest -i"
```
#### H5平台测试流程
......@@ -128,26 +125,6 @@ npm run test:ios
#### 微信小程序测试流程
1. 创建cli项目,同H5平台 (必须配置微信小程序 appid, manifest.json -> mp-weixin -> appid)
2. 运行测试(如果微信开发者工具无法成功打开项目,请手动打开)
```
npm run test:mp-weixin
```
3. 测试结果
```
> cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch "--auto-port" "9520"
Test Suites: 1 passed, 1 total
Tests: 4 passed, 4 total
Snapshots: 0 total
Time: 14.995s, estimated 16s
```
#### 测试示例
使用 hello uni-app 工程测试 H5 平台
......@@ -291,25 +268,6 @@ module.exports = {
id: "",
executablePath: "HBuilderX/plugins/launcher/base/Pandora_simulator.app" // ipa 目录
}
},
"mp-weixin": {
port: 9420, // 默认 9420
account: "", // 测试账号
args: "", // 指定开发者工具参数
cwd: "", // 指定开发者工具工作目录
launch: true, // 是否主动拉起开发者工具
teardown: "disconnect", // 可选值 "disconnect"|"close" 运行测试结束后,断开开发者工具或关闭开发者工具
remote: false, // 是否真机自动化测试
executablePath: "", // 开发者工具cli路径,默认会自动查找, windows: C:/Program Files (x86)/Tencent/微信web开发者工具/cli.bat", mac: /Applications/wechatwebdevtools.app/Contents/MacOS/cli
},
"mp-baidu": {
port: 9430, // 默认 9430
args: "", // 指定开发者工具参数
cwd: "", // 指定开发者工具工作目录
launch: true, // 是否主动拉起开发者工具
teardown: "disconnect", // 可选值 "disconnect"|"close" 运行测试结束后,断开开发者工具或关闭开发者工具
remote: false, // 是否真机自动化测试
executablePath: "", // 开发者工具cli路径,默认会自动查找
}
},
testTimeout: 15000,
......@@ -330,31 +288,11 @@ module.exports = {
**注意事项**
1. 如果页面涉及到分包加载问题,`reLaunch` 获取的页面路径可能会出现问题 ,解决方案如下 :
```javascript
// 重新 reLaunch至首页,并获取 page 对象(其中 program 是 uni-automator 自动注入的全局对象)
page = await program.reLaunch('/pages/extUI/calendar/calendar')
// 微信小程序如果是分包页面,需要延迟大概 7s 以上,保证可以正确获取page对象
await page.waitFor(7000)
page = await program.currentPage()
```
2. 微信小程序 element 不能跨组件选择元素,首先要先获取当前组件,再继续查找
```html
<uni-tag>
<view class="test"></view>
</uni-tag>
```
```javascript
// 错误,取不到元素
await page.$('.test')
// 可以取到元素
let tag = await page.$('uni-tag')
await tag.$('.test')
```
```javascript
// 重新 reLaunch至首页,并获取 page 对象(其中 program 是 uni-automator 自动注入的全局对象)
page = await program.reLaunch('/pages/extUI/calendar/calendar')
page = await program.currentPage()
```
3. 微信小程序暂不支持父子选择器
4. 百度小程序选择元素必须有事件的元素才能被选中,否则提示元素不存在
5. 分包中的页面,打开之后要延迟时间长一点,否则不能正确获取到页面信息
2. 分包中的页面,打开之后要延迟时间长一点,否则不能正确获取到页面信息
......@@ -134,10 +134,10 @@
|onReachBottomDistance|Number|50|页面上拉触底事件触发时距页面底部距离,单位只支持px,详见[页面生命周期](/collocation/frame/lifecycle?id=页面生命周期)||
|backgroundColorTop|HexColor|#ffffff|顶部窗口的背景色(bounce回弹区域)|仅 iOS 平台|
|backgroundColorBottom|HexColor|#ffffff|底部窗口的背景色(bounce回弹区域)|仅 iOS 平台|
|titleImage|String||导航栏图片地址(替换当前文字标题),支付宝小程序内必须使用https的图片链接地址|支付宝小程序、H5、APP|
|transparentTitle|String|none|导航栏整体(前景、背景)透明设置。支持 always 一直透明 / auto 滑动自适应 / none 不透明|支付宝小程序、H5、APP|
|titlePenetrate|String|NO|导航栏点击穿透|支付宝小程序、H5|
|pageOrientation|String|portrait|横屏配置,屏幕旋转设置,仅支持 auto / portrait / landscape 详见 [响应显示区域变化](https://developers.weixin.qq.com/miniprogram/dev/framework/view/resizable.html)|App 2.4.7+、微信小程序|
|titleImage|String||导航栏图片地址(替换当前文字标题)|H5、APP|
|transparentTitle|String|none|导航栏整体(前景、背景)透明设置。支持 always 一直透明 / auto 滑动自适应 / none 不透明|H5、APP|
|titlePenetrate|String|NO|导航栏点击穿透|H5|
|pageOrientation|String|portrait|横屏配置,屏幕旋转设置,仅支持 auto / portrait / landscape 详见 [响应显示区域变化](https://developers.weixin.qq.com/miniprogram/dev/framework/view/resizable.html)|App 2.4.7+|
|animationType|String|pop-in|窗口显示的动画效果,详见:[窗口动画](api/router?id=animation)|App|
|animationDuration|Number|300|窗口显示动画的持续时间,单位为 ms|App|
|app-plus|Object||设置编译到 App 平台的特定样式,配置项参考下方 [app-plus](/collocation/pages?id=app-plus)|App|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册