提交 5b3b259c 编写于 作者: DCloud_iOS_WZT's avatar DCloud_iOS_WZT

Merge branch 'dev' of https://gitcode.net/dcloud/hello-uni-app-x into dev

......@@ -3,15 +3,19 @@ import App from './App.uvue'
import { createSSRApp } from 'vue'
export function createApp() {
const app = createSSRApp(App)
app.config.errorHandler = (err, vm, info) => {
console.log(err, vm, info)
}
app.mixin({
onReady() {
// #ifdef APP-ANDROID
setTimeout(() => {
console.log((this as BasePage).$nativePage!.getDomJson())
}, 100)
// #endif
}
})
return {
app
}
}
}
......@@ -269,7 +269,6 @@
"navigationBarTitleText": "web-view-local"
}
},
// #ifndef APP-IOS
{
"path": "pages/component/unicloud-db-contacts/list",
"style": {
......@@ -301,7 +300,6 @@
"navigationBarTitleText": "mixinDatacom"
}
},
// #endif
{
"path": "pages/component/general-attribute/general-attribute",
"style": {
......@@ -576,6 +574,13 @@
"navigationBarTitleText": "get-system-setting"
}
},
{
"path": "pages/API/element-takesnapshot/element-takesnapshot",
"style": {
"navigationBarTitleText": "takeSnapshot",
"enablePullDownRefresh": false
}
},
// #endif
// #ifndef WEB
{
......@@ -655,13 +660,6 @@
"enablePullDownRefresh": false
}
},
{
"path": "pages/API/element-takesnapshot/element-takesnapshot",
"style": {
"navigationBarTitleText": "takeSnapshot",
"enablePullDownRefresh": false
}
},
{
"path": "pages/API/element-draw/element-draw",
"style": {
......
......@@ -116,7 +116,13 @@
icon: "none"
})
},
fail: (e) => {
fail: (e) => {
if(this.showErrorToast){
uni.showToast({
title: e.errMsg,
icon: "none"
})
}
console.log(e);
}
})
......
......@@ -23,7 +23,7 @@ describe('ExtApi-DownloadFile', () => {
});
let shouldTestCookie = false
if (process.env.uniTestPlatformInfo.startsWith('android')) {
if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
let version = process.env.uniTestPlatformInfo
version = parseInt(version.split(" ")[1])
shouldTestCookie = version > 9
......@@ -47,4 +47,4 @@ describe('ExtApi-DownloadFile', () => {
res = await page.data('jest_result');
expect(res).toBe(true)
});
});
});
<template>
<!-- #ifdef APP -->
<scroll-view class="page-scroll-view">
<!-- #endif -->
<view class="page">
<page-head :title="title"></page-head>
<view class="service-item" v-for="(item, index) in serviceList" :key="index">
<text class="service-name">{{item.name}}:</text>
<view class="provider-list">
<text class="provider-item" v-for="(item2, index2) in item.provider" :key="index2">{{item2}}</text>
</view>
</view>
<button class="btn-get-provider" type="primary" @click="getProvider">getProvider</button>
</view>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template>
<script>
type ProviderItem = {
service : string,
name : string,
provider : string[]
}
export default {
data() {
return {
title: 'provider',
serviceList: [
{ service: "oauth", name: "登陆", provider: [] },
{ service: "share", name: "分享", provider: [] },
{ service: "payment", name: "支付", provider: [] },
{ service: "push", name: "推送", provider: [] },
{ service: "location", name: "定位", provider: [] }
] as ProviderItem[]
}
},
methods: {
getProvider() {
this.serviceList.forEach((item : ProviderItem) => {
uni.getProvider({
service: item.service,
success: (e) => {
this.updateProvider(e.service, e.provider);
}
})
})
},
updateProvider(service : string, provider : string[]) {
const item : ProviderItem | null = this.serviceList.find((item : ProviderItem) : boolean => {
return item.service == service
});
if (item != null) {
item.provider = provider
}
}
}
}
</script>
<style>
.page {
padding: 15px;
}
.service-item {
margin-top: 10px;
}
.service-name {
font-weight: bold;
}
.provider-list {
margin-left: 32px;
}
.provider-item {
line-height: 1.5;
}
.btn-get-provider {
margin-top: 30px;
}
</style>
......@@ -22,7 +22,7 @@ describe("onLoad", () => {
expect(page.path).toBe(TARGET_PAGE_PATH.substring(1));
});
it("navigateBack", async () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
page = await program.reLaunch(INTERMEDIATE_PAGE_PATH);
await page.waitFor('view');
await page.callMethod("navigateToOnLoadWithType", "navigateBack");
......@@ -89,7 +89,7 @@ describe("onLoad", () => {
expect(image).toMatchImageSnapshot({
failureThreshold: 0.05,
failureThresholdType: "percent",
});
});
});
it("showModal", async () => {
page = await program.reLaunch(INTERMEDIATE_PAGE_PATH);
......@@ -127,4 +127,4 @@ describe("onLoad", () => {
failureThresholdType: "percent",
});
});
});
});
......@@ -86,7 +86,7 @@ describe('ExtApi-Request', () => {
});
let shouldTestCookie = false
if (process.env.uniTestPlatformInfo.startsWith('android')) {
if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
let version = process.env.uniTestPlatformInfo
version = parseInt(version.split(" ")[1])
shouldTestCookie = version > 9
......@@ -108,4 +108,10 @@ describe('ExtApi-Request', () => {
res = await page.data('jest_result');
expect(res).toBe(true)
});
});
it('Check Get With Data', async () => {
res = await page.callMethod('jest_get_with_data')
await page.waitFor(2000);
res = await page.data('jest_result');
expect(res).toBe(true)
})
});
......@@ -300,6 +300,25 @@
this.jest_result = false;
},
});
},
jest_get_with_data() {
uni.request({
url: "https://unidemo.dcloud.net.cn/api/banner/36kr",
method: "GET",
data:{
column: 'id,post_id,title,author_name,cover,published_at' //需要的字段名
},
timeout: 6000,
sslVerify: false,
withCredentials: false,
firstIpv4: false,
success: () => {
this.jest_result = true;
},
fail: () => {
this.jest_result = false;
},
});
},
}
}
......
......@@ -10,7 +10,7 @@
<!-- #ifndef MP-ALIPAY -->
<button class="uni-btn-v" type="default" @tap="toast4Tap">点击弹出显示自定义图片的toast</button>
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<!-- #ifdef APP -->
<button class="uni-btn-v" type="default" @tap="toast5Tap" id="btn-toast-postion-bottom">点击显示无图标的居底toast</button>
<!-- #endif -->
<button class="uni-btn-v" type="default" @tap="hideToast" id="btn-toast-hide">点击隐藏toast</button>
......@@ -101,7 +101,7 @@
},
})
},
// #ifdef APP-PLUS
// #ifdef APP
toast5Tap: function () {
uni.showToast({
title: "显示一段轻提示",
......
......@@ -27,17 +27,17 @@ describe('ExtApi-UploadFile', () => {
it('Check ', async () => {
expect(res).toBe(true);
});
it('Check files upload', async () => {
res = await page.callMethod('jest_files_upload')
await page.waitFor(2000);
res = await page.data('jest_result');
expect(res).toBe(true)
});
it('Check files upload', async () => {
res = await page.callMethod('jest_files_upload')
await page.waitFor(2000);
res = await page.data('jest_result');
expect(res).toBe(true)
});
let shouldTestCookie = false
if (process.env.uniTestPlatformInfo.startsWith('android')) {
if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
let version = process.env.uniTestPlatformInfo
version = parseInt(version.split(" ")[1])
shouldTestCookie = version > 9
......@@ -59,4 +59,4 @@ describe('ExtApi-UploadFile', () => {
res = await page.data('jest_result');
expect(res).toBe(true)
});
});
});
describe('component-native-overflow', () => {
let page
describe('component-native-overflow', () => {
let page
beforeAll(async () => {
//打开list-view测试页
page = await program.reLaunch('/pages/CSS/overflow/overflow')
await page.waitFor("image")
//打开list-view测试页
page = await program.reLaunch('/pages/CSS/overflow/overflow')
await page.waitFor("image")
})
//检测overflow设置hidden,visible
it('check_view_overflow', async () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
let version = process.env.uniTestPlatformInfo
version = parseInt(version.split(" ")[1])
//安卓7模拟器不截图 导致闪退
......@@ -21,5 +21,5 @@ describe('component-native-overflow', () => {
fullPage: true,
});
expect(image).toMatchImageSnapshot();
})
})
})
......@@ -86,4 +86,11 @@ describe('Button.uvue', () => {
const value = await page.callMethod('checkUniButtonElement')
expect(value).toBe(true)
})
it("setbuttonEmpty", async () => {
const textBtn = await page.$('.btn')
await page.setData({
text: '',
})
expect(await textBtn.text()).toEqual('')
})
})
......@@ -35,14 +35,14 @@
uni.navigateTo({
url: 'buttonstatus',
})
},
//用于自动化测试
checkUniButtonElement(): boolean {
const button = uni.getElementById("testButton")
if(button != null && button instanceof UniButtonElement) {
return true
}
return false
},
//用于自动化测试
checkUniButtonElement() : boolean {
const button = uni.getElementById("testButton")
if (button != null && button instanceof UniButtonElement) {
return true
}
return false
}
}
}
......@@ -65,7 +65,7 @@
<boolean-data :defaultValue="false" title="修改默认样式和点击效果(高优先)" @change="change_default_style"></boolean-data>
<enum-data :items="size_enum" title="按钮的大小" @change="radio_change_size_enum"></enum-data>
<enum-data :items="type_enum" title="按钮的类型" @change="radio_change_type_enum"></enum-data>
<input-data :defaultValue="text" title="按钮的文案" type="text" @confirm="confirm_text_input"></input-data>
<input-data :defaultValue="text" title="按钮的文案" type="text" @confirm="confirm_text_input"></input-data>
<view style="height: 10px;"></view>
<button @click="navigateToChild">更多示例</button>
</view>
......@@ -97,4 +97,9 @@
background-color: #179b16;
border-color: #179b16;
}
.button-hover {
color: rgba(0, 0, 0, 0.6);
background-color: #dedede;
}
</style>
<script>
import { ItemType } from '@/components/enum-data/enum-data'
export default {
data() {
return {
plain_boolean: false,
disabled_boolean: false,
default_style: false,
size_enum: [{ "value": 0, "name": "default" }, { "value": 1, "name": "mini" }] as ItemType[],
size_enum_current: 0,
type_enum: [{ "value": 0, "name": "default" }, { "value": 1, "name": "primary" }, { "value": 2, "name": "warn" }] as ItemType[],
type_enum_current: 0,
count: 0,
text: 'uni-app-x'
}
},
methods: {
button_click() {
console.log("组件被点击时触发")
this.count++
},
button_touchstart() { console.log("手指触摸动作开始") },
button_touchmove() { console.log("手指触摸后移动") },
button_touchcancel() { console.log("手指触摸动作被打断,如来电提醒,弹窗") },
button_touchend() { console.log("手指触摸动作结束") },
button_tap() { console.log("手指触摸后马上离开") },
button_longpress() { console.log("如果一个组件被绑定了 longpress 事件,那么当用户长按这个组件时,该事件将会被触发。") },
change_plain_boolean(checked : boolean) { this.plain_boolean = checked },
change_disabled_boolean(checked : boolean) { this.disabled_boolean = checked },
change_default_style(checked : boolean) { this.default_style = checked },
radio_change_size_enum(checked : number) { this.size_enum_current = checked },
radio_change_type_enum(checked : number) { this.type_enum_current = checked },
confirm_text_input(value : string) { this.text = value }
}
}
</script>
<template>
<view class="main">
<!--type-->
<view class="container">
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[size_enum_current].name"
:type="type_enum[0].name" :plain="plain_boolean" @click="button_click" @touchstart="button_touchstart"
@touchmove="button_touchmove" @touchcancel="button_touchcancel" @touchend="button_touchend" @tap="button_tap"
@longpress="button_longpress" class="btn" :class="default_style ? 'custom-btn' : ''"
:hover-class="default_style ? 'is-hover' : 'button-hover'">
type-default
</button>
</view>
<view class="container">
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[size_enum_current].name"
:type="type_enum[1].name" :plain="plain_boolean" @click="button_click" @touchstart="button_touchstart"
@touchmove="button_touchmove" @touchcancel="button_touchcancel" @touchend="button_touchend" @tap="button_tap"
@longpress="button_longpress" class="btn" :class="default_style ? 'custom-btn' : ''"
:hover-class="default_style ? 'is-hover' : 'button-hover'">
type-primary
</button>
</view>
<view class="container">
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[size_enum_current].name"
:type="type_enum[2].name" :plain="plain_boolean" @click="button_click" @touchstart="button_touchstart"
@touchmove="button_touchmove" @touchcancel="button_touchcancel" @touchend="button_touchend" @tap="button_tap"
@longpress="button_longpress" class="btn" :class="default_style ? 'custom-btn' : ''"
:hover-class="default_style ? 'is-hover' : 'button-hover'">
type-warn
</button>
</view>
<!--size-->
<view class="container">
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[0].name"
:type="type_enum[type_enum_current].name" :plain="plain_boolean" @click="button_click"
@touchstart="button_touchstart" @touchmove="button_touchmove" @touchcancel="button_touchcancel"
@touchend="button_touchend" @tap="button_tap" @longpress="button_longpress" class="btn"
:class="default_style ? 'custom-btn' : ''" :hover-class="default_style ? 'is-hover' : 'button-hover'">
size-default
</button>
</view>
<view class="container">
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[1].name"
:type="type_enum[type_enum_current].name" :plain="plain_boolean" @click="button_click"
@touchstart="button_touchstart" @touchmove="button_touchmove" @touchcancel="button_touchcancel"
@touchend="button_touchend" @tap="button_tap" @longpress="button_longpress" class="btn"
:class="default_style ? 'custom-btn' : ''" :hover-class="default_style ? 'is-hover' : 'button-hover'">
size-mini
</button>
</view>
<!--plain-->
<view class="container">
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[size_enum_current].name"
:type="type_enum[type_enum_current].name" :plain="true" @click="button_click" @touchstart="button_touchstart"
@touchmove="button_touchmove" @touchcancel="button_touchcancel" @touchend="button_touchend" @tap="button_tap"
@longpress="button_longpress" class="btn" :class="default_style ? 'custom-btn' : ''"
:hover-class="default_style ? 'is-hover' : 'button-hover'">
plain-true
</button>
</view>
<view class="container">
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[size_enum_current].name"
:type="type_enum[type_enum_current].name" :plain="false" @click="button_click" @touchstart="button_touchstart"
@touchmove="button_touchmove" @touchcancel="button_touchcancel" @touchend="button_touchend" @tap="button_tap"
@longpress="button_longpress" class="btn" :class="default_style ? 'custom-btn' : ''"
:hover-class="default_style ? 'is-hover' : 'button-hover'">
plain-false
</button>
</view>
<!--disable-->
<view class="container">
<button style="margin: 10px;" :disabled="false" :size="size_enum[size_enum_current].name"
:type="type_enum[type_enum_current].name" :plain="plain_boolean" @click="button_click"
@touchstart="button_touchstart" @touchmove="button_touchmove" @touchcancel="button_touchcancel"
@touchend="button_touchend" @tap="button_tap" @longpress="button_longpress" class="btn"
:class="default_style ? 'custom-btn' : ''" :hover-class="default_style ? 'is-hover' : 'button-hover'">
disable-false
</button>
</view>
<view class="container">
<button style="margin: 10px;" :disabled="true" :size="size_enum[size_enum_current].name"
:type="type_enum[type_enum_current].name" :plain="plain_boolean" @click="button_click"
@touchstart="button_touchstart" @touchmove="button_touchmove" @touchcancel="button_touchcancel"
@touchend="button_touchend" @tap="button_tap" @longpress="button_longpress" class="btn"
:class="default_style ? 'custom-btn' : ''" :hover-class="default_style ? 'is-hover' : 'button-hover'">
disable-true
</button>
</view>
<view class="container">
<button style="margin: 10px;position: relative;text-align:left;padding:5px;color: #ffffff;background-color: #1AAD19;
font-size: 10px;line-height: 2;">
custom-btn
</button>
</view>
<view class="container">
<button style="margin: 10px;
font-size: 15px;color: red;" type="warn" plain="true">
custom-btn-plain-warn
</button>
</view>
<view class="content">
<button style="margin: 10px;" type="primary" size="default" :disabled="disabled_boolean">uni-app x</button>
<button style="margin: 10px;" type="primary" @tap="change_disabled_boolean(!disabled_boolean)">修改disabled为{{disabled_boolean}}</button>
</view>
</view>
</template>
<style>
.main {
padding: 5px 0;
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
flex-direction: column;
justify-content: center;
}
.main .list-item {
width: 100%;
height: 100px;
border: 1px solid #666;
}
.custom-btn {
color: #ffffff;
background-color: #1AAD19;
border-color: #1AAD19;
border-radius: 5px;
border-width: 0.5px;
height: 53px;
<script>
import { ItemType } from '@/components/enum-data/enum-data'
export default {
data() {
return {
plain_boolean: false,
disabled_boolean: false,
default_style: false,
size_enum: [{ "value": 0, "name": "default" }, { "value": 1, "name": "mini" }] as ItemType[],
size_enum_current: 0,
type_enum: [{ "value": 0, "name": "default" }, { "value": 1, "name": "primary" }, { "value": 2, "name": "warn" }] as ItemType[],
type_enum_current: 0,
count: 0,
text: 'uni-app-x'
}
},
methods: {
button_click() {
console.log("组件被点击时触发")
this.count++
},
button_touchstart() { console.log("手指触摸动作开始") },
button_touchmove() { console.log("手指触摸后移动") },
button_touchcancel() { console.log("手指触摸动作被打断,如来电提醒,弹窗") },
button_touchend() { console.log("手指触摸动作结束") },
button_tap() { console.log("手指触摸后马上离开") },
button_longpress() { console.log("如果一个组件被绑定了 longpress 事件,那么当用户长按这个组件时,该事件将会被触发。") },
change_plain_boolean(checked : boolean) { this.plain_boolean = checked },
change_disabled_boolean(checked : boolean) { this.disabled_boolean = checked },
change_default_style(checked : boolean) { this.default_style = checked },
radio_change_size_enum(checked : number) { this.size_enum_current = checked },
radio_change_type_enum(checked : number) { this.type_enum_current = checked },
confirm_text_input(value : string) { this.text = value }
}
}
</script>
<template>
<scroll-view direction="vertical" style="flex:1">
<view class="main">
<!--type-->
<view class="container">
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[size_enum_current].name"
:type="type_enum[0].name" :plain="plain_boolean" @click="button_click" @touchstart="button_touchstart"
@touchmove="button_touchmove" @touchcancel="button_touchcancel" @touchend="button_touchend" @tap="button_tap"
@longpress="button_longpress" class="btn" :class="default_style ? 'custom-btn' : ''"
:hover-class="default_style ? 'is-hover' : 'button-hover'">
type-default
</button>
</view>
<view class="container">
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[size_enum_current].name"
:type="type_enum[1].name" :plain="plain_boolean" @click="button_click" @touchstart="button_touchstart"
@touchmove="button_touchmove" @touchcancel="button_touchcancel" @touchend="button_touchend" @tap="button_tap"
@longpress="button_longpress" class="btn" :class="default_style ? 'custom-btn' : ''"
:hover-class="default_style ? 'is-hover' : 'button-hover'">
type-primary
</button>
</view>
<view class="container">
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[size_enum_current].name"
:type="type_enum[2].name" :plain="plain_boolean" @click="button_click" @touchstart="button_touchstart"
@touchmove="button_touchmove" @touchcancel="button_touchcancel" @touchend="button_touchend" @tap="button_tap"
@longpress="button_longpress" class="btn" :class="default_style ? 'custom-btn' : ''"
:hover-class="default_style ? 'is-hover' : 'button-hover'">
type-warn
</button>
</view>
<!--size-->
<view class="container">
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[0].name"
:type="type_enum[type_enum_current].name" :plain="plain_boolean" @click="button_click"
@touchstart="button_touchstart" @touchmove="button_touchmove" @touchcancel="button_touchcancel"
@touchend="button_touchend" @tap="button_tap" @longpress="button_longpress" class="btn"
:class="default_style ? 'custom-btn' : ''" :hover-class="default_style ? 'is-hover' : 'button-hover'">
size-default
</button>
</view>
<view class="container">
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[1].name"
:type="type_enum[type_enum_current].name" :plain="plain_boolean" @click="button_click"
@touchstart="button_touchstart" @touchmove="button_touchmove" @touchcancel="button_touchcancel"
@touchend="button_touchend" @tap="button_tap" @longpress="button_longpress" class="btn"
:class="default_style ? 'custom-btn' : ''" :hover-class="default_style ? 'is-hover' : 'button-hover'">
size-mini
</button>
</view>
<!--plain-->
<view class="container">
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[size_enum_current].name"
:type="type_enum[type_enum_current].name" :plain="true" @click="button_click" @touchstart="button_touchstart"
@touchmove="button_touchmove" @touchcancel="button_touchcancel" @touchend="button_touchend" @tap="button_tap"
@longpress="button_longpress" class="btn" :class="default_style ? 'custom-btn' : ''"
:hover-class="default_style ? 'is-hover' : 'button-hover'">
plain-true
</button>
</view>
<view class="container">
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[size_enum_current].name"
:type="type_enum[type_enum_current].name" :plain="false" @click="button_click" @touchstart="button_touchstart"
@touchmove="button_touchmove" @touchcancel="button_touchcancel" @touchend="button_touchend" @tap="button_tap"
@longpress="button_longpress" class="btn" :class="default_style ? 'custom-btn' : ''"
:hover-class="default_style ? 'is-hover' : 'button-hover'">
plain-false
</button>
</view>
<!--disable-->
<view class="container">
<button style="margin: 10px;" :disabled="false" :size="size_enum[size_enum_current].name"
:type="type_enum[type_enum_current].name" :plain="plain_boolean" @click="button_click"
@touchstart="button_touchstart" @touchmove="button_touchmove" @touchcancel="button_touchcancel"
@touchend="button_touchend" @tap="button_tap" @longpress="button_longpress" class="btn"
:class="default_style ? 'custom-btn' : ''" :hover-class="default_style ? 'is-hover' : 'button-hover'">
disable-false
</button>
</view>
<view class="container">
<button style="margin: 10px;" :disabled="true" :size="size_enum[size_enum_current].name"
:type="type_enum[type_enum_current].name" :plain="plain_boolean" @click="button_click"
@touchstart="button_touchstart" @touchmove="button_touchmove" @touchcancel="button_touchcancel"
@touchend="button_touchend" @tap="button_tap" @longpress="button_longpress" class="btn"
:class="default_style ? 'custom-btn' : ''" :hover-class="default_style ? 'is-hover' : 'button-hover'">
disable-true
</button>
</view>
<view class="container">
<button style="margin: 10px;position: relative;text-align:left;padding:5px;color: #ffffff;background-color: #1AAD19;
font-size: 10px;line-height: 2;">
custom-btn
</button>
</view>
<view class="container">
<button style="margin: 10px;
font-size: 15px;color: red;" type="warn" plain="true">
custom-btn-plain-warn
</button>
</view>
<view class="content">
<button style="margin: 10px;" type="primary" size="default" :disabled="disabled_boolean">uni-app x</button>
<button style="margin: 10px;" type="primary"
@tap="change_disabled_boolean(!disabled_boolean)">修改disabled为{{!disabled_boolean}}</button>
</view>
<view class="content">
<button style="margin: 10px;" type="primary" size="default" :disabled="disabled_boolean" hover-class="none">hover-class none</button>
</view>
</view>
</scroll-view>
</template>
<style>
.main {
padding: 5px 0;
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
flex-direction: column;
justify-content: center;
}
.main .list-item {
width: 100%;
height: 100px;
border: 1px solid #666;
}
.custom-btn {
color: #ffffff;
background-color: #1AAD19;
border-color: #1AAD19;
border-radius: 5px;
border-width: 0.5px;
height: 53px;
}
.is-hover {
color: rgba(255, 255, 255, 0.6);
background-color: #179b16;
border-color: #179b16;
}
.container {
width: 100%;
height: 60px;
}
.is-hover {
color: rgba(255, 255, 255, 0.6);
background-color: #179b16;
border-color: #179b16;
}
.container {
width: 100%;
height: 60px;
/* background-color: orange; */
.button-hover {
color: rgba(0, 0, 0, 0.6);
background-color: #dedede;
}
</style>
......@@ -10,7 +10,7 @@ describe('event trigger sequence', () => {
})
it('touch', async () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
await el.touchstart({
touches: [{
identifier: 1,
......@@ -56,10 +56,10 @@ describe('event trigger sequence', () => {
})
it('longPress', async () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
await el.longpress()
const data = await page.data()
expect(data.onLongPressTime).toBeGreaterThan(0)
}
})
})
})
......@@ -30,7 +30,7 @@ describe('component-native-image', () => {
expect(await page.data('loadError')).toBe(true)
})
if (process.env.uniTestPlatformInfo.startsWith('android')) {
if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
it('check-cookie', async () => {
await page.setData({
autoTest: true,
......
......@@ -147,19 +147,19 @@ describe('component-native-input', () => {
expect(await (await page.$('#uni-input-cursor-color')).attribute("cursor-color")).toBe("red")
})
it("maxlength default", async () => {
const input = await page.$('#uni-input-disable');
it("maxlength", async () => {
const input = await page.$('#uni-input-maxlength');
let str = "";
for(let i = 0;i < 200;i++){
str += `${i}`
}
await page.setData({
disableValue: str
inputMaxLengthValue: str
})
let length = (await input.attribute("value")).length
expect(length).toBe(140)
expect(length).toBe(10)
await page.setData({
disableValue: ""
inputMaxLengthValue: ""
})
})
......
......@@ -59,7 +59,7 @@
<text class="uni-title-text">设置禁用输入框</text>
</view>
<view class="input-wrapper">
<input id="uni-input-disable" class="uni-input" :disabled="true" :value="disableValue"/>
<input id="uni-input-disable" class="uni-input" :disabled="true"/>
</view>
</view>
......@@ -266,7 +266,6 @@
inputPasswordValue: "",
inputFocusKeyBoardChangeValue: true,
holdKeyboard: false,
disableValue: ""
}
},
methods: {
......
<template>
<scroll-view style="flex:1;" :refresher-enabled="true" :refresher-triggered="refresherTriggered"
refresher-default-style="none" @refresherpulling="onRefresherpulling" @refresherrefresh="onRefresherrefresh">
refresher-default-style="none" @refresherpulling="onRefresherpulling" @refresherrefresh="onRefresherrefresh" @refresherrestore="onRefreshrestore">
<view style="height: 25px;"></view>
<view v-for="i in 20" class="content-item">
<text class="text">item-{{i}}</text>
......@@ -38,9 +38,6 @@
methods: {
onRefresherpulling(e : RefresherEvent) {
this.pullingDistance = e.detail.dy;
if (this.pullingDistance.toDouble() == 0.0) {
this.resetting = false;
}
},
onRefresherrefresh() {
this.refresherTriggered = true
......@@ -48,7 +45,11 @@
this.refresherTriggered = false
this.resetting = true;
}, 1500)
},
},
onRefreshrestore() {
this.pullingDistance = 0
this.resetting = false;
}
}
}
</script>
......
......@@ -64,10 +64,10 @@
data() {
return {
items: [] as Item[],
refresherEnabled: false,
refresherEnabled: true,
refresherTriggered: false,
refresherThreshold: 45,
refresherDefaultStyle: "white",
refresherDefaultStyle: "black",
refresherBackground: "transparent",
}
},
......
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe('component-native-scroll-view-refresher', () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
let page;
beforeAll(async () => {
page = await program.reLaunch('/pages/component/scroll-view/scroll-view-refresher');
await page.waitFor(300);
});
it('scroll-view-refresher-screenshot', async () => {
//禁止滚动条
await page.setData({
showScrollbar: false
})
await page.waitFor(300);
const image = await program.screenshot();
expect(image).toMatchImageSnapshot();
it('scroll-view-refresher-screenshot', async () => {
//禁止滚动条
await page.setData({
showScrollbar: false
})
await page.waitFor(300);
const image = await program.screenshot();
expect(image).toMatchImageSnapshot();
})
it('check_refresher', async () => {
......@@ -30,4 +30,4 @@ describe('component-native-scroll-view-refresher', () => {
expect(1).toBe(1)
})
}
});
});
......@@ -19,7 +19,7 @@ describe('component-native-sticky-section', () => {
await page.setData({
scrolling: 'true'
})
if (process.env.uniTestPlatformInfo.startsWith('android')) {
if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
//跳转到id为C的StickyHeader位置
await page.callMethod('gotoStickyHeader', 'C')
}
......@@ -29,4 +29,4 @@ describe('component-native-sticky-section', () => {
const image = await program.screenshot();
expect(image).toMatchImageSnapshot();
})
})
})
......@@ -13,23 +13,55 @@ describe('text-props', () => {
})
it('empty text', async () => {
await page.setData({
autoTest: true
})
const element = await page.$('#empty-text')
if (element != null) {
const { width, height } = await element.size()
expect(width).toBe(0)
expect(height).toBe(0)
}
await page.callMethod("setEmptyText")
await page.waitFor(100)
const element2 = await page.$('#empty-text2')
if (element2 != null) {
const { width, height } = await element2.size()
expect(width).toBe(0)
expect(height).toBe(0)
}
await page.setData({
autoTest: false
})
})
if (process.env.uniTestPlatformInfo.indexOf('web') > -1) {
return
}
it('nested text', async () => {
await page.setData({
autoTest: true
})
await page.callMethod("setNestedText")
await page.waitFor(100)
const element = await page.$('#nested-text')
if (element != null) {
expect(await element.text()).toBe("修改三级节点文本")
}
await page.setData({
autoTest: false
})
})
it('text nested', async () => {
page.callMethod("setTextNested")
const element = await page.$('#text-nested')
it('height text', async () => {
await page.setData({
autoTest: true
})
await page.callMethod("setHeightText")
await page.waitFor(100)
const element = await page.$('#height-text')
if (element != null) {
expect(await element.text()).toBe("二级节点文字红色且背景色黄色")
expect(await element.text()).toBe("修改设置高度文本")
}
await page.setData({
autoTest: false
})
})
})
......@@ -78,7 +78,7 @@
<view class="text-box">
<text
>一级节点黑色
<text id="text-nested" ref="text-nested" style="color: red;background-color: yellow;"
<text style="color: red;background-color: yellow;"
>二级节点红色且背景色黄色
<text>三级节点不继承二级的颜色</text>
</text>
......@@ -96,10 +96,22 @@
<text class="text-padding" style="width: 200px;height: 100px;">hello uni-app x</text>
</view>
<view class="uni-row">
<text id="empty-text"></text>
<view v-if="autoTest">
<view class="uni-row">
<text id="empty-text"></text>
</view>
<view class="uni-row">
<text id="empty-text2">{{emptyText}}</text>
</view>
<text
>一级节点文本
<text
>二级节点文本
<text id="nested-text">{{nestedText}}</text>
</text>
</text>
<text id="height-text" style="height: 50px;">{{heightText}}</text>
</view>
</view>
</scroll-view>
</template>
......@@ -112,12 +124,23 @@ export default {
multiLineText:
'HBuilderX,轻巧、极速,极客编辑器;uni-app x,终极跨平台方案;uts,大一统语言;HBuilderX,轻巧、极速,极客编辑器;uni-app x,终极跨平台方案;uts,大一统语言',
singleLineText: 'uni-app x,终极跨平台方案',
// 自动化测试
autoTest: false,
nestedText: '三级节点文本',
emptyText: '空文本',
heightText: '设置高度文本'
}
},
methods: {
// 自动化测试
setTextNested() {
(this.$refs["text-nested"] as UniTextElement).value = "二级节点文字红色且背景色黄色";
setNestedText() {
this.nestedText = "修改三级节点文本";
},
setEmptyText() {
this.emptyText = "";
},
setHeightText() {
this.heightText = "修改设置高度文本";
}
}
}
......
......@@ -12,7 +12,7 @@ describe('component-native-web-view', () => {
});
it('screenshot', async () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
await page.waitFor(async () => {
return await page.data('loadFinish') === true;
});
......
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe('component-native-web-view', () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
let page;
beforeAll(async () => {
page = await program.reLaunch('/pages/component/web-view/web-view');
......
......@@ -121,7 +121,7 @@ const pages = [
// '/pages/API/element-draw/element-draw',
]
if (process.env.uniTestPlatformInfo.startsWith('android')) {
if (process.env.uniTestPlatformInfo.startsWith('android')&& !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
// 规避 web 端不支持页面
pages.push(
"/pages/component/list-view/list-view",
......@@ -133,18 +133,18 @@ if (process.env.uniTestPlatformInfo.startsWith('android')) {
'/pages/template/pull-zoom-image/pull-zoom-image',
'/pages/template/scroll-fold-nav/scroll-fold-nav',
'/pages/template/scroll-sticky/scroll-sticky',
'/pages/template/custom-refresher/custom-refresher',
'/pages/template/custom-tab-bar/custom-tab-bar',
'/pages/template/custom-refresher/custom-refresher',
'/pages/template/custom-tab-bar/custom-tab-bar',
'/pages/template/half-screen/half-screen',
)
}
// 设置position: fixed的页面不能截取完整内容
const notFullPages = [
'/pages/CSS/layout/position',
'/pages/CSS/layout/z-index'
]
}
// 设置position: fixed的页面不能截取完整内容
const notFullPages = [
'/pages/CSS/layout/position',
'/pages/CSS/layout/z-index'
]
let page;
describe("page screenshot test", () => {
beforeAll(async () => {
......@@ -162,14 +162,14 @@ describe("page screenshot test", () => {
});
test.each(pages)("%s", async () => {
console.log("Taking screenshot: ", pageIndex, pages[pageIndex]);
let fullPage = true;
if (notFullPages.includes(pages[pageIndex])) {
fullPage = false;
let fullPage = true;
if (notFullPages.includes(pages[pageIndex])) {
fullPage = false;
}
const image = await program.screenshot({
fullPage: fullPage
});
});
expect(image).toMatchImageSnapshot();
await page.waitFor(500);
});
});
});
......@@ -3,6 +3,7 @@
:refresher-enabled="true" :refresher-triggered="refresherTriggered" refresher-default-style="none"
@refresherpulling="onRefresherpulling"
@refresherrefresh="onRefresherrefresh"
@refresherrestore="onRefreshrestore"
:refresher-threshold="refresherThreshold"
>
<view v-for="i in 20" class="content-item">
......@@ -43,9 +44,6 @@
onRefresherpulling(e:RefresherEvent){
// console.log('onRefresherpulling',e.detail.dy)
this.pullingDistance = e.detail.dy
if (this.pullingDistance.toDouble() == 0.0) {
this.resetting = false;
}
},
onRefresherrefresh(){
this.refresherTriggered = true
......@@ -53,12 +51,10 @@
this.refresherTriggered = false
},1500)
},
// onRefresherrestore(e:RefresherEvent){
// console.log('onRefresherrestore',e)
// },
// onRefresherabort(e:RefresherEvent){
// console.log('onRefresherabort',e)
// },
onRefreshrestore() {
this.pullingDistance = 0
this.resetting = false;
}
}
}
</script>
......
......@@ -8,7 +8,7 @@ const pages = [
"pages/component/text/text-props",
"pages/component/progress/progress",
"pages/component/form/form",
"pages/component/button/button",
"pages/component/button/button",
"pages/component/button/buttonstatus",
"pages/component/radio/radio",
"pages/component/rich-text/rich-text",
......@@ -237,7 +237,7 @@ const PAGE_PATH =
describe("shot-compare", () => {
let shouldCompareScreenShot = false
if (process.env.uniTestPlatformInfo.startsWith('android')) {
if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
let version = process.env.uniTestPlatformInfo
version = parseInt(version.split(" ")[1])
shouldCompareScreenShot = version > 9
......@@ -246,7 +246,7 @@ describe("shot-compare", () => {
if (!shouldCompareScreenShot) {
it("other platform not support", async () => {
expect(1).toBe(1);
});
});
return
}
......@@ -355,4 +355,4 @@ describe("shot-compare", () => {
},
});
});
});
});
......@@ -236,7 +236,7 @@ const PAGE_PATH =
describe("shot-compare", () => {
let shouldCompareScreenShot = false
if (process.env.uniTestPlatformInfo.startsWith('android')) {
if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
let version = process.env.uniTestPlatformInfo
version = parseInt(version.split(" ")[1])
shouldCompareScreenShot = version > 9
......@@ -245,7 +245,7 @@ describe("shot-compare", () => {
if (!shouldCompareScreenShot) {
it("other platform not support", async () => {
expect(1).toBe(1);
});
});
return
}
let page = null;
......@@ -330,4 +330,4 @@ describe("shot-compare", () => {
},
});
});
});
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册