提交 c2983695 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

test: 优化测试例

上级 2f59b2af
jest.setTimeout(20000)
describe('pages/clientDB/permission-table-compound/permission-table-compound.vue', () => { describe('pages/clientDB/permission-table-compound/permission-table-compound.vue', () => {
let page,errMsgA,errMsgB,perPage,segItems,roles; let page,errMsgA,errMsgB,perPage,segItems,roles;
beforeAll(async () => { beforeAll(async () => {
...@@ -398,9 +400,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue ...@@ -398,9 +400,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"index": 1, "index": 1,
"action": "add_view_count" "action": "add_view_count"
}) })
}) })
......
...@@ -13,7 +13,7 @@ describe('pages/clientDB/validate/validate.vue', () => { ...@@ -13,7 +13,7 @@ describe('pages/clientDB/validate/validate.vue', () => {
const segmentedControl = await page.$('.segmented-control') const segmentedControl = await page.$('.segmented-control')
const seControl = await segmentedControl.$$('.segmented-control__item') const seControl = await segmentedControl.$$('.segmented-control__item')
// console.log(await seControl[0].text()); // console.log(await seControl[0].text());
expect(await seControl[0].text()).toBe('实例demo') expect((await seControl[0].text()).trim()).toBe('实例demo')
await seControl[1].tap() await seControl[1].tap()
await page.waitFor(300) await page.waitFor(300)
await seControl[2].tap() await seControl[2].tap()
......
describe('pages/schema2code/schema2code.nvue', () => { describe('pages/schema2code/schema2code.nvue', () => {
let page
let page beforeAll(async () => {
beforeAll(async () => { // 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象) page = await program.reLaunch('/pages/schema2code/schema2code')
page = await program.switchTab('/pages/schema2code/schema2code') await page.setData({ isTest: true })
await page.waitFor('view') await page.waitFor('view')
}) })
it('schema2code-点击',async()=>{ it('schema2code-点击', async () => {
const title = await page.$('.uni-title') const title = await page.$('.uni-title')
const showSchemaCode = await title.$('.showSchemaCode') const showSchemaCode = await title.$('.showSchemaCode')
await showSchemaCode.tap() await showSchemaCode.tap()
await page.waitFor(300) await page.waitFor(300)
// const showSchemaCode = await page.callMethod('showSchemaCode') // const showSchemaCode = await page.callMethod('showSchemaCode')
}) })
it('前往生成的云端一体页面', async () => {
it('前往生成的云端一体页面',async()=>{ const toForm = await page.$('.toForm')
const toForm = await page.$('.toForm') await toForm.tap()
await toForm.tap() await page.waitFor(1000)
await page.waitFor(1000) // expect( (await program.currentPage()).path).toBe('pages/user-info/list')
// expect( (await program.currentPage()).path).toBe('pages/user-info/list') // await page.waitFor(500)
// await page.waitFor(500) // //返回navigateBack 验证是否返回
// //返回navigateBack 验证是否返回 // expect((await program.navigateBack()).path).toBe('pages/schema2code/schema2code')
// expect((await program.navigateBack()).path).toBe('pages/schema2code/schema2code') })
}) })
})
\ No newline at end of file
<template> <template>
<view class="root"> <view class="root">
<view class="uni-title dashed-box"> <view class="uni-title dashed-box">
<text class="tip"> <text class="tip">
schema2code是一个根据数据库schema自动生成代码的工具。它可以直接生成云端一体的列表、详情、新建、修改页面,云端一体直接可用。大幅提升开发效率。 schema2code是一个根据数据库schema自动生成代码的工具。它可以直接生成云端一体的列表、详情、新建、修改页面,云端一体直接可用。大幅提升开发效率。
</text> </text>
<text>\n schema路径:uniCloud/database/user-info.schema.json \n</text> <text>\n schema路径:uniCloud/database/user-info.schema.json \n</text>
<button class="showSchemaCode" size="mini" @click="showSchemaCode" type="primary" plain>查看schema代码</button> <button class="showSchemaCode" size="mini" @click="showSchemaCode" type="primary" plain>查看schema代码</button>
</view> </view>
<j-video :src="videoUrl" title="schema2code步骤演示" height="421rpx" width="750rpx"></j-video> <j-video v-if="showVideo" :src="videoUrl" title="schema2code步骤演示" height="421rpx" width="750rpx"></j-video>
<alertCode ref="alertCode"></alertCode> <alertCode ref="alertCode"></alertCode>
<button class="toForm" @click="toForm" type="primary" size="mini" plain>前往生成的云端一体页面</button> <button class="toForm" @click="toForm" type="primary" size="mini" plain>前往生成的云端一体页面</button>
</view> </view>
</template> </template>
<script> <script>
import schemaCode from './schemaCode'; import schemaCode from './schemaCode';
export default { export default {
data() { data() {
return { return {
schemaCode:schemaCode, 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", 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 // https://web-assets.dcloud.net.cn/unidoc/zh/create-schema2code-video.mp4,
} showVideo: false,
}, isTest: false
methods: { }
async showSchemaCode(){ },
return this.$refs.alertCode.open(schemaCode) onReady() {
}, setTimeout(() => {
toForm(){ if(!this.isTest){
uni.navigateTo({ this.showVideo = true;
url:'../user-info/list' }
}) },1000)
} },
} methods: {
} async showSchemaCode() {
</script> return this.$refs.alertCode.open(schemaCode)
},
<style scoped> toForm() {
.code-view{ uni.navigateTo({
height:750rpx; url: '../user-info/list'
width: 750rpx; })
padding:5px 8px; }
overflow: scroll; }
background-color:#fffae7; }
} </script>
.code-box{
white-space:nowrap; <style scoped>
color: #447315; .code-view {
font-size: 12px; height: 750rpx;
} width: 750rpx;
.root{ padding: 5px 8px;
flex-direction: column; overflow: scroll;
} background-color: #fffae7;
.dashed-box{ }
border: dashed 1px #EEEEEE;
border-radius: 5px; .code-box {
width: 750rpx; white-space: nowrap;
position: relative; color: #447315;
} font-size: 12px;
.uni-title { }
width: 680rpx;
margin: 15rpx; .root {
font-size:26rpx; flex-direction: column;
padding:20rpx; }
line-height:1.5;
background-color: #FFFFFF; .dashed-box {
} border: dashed 1px #EEEEEE;
.uni-title text{ border-radius: 5px;
font-size:24rpx; width: 750rpx;
color:#888; position: relative;
} }
.toForm{
width: 500rpx; .uni-title {
margin:30px 125rpx; width: 680rpx;
} margin: 15rpx;
.uni-title text.link{ font-size: 26rpx;
color: #586b95; padding: 20rpx;
} line-height: 1.5;
text.tip{ background-color: #FFFFFF;
background-color: #FFFFFF; }
color: #333;
height: 80px; .uni-title text {
width: 750rpx; font-size: 24rpx;
} color: #888;
.showSchemaCode{ }
margin-top: 10px;
} .toForm {
</style> width: 500rpx;
margin: 30px 125rpx;
}
.uni-title text.link {
color: #586b95;
}
text.tip {
background-color: #FFFFFF;
color: #333;
height: 80px;
width: 750rpx;
}
.showSchemaCode {
margin-top: 10px;
}
</style>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册