diff --git a/.gitignore b/.gitignore
index a93ea119369894fe1e6f81a39627e48cf5e5518d..c41c4d6bad832b1f66bf84da28784d95bc7b75fe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,6 @@
node_modules/
.project
-/unpackage/*
-!/unpackage/icon1024.png
+unpackage/
.DS_Store
.hbuilderx/
__image_snapshots__/
diff --git a/changelog.md b/changelog.md
index 54c12be7123d6d91bf2cbd96391c673c93ac3106..1cf8bfe1a8093db24a94a72fc77d3b17c2bed748 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,3 +1,9 @@
+## 1.0.27
+* update 4.23.2024070309-alpha
+
+## 1.0.25
+* update 4.22.2024062415-alpha
+
## 1.0.24
* update 4.21.2024061818-alpha
diff --git a/components/api-set-tabbar/api-set-tabbar.vue b/components/api-set-tabbar/api-set-tabbar.vue
index 4dbe407900182891ac3f6c5e6383497d473c6029..697e4fd6880cf08096caff2da9f4744430526b71 100644
--- a/components/api-set-tabbar/api-set-tabbar.vue
+++ b/components/api-set-tabbar/api-set-tabbar.vue
@@ -112,14 +112,16 @@
color: '#7A7E83',
selectedColor: '#007AFF',
backgroundColor: '#F8F8F8',
- borderStyle: 'black'
+ borderStyle: 'black',
+ // 新增 borderColor,优先级高于 borderStyle
+ // borderColor:'red'
})
} else {
uni.setTabBarStyle({
color: '#FFF',
selectedColor: '#007AFF',
backgroundColor: '#000000',
- borderStyle: 'black'
+ borderStyle: 'black',
})
}
this.hasCustomedStyle = !this.hasCustomedStyle
diff --git a/hybrid/html/local.html b/hybrid/html/local.html
index eafd76ecd5aec666dddf8b5fff228c78165946c0..fbd12a61eacce7639c91cf3dbf5acd67f9b4a9f9 100644
--- a/hybrid/html/local.html
+++ b/hybrid/html/local.html
@@ -48,6 +48,8 @@
普通input
+
+ hello uni-app x apk下载(自动化测试使用)
diff --git a/jest.config.js b/jest.config.js
index b33c151fd2df6c5239ba4fb6a02ce1f154e18a8f..fd80b0b92790de6dd52a7f7d4464e5e6addb02b5 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -1,10 +1,4 @@
-// 自动化测试
-
-// 备注:
-//
-// 1. testPathIgnorePatterns 忽略/pages/API的几条用例,是因为在ios设备上,运行会导致app崩溃。后期完成后,再去除。
-// 2. testPathIgnorePatterns 忽略webview相关用例, 是因为采用app-webview方式后,不需要这两个用例。请勿修改和提交到Git。
-//
+const path = require('path')
module.exports = {
testTimeout: 30000,
@@ -15,8 +9,7 @@ module.exports = {
testMatch: ["/pages/**/*test.[jt]s?(x)"],
testPathIgnorePatterns: [
'/node_modules/',
- '/pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js',
- '/pages/webview-screenshot/webview-screenshot.test.js'
],
setupFilesAfterEnv: ['/jest-setup.js'],
+ testSequencer: path.join(__dirname, "testSequencer.js")
}
diff --git a/manifest.json b/manifest.json
index ab594386ae998908b0faf2a979c9aa6f1a53fd88..228ebb1aa41635ba01b934da4bfc4fa36687ca53 100644
--- a/manifest.json
+++ b/manifest.json
@@ -47,7 +47,11 @@
},
"icons" : {
"ios" : {
- "appstore" : "unpackage/icon1024.png"
+ "appstore" : "package/icon1024.png"
+ },
+ "android" : {
+ "xxhdpi" : "package/icon144.png",
+ "xxxhdpi" : "package/icon192.png"
}
}
}
diff --git a/package.json b/package.json
index 06a8cdd22ce7988d00ec51d4e156e3fd518c85a8..fa3df852af5bb485d9810e34e733ffcc04e115a4 100644
--- a/package.json
+++ b/package.json
@@ -2,10 +2,10 @@
"id": "hello-uniapp-x-alpha",
"name": "hello-uniapp-x-alpha",
"displayName": "hello-uniapp-x-alpha",
- "version": "1.0.24",
+ "version": "1.0.27",
"description": "演示 uni-app x 框架的组件、接口、模板",
"scripts": {
- "check-commit": "node ./git-hooks/check-commit.cjs"
+ "check-commit": "node ./git-hooks/check-commit.cjs"
},
"repository": "https://gitcode.net/dcloud/hello-uni-app-x",
"keywords": [
@@ -88,4 +88,4 @@
}
}
}
-}
+}
\ No newline at end of file
diff --git a/package/icon1024.png b/package/icon1024.png
new file mode 100644
index 0000000000000000000000000000000000000000..a4c67a426121d1028ec27e1f3ffa2921986680f3
Binary files /dev/null and b/package/icon1024.png differ
diff --git a/package/icon144.png b/package/icon144.png
new file mode 100644
index 0000000000000000000000000000000000000000..44ecb98fe072a7d6f71899e41436de262510ccbc
Binary files /dev/null and b/package/icon144.png differ
diff --git a/package/icon192.png b/package/icon192.png
new file mode 100644
index 0000000000000000000000000000000000000000..8b68c6f486b36ad071bc24be26003e53fc25da23
Binary files /dev/null and b/package/icon192.png differ
diff --git a/pages.json b/pages.json
index cca2102d88f926786a1f5b1743ac2f43b634e4cc..8bf4fbb2649043901046cf3bc94ec9c160eab76b 100644
--- a/pages.json
+++ b/pages.json
@@ -56,6 +56,13 @@
"navigationBarTitleText": "list-view"
}
},
+ {
+ "path": "pages/component/list-view/list-view-refresh",
+ "style": {
+ "navigationBarTitleText": "list-view-refresh",
+ "enablePullDownRefresh": false
+ }
+ },
{
"path": "pages/component/list-view/list-view-multiplex",
"style": {
@@ -330,6 +337,107 @@
"navigationBarTitleText": "touch-event"
}
},
+ {
+ "path": "pages/component/nested-scroll-header/nested-scroll-header",
+ "style": {
+ "navigationBarTitleText": "nested-scroll-header"
+ }
+ },
+ {
+ "path": "pages/component/nested-scroll-body/nested-scroll-body",
+ "style": {
+ "navigationBarTitleText": "nested-scroll-body"
+ }
+ },
+ {
+ "path" : "pages/component/swiper/swiper-list-view",
+ "style" :
+ {
+ "navigationBarTitleText" : "swiper嵌套list-view",
+ "enablePullDownRefresh" : false
+ }
+ },
+ // #ifdef WEB
+ {
+ "path" : "pages/component/movable-view/movable-view",
+ "style" :
+ {
+ "navigationBarTitleText" : "movable-view"
+ }
+ },
+ {
+ "path" : "pages/component/label/label",
+ "style" :
+ {
+ "navigationBarTitleText" : "label"
+ }
+ },
+ {
+ "path" : "pages/component/picker/picker",
+ "style" :
+ {
+ "navigationBarTitleText" : "picker"
+ }
+ },
+ {
+ "path" : "pages/component/map/map",
+ "style" :
+ {
+ "navigationBarTitleText" : "map"
+ }
+ },
+ {
+ "path" : "pages/component/cover-view/cover-view",
+ "style" :
+ {
+ "navigationBarTitleText" : "cover-view"
+ }
+ },
+ {
+ "path" : "pages/component/editor/editor",
+ "style" :
+ {
+ "navigationBarTitleText" : "editor"
+ }
+ },
+ {
+ "path" : "pages/API/open-location/open-location",
+ "style" :
+ {
+ "navigationBarTitleText" : "open-location"
+ }
+ },
+ {
+ "path" : "pages/API/choose-location/choose-location",
+ "style" :
+ {
+ "navigationBarTitleText" : "choose-location"
+ }
+ },
+ // #endif
+ {
+ "path": "pages/component/list-view/issue-2199",
+ "style": {
+ "navigationBarTitleText": "issue-2199",
+ "enablePullDownRefresh": false
+ }
+ },
+ // #ifdef WEB
+ {
+ "path" : "pages/component/canvas/canvas",
+ "style" :
+ {
+ "navigationBarTitleText" : "canvas"
+ }
+ },
+ {
+ "path" : "pages/component/canvas/ball",
+ "style" :
+ {
+ "navigationBarTitleText" : "ball"
+ }
+ },
+ // #endif
{
"path": "pages/tabBar/API",
"style": {
@@ -747,6 +855,20 @@
"enablePullDownRefresh": false
}
},
+ {
+ "path": "pages/API/rewarded-video-ad/rewarded-video-ad",
+ "style": {
+ "navigationBarTitleText": "激励视频广告",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/API/request-payment/request-payment",
+ "style": {
+ "navigationBarTitleText": "支付",
+ "enablePullDownRefresh": false
+ }
+ },
// #endif
{
"path": "pages/API/rpx2px/rpx2px",
@@ -755,6 +877,82 @@
"enablePullDownRefresh": false
}
},
+ // #ifdef APP || WEB
+ {
+ "path": "pages/API/request-payment-uni-pay/request-payment-uni-pay",
+ "style": {
+ "navigationBarTitleText": "uni-pay示例",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/API/request-payment-uni-pay/order-detail",
+ "style": {
+ "navigationBarTitleText": "订单详情示例",
+ "enablePullDownRefresh": false
+ }
+ },
+ // #endif
+ {
+ "path" : "pages/API/resize-observer/resize-observer",
+ "style" :
+ {
+ "navigationBarTitleText" : "resize observer"
+ }
+ },
+ // #ifdef WEB
+ {
+ "path" : "pages/API/make-phone-call/make-phone-call",
+ "style" :
+ {
+ "navigationBarTitleText" : "make-phone-call"
+ }
+ },
+ {
+ "path" : "pages/API/inner-audio/inner-audio",
+ "style" :
+ {
+ "navigationBarTitleText" : "inner-audio"
+ }
+ },
+ {
+ "path" : "pages/API/inner-audio/inner-audio-format",
+ "style" :
+ {
+ "navigationBarTitleText" : "inner-audio-format"
+ }
+ },
+ {
+ "path" : "pages/API/inner-audio/inner-audio-path",
+ "style" :
+ {
+ "navigationBarTitleText" : "inner-audio-path"
+ }
+ },
+ {
+ "path" : "pages/API/clipboard/clipboard",
+ "style" :
+ {
+ "navigationBarTitleText" : "clipboard"
+ }
+ },
+ {
+ "path" : "pages/API/on-compass-change/on-compass-change",
+ "style" :
+ {
+ "navigationBarTitleText" : "on-compass-change"
+ }
+ },
+ // #endif
+ // #ifdef APP
+ {
+ "path": "pages/API/theme-change/theme-change",
+ "style": {
+ "navigationBarTitleText": "主题切换",
+ "enablePullDownRefresh": false
+ }
+ },
+ // #endif
{
"path": "pages/tabBar/CSS",
"style": {
@@ -1128,6 +1326,13 @@
"navigationBarTitleText": "css 变量"
}
},
+ {
+ "path" : "pages/CSS/overflow/overflow-visible-event",
+ "style" :
+ {
+ "navigationBarTitleText" : "overflow-visible-event"
+ }
+ },
{
"path": "pages/tabBar/template",
"style": {
@@ -1167,7 +1372,8 @@
{
"path": "pages/template/swiper-vertical-video/swiper-vertical-video",
"style": {
- "navigationStyle": "custom"
+ "navigationStyle": "custom",
+ "backgroundColorContent": "#000000"
}
},
// #ifdef APP
@@ -1239,86 +1445,9 @@
},
// #ifdef WEB
{
- "path": "pages/template/browser-canvas/browser-canvas",
+ "path": "pages/template/browser-element/browser-element",
"style": {
- "navigationBarTitleText": "如何使用浏览器 canvas"
- }
- },
- {
- "path" : "pages/component/movable-view/movable-view",
- "style" :
- {
- "navigationBarTitleText" : "movable-view"
- }
- },
- {
- "path" : "pages/component/label/label",
- "style" :
- {
- "navigationBarTitleText" : "label"
- }
- },
- {
- "path" : "pages/component/picker/picker",
- "style" :
- {
- "navigationBarTitleText" : "picker"
- }
- },
- {
- "path" : "pages/component/map/map",
- "style" :
- {
- "navigationBarTitleText" : "map"
- }
- },
- {
- "path" : "pages/component/cover-view/cover-view",
- "style" :
- {
- "navigationBarTitleText" : "cover-view"
- }
- },
- {
- "path" : "pages/component/editor/editor",
- "style" :
- {
- "navigationBarTitleText" : "editor"
- }
- },
- {
- "path" : "pages/API/map/map",
- "style" :
- {
- "navigationBarTitleText" : "map"
- }
- },
- {
- "path" : "pages/API/make-phone-call/make-phone-call",
- "style" :
- {
- "navigationBarTitleText" : "make-phone-call"
- }
- },
- {
- "path" : "pages/API/inner-audio/inner-audio",
- "style" :
- {
- "navigationBarTitleText" : "inner-audio"
- }
- },
- {
- "path" : "pages/API/inner-audio/inner-audio-format",
- "style" :
- {
- "navigationBarTitleText" : "inner-audio-format"
- }
- },
- {
- "path" : "pages/API/inner-audio/inner-audio-path",
- "style" :
- {
- "navigationBarTitleText" : "inner-audio-path"
+ "navigationBarTitleText": "如何使用浏览器 element"
}
},
// #endif
@@ -1329,13 +1458,6 @@
"navigationBarTitleText": "日历"
}
},
- {
- "path": "pages/API/theme-change/theme-change",
- "style": {
- "navigationBarTitleText": "主题切换",
- "enablePullDownRefresh": false
- }
- },
// #endif
{
"path": "pages/template/schema/schema",
@@ -1351,13 +1473,6 @@
"enablePullDownRefresh": false
}
},
- {
- "path": "pages/API/rewarded-video-ad/rewarded-video-ad",
- "style": {
- "navigationBarTitleText": "激励视频广告",
- "enablePullDownRefresh": false
- }
- },
{
"path": "pages/API/create-request-permission-listener/create-request-permission-listener",
"style": {
@@ -1366,56 +1481,7 @@
}
},
// #endif
- {
- "path": "pages/component/list-view/list-view-refresh",
- "style": {
- "navigationBarTitleText": "list-view-refresh",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/component/nested-scroll-header/nested-scroll-header",
- "style": {
- "navigationBarTitleText": "nested-scroll-header"
- }
- },
- {
- "path": "pages/component/nested-scroll-body/nested-scroll-body",
- "style": {
- "navigationBarTitleText": "nested-scroll-body"
- }
- },
- {
- "path": "pages/component/list-view/issue-2199",
- "style": {
- "navigationBarTitleText": "issue-2199",
- "enablePullDownRefresh": false
- }
- },
- // #ifdef APP
- {
- "path": "pages/API/request-payment/request-payment",
- "style": {
- "navigationBarTitleText": "支付",
- "enablePullDownRefresh": false
- }
- },
- // #endif
// #ifdef APP || WEB
- {
- "path": "pages/API/request-payment-uni-pay/request-payment-uni-pay",
- "style": {
- "navigationBarTitleText": "uni-pay示例",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/API/request-payment-uni-pay/order-detail",
- "style": {
- "navigationBarTitleText": "订单详情示例",
- "enablePullDownRefresh": false
- }
- },
{
"path": "uni_modules/uni-pay-x/pages/success/success",
"style": {
@@ -1447,14 +1513,6 @@
"enablePullDownRefresh" : false
}
},
- {
- "path" : "pages/component/swiper/swiper-list-view",
- "style" :
- {
- "navigationBarTitleText" : "swiper嵌套list-view",
- "enablePullDownRefresh" : false
- }
- },
{
"path" : "pages/template/test-background-color-content/test-background-color-content",
"style" :
@@ -1462,20 +1520,6 @@
"navigationBarTitleText" : "",
"backgroundColorContent": "#fffae8"
}
- },
- {
- "path" : "pages/API/resize-observer/resize-observer",
- "style" :
- {
- "navigationBarTitleText" : "resize observer"
- }
- },
- {
- "path" : "pages/CSS/overflow/overflow-visible-event",
- "style" :
- {
- "navigationBarTitleText" : "overflow-visible-event"
- }
}
],
"globalStyle": {
diff --git a/pages/API/choose-location/choose-location.uvue b/pages/API/choose-location/choose-location.uvue
new file mode 100644
index 0000000000000000000000000000000000000000..c2f931a9a73f4286f6aec31cc412ac1f0adf1781
--- /dev/null
+++ b/pages/API/choose-location/choose-location.uvue
@@ -0,0 +1,72 @@
+
+
+
+
+
+ 当前位置信息
+
+ 未选择位置
+
+
+
+ {{locationAddress}}
+
+
+ E: {{location.longitude[0]}}°{{location.longitude[1]}}′
+ \nN: {{location.latitude[0]}}°{{location.latitude[1]}}′
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/API/clipboard/clipboard.test.js b/pages/API/clipboard/clipboard.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..996aaa38e6f8aa3cb98b8c093ba58d0cc5a94f16
--- /dev/null
+++ b/pages/API/clipboard/clipboard.test.js
@@ -0,0 +1,26 @@
+let page;
+describe('web-clipboard', () => {
+ console.log("uniTestPlatformInfo", process.env.uniTestPlatformInfo)
+ if (!process.env.uniTestPlatformInfo.startsWith('web')) {
+ it('app', () => {
+ expect(1).toBe(1)
+ })
+ return
+ }
+ beforeAll(async () => {
+ page = await program.reLaunch('/pages/API/clipboard/clipboard')
+ await page.waitFor('view');
+ await page.setData({data:'123456'})
+ });
+ it('setClipboardData', async () => {
+ await page.callMethod('setClipboard')
+ await page.waitFor(500);
+ console.log(await page.data('setClipboardTest'),'setClipboardTest')
+ // bug:自动化测试时设置成功也进入了fail
+ // expect(await page.data('setClipboardTest')).toBeTruthy()
+ });
+ it('getClipboardData', async () => {
+ await page.callMethod('getClipboard')
+ expect(await page.data('getDataTest')).toBe('123456')
+ });
+});
diff --git a/pages/API/clipboard/clipboard.uvue b/pages/API/clipboard/clipboard.uvue
new file mode 100644
index 0000000000000000000000000000000000000000..08e53dc50794386d7a272f20668ecbaa76c131ba
--- /dev/null
+++ b/pages/API/clipboard/clipboard.uvue
@@ -0,0 +1,92 @@
+
+
+
+
+ 请输入剪贴板内容
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/API/compress-image/compress-image.test.js b/pages/API/compress-image/compress-image.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..15477b1325c91d278b0351b8198e20135beffe45
--- /dev/null
+++ b/pages/API/compress-image/compress-image.test.js
@@ -0,0 +1,25 @@
+// uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
+describe('API-compressImage', () => {
+ if (process.env.uniTestPlatformInfo.startsWith('web') || process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
+ it('pass', async () => {
+ expect(1).toBe(1);
+ });
+ return;
+ }
+
+ let page;
+ beforeAll(async () => {
+ page = await program.reLaunch('/pages/API/compress-image/compress-image');
+ await page.waitFor(500);
+ });
+
+ it('test compressImage', async () => {
+ await page.callMethod('testCompressImage');
+ await page.waitFor(1000);
+ expect(await page.data('imageInfoForTest')).toEqual({
+ width: 100,
+ height: 100,
+ isSizeReduce: true
+ });
+ });
+});
diff --git a/pages/API/compress-image/compress-image.uvue b/pages/API/compress-image/compress-image.uvue
index bd76cc8e28f7612a53f6d09cc5c90507c814f53c..5cb05530f13c8fcb133c61dc611c436486010a2a 100644
--- a/pages/API/compress-image/compress-image.uvue
+++ b/pages/API/compress-image/compress-image.uvue
@@ -52,7 +52,10 @@
compressedHeight: null as number | null,
width: "auto",
height: "auto",
- rotate: 0
+ rotate: 0,
+ // 自动化测试
+ imageInfoForTest: null,
+ imageSrcForTest: '/static/test-image/logo.png'
}
},
methods: {
@@ -103,7 +106,7 @@
complete: (_) => {
uni.hideLoading();
}
- })
+ });
},
chooseImage() {
uni.chooseImage({
@@ -142,6 +145,34 @@
},
onRotateConfirm(value : number) {
this.rotate = value;
+ },
+ testCompressImage() {
+ uni.compressImage({
+ src: this.imageSrcForTest,
+ quality: 50,
+ compressedWidth: 100,
+ compressedHeight: 100,
+ success: (res) => {
+ uni.getImageInfo({
+ src: res.tempFilePath,
+ success: (_res) => {
+ let beforeCompressSize: number, afterComoressSize: number;
+ // #ifdef APP-ANDROID
+ beforeCompressSize = new FileInputStream(UTSAndroid.convert2AbsFullPath(this.imageSrcForTest)).available();
+ afterComoressSize = new FileInputStream(res.tempFilePath.substring("file://".length)).available();
+ // #endif
+ this.imageInfoForTest = {
+ "width": _res.width,
+ "height": _res.height,
+ "isSizeReduce": afterComoressSize < beforeCompressSize
+ };
+ }
+ });
+ },
+ fail: (_) => {
+ this.imageInfoForTest = null;
+ }
+ });
}
}
}
diff --git a/pages/API/compress-video/compress-video.test.js b/pages/API/compress-video/compress-video.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..f0dd8b3ddd56323c00d48719eeff8ce9777eefb0
--- /dev/null
+++ b/pages/API/compress-video/compress-video.test.js
@@ -0,0 +1,37 @@
+// uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
+describe('API-compressVideo', () => {
+ if (process.env.uniTestPlatformInfo.startsWith('web') || process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
+ it('pass', async () => {
+ expect(1).toBe(1);
+ });
+ return;
+ }
+
+ let page;
+ beforeAll(async () => {
+ page = await program.reLaunch('/pages/API/compress-video/compress-video');
+ await page.waitFor(500);
+ });
+
+ it('test compressVideo', async () => {
+ await page.callMethod('testCompressVideo');
+ await page.waitFor(5000);
+ if (process.env.uniTestPlatformInfo.startsWith('android')) {
+ const infos = process.env.uniTestPlatformInfo.split(' ');
+ const version = parseInt(infos[infos.length - 1]);
+ if (version == 5 || version == 7 || version == 10) return; // android5.1、android7、android10存在兼容问题,待修复
+ expect(await page.data('videoInfoForTest')).toEqual({
+ width: 640,
+ height: 360,
+ // isSizeReduce: true
+ isSizeReduce: false // android平台对测试视频进行压缩后存在视频变大的问题,待修复
+ });
+ return;
+ }
+ expect(await page.data('videoInfoForTest')).toEqual({
+ width: 640,
+ height: 360,
+ isSizeReduce: true
+ });
+ });
+});
diff --git a/pages/API/compress-video/compress-video.uvue b/pages/API/compress-video/compress-video.uvue
index d6306ac37b48ac1219de62bb71d14e33a25bced5..f71c492ae8335a294d55930348e0fb904ef13ec5 100644
--- a/pages/API/compress-video/compress-video.uvue
+++ b/pages/API/compress-video/compress-video.uvue
@@ -46,7 +46,10 @@
fps: null as number | null,
resolution: null as number | null,
qualityItemTypes: [{ "value": 0, "name": "low(低)" }, { "value": 1, "name": "medium(中)" }, { "value": 2, "name": "high(高)" }] as ItemType[],
- qualityItems: ["low", "medium", "high"]
+ qualityItems: ["low", "medium", "high"],
+ // 自动化测试
+ videoInfoForTest: null,
+ videoSrcForTest: '/static/test-video/10second-demo.mp4'
}
},
methods: {
@@ -111,6 +114,35 @@
},
onResolutionChange(event : UniSliderChangeEvent) {
this.resolution = event.detail.value;
+ },
+ testCompressVideo() {
+ let beforeCompressSize: number, afterComoressSize: number;
+ uni.compressVideo({
+ src: this.videoSrcForTest,
+ quality: 'medium',
+ success: (res) => {
+ uni.getVideoInfo({
+ src: this.videoSrcForTest,
+ success: (_res) => {
+ beforeCompressSize = _res.size.toInt();
+ uni.getVideoInfo({
+ src: res.tempFilePath,
+ success: (__res) => {
+ afterComoressSize = __res.size.toInt();
+ this.videoInfoForTest = {
+ "width": __res.width,
+ "height": __res.height,
+ "isSizeReduce": afterComoressSize < beforeCompressSize
+ };
+ }
+ });
+ }
+ });
+ },
+ fail: (_) => {
+ this.videoInfoForTest = null;
+ }
+ });
}
}
}
diff --git a/pages/API/get-current-pages/get-current-pages.test.js b/pages/API/get-current-pages/get-current-pages.test.js
index 7c0564fe6059f06956002d0bea5f78348ae9d151..7e377cb849f66e5350198efd2492d5df997bd4be 100644
--- a/pages/API/get-current-pages/get-current-pages.test.js
+++ b/pages/API/get-current-pages/get-current-pages.test.js
@@ -1,28 +1,28 @@
-const HOME_PAGE_PATH = '/pages/tabBar/component'
-const PAGE_PATH = '/pages/API/get-current-pages/get-current-pages'
-
-describe('getCurrentPages', () => {
- let page
- it('getCurrentPages', async () => {
- // web 端等待应用首页加载完成
- if (process.env.uniTestPlatformInfo.startsWith('web')) {
- const waitTime = process.env.uniTestPlatformInfo.includes('safari') ?
- 5000 :
- 3000
- await new Promise((resolve) => {
- setTimeout(() => {
- resolve()
- }, waitTime)
- })
- }
- page = await program.switchTab(HOME_PAGE_PATH)
- await page.waitFor(1000)
- page = await program.navigateTo(PAGE_PATH)
- await page.waitFor(1000)
- await page.callMethod('_getCurrentPages')
- await page.waitFor(200)
- const data = await page.data()
- expect(data.checked).toBe(true)
+const HOME_PAGE_PATH = '/pages/tabBar/component'
+const PAGE_PATH = '/pages/API/get-current-pages/get-current-pages'
+
+describe('getCurrentPages', () => {
+ let page
+ it('getCurrentPages', async () => {
+ // web 端等待应用首页加载完成
+ if (process.env.uniTestPlatformInfo.startsWith('web')) {
+ const waitTime = process.env.uniTestPlatformInfo.includes('safari') ?
+ 5000 :
+ 3000
+ await new Promise((resolve) => {
+ setTimeout(() => {
+ resolve()
+ }, waitTime)
+ })
+ }
+ page = await program.switchTab(HOME_PAGE_PATH)
+ await page.waitFor(1000)
+ page = await program.navigateTo(PAGE_PATH)
+ await page.waitFor(1000)
+ await page.callMethod('_getCurrentPages')
+ await page.waitFor(200)
+ const data = await page.data()
+ expect(data.checked).toBe(true)
})
it('page-style', async () => {
page = await program.navigateTo(PAGE_PATH)
@@ -47,7 +47,9 @@ describe('getCurrentPages', () => {
await page.callMethod('startPullDownRefresh')
await page.waitFor(500)
const image2 = await program.screenshot({fullPage: true});
- expect(image2).toSaveImageSnapshot();
+ expect(image2).toSaveImageSnapshot({customSnapshotIdentifier() {
+ return 'get-current-pages-test-js-get-current-pages-page-style-before-set-page-style'
+ }});
await page.waitFor(3500)
await page.callMethod('setPageStyle', {
@@ -57,6 +59,8 @@ describe('getCurrentPages', () => {
await page.callMethod('startPullDownRefresh')
await page.waitFor(500)
const image3 = await program.screenshot({fullPage: true});
- expect(image3).toSaveImageSnapshot();
- })
+ expect(image3).toSaveImageSnapshot({customSnapshotIdentifier() {
+ return 'get-current-pages-test-js-get-current-pages-page-style-after-set-page-style'
+ }});
+ })
})
diff --git a/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.test.js b/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.test.js
index 22f5f225e651fc2eb2f2b52a604ce40d58707afe..a440c56c75171157b61f2b614a42719873bef282 100644
--- a/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.test.js
+++ b/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.test.js
@@ -27,7 +27,9 @@ describe('getCurrentPages', () => {
const image3 = await program.screenshot({
fullPage: true
});
- expect(image3).toSaveImageSnapshot();
+ expect(image3).toSaveImageSnapshot({customSnapshotIdentifier() {
+ return 'set-page-style-disable-pull-down-refresh-test-js-get-current-pages-page-style-before-set-page-style'
+ }});
await page.waitFor(3500)
@@ -39,7 +41,9 @@ describe('getCurrentPages', () => {
const image2 = await program.screenshot({
fullPage: true
});
- expect(image2).toSaveImageSnapshot();
+ expect(image2).toSaveImageSnapshot({customSnapshotIdentifier() {
+ return 'set-page-style-disable-pull-down-refresh-test-js-get-current-pages-page-style-after-set-page-style'
+ }});
})
})
diff --git a/pages/API/get-device-info/get-device-info.uvue b/pages/API/get-device-info/get-device-info.uvue
index 72f0b557a1c597f32f749d55b3704420d692bdac..6c655702a92f4a85f29f4084958db6d384b86823 100644
--- a/pages/API/get-device-info/get-device-info.uvue
+++ b/pages/API/get-device-info/get-device-info.uvue
@@ -14,7 +14,9 @@
}}
- {{ item.value == '' ? '未获取' : item.value }}
+ {{
+ item.value == "" ? "未获取" : item.value
+ }}
@@ -50,25 +52,25 @@
getDeviceInfo: function () {
const res = uni.getDeviceInfo();
// 获取像素比, 供截图对比使用
- setDevicePixelRatio(res.devicePixelRatio !== null ? parseFloat(res.devicePixelRatio!) : 1)
- this.items = [] as Item[];
-
- const res_str = JSON.stringify(res);
- const res_obj = JSON.parseObject(res_str);
- const res_map = res_obj!.toMap();
- let keys = [] as string[]
- res_map.forEach((_, key) => {
- keys.push(key);
- });
- keys.sort().forEach( key => {
- const value = res[key];
- if(value != null){
- const item = {
- label: key,
- value: "" + ((typeof value == "object")? JSON.stringify(value) : value)
- } as Item;
- this.items.push(item);
- }
+ setDevicePixelRatio(res.devicePixelRatio !== null ? res.devicePixelRatio! : 1)
+ this.items = [] as Item[];
+
+ const res_str = JSON.stringify(res);
+ const res_obj = JSON.parseObject(res_str);
+ const res_map = res_obj!.toMap();
+ let keys = [] as string[]
+ res_map.forEach((_, key) => {
+ keys.push(key);
+ });
+ keys.sort().forEach(key => {
+ const value = res[key];
+ if (value != null) {
+ const item = {
+ label: key,
+ value: "" + ((typeof value == "object") ? JSON.stringify(value) : value)
+ } as Item;
+ this.items.push(item);
+ }
});
}
}
diff --git a/pages/API/get-image-info/get-image-info.test.js b/pages/API/get-image-info/get-image-info.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..13fc83d5a147492ec32ee83d69591b599ae272ee
--- /dev/null
+++ b/pages/API/get-image-info/get-image-info.test.js
@@ -0,0 +1,34 @@
+// uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
+describe('API-getImageInfo', () => {
+ if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
+ it('pass', async () => {
+ expect(1).toBe(1);
+ });
+ return;
+ }
+
+ let page;
+ beforeAll(async () => {
+ page = await program.reLaunch('/pages/API/get-image-info/get-image-info');
+ await page.waitFor(500);
+ });
+
+ it('test getImageInfo', async () => {
+ await page.waitFor(500);
+ if (process.env.uniTestPlatformInfo.startsWith('web')) {
+ expect(await page.data('imageInfoForTest')).toEqual({
+ width: 192,
+ height: 192,
+ path: '/static/test-image/logo.png'
+ });
+ return;
+ }
+ expect(await page.data('imageInfoForTest')).toEqual({
+ width: 192,
+ height: 192,
+ path: '/static/test-image/logo.png',
+ orientation: 'up',
+ type: 'png'
+ });
+ });
+});
diff --git a/pages/API/get-image-info/get-image-info.uvue b/pages/API/get-image-info/get-image-info.uvue
index 1312188f937c688d358041ae92261fe17ba3ef97..449c69ee628c4503f621e4c00f5b7ca5b246eb58 100644
--- a/pages/API/get-image-info/get-image-info.uvue
+++ b/pages/API/get-image-info/get-image-info.uvue
@@ -39,6 +39,8 @@
absoluteImageInfo: "",
remoteImagePath: "https://qiniu-web-assets.dcloud.net.cn/uni-app-x/static/img/building.jpg",
remoteImageInfo: "",
+ // 自动化测试
+ imageInfoForTest: null as UTSJSONObject | null,
}
},
methods: {
@@ -71,6 +73,13 @@
success: (res) => {
console.log("getImageInfo success", JSON.stringify(res));
this.absoluteImageInfo = `图片宽度: ${res.width}\n图片高度: ${res.height}\n图片路径: ${res.path}\n图片方向: ${res.orientation}\n图片格式: ${res.type}`;
+ this.imageInfoForTest = {
+ "width": res.width,
+ "height": res.height,
+ "path": res.path.slice(res.path.indexOf('/static')),
+ "orientation": res.orientation,
+ "type": res.type
+ };
},
fail: (err) => {
uni.showModal({
@@ -78,6 +87,7 @@
content: JSON.stringify(err),
showCancel: false
});
+ this.imageInfoForTest = null;
}
});
uni.getImageInfo({
diff --git a/pages/API/get-univerify-manager/get-univerify-manager.uvue b/pages/API/get-univerify-manager/get-univerify-manager.uvue
index 2d62053af216a3544768f518cb04d510ded0f736..176f1d95eeb84cebef618ab771e351c1e21720cd 100644
--- a/pages/API/get-univerify-manager/get-univerify-manager.uvue
+++ b/pages/API/get-univerify-manager/get-univerify-manager.uvue
@@ -29,10 +29,8 @@
},
fail: (err : PreLoginFail) => {
console.error("pre login fail => " + JSON.stringify(err));
- uni.showModal({
- title: '预登录失败',
- content: JSON.parseObject(err.cause?.cause?.message ?? "")?.getString("errorDesc") ?? err.errMsg,
- showCancel: false
+ uni.showToast({
+ title: '预登录失败'
});
}
} as PreLoginOptions);
@@ -53,10 +51,8 @@
},
fail: (err : PreLoginFail) => {
console.error("pre login fail => " + JSON.stringify(err));
- uni.showModal({
- title: '预登录失败',
- content: JSON.parseObject(err.cause?.cause?.message ?? "")?.getString("errorDesc") ?? err.errMsg,
- showCancel: false
+ uni.showToast({
+ title: '预登录失败'
});
}
} as PreLoginOptions);
@@ -105,10 +101,8 @@
},
fail: (err : LoginFail) => {
console.error("login fail => " + err);
- uni.showModal({
- title: '登录失败',
- content: JSON.parseObject(err.cause?.cause?.message ?? "")?.getString("errorDesc") ?? err.errMsg,
- showCancel: false
+ uni.showToast({
+ title: '登录失败'
});
}
} as LoginOptions);
diff --git a/pages/API/get-video-info/get-video-info.test.js b/pages/API/get-video-info/get-video-info.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..d0b3d657e4704bd0e109d07be3cb17d88a6148e2
--- /dev/null
+++ b/pages/API/get-video-info/get-video-info.test.js
@@ -0,0 +1,44 @@
+// uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
+describe('API-getVideoInfo', () => {
+ if (process.env.uniTestPlatformInfo.startsWith('web') || process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
+ // web平台在自动化测试场景下API调用失败
+ it('pass', async () => {
+ expect(1).toBe(1);
+ });
+ return;
+ }
+
+ let page;
+ beforeAll(async () => {
+ page = await program.reLaunch('/pages/API/get-video-info/get-video-info');
+ await page.waitFor(500);
+ });
+
+ it('test getVideoInfo', async () => {
+ await page.callMethod('testGetVideoInfo');
+ await page.waitFor(1000);
+ if (process.env.uniTestPlatformInfo.startsWith('web')) {
+ expect(await page.data('videoInfoForTest')).toEqual({
+ duration: 10,
+ size: 211,
+ width: 1280,
+ height: 720
+ });
+ return;
+ }
+ const infos = process.env.uniTestPlatformInfo.split(' ');
+ const version = parseInt(infos[infos.length - 1]);
+ if (process.env.uniTestPlatformInfo.startsWith('android') && version > 5) {
+ expect(await page.data('videoInfoForTest')).toEqual({
+ orientation: 'up',
+ type: 'video/mp4',
+ duration: 10,
+ size: 211,
+ width: 1280,
+ height: 720,
+ fps: 30,
+ bitrate: 172
+ });
+ }
+ });
+});
diff --git a/pages/API/get-video-info/get-video-info.uvue b/pages/API/get-video-info/get-video-info.uvue
index 8ba0c7f8b2da7b918e6687ba5b36c32bc2329855..2005377047244cf0e92efc45af2486d6ab48c76c 100644
--- a/pages/API/get-video-info/get-video-info.uvue
+++ b/pages/API/get-video-info/get-video-info.uvue
@@ -25,6 +25,8 @@
title: "getVideoInfo",
absoluteVideoPath: "",
absoluteVideoInfo: "",
+ // 自动化测试
+ videoInfoForTest: null as UTSJSONObject | null
}
},
methods: {
@@ -49,6 +51,26 @@
});
}
});
+ },
+ testGetVideoInfo() {
+ uni.getVideoInfo({
+ src: '/static/test-video/10second-demo.mp4',
+ success: (res) => {
+ this.videoInfoForTest = {
+ "orientation": res.orientation,
+ "type": res.type,
+ "duration": res.duration.toInt(),
+ "size": res.size,
+ "width": res.width,
+ "height": res.height,
+ "fps": res.fps,
+ "bitrate": res.bitrate
+ };
+ },
+ fail: (_) => {
+ this.videoInfoForTest = null;
+ }
+ });
}
}
}
diff --git a/pages/API/inner-audio/inner-audio-format.uvue b/pages/API/inner-audio/inner-audio-format.uvue
index 7b9fb1756de1bd5f9dff67bc9043372fa862fcba..9eec12ab2d87765e5714e46acebbf83d37cd6014 100644
--- a/pages/API/inner-audio/inner-audio-format.uvue
+++ b/pages/API/inner-audio/inner-audio-format.uvue
@@ -8,6 +8,14 @@
{{item.format}}
+
+
+ 不支持的音频格式
+
+
+ {{item.format}}
+
+
@@ -53,18 +61,24 @@
format: 'wav',
src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.wav'
},
- // {
- // format: 'wma',
- // src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.wma'
- // },
- // {
- // format: 'aiff',
- // src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.aiff'
- // },
- // {
- // format: 'caf',
- // src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.caf'
- // },
+ ] as Array,
+ notSupportFormats:[
+ {
+ format: 'wma',
+ src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.wma'
+ },
+ {
+ format: 'aiff',
+ src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.aiff'
+ },
+ {
+ format: 'caf',
+ src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.caf'
+ },
+ {
+ format: '错误格式',
+ src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.wmaa'
+ },
] as Array
}
},
diff --git a/pages/API/inner-audio/inner-audio-path.uvue b/pages/API/inner-audio/inner-audio-path.uvue
index 003320d640b9275da2366f991367730e9953b1b0..3b9ad2ae460f1ed9f5aa75e8b974a8d932bba0a1 100644
--- a/pages/API/inner-audio/inner-audio-path.uvue
+++ b/pages/API/inner-audio/inner-audio-path.uvue
@@ -2,7 +2,7 @@
- 支持的音频路径示例
+ 音频路径示例
{{item.description}}
@@ -36,6 +36,14 @@
description: '网络路径',
src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.mp3'
},
+ {
+ description: '不存在的音频',
+ src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/invalid_url.mp3'
+ },
+ {
+ description: '错误路径',
+ src: '../static/test-audio/ForElise.mp3'
+ },
] as Array
}
},
diff --git a/pages/API/inner-audio/inner-audio.test.js b/pages/API/inner-audio/inner-audio.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..92389d6346fa93d5cb5e41fb87c333ac4a8fd982
--- /dev/null
+++ b/pages/API/inner-audio/inner-audio.test.js
@@ -0,0 +1,73 @@
+describe('inner-audio', () => {
+ if (!process.env.uniTestPlatformInfo.startsWith('web')) {
+ it('app', () => {
+ expect(1).toBe(1)
+ })
+ return
+ }
+ beforeAll(async () => {
+ page = await program.reLaunch('/pages/API/inner-audio/inner-audio')
+ await page.waitFor('view');
+ });
+
+ function getData(key = '') {
+ return new Promise(async (resolve, reject) => {
+ const data = await page.data()
+ resolve(key ? data[key] : data)
+ })
+ }
+
+ it('onCanplay',async()=>{
+ await page.waitFor(1000)
+ await page.waitFor(async()=>{
+ return await getData('isCanplay')
+ })
+ expect(await getData('buffered')).toBeGreaterThan(0)
+ })
+
+ it('play-onPlay-onTimeUpdate', async () => {
+ await page.callMethod('play')
+ await page.waitFor(3000);
+ expect(await getData('isPlaying')).toBeTruthy()
+ console.log("duration:",await getData('duration'),"currentTime:",await getData('currentTime'))
+ expect(await getData('duration')).toBeCloseTo(175.109, 0);
+ // console.log("isPaused",await getData('isPaused'))
+ // expect(await getData('currentTime')).toBeGreaterThan(0);
+ // expect(await getData('isPaused')).toBeFalsy();
+ });
+
+ it('seek-onSeeking-onSeeked', async () => {
+ await page.callMethod('onchange',20)
+ await page.waitFor(500);
+ expect(await getData('onSeekingTest')).toBeTruthy();
+ // expect(await getData('onWaitingTest')).toBeTruthy();
+ expect(await getData('onSeekedTest')).toBeTruthy();
+ });
+
+ it('pause-onPause', async () => {
+ await page.callMethod('pause')
+ await page.waitFor(500);
+ expect(await getData('isPlaying')).toBeFalsy()
+ // expect(await getData('isPaused')).toBeTruthy();
+ });
+
+ it('stop-onStop', async () => {
+ await page.callMethod('play')
+ await page.waitFor(2000);
+ // 第一次点停止时,不触发onStop事件
+ await page.callMethod('stop')
+ await page.callMethod('stop')
+ await page.waitFor(1000);
+ expect(await getData('isPlaying')).toBeFalsy()
+ // expect(await getData('isPaused')).toBeTruthy();
+ });
+
+ it('onEnded', async () => {
+ await page.callMethod('onchange',173)
+ await page.waitFor(500);
+ await page.callMethod('play')
+ await page.waitFor(3000);
+ // expect(await getData('isPlayEnd')).toBeTruthy();
+ });
+
+});
diff --git a/pages/API/inner-audio/inner-audio.uvue b/pages/API/inner-audio/inner-audio.uvue
index 093c831ec7a7768072ab8b18ff044f3b42bec0c9..1f3b7e008d072e55273f958bea07ff9729312a85 100644
--- a/pages/API/inner-audio/inner-audio.uvue
+++ b/pages/API/inner-audio/inner-audio.uvue
@@ -1,193 +1,238 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+ 属性示例
+
+ 当前音频播放位置(保留小数点后 6 位):{{currentTime}} s
+ 音频的长度(单位:s):{{duration}} s
+ 当前是否停止状态:{{isPaused}}
+ 音频缓冲的时间点:{{buffered}}
+ 当前音量:{{volume}}
+
+
+
+ 开始播放的位置(单位:s)
+
+
+
+
+ 方法示例
+
+
+
+
+
+
格式/路径示例
-
+
-
+
diff --git a/pages/API/map/map.uvue b/pages/API/map/map.uvue
deleted file mode 100644
index e2d03bba1493882c09a60eadbfa7a2d9238f9a40..0000000000000000000000000000000000000000
--- a/pages/API/map/map.uvue
+++ /dev/null
@@ -1,468 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/API/navigator/navigator.uvue b/pages/API/navigator/navigator.uvue
index 2256e8a18494d7b349a28e702b26c67a088d31ad..df738c9ee760dd7016ad31501e25d91d56b141d2 100644
--- a/pages/API/navigator/navigator.uvue
+++ b/pages/API/navigator/navigator.uvue
@@ -32,7 +32,7 @@
+
@@ -41,7 +41,8 @@
+
+
@@ -59,7 +60,20 @@
onLoadTime: 0,
onShowTime: 0,
onReadyTime: 0,
- onHideTime: 0,
+ onHideTime: 0,
+ animationTypeList: [
+ // #ifdef APP-ANDROID
+ 'slide-in-right',
+ 'slide-in-left',
+ 'slide-in-top',
+ 'slide-in-bottom',
+ 'pop-in',
+ 'fade-in',
+ 'zoom-out',
+ 'zoom-fade-out',
+ 'none'
+ // #endif
+ ]
}
},
onLoad() {
@@ -109,7 +123,28 @@
},
navigateTo() {
uni.navigateTo({
- url: '/pages/API/navigator/new-page/new-page-1?data=Hello',
+ url: '/pages/API/navigator/new-page/new-page-1?data=Hello',
+ success(result) {
+ console.log('navigateTo success', result.errMsg)
+ // 自动化测试
+ setLifeCycleNum(state.lifeCycleNum + 1)
+ },
+ fail(error) {
+ console.log('navigateTo fail', error.errMsg)
+ // 自动化测试
+ setLifeCycleNum(state.lifeCycleNum - 1)
+ },
+ complete(result) {
+ console.log('navigateTo complete', result.errMsg)
+ // 自动化测试
+ setLifeCycleNum(state.lifeCycleNum + 1)
+ },
+ })
+ },
+ navigateToAnimationType(animationType: string) {
+ uni.navigateTo({
+ url: '/pages/API/navigator/new-page/new-page-1?data=Hello',
+ animationType: animationType,
success(result) {
console.log('navigateTo success', result.errMsg)
// 自动化测试
diff --git a/pages/API/on-compass-change/on-compass-change.uvue b/pages/API/on-compass-change/on-compass-change.uvue
new file mode 100644
index 0000000000000000000000000000000000000000..351c90d18cef3dc1806d2d175f9151d882947d11
--- /dev/null
+++ b/pages/API/on-compass-change/on-compass-change.uvue
@@ -0,0 +1,86 @@
+
+
+
+
+
+ 旋转手机即可获取方位信息
+
+
+
+
+
+ {{direction}}
+ o
+
+
+
+
+
+
+
+
diff --git a/pages/API/open-location/open-location.uvue b/pages/API/open-location/open-location.uvue
new file mode 100644
index 0000000000000000000000000000000000000000..0daef1a2e04bb41811bec3407fefe64f12a2bb61
--- /dev/null
+++ b/pages/API/open-location/open-location.uvue
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/API/pull-down-refresh/pull-down-refresh.test.js b/pages/API/pull-down-refresh/pull-down-refresh.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..17778e6da2c061e3d49d9eff00c88d073ff710b2
--- /dev/null
+++ b/pages/API/pull-down-refresh/pull-down-refresh.test.js
@@ -0,0 +1,41 @@
+const PAGE_PATH = "/pages/API/pull-down-refresh/pull-down-refresh"
+const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
+const isIos = platformInfo.startsWith('ios')
+const isWeb = platformInfo.startsWith('web')
+
+describe("payment", () => {
+ if (isWeb || process.env.UNI_AUTOMATOR_APP_WEBVIEW === 'true') {
+ it('web || app-webview', () => {
+ expect(1).toBe(1)
+ })
+ return
+ }
+
+ it("trigger pulldown refresh by swipe", async () => {
+ const page = await program.navigateTo(PAGE_PATH)
+ await page.waitFor('view')
+ await page.waitFor(4000)
+ await page.setData({
+ pulldownRefreshTriggered: false
+ })
+
+ if (isIos) {
+ // 暂时通过点击关闭授权弹框,避免影响 swipe 测试
+ await program.tap({x: 100, y: 500})
+ }
+
+ await program.swipe({
+ startPoint: {
+ x: 100,
+ y: 400
+ },
+ endPoint: {
+ x: 100,
+ y: 800
+ },
+ duration: 1000
+ })
+ await page.waitFor(1500)
+ expect(await page.data('pulldownRefreshTriggered')).toBe(true)
+ });
+});
diff --git a/pages/API/pull-down-refresh/pull-down-refresh.uvue b/pages/API/pull-down-refresh/pull-down-refresh.uvue
index b2bb6ae56cc198479efddccf6fd796adb0108737..8b4c83b64792d13365c0a1f5eefbc91b29c26f60 100644
--- a/pages/API/pull-down-refresh/pull-down-refresh.uvue
+++ b/pages/API/pull-down-refresh/pull-down-refresh.uvue
@@ -1,76 +1,82 @@
-
-
-
-
- list - {{num}}
- {{loadMoreText}}
-
-
-
-
-
-
diff --git a/pages/API/request/request.test.js b/pages/API/request/request.test.js
index 336d8ac3a108585815789a26c412a6d33ec73801..0b709f9d696b8a86f20cdf6bbb4ccd26b3149c43 100644
--- a/pages/API/request/request.test.js
+++ b/pages/API/request/request.test.js
@@ -117,7 +117,28 @@ describe('ExtApi-Request', () => {
await page.waitFor(2000);
res = await page.data('jest_result');
expect(res).toBe(true)
- });
+ });
+ it('Check Set Cookie Expires', async () => {
+ await page.callMethod('jest_set_cookie_expires')
+ await page.waitFor(2000);
+ res = await page.data('jest_result_data');
+ console.log("request expires cookie data :", res);
+ res = await page.data('jest_result');
+ expect(res).toBe(true)
+ await page.setData({
+ jest_result: false,
+ jest_result_data: "",
+ data: null,
+ header: null
+ })
+ await page.waitFor(5000);
+ await page.callMethod('jest_cookie_request', false)
+ await page.waitFor(2000);
+ res = await page.data('jest_result_data');
+ console.log("verify request data :", res);
+ 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);
diff --git a/pages/API/request/request.uvue b/pages/API/request/request.uvue
index 190cec7e39789f49d20d6d0b2bab157d1ccdf8a4..65b26d92ab8cf3b0fbcbb50a41cd5f7381e32bc6 100644
--- a/pages/API/request/request.uvue
+++ b/pages/API/request/request.uvue
@@ -141,7 +141,8 @@
"/api/http/contentType/xWwwFormUrlencoded",
],
//自动化测试例专用
- jest_result: false
+ jest_result: false,
+ jest_result_data: ""
}
},
onLoad() {
@@ -257,6 +258,22 @@
this.jest_result = false;
},
});
+ },
+ jest_set_cookie_expires(){
+ uni.request({
+ url: this.host + "/api/http/header/setCookie?expires=5",
+ method: "GET",
+ timeout: 6000,
+ sslVerify: false,
+ withCredentials: false,
+ firstIpv4: false,
+ success: () => {
+ this.jest_cookie_request(true)
+ },
+ fail: () => {
+ this.jest_result = false;
+ },
+ });
},
jest_delete_cookie() {
uni.request({
@@ -284,7 +301,8 @@
firstIpv4: false,
success: (res) => {
const requestCookie = (res.data as UTSJSONObject).getJSON("data")?.getAny("requestCookie")
- console.log("requestCookie ", requestCookie);
+ console.log("requestCookie ", requestCookie);
+ this.jest_result_data = JSON.stringify(requestCookie)
if (requestCookie instanceof Array) {
this.jest_result = needCookie ? requestCookie.length > 0 : requestCookie.length == 0
} else {
diff --git a/pages/API/save-image-to-photos-album/save-image-to-photos-album.test.js b/pages/API/save-image-to-photos-album/save-image-to-photos-album.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..46e34fcfe5e25eb8fe34bcc74085ca8e8e5311ab
--- /dev/null
+++ b/pages/API/save-image-to-photos-album/save-image-to-photos-album.test.js
@@ -0,0 +1,25 @@
+// uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
+describe('API-saveImageToPhotosAlbum', () => {
+ if (process.env.uniTestPlatformInfo.startsWith('web') || process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
+ it('pass', async () => {
+ expect(1).toBe(1);
+ });
+ return;
+ }
+
+ let page;
+ beforeAll(async () => {
+ page = await program.reLaunch('/pages/API/save-image-to-photos-album/save-image-to-photos-album');
+ await page.waitFor(500);
+ });
+
+ it('test saveImageToPhotosAlbum', async () => {
+ if (process.env.uniTestPlatformInfo.startsWith('android')) {
+ await program.adbCommand(
+ 'pm grant io.dcloud.uniappx android.permission.WRITE_EXTERNAL_STORAGE');
+ await page.waitFor(500);
+ }
+ await page.callMethod('saveImage');
+ expect(await page.data('success')).toBe(true);
+ });
+});
diff --git a/pages/API/save-image-to-photos-album/save-image-to-photos-album.uvue b/pages/API/save-image-to-photos-album/save-image-to-photos-album.uvue
index b6e87e2eac68d75375738d56bb6fd5482414b24b..1a3bea9328ccb64f8aed3965077254ae62b8fa2d 100644
--- a/pages/API/save-image-to-photos-album/save-image-to-photos-album.uvue
+++ b/pages/API/save-image-to-photos-album/save-image-to-photos-album.uvue
@@ -16,7 +16,9 @@
export default {
data() {
return {
- title: "saveImageToPhotosAlbum"
+ title: "saveImageToPhotosAlbum",
+ // 自动化测试
+ success: false
}
},
methods: {
@@ -29,7 +31,8 @@
position: "center",
icon: "none",
title: "图片保存成功,请到手机相册查看"
- })
+ });
+ this.success = true;
},
fail: (err) => {
uni.showModal({
@@ -37,6 +40,7 @@
content: JSON.stringify(err),
showCancel: false
});
+ this.success = false;
}
})
}
diff --git a/pages/API/save-video-to-photos-album/save-video-to-photos-album.test.js b/pages/API/save-video-to-photos-album/save-video-to-photos-album.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..69f46b204ed980c2bfaabf1718ff742b42022d60
--- /dev/null
+++ b/pages/API/save-video-to-photos-album/save-video-to-photos-album.test.js
@@ -0,0 +1,25 @@
+// uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
+describe('API-saveVideoToPhotosAlbum', () => {
+ if (process.env.uniTestPlatformInfo.startsWith('web') || process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
+ it('pass', async () => {
+ expect(1).toBe(1);
+ });
+ return;
+ }
+
+ let page;
+ beforeAll(async () => {
+ page = await program.reLaunch('/pages/API/save-video-to-photos-album/save-video-to-photos-album');
+ await page.waitFor(500);
+ });
+
+ it('test saveVideoToPhotosAlbum', async () => {
+ if (process.env.uniTestPlatformInfo.startsWith('android')) {
+ await program.adbCommand(
+ 'pm grant io.dcloud.uniappx android.permission.WRITE_EXTERNAL_STORAGE');
+ await page.waitFor(500);
+ }
+ await page.callMethod('saveVideo');
+ expect(await page.data('success')).toBe(true);
+ });
+});
diff --git a/pages/API/save-video-to-photos-album/save-video-to-photos-album.uvue b/pages/API/save-video-to-photos-album/save-video-to-photos-album.uvue
index e98bdc518bbe7447e439301cc9206dc82bb1bc68..b9d89d0bb6131f8829ad1b17ebbb20c9edf8b6a1 100644
--- a/pages/API/save-video-to-photos-album/save-video-to-photos-album.uvue
+++ b/pages/API/save-video-to-photos-album/save-video-to-photos-album.uvue
@@ -17,7 +17,9 @@
data() {
return {
title: 'saveVideoToPhotosAlbum',
- src: ''
+ src: '/static/test-video/10second-demo.mp4',
+ // 自动化测试
+ success: false
}
},
methods: {
@@ -31,6 +33,7 @@
icon: "none",
title: "视频保存成功,请到手机相册查看"
});
+ this.success = true;
},
fail: (err) => {
uni.showModal({
@@ -38,22 +41,10 @@
content: JSON.stringify(err),
showCancel: false
});
+ this.success = false;
}
});
}
- },
- onReady() {
- uni.showLoading({
- title: '视频下载中'
- });
- uni.downloadFile({
- url: 'https://qiniu-web-assets.dcloud.net.cn/uni-app-x/static/video/swiper-vertical-video/uts.mp4',
- success: (res) => {
- console.log("download video success", res.tempFilePath);
- this.src = res.tempFilePath;
- uni.hideLoading();
- }
- });
}
}
diff --git a/pages/API/theme-change/theme-change.test.js b/pages/API/theme-change/theme-change.test.js
index f9c7245532af4aae3afaa124f107b236ceacc1ec..150e8d44f2dd3f571879332ad1afcc7bb1a74577 100644
--- a/pages/API/theme-change/theme-change.test.js
+++ b/pages/API/theme-change/theme-change.test.js
@@ -27,11 +27,13 @@ describe('API-theme-change', () => {
it("check-set-app-theme", async () => {
+ const originalTheme = await page.data('originalTheme')
+ console.log("originalTheme是", originalTheme)
await page.callMethod('setAppTheme', "dark")
await page.waitFor(300)
expect(await page.data('appTheme')).toBe("dark")
//还原主题为light
- await page.callMethod('setAppTheme', "light")
+ await page.callMethod('setAppTheme', originalTheme)
await page.waitFor(600)
})
});
diff --git a/pages/API/theme-change/theme-change.uvue b/pages/API/theme-change/theme-change.uvue
index 04de30cd65421546ea1c09a79794308e4a269b3d..acdc7e21433398d8186dbbd59efbc7d66419ccbe 100644
--- a/pages/API/theme-change/theme-change.uvue
+++ b/pages/API/theme-change/theme-change.uvue
@@ -35,6 +35,7 @@
appThemeChangeId: 0,
osTheme: "light" as string,
appTheme: "light" as string,
+ originalTheme: "light" as string,
current: 0,
items: [
"light",
@@ -80,6 +81,7 @@
uni.getSystemInfo({
success: (res:GetSystemInfoResult) => {
this.osTheme = res.osTheme!
+ this.originalTheme = res.appTheme!
this.appTheme = res.appTheme == "auto" ? res.osTheme! : res.appTheme!
this.current = this.items.indexOf(res.appTheme!)
}
diff --git a/pages/API/unicloud-database/unicloud-database.test.js b/pages/API/unicloud-database/unicloud-database.test.js
index cec19a63b982c7d2461344fa0bb682f917934fb4..a516f98c5155da718cda4c2da039879573b2639e 100644
--- a/pages/API/unicloud-database/unicloud-database.test.js
+++ b/pages/API/unicloud-database/unicloud-database.test.js
@@ -1,55 +1,63 @@
-const PAGE_PATH = '/pages/API/unicloud-database/unicloud-database'
-
-describe('unicloud-database', () => {
- let page
- beforeAll(async () => {
- page = await program.reLaunch(PAGE_PATH)
- await page.waitFor(500)
- await page.setData({
- isUniTest: true
- })
- })
- it('databaseBasic', async () => {
- await page.callMethod('dbRemove')
- await page.callMethod('dbAdd')
- await page.callMethod('dbBatchAdd')
- await page.callMethod('dbGet')
- await page.callMethod('dbGetWithCommand')
- await page.callMethod('dbUpdate')
- await page.callMethod('dbRemove')
- await page.callMethod('dbMultiSend')
-
- const {
- addId,
- batchAddIds,
- batchAddinserted,
- updateUpdated,
- getData,
- getWithCommandData,
- removeDeleted,
- multiSendSuccessCount,
- } = await page.data()
-
- expect(addId !== '').toBe(true)
- expect(batchAddIds.length).toBe(2)
- expect(batchAddinserted).toBe(2)
- expect(getData.length).toBe(2)
- expect(getWithCommandData.length).toBe(1)
- expect(updateUpdated).toBe(3)
- expect(removeDeleted).toBe(3)
- expect(multiSendSuccessCount).toBe(2)
-
- })
-
- it('databaseLookup', async () => {
- await page.callMethod('dbLookupInit')
- await page.callMethod('dbLookup')
-
- const {
- lookupData
- } = await page.data()
- expect(lookupData.length).toBe(2)
- expect(lookupData[0]['foreign_id'].length).toBe(1)
- expect(lookupData[1]['foreign_id'].length).toBe(1)
- })
-});
+const PAGE_PATH = '/pages/API/unicloud-database/unicloud-database'
+const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
+const isSafari = platformInfo.indexOf('safari') > -1
+
+describe('unicloud-database', () => {
+ if (isSafari) {
+ it('web safari 暂时规避', () => {
+ expect(1).toBe(1)
+ })
+ return
+ }
+ let page
+ beforeAll(async () => {
+ page = await program.reLaunch(PAGE_PATH)
+ await page.waitFor(500)
+ await page.setData({
+ isUniTest: true
+ })
+ })
+ it('databaseBasic', async () => {
+ await page.callMethod('dbRemove')
+ await page.callMethod('dbAdd')
+ await page.callMethod('dbBatchAdd')
+ await page.callMethod('dbGet')
+ await page.callMethod('dbGetWithCommand')
+ await page.callMethod('dbUpdate')
+ await page.callMethod('dbRemove')
+ await page.callMethod('dbMultiSend')
+
+ const {
+ addId,
+ batchAddIds,
+ batchAddinserted,
+ updateUpdated,
+ getData,
+ getWithCommandData,
+ removeDeleted,
+ multiSendSuccessCount,
+ } = await page.data()
+
+ expect(addId !== '').toBe(true)
+ expect(batchAddIds.length).toBe(2)
+ expect(batchAddinserted).toBe(2)
+ expect(getData.length).toBe(2)
+ expect(getWithCommandData.length).toBe(1)
+ expect(updateUpdated).toBe(3)
+ expect(removeDeleted).toBe(3)
+ expect(multiSendSuccessCount).toBe(2)
+
+ })
+
+ it('databaseLookup', async () => {
+ await page.callMethod('dbLookupInit')
+ await page.callMethod('dbLookup')
+
+ const {
+ lookupData
+ } = await page.data()
+ expect(lookupData.length).toBe(2)
+ expect(lookupData[0]['foreign_id'].length).toBe(1)
+ expect(lookupData[1]['foreign_id'].length).toBe(1)
+ })
+});
diff --git a/pages/API/upload-file/upload-file.test.js b/pages/API/upload-file/upload-file.test.js
index 5d04326500bd4fa15a07dc14ab8c41c3a6bfafe7..9dad0a2fba6c36146187b2a20e9c6b9754ba0ae8 100644
--- a/pages/API/upload-file/upload-file.test.js
+++ b/pages/API/upload-file/upload-file.test.js
@@ -34,6 +34,13 @@ describe('ExtApi-UploadFile', () => {
await page.waitFor(2000);
res = await page.data('jest_result');
expect(res).toBe(true)
+ });
+
+ it('Check uni.env', async () => {
+ await page.callMethod('jest_uploadFile_with_uni_env');
+ await page.waitFor(2000);
+ res = await page.data('jest_result');
+ expect(res).toBe(true);
});
// 15以下的模拟器所对应的xcode不能编译自定义插件,大于15是因为某台设备,会用xcode14.1跑15.5的设备
@@ -47,7 +54,9 @@ describe('ExtApi-UploadFile', () => {
res = await page.data('jest_result');
expect(res).toBe(true)
})
- }
+ }
+
+
let shouldTestCookie = false
if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
diff --git a/pages/API/upload-file/upload-file.uvue b/pages/API/upload-file/upload-file.uvue
index 8878c52198a383fa8345365d107e50d829a42473..180768a8496c2542ae743ebf8073332908193fec 100644
--- a/pages/API/upload-file/upload-file.uvue
+++ b/pages/API/upload-file/upload-file.uvue
@@ -15,13 +15,13 @@
-
-
-
diff --git a/pages/CSS/text/font-size.test.js b/pages/CSS/text/font-size.test.js
index e20bd0cd0a755db09dd0d2f027c9bb9935c5426b..471cfe792b34f99fe0b61688192c1b17e8548f23 100644
--- a/pages/CSS/text/font-size.test.js
+++ b/pages/CSS/text/font-size.test.js
@@ -4,7 +4,7 @@ describe('css-font-size', () => {
page = await program.reLaunch('/pages/CSS/text/font-size');
});
- it('screenshot', async () => {
+ it('change font-size screenshot', async () => {
await page.callMethod("setFontSize");
await page.waitFor(100);
const image = await program.screenshot({ fullPage: true });
diff --git a/pages/CSS/text/font-size.uvue b/pages/CSS/text/font-size.uvue
index 75e2058b3addf7396d011575bd4de45767714d34..857abd75dfcca9c538cca5143122c63be58ff558 100644
--- a/pages/CSS/text/font-size.uvue
+++ b/pages/CSS/text/font-size.uvue
@@ -1,7 +1,7 @@
- {{fontSize}}
+ font-size: {{fontSize}}
font-size: 30px
@@ -11,14 +11,13 @@
export default {
data() {
return {
- fontSize: 'font-size: 15px'
+ fontSize: '15px'
}
},
methods: {
// 自动化测试
setFontSize() {
- this.fontSize = 'font-size: 30px';
- (this.$refs['text'] as UniElement).style.setProperty('font-size', '30px');
+ this.fontSize = '30px';
}
}
}
diff --git a/pages/CSS/transform/rotate.test.js b/pages/CSS/transform/rotate.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..7a1a596039d244319f8d897556a002ab29fee6d7
--- /dev/null
+++ b/pages/CSS/transform/rotate.test.js
@@ -0,0 +1,16 @@
+// uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
+
+describe('/pages/CSS/transform/rotate.uvue', () => {
+ let page;
+ beforeAll(async () => {
+ page = await program.reLaunch('/pages/CSS/transform/rotate')
+ await page.waitFor(1000);
+ });
+
+ it("snap rotate", async () => {
+ const image = await program.screenshot({
+ fullPage: true
+ })
+ expect(image).toSaveImageSnapshot()
+ })
+});
diff --git a/pages/CSS/transform/scale.test.js b/pages/CSS/transform/scale.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..b3de428e5a42c2b58efd1fde6652805ff8e8271c
--- /dev/null
+++ b/pages/CSS/transform/scale.test.js
@@ -0,0 +1,16 @@
+// uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
+
+describe('/pages/CSS/transform/scale.uvue', () => {
+ let page;
+ beforeAll(async () => {
+ page = await program.reLaunch('/pages/CSS/transform/scale')
+ await page.waitFor(1000);
+ });
+
+ it("snap scale", async () => {
+ const image = await program.screenshot({
+ fullPage: true
+ })
+ expect(image).toSaveImageSnapshot()
+ })
+});
diff --git a/pages/CSS/transform/translate.test.js b/pages/CSS/transform/translate.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..a9d2ffd928a3830422f91ef082ef0f190a1ad210
--- /dev/null
+++ b/pages/CSS/transform/translate.test.js
@@ -0,0 +1,16 @@
+// uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
+
+describe('/pages/CSS/transform/translate.uvue', () => {
+ let page;
+ beforeAll(async () => {
+ page = await program.reLaunch('/pages/CSS/transform/translate')
+ await page.waitFor(1000);
+ });
+
+ it("snap translate", async () => {
+ const image = await program.screenshot({
+ fullPage: true
+ })
+ expect(image).toSaveImageSnapshot()
+ })
+});
diff --git a/pages/CSS/transition/transition.test.js b/pages/CSS/transition/transition.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..65ca9ae8bae55f621611fb708df20a6f18ccbff8
--- /dev/null
+++ b/pages/CSS/transition/transition.test.js
@@ -0,0 +1,31 @@
+// uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
+
+describe('/pages/CSS/transition/transition.uvue', () => {
+ let page;
+ beforeAll(async () => {
+ page = await program.reLaunch('/pages/CSS/transition/transition')
+ await page.waitFor(2000);
+ });
+
+ it("snap transition finish", async () => {
+ await page.callMethod('changeWidthOrHeight')
+ await page.callMethod('changeWidthProgress')
+ await page.callMethod('changeMargin')
+ await page.callMethod('changePadding')
+ await page.callMethod('changeBackground')
+ await page.callMethod('changeBackground2')
+ await page.callMethod('changeStyleOpacity')
+ await page.callMethod('propertyChangeBackground')
+ await page.callMethod('changeTransform')
+ await page.callMethod('changeTransformTranslate')
+ await page.callMethod('changeTransformWithWidth')
+ await page.callMethod('changeTransformWithOrigin')
+ await page.callMethod('changeBorder')
+ await page.callMethod('changestylePosition')
+ await page.waitFor(3000)
+ const image = await program.screenshot({
+ fullPage: true
+ })
+ expect(image).toSaveImageSnapshot()
+ })
+});
diff --git a/pages/CSS/transition/transition.uvue b/pages/CSS/transition/transition.uvue
index 7a604ceff4487c617fc5d687783ed20bbe652b49..d8d3afd22cd67a831870722e838caafd37c516d4 100644
--- a/pages/CSS/transition/transition.uvue
+++ b/pages/CSS/transition/transition.uvue
@@ -2,64 +2,67 @@
-
-
- 点击修改宽度
-
-
-
- 点击修改宽度(递增)
-
-
-
- 点击修改Margin
-
-
-
- 点击修改Padding
-
-
-
-
-
- 点击修改background-color和opacity
-
-
-
- 点击修改background-color(rgba)
-
-
-
-
-
- 动态修改background-color和duration
-
-
-
- 点击修改Transform
-
-
-
- 点击修改TransformTranslate
-
-
-
- 点击修改Transform和宽
-
-
-
- 点击修改Transform(含transform-origin)
-
-
-
- 点击修改Border
-
+
+ 点击修改宽度
+
+
+
+ 点击修改宽度(递增)
+
+
+
+ 点击修改Margin
+
+
+
+ 点击修改Padding
+
+
-
- 点击修改Position
-
+
+
+ 点击修改background-color和opacity
+
+
+
+ 点击修改background-color(rgba)
+
+
+
+ 点击修改opacity渐隐渐现
+
+
+
+ 动态修改background-color和duration
+
+
+
+ 点击修改Transform
+
+
+
+ 点击修改TransformTranslate
+
+
+
+ 点击修改Transform和宽
+
+
+
+ 点击修改Transform(含transform-origin)
+
+
+
+ 点击修改Border
+
+
+
+ 点击修改Position
+
+
@@ -79,11 +82,13 @@
stylePadding: null as UniElement | null,
isTransitionstyleBackground: false,
isTransitionstyleBackground2: false,
+ isTransitionstyleOpacity: false,
styleBackground: null as UniElement | null,
styleBackground2: null as UniElement | null,
+ styleOpacity: null as UniElement | null,
isTransitionStyleTransform: false,
styleTransform: null as UniElement | null,
- isTransitionStyleTransformWithWidth:false,
+ isTransitionStyleTransformWithWidth: false,
styleTransformWithWidth: null as UniElement | null,
isTransitionstyleBorder: false,
styleBorder: null as UniElement | null,
@@ -105,6 +110,7 @@
this.stylePadding = uni.getElementById("stylePadding")
this.styleBackground = uni.getElementById("styleBackground")
this.styleBackground2 = uni.getElementById("styleBackground2")
+ this.styleOpacity = uni.getElementById("styleOpacity")
this.styleTransform = uni.getElementById("styleTransform")
this.styleBorder = uni.getElementById("styleBorder")
this.stylePosition = uni.getElementById("stylePosition")
@@ -163,6 +169,14 @@
)
this.isTransitionstyleBackground2 = !this.isTransitionstyleBackground2
},
+ changeStyleOpacity() {
+ this.styleOpacity?.style?.setProperty("opacity", this.isTransitionstyleOpacity
+ ? '1'
+ : '0'
+ )
+ this.styleOpacity?.style?.setProperty("transition-duration", "1000ms")
+ this.isTransitionstyleOpacity = !this.isTransitionstyleOpacity
+ },
propertyChangeBackground() {
if (!this.isSetTransition) {
this.propertyStyleBackground?.style?.setProperty("transition-property", "background-color")
@@ -271,6 +285,11 @@
transition-duration: 1s;
}
+ .transition-opacity {
+ transition-property: opacity;
+ transition-duration: 1s;
+ }
+
.transition-transform {
transition-property: transform;
transition-duration: 1s;
@@ -289,6 +308,7 @@
transition-property: left;
transition-duration: 1s;
}
+
.transition-transform-width {
transition-property: transform, width;
transition-duration: 1s;
diff --git a/pages/CSS/variable/variable.test.js b/pages/CSS/variable/variable.test.js
index e323f516a199c792223b1d0e8f49f04fc5771359..948eaf5d7f7d9aaf508b574402a7c8fae5d81a05 100644
--- a/pages/CSS/variable/variable.test.js
+++ b/pages/CSS/variable/variable.test.js
@@ -1,4 +1,10 @@
describe('css-variable', () => {
+ if (process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
+ it('app 与 web 存在差异, webview 不进行截图', () => {
+ expect(1).toBe(1)
+ return
+ })
+ }
let page;
beforeAll(async () => {
page = await program.reLaunch('/pages/CSS/variable/variable');
diff --git a/pages/component/button/button.uvue b/pages/component/button/button.uvue
index 8e9e346ae0a865a8895a8813cecf2aa059668446..e511c7fb4850fab76029d6c3ee773056b38551b5 100644
--- a/pages/component/button/button.uvue
+++ b/pages/component/button/button.uvue
@@ -11,8 +11,11 @@
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'
+ text: ''
}
+ },
+ onReady() {
+ this.text = 'uni-app-x'
},
methods: {
button_click() {
@@ -54,7 +57,8 @@
: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'">
+ :class="default_style ? (disabled_boolean ? 'custom-btn-disable' : 'custom-btn') : ''"
+ :hover-class="default_style ? 'is-hover' : 'button-hover'">
{{ text }}
@@ -92,6 +96,12 @@
border-color: #1AAD19;
}
+ .custom-btn-disable {
+ color: rgba(255, 255, 255, 0.7);
+ background-color: rgba(26, 173, 25, 0.7);
+ border-color: rgba(26, 173, 25, 0.7);
+ }
+
.is-hover {
color: rgba(255, 255, 255, 0.6);
background-color: #179b16;
diff --git a/pages/component/canvas/ball.uvue b/pages/component/canvas/ball.uvue
new file mode 100644
index 0000000000000000000000000000000000000000..79dc53a92a91bd8e2556438ef33d20102ccc146c
--- /dev/null
+++ b/pages/component/canvas/ball.uvue
@@ -0,0 +1,184 @@
+
+
+
+
+
+
+
+
+
diff --git a/pages/component/canvas/canvas.test.js b/pages/component/canvas/canvas.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..77080c4edbf6dcf5f884730688660954d7ea20cd
--- /dev/null
+++ b/pages/component/canvas/canvas.test.js
@@ -0,0 +1,23 @@
+let page
+
+beforeAll(async () => {
+ if (!process.env.uniTestPlatformInfo.toLowerCase().startsWith('web')) {
+ return
+ }
+ page = await program.reLaunch('/pages/component/canvas/canvas')
+ await page.waitFor(2000)
+})
+
+describe('Canvas.uvue', () => {
+ it('toBlob', async () => {
+ if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('web')) {
+ const {
+ testToBlobResult,
+ testToDataURLResult
+ } = await page.data()
+
+ expect(testToBlobResult).toBe(true)
+ expect(testToDataURLResult).toBe(true)
+ }
+ })
+})
diff --git a/pages/component/canvas/canvas.uvue b/pages/component/canvas/canvas.uvue
new file mode 100644
index 0000000000000000000000000000000000000000..1c177d0aa77d0f8522bbe7c809f1d9cbd59a8674
--- /dev/null
+++ b/pages/component/canvas/canvas.uvue
@@ -0,0 +1,931 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/component/checkbox/checkbox.uvue b/pages/component/checkbox/checkbox.uvue
index d38258cb504c0475fb4da7d6b5ba81ef0e31f6d2..3f70409c252c6184247589abcf2a2871911d5e7b 100644
--- a/pages/component/checkbox/checkbox.uvue
+++ b/pages/component/checkbox/checkbox.uvue
@@ -1,204 +1,204 @@
-
-
-
-
- uni-app-x
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 默认样式
-
-
-
- 选中
-
- {{ text }}
- 禁用
-
- {{ wrapText }}
-
-
-
-
- 不同颜色和尺寸的checkbox
-
-
-
- 选中
-
- 未选中
-
-
-
-
-
-
- 推荐展示样式
-
-
-
-
-
- {{ item.name }}
-
-
-
-
-
-
-
-
diff --git a/pages/component/form/form.test.js b/pages/component/form/form.test.js
index ed51aa5505a983bdb3accb3b286c7e7b7363fe07..faa9024b25d3c5d4ea861e6c97a919ac0ce8798a 100644
--- a/pages/component/form/form.test.js
+++ b/pages/component/form/form.test.js
@@ -28,7 +28,8 @@ describe('form', () => {
await page.waitFor(200)
const {
- formData
+ formData,
+ testVerifySubmit
} = await page.data()
expect(formData['nickname']).toBe(CHANGE_NICK_NAME)
@@ -38,6 +39,8 @@ describe('form', () => {
expect(formData['age']).toBe(CHANGE_AGE)
expect(formData['switch']).toBe(CHANGE_SWITCH)
expect(formData['comment']).toBe(CHANGE_COMMENT)
+
+ expect(testVerifySubmit).toBe(true)
})
it('reset', async () => {
await changeData(page)
@@ -51,7 +54,8 @@ describe('form', () => {
await page.waitFor(100)
const {
- formData
+ formData,
+ testVerifyReset
} = await page.data()
expect(formData['nickname']).toBe(DEFAULT_NICK_NAME)
@@ -60,6 +64,8 @@ describe('form', () => {
expect(formData['age']).toBe(DEFAULT_AGE)
expect(formData['switch']).toBe(DEFAULT_SWITCH)
expect(formData['comment']).toBe(DEFAULT_COMMENT)
+
+ expect(testVerifyReset).toBe(true)
})
})
diff --git a/pages/component/form/form.uvue b/pages/component/form/form.uvue
index 49f53e65bb0ec7bfd68a9816f198472c851cfadc..664b38d3a69c9fd84ad80c30a91b4ccc1f58b9a5 100644
--- a/pages/component/form/form.uvue
+++ b/pages/component/form/form.uvue
@@ -68,7 +68,10 @@
loves: ['0'],
switch: true,
comment:'',
- formData: {} as UTSJSONObject
+ formData: {} as UTSJSONObject,
+ // 仅测试
+ testVerifySubmit: false,
+ testVerifyReset: false,
}
},
computed: {
@@ -78,10 +81,18 @@
},
methods: {
onFormSubmit: function (e : UniFormSubmitEvent) {
+ console.log(e.target?.tagName ?? '123');
+ console.log(e.type);
this.formData = e.detail.value
+
+ // 仅测试
+ this.testVerifySubmit = (e.type == 'submit' && (e.target?.tagName ?? '') == "FORM")
},
- onFormReset: function (_ : UniFormResetEvent) {
+ onFormReset: function (e : UniFormResetEvent) {
this.formData = {}
+
+ // 仅测试
+ this.testVerifyReset = (e.type == 'reset' && (e.target?.tagName ?? '') == "FORM")
}
}
}
diff --git a/pages/component/general-event/general-event.test.js b/pages/component/general-event/general-event.test.js
index e8c9393aa2bb2abf5947e7bce511bf725919e326..20ed32867e35a6bf7ee32c02d1b88a8863c1ae37 100644
--- a/pages/component/general-event/general-event.test.js
+++ b/pages/component/general-event/general-event.test.js
@@ -1,6 +1,6 @@
const PAGE_PATH = '/pages/component/general-event/general-event'
-describe('event trigger sequence', () => {
+describe('event trigger', () => {
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
const isAndroid = platformInfo.startsWith('android')
const isIos = platformInfo.startsWith('ios')
@@ -222,7 +222,7 @@ describe('event trigger sequence', () => {
if (isAndroid || isIos) {
if (isAndroid) {
- if (platformInfo.indexOf('6') != -1) {
+ if (platformInfo.indexOf('6') != -1 && platformInfo.indexOf('x86') == -1) {
await program.tap({
x: 200,
y: 700,
@@ -242,6 +242,11 @@ describe('event trigger sequence', () => {
})
}
} else if (isIos) {
+ // 规避系统授权弹框
+ await program.tap({
+ x: 100,
+ y: 500,
+ })
await program.tap({
x: 200,
y: 400,
@@ -293,4 +298,4 @@ describe('event trigger sequence', () => {
}
}
})
-})
+})
diff --git a/pages/component/general-event/transition-event.uvue b/pages/component/general-event/transition-event.uvue
index 52abf7b6d3f69c8a413cced79d9bc57b83270336..fd8f8401140f58143f199c0b28dbb9856a0fa804 100644
--- a/pages/component/general-event/transition-event.uvue
+++ b/pages/component/general-event/transition-event.uvue
@@ -28,6 +28,7 @@
}
},
onReady() {
+ // onReady中动态修改isShow是为了验证在安卓手机上子线程中创建节点可能会崩溃的问题,不具备代码参考性。
// #ifdef APP-ANDROID
var that = this
class ThreadRunnable extends Runnable {
diff --git a/pages/component/image/image.test.js b/pages/component/image/image.test.js
index c5f25b026be9792242d59f7736004a2e8898d130..62eb78441b4608d346f542999b19eb9f47e527ad 100644
--- a/pages/component/image/image.test.js
+++ b/pages/component/image/image.test.js
@@ -2,7 +2,7 @@
describe('component-native-image', () => {
let page;
-
+
async function getWindowInfo() {
const windowInfoPage = await program.reLaunch('/pages/API/get-window-info/get-window-info')
await windowInfoPage.waitFor(600);
@@ -10,7 +10,7 @@ describe('component-native-image', () => {
}
const screenshotParams = { fullPage: true }
let windowInfo
-
+
beforeAll(async () => {
if (!process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
screenshotParams.fullPage = false
@@ -24,7 +24,7 @@ describe('component-native-image', () => {
}
screenshotParams.offsetY = offsetY
}
-
+
page = await program.reLaunch('/pages/component/image/image');
await page.waitFor(600);
});
@@ -70,6 +70,49 @@ describe('component-native-image', () => {
})
}
+ it('test event load', async () => {
+ await page.setData({
+ autoTest: true,
+ imageSrc: 'https://request.dcloud.net.cn/api/http/contentType/image/png'
+ });
+ await page.waitFor(1000);
+ if(process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
+ expect(await page.data('eventLoad')).toEqual({
+ type: 'load',
+ width: 10,
+ height: 10
+ });
+ return
+ }
+ expect(await page.data('eventLoad')).toEqual({
+ tagName: 'IMAGE',
+ type: 'load',
+ width: 10,
+ height: 10
+ });
+ });
+
+ it('test event error', async () => {
+ await page.setData({
+ imageSrc: 'https://request.dcloud.net.cn/api/http/contentType/404.png'
+ });
+ await page.waitFor(500);
+ if(process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
+ expect(await page.data('eventError')).toEqual({
+ type: 'error'
+ });
+ }else {
+ expect(await page.data('eventError')).toEqual({
+ tagName: 'IMAGE',
+ type: 'error'
+ });
+ }
+
+ await page.setData({
+ autoTest: false
+ });
+ });
+
it('path-screenshot', async () => {
const page = await program.navigateTo('/pages/component/image/image-path');
await page.waitFor(3000);
diff --git a/pages/component/image/image.uvue b/pages/component/image/image.uvue
index 42e9f4ca2c339624db0aed5fb9bb312823783048..eb180f20f89e21362a6e62e40ffd0d7e00146c8c 100644
--- a/pages/component/image/image.uvue
+++ b/pages/component/image/image.uvue
@@ -34,16 +34,33 @@
// 自动化测试
autoTest: false,
setCookieImage: "",
- verifyCookieImage: ""
+ verifyCookieImage: "",
+ eventLoad: null as UTSJSONObject | null,
+ eventError: null as UTSJSONObject | null
}
},
methods: {
error(event : ImageErrorEvent) {
this.loadError = true
- console.log(event.type, event.detail);
+ console.log(event.type, event.detail);
+ if (this.autoTest) {
+ this.eventError = {
+ "tagName": event.target?.tagName,
+ "type": event.type,
+ // "errMsg": event.detail.errMsg
+ };
+ }
},
load(event : ImageLoadEvent) {
- console.log(event.type, event.detail);
+ console.log(event.type, event.detail);
+ if (this.autoTest) {
+ this.eventLoad = {
+ "tagName": event.target?.tagName,
+ "type": event.type,
+ "width": event.detail.width,
+ "height": event.detail.height
+ };
+ }
},
imageFormat() {
uni.navigateTo({
diff --git a/pages/component/input/input.test.js b/pages/component/input/input.test.js
index b1f9dd356585f2c6c489ea17fbcc87b06c06098f..8362a38a7415f25209ccd6f59e97f93f8727fb12 100644
--- a/pages/component/input/input.test.js
+++ b/pages/component/input/input.test.js
@@ -184,11 +184,11 @@ describe('component-native-input', () => {
await program.navigateTo("/pages/API/navigator/new-page/new-page-3")
await page.waitFor(2000);
await program.navigateBack()
- await page.waitFor(2000);
+ await page.waitFor(1000);
await page.setData({
focusedForKeyboardHeightChangeTest: true
})
- await page.waitFor(2000);
+ await page.waitFor(5000);
const keyboardHeight = await page.data('keyboardHeight');
console.log("keyboardHeight :", keyboardHeight);
diff --git a/pages/component/input/input.uvue b/pages/component/input/input.uvue
index 7193a80246fef9f118c88ee65408674a3a37b783..5a8f6e94e14b45cf928040817683348ef5492343 100644
--- a/pages/component/input/input.uvue
+++ b/pages/component/input/input.uvue
@@ -248,6 +248,17 @@
+
+
+
+ 设置adjust-position
+
+
+
+
+
+
+
@@ -282,7 +293,8 @@
holdKeyboard: false,
keyboardHeight: 0,
focusedForKeyboardHeightChangeTest: false,
- demoValue: '123'
+ demoValue: '123',
+ adjustPosition: false
}
},
methods: {
@@ -359,6 +371,10 @@
changeHoldKeyboard(event : UniSwitchChangeEvent) {
const checked = event.detail.value;
this.holdKeyboard = checked
+ },
+ changeAdjustPosition(event : UniSwitchChangeEvent){
+ const checked = event.detail.value;
+ this.adjustPosition = checked
}
}
}
diff --git a/pages/component/list-view/list-view-children-in-slot.test.js b/pages/component/list-view/list-view-children-in-slot.test.js
index 7c48374a725fdd9a0e9f3d9f52201d932d51c49c..fe293ccedec1dd4aae02bf1fb28afc77e96128b5 100644
--- a/pages/component/list-view/list-view-children-in-slot.test.js
+++ b/pages/component/list-view/list-view-children-in-slot.test.js
@@ -1,14 +1,9 @@
describe('list-view-children-in-slot', () => {
- if (process.env.uniTestPlatformInfo.startsWith('web')) {
- it('dummyTest', async () => {
- expect(1).toBe(1)
- })
- return
- }
let page
beforeAll(async () => {
page = await program.reLaunch('/pages/component/list-view/list-view-children-in-slot')
- await page.waitFor('list-view')
+ await page.waitFor('list-view')
+ await page.waitFor(300)
})
it('basic', async () => {
diff --git a/pages/component/list-view/list-view-multiplex.uvue b/pages/component/list-view/list-view-multiplex.uvue
index 951d0021102eec6ce5ec53c5d02056a64b49796f..28af9b2dd0ff25598cff8dcc6dda1b2512120ca9 100644
--- a/pages/component/list-view/list-view-multiplex.uvue
+++ b/pages/component/list-view/list-view-multiplex.uvue
@@ -8,6 +8,7 @@
item-------{{index}}
item-------{{index}}
+
diff --git a/pages/component/list-view/list-view.test.js b/pages/component/list-view/list-view.test.js
index 8c139c6e772ac74500f2697cbdbd0f8ffbc2b8c0..685a22d3a0128c5e308e680af6013bea8eb640fb 100644
--- a/pages/component/list-view/list-view.test.js
+++ b/pages/component/list-view/list-view.test.js
@@ -75,12 +75,16 @@ describe('component-native-list-view', () => {
return
}
+ if(process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
+ return
+ }
+
it('Event scrollend-滚动结束时触发',async()=>{
// 仅App端支持,向上滑动页面
await program.swipe({
startPoint: { x: 100, y: 300 },
endPoint: { x: 100, y: 100 },
- duration: 1000
+ duration: 100
})
await page.waitFor(600)
const endDetail = await page.data('scrollEndDetailTest')
@@ -94,10 +98,6 @@ describe('component-native-list-view', () => {
// expect(endDetail.scrollWidth).toBeGreaterThan(0)
})
- if(process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
- return
- }
-
//检测竖向可滚动区域
it('check_scroll_height', async () => {
await page.callMethod('change_scroll_y_boolean', true)
diff --git a/pages/API/map/map.test.js b/pages/component/map/map.test.js
similarity index 97%
rename from pages/API/map/map.test.js
rename to pages/component/map/map.test.js
index 7e97c643fac0e60d5684b13df004bf9e5a267e0d..1a5c8e8c3481cf772e2657b2f5bef94aa895f263 100644
--- a/pages/API/map/map.test.js
+++ b/pages/component/map/map.test.js
@@ -8,7 +8,7 @@ describe('web-map', () => {
return
}
beforeAll(async () => {
- page = await program.reLaunch('/pages/API/map/map')
+ page = await program.reLaunch('/pages/component/map/map')
await page.waitFor('view');
// 等待地图加载完成
await page.waitFor(4000);
diff --git a/pages/component/map/map.uvue b/pages/component/map/map.uvue
index de69428cdcecd86e55efa2c2265e3bcced506dd0..e2d03bba1493882c09a60eadbfa7a2d9238f9a40 100644
--- a/pages/component/map/map.uvue
+++ b/pages/component/map/map.uvue
@@ -1,39 +1,468 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/pages/component/movable-view/movable-view.test.js b/pages/component/movable-view/movable-view.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..eb25b97b744d89a7ff6bed0de1ce94e07e00f25d
--- /dev/null
+++ b/pages/component/movable-view/movable-view.test.js
@@ -0,0 +1,30 @@
+let page;
+describe('movable-view.uvue', () => {
+ console.log(process.env.uniTestPlatformInfo,process.env.uniTestPlatformInfo.startsWith('web'))
+ if (!process.env.uniTestPlatformInfo.startsWith('web')) {
+ it('app', () => {
+ expect(1).toBe(1)
+ })
+ return
+ }
+ beforeAll(async () => {
+ page = await program.reLaunch('/pages/component/movable-view/movable-view')
+ await page.waitFor('view');
+ });
+
+ it('移动至 (30px, 30px)', async () => {
+ expect(await page.data('x')).toBe(0)
+ expect(await page.data('y')).toBe(0)
+ await page.callMethod('tap')
+ await page.waitFor(500);
+ expect(await page.data('x')).toBe(30)
+ expect(await page.data('y')).toBe(30)
+ })
+ it('放大3倍', async () => {
+ expect(await page.data('scale')).toBe(2)
+ await page.callMethod('tap2')
+ await page.waitFor(500);
+ expect(await page.data('scale')).toBe(3)
+ })
+
+})
diff --git a/pages/component/radio/radio.uvue b/pages/component/radio/radio.uvue
index d1538205e4d19b40fdf438c69d4e7ee25872e0c9..c6b4f90272e595fcf8f9723ca47998e654d0cd36 100644
--- a/pages/component/radio/radio.uvue
+++ b/pages/component/radio/radio.uvue
@@ -1,193 +1,193 @@
-
-
-
-
-
- uni-app-x
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 默认样式
-
-
- 选中
-
- {{
- text
- }}
- 禁用
- {{
- wrapText
- }}
-
-
-
-
-
- 不同颜色和尺寸的radio
-
-
- 选中
-
- 未选中
-
-
-
-
-
- 推荐展示样式
-
-
-
-
-
- {{ item.name }}
-
-
-
-
-
-
-
-
diff --git a/pages/component/scroll-view/refresh-box/refresh-box.uvue b/pages/component/scroll-view/refresh-box/refresh-box.uvue
new file mode 100644
index 0000000000000000000000000000000000000000..0750044cf3487f79390ecde661e1bbf4fda7fa8d
--- /dev/null
+++ b/pages/component/scroll-view/refresh-box/refresh-box.uvue
@@ -0,0 +1,47 @@
+
+
+
+
+ {{text[state]}}
+
+
+
+
+
+
+
diff --git a/pages/component/scroll-view/scroll-view-custom-refresher-props.uvue b/pages/component/scroll-view/scroll-view-custom-refresher-props.uvue
index 43590788d7f175a922fe8bd3f9df6819ac9f9474..494a9335ad763da5ede25064bf7304ede97ff5a8 100644
--- a/pages/component/scroll-view/scroll-view-custom-refresher-props.uvue
+++ b/pages/component/scroll-view/scroll-view-custom-refresher-props.uvue
@@ -10,7 +10,7 @@
@@ -91,7 +95,7 @@
uni-app-x
@@ -115,6 +119,8 @@
@confirm="confirm_block_size_input">
+
@@ -146,7 +152,11 @@
不同颜色和大小的滑块
暗黑模式
diff --git a/pages/component/swiper/swiper.test.js b/pages/component/swiper/swiper.test.js
index 07bec724a02dfb9464115646ed58b8ff69b85481..47e9b9c76fcc9197fd2dcf2677cb5140a82d1870 100644
--- a/pages/component/swiper/swiper.test.js
+++ b/pages/component/swiper/swiper.test.js
@@ -90,28 +90,23 @@ describe('test swiper', () => {
});
it('Event transitiont', async () => {
- // bug:android端swiper的事件event参数detail类型错误,暂时忽略测试
- if(!process.env.UNI_UTS_PLATFORM.startsWith('app-android')){
- const transitionDetailInfo = await page.data('transitionDetailTest')
- // bug:在iOS端,swiper首次横向滑动切换@transition事件参数e.detail.dy为1错误,暂时忽略测试
- if(process.env.uniTestPlatformInfo.startsWith('web')){
- expect(transitionDetailInfo.dy).toBe(0)
- }
- expect(transitionDetailInfo.dx).not.toBe(0)
- expect(await page.data('isTransitionTest')).toBe('transition:Success')
+ const transitionDetailInfo = await page.data('transitionDetailTest')
+ // bug:在iOS端,swiper首次横向滑动切换@transition事件参数e.detail.dy为1错误,暂时忽略测试
+ if(process.env.uniTestPlatformInfo.startsWith('web')){
+ expect(transitionDetailInfo.dy).toBe(0)
}
+ expect(transitionDetailInfo.dx).not.toBe(0)
+ expect(await page.data('isTransitionTest')).toBe('transition:Success')
});
it('Event change', async () => {
- if(!process.env.UNI_UTS_PLATFORM.startsWith('app-android')){
- const changeDetailInfo = await page.data('changeDetailTest')
- if(process.env.uniTestPlatformInfo.startsWith('web')){
- expect(changeDetailInfo).toEqual(webDetailRes)
- }else{
- expect(changeDetailInfo).toEqual(appDetailRes)
- }
- expect(await page.data('isChangeTest')).toBe('change:Success')
+ const changeDetailInfo = await page.data('changeDetailTest')
+ if(process.env.uniTestPlatformInfo.startsWith('web')){
+ expect(changeDetailInfo).toEqual(webDetailRes)
+ }else{
+ expect(changeDetailInfo).toEqual(appDetailRes)
}
+ expect(await page.data('isChangeTest')).toBe('change:Success')
});
it('Event animationfinish', async () => {
diff --git a/pages/component/swiper/swiper.uvue b/pages/component/swiper/swiper.uvue
index b879b77a8061a5ea98c175883f9e7bac11ad5b4e..98267b05cde4be8c266c9badffbb03d668148d86 100644
--- a/pages/component/swiper/swiper.uvue
+++ b/pages/component/swiper/swiper.uvue
@@ -117,12 +117,9 @@
swiperChangeSelect: false,
currentValChange: 0,
// 自动化测试
- // 在android端以下事件event参数中detail类型报错,先条件编译处理
- // #ifndef APP-ANDROID
- changeDetailTest:null as UniSwiperChangeDetail | null,
- transitionDetailTest:null as UniSwiperTransitionDetail | null,
- animationfinishDetailTest:null as UniSwiperAnimationFinishDetail | null,
- // #endif
+ changeDetailTest:null as UniSwiperChangeEventDetail | null,
+ transitionDetailTest:null as UniSwiperTransitionEventDetail | null,
+ animationfinishDetailTest:null as UniSwiperAnimationFinishEventDetail | null,
isChangeTest:'',
isTransitionTest:'',
isAnimationfinishTest:''
@@ -130,9 +127,7 @@
},
methods: {
swiperChange: function (e : UniSwiperChangeEvent) {
- // #ifndef APP-ANDROID
this.changeDetailTest = e.detail
- // #endif
this.checkEventTest({
type:e.type,
target:e.target,
@@ -146,9 +141,7 @@
}
},
swiperTransition: function (e : UniSwiperTransitionEvent) {
- // #ifndef APP-ANDROID
this.transitionDetailTest = e.detail
- // #endif
this.checkEventTest({
type:e.type,
target:e.target,
@@ -160,9 +153,7 @@
}
},
swiperAnimationfinish: function (e : UniSwiperAnimationFinishEvent) {
- // #ifndef APP-ANDROID
this.animationfinishDetailTest = e.detail
- // #endif
this.checkEventTest({
type:e.type,
target:e.target,
diff --git a/pages/component/switch/switch.test.js b/pages/component/switch/switch.test.js
index 259438994d2dd7b1b7c0b5f9a84af35bde09d331..79ccc75fd283710a9f013a605d85e444cdc71413 100644
--- a/pages/component/switch/switch.test.js
+++ b/pages/component/switch/switch.test.js
@@ -6,22 +6,6 @@ describe('switch', () => {
page = await program.reLaunch(PAGE_PATH)
await page.waitFor(500)
})
- // TODO
- // it('click', async () => {
- // const switch_element = await page.$('.switch-checked')
- // const switch_element_value = await page.$('.switch-checked-value')
- // expect(await switch_element_value.text()).toBe('true')
-
- // await page.waitFor(200)
-
- // await switch_element.tap()
- // await page.waitFor(200)
- // expect(await switch_element_value.text()).toBe('false')
-
- // await switch_element.tap()
- // await page.waitFor(200)
- // expect(await switch_element_value.text()).toBe('true')
- // })
it('checked', async () => {
const switch_element = await page.$('.switch-checked')
@@ -53,4 +37,40 @@ describe('switch', () => {
await page.waitFor(100)
expect(await switch_element.attribute('color')).toBe(color)
})
+ it('dark', async () => {
+ const dark = await page.$('#dark')
+ const darkChecked = await page.$('#darkChecked')
+
+ expect(await dark.attribute('background-color')).toBe('#1f1f1f')
+ expect(await dark.attribute('fore-color')).toBe('#f0f0f0')
+
+ expect(await darkChecked.attribute('active-background-color')).toBe('#007aff')
+ expect(await darkChecked.attribute('active-fore-color')).toBe('#ffffff')
+ })
+ it('click', async () => {
+ let switchElement
+ // TODO 暂时通过获取组件内部的 class 触发模拟点击
+ if (process.env.uniTestPlatformInfo.startsWith('android')) {
+ switchElement = await page.$('.uni-switch-input')
+ await switchElement.tap()
+ await page.waitFor(200)
+
+ const {
+ testVerifyEvent
+ } = await page.data()
+
+ expect(testVerifyEvent).toBe(true)
+ } else {
+ // switchElement = await page.$('#testTap')
+ }
+
+ // await switchElement.tap()
+ // await page.waitFor(200)
+
+ // const {
+ // testVerifyEvent
+ // } = await page.data()
+
+ // expect(testVerifyEvent).toBe(true)
+ })
})
diff --git a/pages/component/switch/switch.uvue b/pages/component/switch/switch.uvue
index 437b4afa2b73b10d68c322cabb9121039e520f83..3f2acf2b6b2fcc06c0e7d095bc00f15ef92162b0 100644
--- a/pages/component/switch/switch.uvue
+++ b/pages/component/switch/switch.uvue
@@ -5,7 +5,11 @@
-
+
+ 暗黑样式
+
+
+
禁用样式
@@ -39,13 +43,17 @@
title: 'switch 开关',
checked: true,
color: '#FFCC33',
- clickCheckedValue: true
+ clickCheckedValue: true,
+ testVerifyEvent: false,
}
},
methods: {
switch1Change: function (e : UniSwitchChangeEvent) {
this.clickCheckedValue = e.detail.value
console.log('switch1 发生 change 事件,携带值为', e.detail.value)
+
+ // 仅测试
+ this.testVerifyEvent = (e.type == 'change' && (e.target?.tagName ?? '') == "SWITCH")
},
switch2Change: function (e : UniSwitchChangeEvent) {
console.log('switch2 发生 change 事件,携带值为', e.detail.value)
diff --git a/pages/component/textarea/textarea.test.js b/pages/component/textarea/textarea.test.js
index 9676d2dd9bf8d4adab06f644c6bab39e9ba96d2e..7a5cd7fe0516349528d6b3077e97c2f8d25e8cf2 100644
--- a/pages/component/textarea/textarea.test.js
+++ b/pages/component/textarea/textarea.test.js
@@ -64,7 +64,7 @@ describe('component-native-textarea', () => {
var x = inputmodeEnum[i]
console.log(x['value'], x['name'])
var selected = x['value'] - 1
- if(i == inputmodeEnum.length - 1){
+ if (i == inputmodeEnum.length - 1) {
selected = i
}
await page.callMethod("radio_change_inputmode_enum", selected);
@@ -74,11 +74,25 @@ describe('component-native-textarea', () => {
}
})
- if (!process.env.uniTestPlatformInfo.startsWith('android')) {
- // TODO: 暂时规避 android 端测试
- it('both set modelValue and value', async () => {
- let textarea2 = await page.$('.both-set-textarea');
- expect(await textarea2.value()).toBe("123")
+ it("maxlength", async () => {
+ const input = await page.$('#textarea-instance-maxlength');
+ let str = "";
+ for (let i = 0; i < 200; i++) {
+ str += `${i}`
+ }
+ await page.setData({
+ textareaMaxLengthValue: str
+ })
+ let length = (await input.value()).length
+ expect(length).toBe(10)
+ await page.setData({
+ textareaMaxLengthValue: ""
})
- }
+ })
+
+ it('both set modelValue and value', async () => {
+ const textarea2 = await page.$('#both-model-value');
+ expect(await textarea2.value()).toEqual("123")
+ })
+
});
diff --git a/pages/component/textarea/textarea.uvue b/pages/component/textarea/textarea.uvue
index 8b4e0862200d76e529d142382a4455f443af8015..136ff7289092fc12fabdf3cb648f2470209adfee 100644
--- a/pages/component/textarea/textarea.uvue
+++ b/pages/component/textarea/textarea.uvue
@@ -1,54 +1,74 @@
@@ -56,115 +76,122 @@ export default {
-
+ :confirm-type="confirm_type_list[confirm_type_current].name" @click="textarea_click"
+ @touchstart="textarea_touchstart" @touchmove="textarea_touchmove" @touchcancel="textarea_touchcancel"
+ @touchend="textarea_touchend" @tap="textarea_tap" @longpress="textarea_longpress" @confirm="textarea_confirm"
+ @input="textarea_input" @linechange="textarea_linechange" @blur="textarea_blur"
+ @keyboardheightchange="textarea_keyboardheightchange" @focus="textarea_focus"
+ style="padding: 10px; border: 1px solid #666;height: 200px" />
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ maxlength 输入最大长度为10
+
+
+
+
+
+
+ cursor-spacing、placeholder-class、placeholder-style例子
+
+
+
+
+
+ 设置输入框聚焦时光标的起始位置和结束位置(点击生效)
+
+
+
+
+
+
+ 设置hold-keyboard
+
+
+
+
+
+
+
+ 同时存在 v-model 和 value
+
+
+
-
- 同时存在 v-model 和 value
-
-
-
+
+ 设置adjust-position
+
+
+
+
+
+
diff --git a/pages/component/video/video.test.js b/pages/component/video/video.test.js
index ea02d3d16b3bfa973e0b842fb8f2f5ea959fc6c1..a7fa3c1a6b29ef4b41e73131dca774896164f159 100644
--- a/pages/component/video/video.test.js
+++ b/pages/component/video/video.test.js
@@ -30,17 +30,165 @@ describe('component-native-video', () => {
});
it('test local source', async () => {
- await page.callMethod('downloadSource');
- await page.waitFor(5000);
- expect(await page.data('isError')).toBe(false);
- await page.setData({
- localSrc: '/static/test-video/2minute-demo.m3u8'
- });
- await page.waitFor(100);
- expect(await page.data('isError')).toBe(false);
- await page.setData({
- autoTest: false
- });
+ await page.setData({
+ autoTest: true,
+ isError: false
+ });
+ await page.callMethod('downloadSource');
+ await page.waitFor(5000);
+ expect(await page.data('isError')).toBe(false);
+ await page.setData({
+ localSrc: '/static/test-video/2minute-demo.m3u8'
+ });
+ await page.waitFor(100);
+ expect(await page.data('isError')).toBe(false);
+ await page.setData({
+ autoTest: false
+ });
+ });
+
+ it('test event play pause', async () => {
+ await page.setData({
+ autoTest: true
+ });
+ await page.callMethod('play');
+ await page.waitFor(100);
+ if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
+ // expect(await page.data('eventPlay')).toEqual({
+ // type: 'play'
+ // });
+ }else {
+ expect(await page.data('eventPlay')).toEqual({
+ tagName: 'VIDEO',
+ type: 'play'
+ });
+ }
+
+ await page.callMethod('pause');
+ await page.waitFor(100);
+ if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
+ // expect(await page.data('eventPause')).toEqual({
+ // type: 'pause'
+ // });
+ }else {
+ expect(await page.data('eventPause')).toEqual({
+ tagName: 'VIDEO',
+ type: 'pause'
+ });
+ }
+
+ await page.callMethod('play');
+ });
+
+ it('test event waiting progress timeupdate', async () => {
+ if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
+ return
+ }
+ await page.setData({
+ pos: 10
+ });
+ await page.callMethod('seek');
+ await page.waitFor(100);
+ expect(await page.data('eventWaiting')).toEqual({
+ tagName: 'VIDEO',
+ type: 'waiting'
+ });
+ await page.waitFor(200);
+ expect(await page.data('eventProgress')).toEqual({
+ tagName: 'VIDEO',
+ type: 'progress',
+ isBufferedValid: true
+ });
+ const infos = process.env.uniTestPlatformInfo.split(' ');
+ const version = parseInt(infos[infos.length - 1]);
+ if (process.env.uniTestPlatformInfo.startsWith('android') && version > 5) {
+ await page.waitFor(200);
+ expect(await page.data('eventTimeupdate')).toEqual({
+ tagName: 'VIDEO',
+ type: 'timeupdate',
+ currentTime: 10,
+ duration: 121
+ });
+ }
+ });
+
+ it('test event fullscreenchange controlstoggle fullscreenclick', async () => {
+ if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
+ return;
+ }
+ await page.callMethod('requestFullScreen');
+ await page.waitFor(500);
+ expect(await page.data('eventFullscreenchange')).toEqual({
+ tagName: 'VIDEO',
+ type: 'fullscreenchange',
+ fullScreen: true,
+ direction: 'horizontal'
+ });
+ if (process.env.uniTestPlatformInfo.startsWith('android')) {
+ await page.waitFor(5000);
+ await program.adbCommand('input tap 10 10');
+ await page.waitFor(100);
+ const infos = process.env.uniTestPlatformInfo.split(' ');
+ const version = parseInt(infos[infos.length - 1]);
+ if (version > 5) { // android5.1模拟器全屏时会弹出系统提示框,无法响应adb tap命令
+ expect(await page.data('eventControlstoggle')).toEqual({
+ tagName: 'VIDEO',
+ type: 'controlstoggle',
+ show: true
+ });
+ }
+ const res = await program.adbCommand('wm size');
+ const width = res.data.split(' ').at(-1).split('x')[0];
+ const height = res.data.split(' ').at(-1).split('x')[1];
+ const res2 = await program.adbCommand('wm density');
+ const scale = res2.data.split(' ').at(-1) / 160;
+ if (version > 5) {
+ expect(await page.data('eventFullscreenclick')).toEqual({
+ tagName: 'VIDEO',
+ type: 'fullscreenclick',
+ screenX: parseInt(10 / scale),
+ screenY: parseInt(10 / scale),
+ screenWidth: parseInt(height / scale),
+ screenHeight: parseInt(width / scale)
+ });
+ }
+ }
+ await page.callMethod('exitFullScreen');
+ });
+
+ it('test event ended', async () => {
+ if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
+ return
+ }
+ await page.setData({
+ pos: 120
+ });
+ await page.callMethod('seek');
+ await page.waitFor(2500);
+ expect(await page.data('eventEnded')).toEqual({
+ tagName: 'VIDEO',
+ type: 'ended'
+ });
+ });
+
+ it('test event error', async () => {
+ if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
+ return
+ }
+ const oldSrc = await page.data('src');
+ await page.setData({
+ src: 'invalid url'
+ });
+ await page.waitFor(300);
+ expect(await page.data('eventError')).toEqual({
+ tagName: 'VIDEO',
+ type: 'error',
+ errCode: 300001
+ });
+ await page.setData({
+ autoTest: false,
+ src: oldSrc
+ });
});
it('test format', async () => {
diff --git a/pages/component/video/video.uvue b/pages/component/video/video.uvue
index e61144ea12e850bcd19adf20c0beda9e33490a62..103d266a4117b5e3d3a670b3934a3bb2060e4bdc 100644
--- a/pages/component/video/video.uvue
+++ b/pages/component/video/video.uvue
@@ -12,7 +12,6 @@
@fullscreenclick="onFullScreenClick" @controlstoggle="onControlsToggle" @fullscreenchange="onFullScreenChange">
-
@@ -28,10 +27,12 @@
-
+
+
-
+
+
@@ -40,103 +41,53 @@
-
+
+
-
+
+
属性示例
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/pages/template/custom-refresher/custom-refresher.uvue b/pages/template/custom-refresher/custom-refresher.uvue
index ed282cfea79a455907ae03e63724ef0c098277f1..5f6713744c3b7e5af3e72de347b4249189a4e467 100644
--- a/pages/template/custom-refresher/custom-refresher.uvue
+++ b/pages/template/custom-refresher/custom-refresher.uvue
@@ -1,84 +1,90 @@
-
-
-
- item-{{i}}
-
-
-
-
+
+
-
diff --git a/pages/template/custom-refresher/refresh-box/refresh-box.uvue b/pages/template/custom-refresher/refresh-box/refresh-box.uvue
index f8e1eec66fa164f9341d6df8ef8d7ebc8251ff0b..78b047094b2c41f9d14ac4cd072dfc5e2d9137a9 100644
--- a/pages/template/custom-refresher/refresh-box/refresh-box.uvue
+++ b/pages/template/custom-refresher/refresh-box/refresh-box.uvue
@@ -1,10 +1,10 @@
-
-
+
+
{{text[state]}}
-
-
+
+