提交 131b0724 编写于 作者: Anne_LXM's avatar Anne_LXM

test update

上级 c255655a
......@@ -3,7 +3,7 @@ import App from './App'
// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
//自动化测试
uni.showModal = ()=>{};
App.mpType = 'app'
......
......@@ -2,8 +2,7 @@ describe('pages/clientDB/demo/demo.vue', () => {
let page,perPage,roles;
beforeAll(async () => {
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
page = await program.reLaunch(
'/pages/clientDB/demo/demo')
page = await program.reLaunch('/pages/clientDB/demo/demo')
await page.waitFor("view")
perPage = await page.$('.page')
//底部角色控制条
......
......@@ -64,26 +64,23 @@ describe('pages/clientDB/unicloud-db-demo/unicloud-db-demo', () => {
//改变分页策略为add
// const pageCheckbox = await page.$('.page-checkbox')
await page.setData({"pageData": "add"})
// console.log('pageData---add: ',await page.data('pageData'));
const isAdd = await page.waitFor(async()=>{
const addText = await page.data('pageData')
return addText === 'add'
})
if(isAdd){//加载更多
/* if (process.env.UNI_PLATFORM === "mp-weixin") {
const toLoadMore = await page.$('.toLoadMore')
const loadMore = await toLoadMore.$('.loadMore')
await loadMore.tap()
await page.waitFor(300)
} */
if (process.env.UNI_PLATFORM === "h5" || process.env.UNI_PLATFORM.startsWith("app")) {
const loadMore = await page.$('.loadMore')
// console.log('loadMore: ',loadMore);
// await page.waitFor(300)
await loadMore.tap()
await page.waitFor(300)
}
console.log('pageData---: ',await page.data('pageData'));
await page.waitFor(1000)
//加载更多
/* if (process.env.UNI_PLATFORM === "mp-weixin") {
const toLoadMore = await page.$('.toLoadMore')
const loadMore = await toLoadMore.$('.loadMore')
await loadMore.tap()
await page.waitFor(300)
} */
if (process.env.UNI_PLATFORM === "h5" || process.env.UNI_PLATFORM.startsWith("app")) {
const loadMore = await page.$('.loadMore')
console.log('loadMore: ',loadMore);
await loadMore.tap()
await page.waitFor(300)
}
//每页数据数量减去1
const pageSizeSubBefore = await page.data('pageSize')
const numBox2 = await page.$('.num-box2')
......
......@@ -3,25 +3,12 @@ describe('pages/schema2code/schema2code.nvue', () => {
beforeAll(async () => {
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
page = await program.reLaunch('/pages/schema2code/schema2code')
await page.setData({ isTest: true })
await page.waitFor('view')
})
it('schema2code-点击', async () => {
const title = await page.$('.uni-title')
const showSchemaCode = await title.$('.showSchemaCode')
await showSchemaCode.tap()
await page.waitFor(300)
// const showSchemaCode = await page.callMethod('showSchemaCode')
})
it('前往生成的云端一体页面', async () => {
const toForm = await page.$('.toForm')
await toForm.tap()
await page.waitFor(1000)
// expect( (await program.currentPage()).path).toBe('pages/user-info/list')
// await page.waitFor(500)
// //返回navigateBack 验证是否返回
// expect((await program.navigateBack()).path).toBe('pages/schema2code/schema2code')
})
})
<template>
<view class="root">
<view class="uni-title dashed-box">
<text class="tip">
schema2code是一个根据数据库schema自动生成代码的工具。它可以直接生成云端一体的列表、详情、新建、修改页面,云端一体直接可用。大幅提升开发效率。
</text>
<text>\n schema路径:uniCloud/database/user-info.schema.json \n</text>
<button class="showSchemaCode" size="mini" @click="showSchemaCode" type="primary" plain>查看schema代码</button>
</view>
<j-video v-if="showVideo" :src="videoUrl" title="schema2code步骤演示" height="421rpx" width="750rpx"></j-video>
<alertCode ref="alertCode"></alertCode>
<button class="toForm" @click="toForm" type="primary" size="mini" plain>前往生成的云端一体页面</button>
</view>
<view class="root">
<view class="uni-title dashed-box">
<text class="tip">
schema2code是一个根据数据库schema自动生成代码的工具。它可以直接生成云端一体的列表、详情、新建、修改页面,云端一体直接可用。大幅提升开发效率。
</text>
<text>\n schema路径:uniCloud/database/user-info.schema.json \n</text>
<button class="showSchemaCode" size="mini" @click="showSchemaCode" type="primary" plain>查看schema代码</button>
</view>
<j-video v-if="showVideo" :src="videoUrl" title="schema2code步骤演示" height="421rpx" width="750rpx"></j-video>
<alertCode ref="alertCode"></alertCode>
<button class="toForm" @click="toForm" type="primary" size="mini" plain>前往生成的云端一体页面</button>
</view>
</template>
<script>
import schemaCode from './schemaCode';
export default {
data() {
return {
schemaCode: schemaCode,
videoUrl: "https://web-assets.dcloud.net.cn/unidoc/zh/schema2code%E7%9A%84%E4%B8%A4%E7%A7%8D%E6%96%B9%E5%BC%8F.mp4",
// https://web-assets.dcloud.net.cn/unidoc/zh/create-schema2code-video.mp4,
showVideo: false,
isTest: false
}
},
onReady() {
setTimeout(() => {
if(!this.isTest){
this.showVideo = true;
}
},1000)
},
methods: {
async showSchemaCode() {
return this.$refs.alertCode.open(schemaCode)
},
toForm() {
uni.navigateTo({
url: '../user-info/list'
})
}
}
}
import schemaCode from './schemaCode';
export default {
data() {
return {
schemaCode: schemaCode,
videoUrl: "https://web-assets.dcloud.net.cn/unidoc/zh/schema2code%E7%9A%84%E4%B8%A4%E7%A7%8D%E6%96%B9%E5%BC%8F.mp4",
// https://web-assets.dcloud.net.cn/unidoc/zh/create-schema2code-video.mp4,
showVideo: false,
}
},
onReady() {
this.showVideo = true;
},
methods: {
async showSchemaCode() {
return this.$refs.alertCode.open(schemaCode)
},
toForm() {
uni.navigateTo({
url: '../user-info/list'
})
}
}
}
</script>
<style scoped>
.code-view {
height: 750rpx;
width: 750rpx;
padding: 5px 8px;
overflow: scroll;
background-color: #fffae7;
}
.code-view {
height: 750rpx;
width: 750rpx;
padding: 5px 8px;
overflow: scroll;
background-color: #fffae7;
}
.code-box {
white-space: nowrap;
color: #447315;
font-size: 12px;
}
.code-box {
white-space: nowrap;
color: #447315;
font-size: 12px;
}
.root {
flex-direction: column;
}
.root {
flex-direction: column;
}
.dashed-box {
border: dashed 1px #EEEEEE;
border-radius: 5px;
width: 750rpx;
position: relative;
}
.dashed-box {
border: dashed 1px #EEEEEE;
border-radius: 5px;
width: 750rpx;
position: relative;
}
.uni-title {
width: 680rpx;
margin: 15rpx;
font-size: 26rpx;
padding: 20rpx;
line-height: 1.5;
background-color: #FFFFFF;
}
.uni-title {
width: 680rpx;
margin: 15rpx;
font-size: 26rpx;
padding: 20rpx;
line-height: 1.5;
background-color: #FFFFFF;
}
.uni-title text {
font-size: 24rpx;
color: #888;
}
.uni-title text {
font-size: 24rpx;
color: #888;
}
.toForm {
width: 500rpx;
margin: 30px 125rpx;
}
.toForm {
width: 500rpx;
margin: 30px 125rpx;
}
.uni-title text.link {
color: #586b95;
}
.uni-title text.link {
color: #586b95;
}
text.tip {
background-color: #FFFFFF;
color: #333;
height: 80px;
width: 750rpx;
}
text.tip {
background-color: #FFFFFF;
color: #333;
height: 80px;
width: 750rpx;
}
.showSchemaCode {
margin-top: 10px;
}
.showSchemaCode {
margin-top: 10px;
}
</style>
\ No newline at end of file
......@@ -10,6 +10,7 @@ describe('pages/user-info/add.vue', () => {
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
page = await program.reLaunch('/pages/user-info/add')
await page.waitFor('view')
await page.setData({'isTest':true})
})
it('输入表单内容', async () => {
await page.setData({
......@@ -30,5 +31,6 @@ describe('pages/user-info/add.vue', () => {
"isTest": true
})
await page.callMethod('submit')
await page.waitFor(1000)
})
})
\ No newline at end of file
......@@ -23,19 +23,23 @@
<uni-easyinput placeholder="请输入网址的地址" v-model="formData.url"></uni-easyinput>
</uni-forms-item>
<uni-forms-item name="favorite_book_id" label="喜欢的书">
<uni-data-checkbox v-model="formData.favorite_book_id" collection="book" field="title as text, _id as value" orderby="desc"></uni-data-checkbox>
<uni-data-checkbox v-model="formData.favorite_book_id" collection="book" field="title as text, _id as value"
orderby="desc"></uni-data-checkbox>
</uni-forms-item>
<uni-forms-item name="address_code" label="地址">
<uni-data-picker self-field="code" parent-field="parent_code" v-model="formData.address_code" collection="opendb-city-china" orderby="value asc" field="code as value, name as text"></uni-data-picker>
<uni-data-picker self-field="code" parent-field="parent_code" v-model="formData.address_code"
collection="opendb-city-china" orderby="value asc" field="code as value, name as text"></uni-data-picker>
</uni-forms-item>
<uni-forms-item name="party_member" label="是否为党员">
<switch @change="binddata('party_member', $event.detail.value)" :checked="formData.party_member"></switch>
</uni-forms-item>
<uni-forms-item name="hobby" label="业余爱好">
<uni-data-checkbox multiple="true" :multiple="true" v-model="formData.hobby" :localdata="formOptions.hobby_localdata"></uni-data-checkbox>
<uni-data-checkbox multiple="true" :multiple="true" v-model="formData.hobby"
:localdata="formOptions.hobby_localdata"></uni-data-checkbox>
</uni-forms-item>
<uni-forms-item name="comment" label="备注">
<textarea placeholder="拒绝违禁词,如:test" @input="binddata('comment', $event.detail.value)" class="uni-textarea-border" v-model="formData.comment"></textarea>
<textarea placeholder="拒绝违禁词,如:test" @input="binddata('comment', $event.detail.value)"
class="uni-textarea-border" v-model="formData.comment"></textarea>
</uni-forms-item>
<view class="uni-button-group">
<button type="primary" class="uni-button" @click="submit">提交</button>
......@@ -45,7 +49,9 @@
</template>
<script>
import { validator } from '../../js_sdk/validator/user-info.js';
import {
validator
} from '../../js_sdk/validator/user-info.js';
const db = uniCloud.database();
const dbCollectionName = 'user-info';
......@@ -77,11 +83,11 @@
"comment": ""
}
return {
isTest:false,
//自动化测试
isTest: false,
formData,
formOptions: {
"gender_localdata": [
{
"gender_localdata": [{
"text": "未知",
"value": 0
},
......@@ -94,8 +100,7 @@
"value": 2
}
],
"hobby_localdata": [
{
"hobby_localdata": [{
"text": "唱歌",
"value": "Sing"
},
......@@ -125,8 +130,8 @@
uni.showLoading({
mask: true
})
return this.$refs.form.validate().then(async(res) => {
return await this.submitForm(res)
return this.$refs.form.validate().then(async (res) => {
return await this.submitForm(res)
}).catch(() => {
uni.hideLoading()
})
......@@ -138,17 +143,17 @@
icon: 'none',
title: '新增成功'
})
if(!this.isTest){
this.getOpenerEventChannel().emit('refreshData')
setTimeout(() => uni.navigateBack(), 500)
}
return res
if (!this.isTest) {
this.getOpenerEventChannel().emit('refreshData')
setTimeout(() => uni.navigateBack(), 500)
}
return res
}).catch((err) => {
uni.showModal({
content: err.message || '请求服务失败',
showCancel: false
})
return err
return err
}).finally(() => {
uni.hideLoading()
})
......@@ -199,4 +204,4 @@
line-height: 1;
margin: 0;
}
</style>
</style>
\ No newline at end of file
......@@ -11,7 +11,7 @@ describe('pages/user-info/detail.vue', () => {
// page = await program.navigateTo('/pages/user-info/detail')
page = await program.currentPage()
await page.waitFor('view')
const getQuery = await page.query
getQuery = await page.query
console.log('getQuery: ', getQuery);
if (Object.keys(getQuery).length === 0 || getQuery === undefined) {
console.log('err query')
......@@ -25,4 +25,11 @@ describe('pages/user-info/detail.vue', () => {
console.log('currentPage', await program.currentPage())
expect((await program.currentPage()).path).toBe('pages/user-info/edit')
})
// it('删除当前数据', async () => {
// await page.callMethod('handleDelete')
// await page.waitFor(1000)
// const testRes = await page.data('testRes')
// console.log('testRes', testRes)
// console.log('currentPage', await program.currentPage())
// })
})
\ No newline at end of file
<template>
<view class="container">
<unicloud-db ref="udb" v-slot:default="{data, loading, error, options}" :options="options"
collection="user-info,book,opendb-city-china"
field="username,gender,birth_date,weight,mobile,email,url,favorite_book_id{title},address_code{name},party_member,hobby,comment"
:where="queryWhere" :getone="true" :manual="true">
<view v-if="error">{{error.message}}</view>
<view v-else-if="loading">
<uni-load-more :contentText="loadMore" status="loading"></uni-load-more>
</view>
<view v-else-if="data">
<view>
<text>真实姓名</text>
<text>{{data.username}}</text>
</view>
<view>
<text>性别</text>
<text>{{options.gender_valuetotext[data.gender]}}</text>
</view>
<view>
<text>生日</text>
<uni-dateformat :threshold="[0, 0]" :date="data.birth_date"></uni-dateformat>
</view>
<view>
<text>体重</text>
<text>{{data.weight}}</text>
</view>
<view>
<text>手机号码</text>
<text>{{data.mobile}}</text>
</view>
<view>
<text>邮箱账号</text>
<uni-link :href="'mailto:'+data.email" :text="data.email"></uni-link>
</view>
<view>
<text>个人博客</text>
<uni-link :href="data.url" :download="data.url" :text="data.url"></uni-link>
</view>
<view>
<text>喜欢的书</text>
<text>{{data.favorite_book_id && data.favorite_book_id[0] && data.favorite_book_id[0].title}}</text>
</view>
<view>
<text>地址</text>
<text>{{data.address_code && data.address_code[0] && data.address_code[0].name}}</text>
</view>
<view>
<text>是否为党员</text>
<text>{{data.party_member == true ? '' : ''}}</text>
</view>
<view>
<text>业余爱好</text>
<uni-data-picker :localdata="options.hobby_valuetotext" :value="data.hobby" :multiple="false"
:readonly="true" :arrow="false" split=","></uni-data-picker>
</view>
<view>
<text>备注</text>
<text>{{data.comment}}</text>
</view>
</view>
</unicloud-db>
<view class="btns">
<button type="primary" @click="handleUpdate">修改</button>
<button type="warn" class="btn-delete" @click="handleDelete">删除</button>
</view>
</view>
<view class="container">
<unicloud-db ref="udb" v-slot:default="{data, loading, error, options}" :options="options"
collection="user-info,book,opendb-city-china"
field="username,gender,birth_date,weight,mobile,email,url,favorite_book_id{title},address_code{name},party_member,hobby,comment"
:where="queryWhere" :getone="true" :manual="true">
<view v-if="error">{{error.message}}</view>
<view v-else-if="loading">
<uni-load-more :contentText="loadMore" status="loading"></uni-load-more>
</view>
<view v-else-if="data">
<view>
<text>真实姓名</text>
<text>{{data.username}}</text>
</view>
<view>
<text>性别</text>
<text>{{options.gender_valuetotext[data.gender]}}</text>
</view>
<view>
<text>生日</text>
<uni-dateformat :threshold="[0, 0]" :date="data.birth_date"></uni-dateformat>
</view>
<view>
<text>体重</text>
<text>{{data.weight}}</text>
</view>
<view>
<text>手机号码</text>
<text>{{data.mobile}}</text>
</view>
<view>
<text>邮箱账号</text>
<uni-link :href="'mailto:'+data.email" :text="data.email"></uni-link>
</view>
<view>
<text>个人博客</text>
<uni-link :href="data.url" :download="data.url" :text="data.url"></uni-link>
</view>
<view>
<text>喜欢的书</text>
<text>{{data.favorite_book_id && data.favorite_book_id[0] && data.favorite_book_id[0].title}}</text>
</view>
<view>
<text>地址</text>
<text>{{data.address_code && data.address_code[0] && data.address_code[0].name}}</text>
</view>
<view>
<text>是否为党员</text>
<text>{{data.party_member == true ? '' : ''}}</text>
</view>
<view>
<text>业余爱好</text>
<uni-data-picker :localdata="options.hobby_valuetotext" :value="data.hobby" :multiple="false" :readonly="true"
:arrow="false" split=","></uni-data-picker>
</view>
<view>
<text>备注</text>
<text>{{data.comment}}</text>
</view>
</view>
</unicloud-db>
<view class="btns">
<button type="primary" @click="handleUpdate">修改</button>
<button type="warn" class="btn-delete" @click="handleDelete">删除</button>
</view>
</view>
</template>
<script>
// 由schema2code生成,包含校验规则和enum静态数据
import {
enumConverter
} from '../../js_sdk/validator/user-info.js';
// 由schema2code生成,包含校验规则和enum静态数据
import {
enumConverter
} from '../../js_sdk/validator/user-info.js';
export default {
data() {
return {
queryWhere: '',
loadMore: {
contentdown: '',
contentrefresh: '',
contentnomore: ''
},
options: {
// 将scheme enum 属性静态数据中的value转成text
...enumConverter
},
_id: ''
}
},
onLoad(e) {
console.log('e:-----id ', e);
this._id = e.id
},
onReady() {
if (this._id) {
this.queryWhere = '_id=="' + this._id + '"'
}
},
methods: {
handleUpdate() {
// 打开修改页面
uni.navigateTo({
url: './edit?id=' + this._id,
events: {
// 监听修改页面成功修改数据后, 刷新当前页面数据
refreshData: () => {
this.$refs.udb.loadData({
clear: true
})
}
}
})
},
handleDelete() {
console.log('handleDelete:-----');
this.$refs.udb.remove(this._id, {
success: (res) => {
console.log('res:-----', res);
// 删除数据成功后跳转到list页面
uni.navigateTo({
url: './list'
})
},
fail: (err) => {
console.log('err:-----', err);
uni.showToast({
title: '删除失败',
icon: 'none'
})
}
})
}
}
}
export default {
data() {
return {
queryWhere: '',
loadMore: {
contentdown: '',
contentrefresh: '',
contentnomore: ''
},
options: {
// 将scheme enum 属性静态数据中的value转成text
...enumConverter
},
_id: '',
//自动化测试
testRes:{}
}
},
onLoad(e) {
console.log('e:-----id ', e);
this._id = e.id
},
onReady() {
if (this._id) {
this.queryWhere = '_id=="' + this._id + '"'
}
},
methods: {
handleUpdate() {
// 打开修改页面
uni.navigateTo({
url: './edit?id=' + this._id,
events: {
// 监听修改页面成功修改数据后, 刷新当前页面数据
refreshData: () => {
this.$refs.udb.loadData({
clear: true
})
}
}
})
},
handleDelete() {
this.$refs.udb.remove(this._id, {
needConfirm: false, //自动化测试关闭弹框
success: (res) => {
console.log('res:-----', res);
this.testRes = res
// 删除数据成功后跳转到list页面
uni.navigateTo({
url: './list'
})
},
fail: (err) => {
console.log('err:-----', err);
this.testRes = err
uni.showToast({
title: '删除失败',
icon: 'none'
})
}
})
}
}
}
</script>
<style>
.container {
padding: 10px;
}
.container {
padding: 10px;
}
.btns {
margin-top: 10px;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
}
.btns {
margin-top: 10px;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
}
.btns button {
flex: 1;
}
.btns button {
flex: 1;
}
.btn-delete {
margin-left: 10px;
}
.btn-delete {
margin-left: 10px;
}
</style>
\ No newline at end of file
......@@ -10,7 +10,9 @@ describe('pages/user-info/detail.vue', () => {
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
// page = await program.navigateTo('/pages/user-info/edit?id=601d044ac9e7be0001cc00b8')
page = await program.currentPage()
await page.waitFor('view')
console.log('page: ', page);
await page.waitFor('view')
await page.setData({'isTest':true})
getQuery = await page.query
console.log('getQuery: ', getQuery);
if (Object.keys(getQuery).length === 0 || getQuery === undefined) {
......
......@@ -23,19 +23,23 @@
<uni-easyinput placeholder="请输入网址的地址" v-model="formData.url"></uni-easyinput>
</uni-forms-item>
<uni-forms-item name="favorite_book_id" label="喜欢的书">
<uni-data-checkbox v-model="formData.favorite_book_id" collection="book" field="title as text, _id as value" orderby="desc"></uni-data-checkbox>
<uni-data-checkbox v-model="formData.favorite_book_id" collection="book" field="title as text, _id as value"
orderby="desc"></uni-data-checkbox>
</uni-forms-item>
<uni-forms-item name="address_code" label="地址">
<uni-data-picker self-field="code" parent-field="parent_code" v-model="formData.address_code" collection="opendb-city-china" orderby="value asc" field="code as value, name as text"></uni-data-picker>
<uni-data-picker self-field="code" parent-field="parent_code" v-model="formData.address_code"
collection="opendb-city-china" orderby="value asc" field="code as value, name as text"></uni-data-picker>
</uni-forms-item>
<uni-forms-item name="party_member" label="是否为党员">
<switch @change="binddata('party_member', $event.detail.value)" :checked="formData.party_member"></switch>
</uni-forms-item>
<uni-forms-item name="hobby" label="业余爱好">
<uni-data-checkbox multiple="true" :multiple="true" v-model="formData.hobby" :localdata="formOptions.hobby_localdata"></uni-data-checkbox>
<uni-data-checkbox multiple="true" :multiple="true" v-model="formData.hobby"
:localdata="formOptions.hobby_localdata"></uni-data-checkbox>
</uni-forms-item>
<uni-forms-item name="comment" label="备注">
<textarea placeholder="拒绝违禁词,如:test" @input="binddata('comment', $event.detail.value)" class="uni-textarea-border" v-model="formData.comment"></textarea>
<textarea placeholder="拒绝违禁词,如:test" @input="binddata('comment', $event.detail.value)"
class="uni-textarea-border" v-model="formData.comment"></textarea>
</uni-forms-item>
<view class="uni-button-group">
<button type="primary" class="uni-button" @click="submit">提交</button>
......@@ -45,7 +49,9 @@
</template>
<script>
import { validator } from '../../js_sdk/validator/user-info.js';
import {
validator
} from '../../js_sdk/validator/user-info.js';
const db = uniCloud.database();
const dbCollectionName = 'user-info';
......@@ -77,11 +83,11 @@
"comment": ""
}
return {
isTest:false,
//自动化测试
isTest: false,
formData,
formOptions: {
"gender_localdata": [
{
"gender_localdata": [{
"text": "未知",
"value": 0
},
......@@ -94,8 +100,7 @@
"value": 2
}
],
"hobby_localdata": [
{
"hobby_localdata": [{
"text": "唱歌",
"value": "Sing"
},
......@@ -132,7 +137,7 @@
uni.showLoading({
mask: true
})
return this.$refs.form.validate().then(async(res) => {
return this.$refs.form.validate().then(async (res) => {
return await this.submitForm(res)
}).catch(() => {
uni.hideLoading()
......@@ -146,19 +151,18 @@
icon: 'none',
title: '修改成功'
})
if(!this.isTest){
}
this.getOpenerEventChannel().emit('refreshData')
setTimeout(() => uni.navigateBack(), 500)
console.log('res: ',res);
return res.result
if (!this.isTest) {
this.getOpenerEventChannel().emit('refreshData')
setTimeout(() => uni.navigateBack(), 500)
}
console.log('res: ', res);
return res.result
}).catch((err) => {
uni.showModal({
content: err.message || '请求服务失败',
showCancel: false
})
return err
return err
}).finally(() => {
uni.hideLoading()
})
......@@ -172,7 +176,9 @@
uni.showLoading({
mask: true
})
db.collection(dbCollectionName).doc(id).field("username,gender,birth_date,weight,mobile,email,url,favorite_book_id,address_code,party_member,hobby,comment").get().then((res) => {
db.collection(dbCollectionName).doc(id).field(
"username,gender,birth_date,weight,mobile,email,url,favorite_book_id,address_code,party_member,hobby,comment"
).get().then((res) => {
const data = res.result.data[0]
if (data) {
this.formData = data
......@@ -232,4 +238,4 @@
line-height: 1;
margin: 0;
}
</style>
</style>
\ No newline at end of file
// jest.setTimeout(20000)
describe('pages/user-info/list.vue', () => {
let page, currentPage;
console.log('uniTestPlatformInfo', process.env.uniTestPlatformInfo)
console.log('uniTestPlatformInfo', process.env.uniTestPlatformInfo,process.env.UNI_PLATFORM)
if (process.env.uniTestPlatformInfo == 'ios_simulator 13.7') {
it('ios', async () => {
expect(1).toBe(1)
......@@ -12,7 +12,6 @@ describe('pages/user-info/list.vue', () => {
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
page = await program.navigateTo('/pages/user-info/list')
await page.waitFor('view')
console.log('process----', process.env.UNI_PLATFORM)
})
async function waitTime() {
if (process.env.UNI_PLATFORM == 'mp-weixin') {
......@@ -21,7 +20,7 @@ describe('pages/user-info/list.vue', () => {
await page.waitFor(1000)
}
}
it('点击fab跳转到添加', async () => {
it('点击fab跳转到add', async () => {
await page.callMethod('fabClick')
await page.waitFor('view')
await waitTime()
......@@ -33,7 +32,7 @@ describe('pages/user-info/list.vue', () => {
await program.navigateBack()
await page.waitFor('view')
})
it('点击第一条', async () => {
it('点击第一条跳转到detail页', async () => {
await waitTime()
const items = await page.$$('.uni-list-item')
if (items.length > 0) {
......
const Sequencer = require("@jest/test-sequencer").default;
const sortTestFilenames = ["add.test.js","list.test.js","detail.test.js","edit.test.js","cloudFunction.test.js"];
const sortTestFilenames = ["add.test.js","list.test.js","detail.test.js","edit.test.js"];
class CustomSequencer extends Sequencer {
sort(tests) {
// 测试例排序
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册