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

feat(input): 补充 type digit 测试

上级 fcbe5468
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe('component-native-input', () => { describe('component-native-input', () => {
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
const isAndroid = platformInfo.startsWith('android')
const isIos = platformInfo.startsWith('ios')
let page; let page;
beforeAll(async () => { beforeAll(async () => {
page = await program.reLaunch('/pages/component/input/input') page = await program.reLaunch('/pages/component/input/input')
await page.waitFor(3000); await page.waitFor('view');
}); });
// it("beforeAllTestScreenshot", async () => { // it("beforeAllTestScreenshot", async () => {
...@@ -210,4 +210,55 @@ describe('component-native-input', () => { ...@@ -210,4 +210,55 @@ describe('component-native-input', () => {
const input2 = await page.$('#both-model-value'); const input2 = await page.$('#both-model-value');
expect(await input2.value()).toEqual("123") expect(await input2.value()).toEqual("123")
}) })
it('digit input .', async () => {
// ios 非 webview 模式规避该测试
// ios input type='digit' 输入 . 实际得到 。,只有系统软键盘才可以输入 .
if(isIos && !process.env.UNI_AUTOMATOR_APP_WEBVIEW){
return
}
await page.setData({
focus: false,
digitValue: '1'
})
await program.pageScrollTo(0)
const digitInput = await page.$('#uni-input-type-digit')
expect(await digitInput.value()).toEqual('1')
if (isAndroid) {
if (platformInfo.indexOf('6') != -1 && platformInfo.indexOf('x86') == -1) {
await program.tap({
x: 200,
y: 850,
})
} else if (platformInfo.indexOf('12') != -1) {
await program.tap({
x: 200,
y: 1500,
})
} else {
await program.tap({
x: 200,
y: 1200,
})
}
} else if (isIos) {
await program.tap({
x: 200,
y: 450,
})
} else {
await program.tap({
x: 200,
y: 400,
})
}
await page.waitFor(1000)
await program.keyboardInput('.2')
await page.waitFor(500)
await program.tap({
x: 0,
y: 0,
})
await page.waitFor(500)
expect(await digitInput.value()).toEqual('1.2');
})
}); });
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<input id="uni-input-type-number" class="uni-input" type="number" placeholder="数字输入键盘" /> <input id="uni-input-type-number" class="uni-input" type="number" placeholder="数字输入键盘" />
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input id="uni-input-type-digit" class="uni-input" type="digit" placeholder="带小数点的数字输入键盘" /> <input id="uni-input-type-digit" class="uni-input" type="digit" placeholder="带小数点的数字输入键盘" v-model="digitValue" />
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input id="uni-input-type-tel" class="uni-input" :type="inputTypeTel" placeholder="电话输入键盘" /> <input id="uni-input-type-tel" class="uni-input" :type="inputTypeTel" placeholder="电话输入键盘" />
...@@ -303,7 +303,8 @@ ...@@ -303,7 +303,8 @@
keyboardHeight: 0, keyboardHeight: 0,
focusedForKeyboardHeightChangeTest: false, focusedForKeyboardHeightChangeTest: false,
demoValue: '123', demoValue: '123',
adjustPosition: false adjustPosition: false,
digitValue: ''
} }
}, },
methods: { methods: {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册