提交 3bb685ca 编写于 作者: taohebin@dcloud.io's avatar taohebin@dcloud.io

update: dialog-page.uvue

上级 61bf6617
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<button class="mt-10" id="dialog1-close-dialog" @click="closeDialog">closeDialog</button> <button class="mt-10" id="dialog1-close-dialog" @click="closeDialog">closeDialog</button>
<button class="mt-10" id="dialog1-close-this-dialog" @click="closeThisDialog">closeThisDialog</button> <button class="mt-10" id="dialog1-close-this-dialog" @click="closeThisDialog">closeThisDialog</button>
<button class="mt-10" id="dialog1-back" @click="back">back</button> <button class="mt-10" id="dialog1-back" @click="back">back</button>
<input class="uni-common-mt" style="border-width: 1px;border-style: solid;" :focus="true" value="DialogPage中焦点测试"/>
</view> </view>
</view> </view>
</template> </template>
......
...@@ -2,6 +2,7 @@ jest.setTimeout(20000) ...@@ -2,6 +2,7 @@ jest.setTimeout(20000)
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase() const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
const isWeb = platformInfo.startsWith('web') const isWeb = platformInfo.startsWith('web')
const isAndroid = platformInfo.startsWith('android')
const FIRST_PAGE_PATH = '/pages/API/dialog-page/dialog-page' const FIRST_PAGE_PATH = '/pages/API/dialog-page/dialog-page'
const NEXT_PAGE_PATH = '/pages/API/dialog-page/next-page' const NEXT_PAGE_PATH = '/pages/API/dialog-page/next-page'
...@@ -282,6 +283,32 @@ describe('dialog page', () => { ...@@ -282,6 +283,32 @@ describe('dialog page', () => {
}) })
it('input-hold-keyboard in dialog', async () => {
await page.callMethod('jest_OpenDialog1')
await page.waitFor(2000);
await page.callMethod('jest_getTapPoint')
const point_x = await page.data('jest_click_x');
const point_y = await page.data('jest_click_y');
if (isAndroid){
await program.adbCommand("input tap" + " " + point_x + " " + point_y)
console.log("input tap" + " " + point_x + " " + point_y);
} else {
await program.tap({x: point_x, y: point_y})
}
await page.waitFor(1000);
const image = await program.screenshot({
deviceShot: true,
area: {
x: 0,
y: 200,
}
})
expect(image).toSaveImageSnapshot()
await page.waitFor(2000);
await page.callMethod('jest_CloseDialog1')
})
afterAll(async () => { afterAll(async () => {
await page.callMethod('setLifeCycleNum', initLifeCycleNum) await page.callMethod('setLifeCycleNum', initLifeCycleNum)
}); });
......
...@@ -16,6 +16,12 @@ ...@@ -16,6 +16,12 @@
} from '@/store/index.uts' } from '@/store/index.uts'
export default { export default {
data() {
return {
jest_click_x: -1,
jest_click_y: -1
}
},
onLoad() { onLoad() {
console.log('dialogPage parent onLoad') console.log('dialogPage parent onLoad')
}, },
...@@ -170,6 +176,23 @@ ...@@ -170,6 +176,23 @@
}, },
getLifeCycleNum(): number { getLifeCycleNum(): number {
return state.lifeCycleNum return state.lifeCycleNum
},
jest_OpenDialog1(){
uni.openDialogPage({
url: '/pages/API/dialog-page/dialog-1?name=dialog1'
})
},
jest_CloseDialog1(){
uni.closeDialogPage({})
},
jest_getTapPoint(){
const systemInfo = uni.getSystemInfoSync()
let ratio = 1
if (systemInfo.platform == 'android'){
ratio = systemInfo.devicePixelRatio
}
this.jest_click_x = systemInfo.screenWidth / 2 * ratio
this.jest_click_y = systemInfo.statusBarHeight * ratio + 10
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册