diff --git a/main.uts b/main.uts index 3d4dc082ef61dbe83ce74b4401924505e1858304..4f70a38446aafc0f121f6dbe89b57b5797a4f538 100644 --- a/main.uts +++ b/main.uts @@ -3,15 +3,19 @@ import App from './App.uvue' import { createSSRApp } from 'vue' export function createApp() { const app = createSSRApp(App) - + app.config.errorHandler = (err, vm, info) => { + console.log(err, vm, info) + } app.mixin({ onReady() { + // #ifdef APP-ANDROID setTimeout(() => { console.log((this as BasePage).$nativePage!.getDomJson()) }, 100) + // #endif } }) return { app } -} +} diff --git a/pages.json b/pages.json index 7da72ea1b5f4937d2401e965ebe3c79f670d2c6b..3da6ab1fd83ab12af9302f9dc7f493166b054a57 100644 --- a/pages.json +++ b/pages.json @@ -269,7 +269,6 @@ "navigationBarTitleText": "web-view-local" } }, - // #ifndef APP-IOS { "path": "pages/component/unicloud-db-contacts/list", "style": { @@ -301,7 +300,6 @@ "navigationBarTitleText": "mixinDatacom" } }, - // #endif { "path": "pages/component/general-attribute/general-attribute", "style": { @@ -576,6 +574,13 @@ "navigationBarTitleText": "get-system-setting" } }, + { + "path": "pages/API/element-takesnapshot/element-takesnapshot", + "style": { + "navigationBarTitleText": "takeSnapshot", + "enablePullDownRefresh": false + } + }, // #endif // #ifndef WEB { @@ -655,13 +660,6 @@ "enablePullDownRefresh": false } }, - { - "path": "pages/API/element-takesnapshot/element-takesnapshot", - "style": { - "navigationBarTitleText": "takeSnapshot", - "enablePullDownRefresh": false - } - }, { "path": "pages/API/element-draw/element-draw", "style": { diff --git a/pages/API/action-sheet/action-sheet.uvue b/pages/API/action-sheet/action-sheet.uvue index 2642faa5868fdc7959b68e3daf3f799f0722d82e..57955275a40e26ca2f3621a5996c8956bcee6dcf 100644 --- a/pages/API/action-sheet/action-sheet.uvue +++ b/pages/API/action-sheet/action-sheet.uvue @@ -116,7 +116,13 @@ icon: "none" }) }, - fail: (e) => { + fail: (e) => { + if(this.showErrorToast){ + uni.showToast({ + title: e.errMsg, + icon: "none" + }) + } console.log(e); } }) diff --git a/pages/API/download-file/download-file.test.js b/pages/API/download-file/download-file.test.js index 85ed9b054d2912dbb24bb579cfe735341f658af6..8a64b2b55678c731a8ba66af09615d878af8d17e 100644 --- a/pages/API/download-file/download-file.test.js +++ b/pages/API/download-file/download-file.test.js @@ -23,7 +23,7 @@ describe('ExtApi-DownloadFile', () => { }); let shouldTestCookie = false - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { let version = process.env.uniTestPlatformInfo version = parseInt(version.split(" ")[1]) shouldTestCookie = version > 9 @@ -47,4 +47,4 @@ describe('ExtApi-DownloadFile', () => { res = await page.data('jest_result'); expect(res).toBe(true) }); -}); +}); diff --git a/pages/API/get-provider/get-provider.uvue b/pages/API/get-provider/get-provider.uvue new file mode 100644 index 0000000000000000000000000000000000000000..71d5d17894ff02f9c8095f5622b966c24b022018 --- /dev/null +++ b/pages/API/get-provider/get-provider.uvue @@ -0,0 +1,87 @@ + + + + + diff --git a/pages/API/navigator/new-page/onLoad.test.js b/pages/API/navigator/new-page/onLoad.test.js index 1140f99636060d13c3a7b985462d1a7a1286becd..2a5101dd6261e48c8c0711b725a91f2913d4fe90 100644 --- a/pages/API/navigator/new-page/onLoad.test.js +++ b/pages/API/navigator/new-page/onLoad.test.js @@ -22,7 +22,7 @@ describe("onLoad", () => { expect(page.path).toBe(TARGET_PAGE_PATH.substring(1)); }); it("navigateBack", async () => { - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); await page.waitFor('view'); await page.callMethod("navigateToOnLoadWithType", "navigateBack"); @@ -89,7 +89,7 @@ describe("onLoad", () => { expect(image).toMatchImageSnapshot({ failureThreshold: 0.05, failureThresholdType: "percent", - }); + }); }); it("showModal", async () => { page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); @@ -127,4 +127,4 @@ describe("onLoad", () => { failureThresholdType: "percent", }); }); -}); +}); diff --git a/pages/API/request/request.test.js b/pages/API/request/request.test.js index 2dd94105704213c04ee7bfd112488fe6c8b7483b..67cde3b79ec2162a93a8dc3993146f7917bebf32 100644 --- a/pages/API/request/request.test.js +++ b/pages/API/request/request.test.js @@ -86,7 +86,7 @@ describe('ExtApi-Request', () => { }); let shouldTestCookie = false - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { let version = process.env.uniTestPlatformInfo version = parseInt(version.split(" ")[1]) shouldTestCookie = version > 9 @@ -108,4 +108,10 @@ describe('ExtApi-Request', () => { 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); + res = await page.data('jest_result'); + expect(res).toBe(true) + }) +}); diff --git a/pages/API/request/request.uvue b/pages/API/request/request.uvue index bc33bda1d8346cca49a9b31a16a3fe8dfde5ab28..8890befdb4f0880365eeb4f006b7e6e05b8cda0a 100644 --- a/pages/API/request/request.uvue +++ b/pages/API/request/request.uvue @@ -300,6 +300,25 @@ this.jest_result = false; }, }); + }, + jest_get_with_data() { + uni.request({ + url: "https://unidemo.dcloud.net.cn/api/banner/36kr", + method: "GET", + data:{ + column: 'id,post_id,title,author_name,cover,published_at' //需要的字段名 + }, + timeout: 6000, + sslVerify: false, + withCredentials: false, + firstIpv4: false, + success: () => { + this.jest_result = true; + }, + fail: () => { + this.jest_result = false; + }, + }); }, } } diff --git a/pages/API/toast/toast.uvue b/pages/API/toast/toast.uvue index 10a952e84ed079b584e0c4fabcc350925a16e7ac..3aa2c5b6c9a3d877f238c7014cb1ab2fd2f6ec93 100644 --- a/pages/API/toast/toast.uvue +++ b/pages/API/toast/toast.uvue @@ -10,7 +10,7 @@ - + @@ -101,7 +101,7 @@ }, }) }, - // #ifdef APP-PLUS + // #ifdef APP toast5Tap: function () { uni.showToast({ title: "显示一段轻提示", diff --git a/pages/API/upload-file/upload-file.test.js b/pages/API/upload-file/upload-file.test.js index 6f26d3ee46ea0fb8fd8d0d72f28b2fed02dba41e..c23bd72a3b0ccd80b7cf9e3a3ad2341ea303408d 100644 --- a/pages/API/upload-file/upload-file.test.js +++ b/pages/API/upload-file/upload-file.test.js @@ -27,17 +27,17 @@ describe('ExtApi-UploadFile', () => { it('Check ', async () => { expect(res).toBe(true); - }); - - it('Check files upload', async () => { - res = await page.callMethod('jest_files_upload') - await page.waitFor(2000); - res = await page.data('jest_result'); - expect(res).toBe(true) + }); + + it('Check files upload', async () => { + res = await page.callMethod('jest_files_upload') + await page.waitFor(2000); + res = await page.data('jest_result'); + expect(res).toBe(true) }); let shouldTestCookie = false - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { let version = process.env.uniTestPlatformInfo version = parseInt(version.split(" ")[1]) shouldTestCookie = version > 9 @@ -59,4 +59,4 @@ describe('ExtApi-UploadFile', () => { res = await page.data('jest_result'); expect(res).toBe(true) }); -}); +}); diff --git a/pages/CSS/overflow/overflow.test.js b/pages/CSS/overflow/overflow.test.js index d22653b6ce06b9b6c35237d4204aa4a5d178a075..dd7f5ae3af25bd068be88e78378a3b7e9f8a5755 100644 --- a/pages/CSS/overflow/overflow.test.js +++ b/pages/CSS/overflow/overflow.test.js @@ -1,14 +1,14 @@ -describe('component-native-overflow', () => { - let page +describe('component-native-overflow', () => { + let page beforeAll(async () => { - //打开list-view测试页 - page = await program.reLaunch('/pages/CSS/overflow/overflow') - await page.waitFor("image") + //打开list-view测试页 + page = await program.reLaunch('/pages/CSS/overflow/overflow') + await page.waitFor("image") }) //检测overflow设置hidden,visible it('check_view_overflow', async () => { - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { let version = process.env.uniTestPlatformInfo version = parseInt(version.split(" ")[1]) //安卓7模拟器不截图 导致闪退 @@ -21,5 +21,5 @@ describe('component-native-overflow', () => { fullPage: true, }); expect(image).toMatchImageSnapshot(); - }) + }) }) diff --git a/pages/component/button/button.test.js b/pages/component/button/button.test.js index ccd09420ba41febaeeb0bbbeeaf30b8f1065aa10..ed8384a5b1b7e6ad518bd6208ee55189f7806c2d 100644 --- a/pages/component/button/button.test.js +++ b/pages/component/button/button.test.js @@ -86,4 +86,11 @@ describe('Button.uvue', () => { const value = await page.callMethod('checkUniButtonElement') expect(value).toBe(true) }) + it("setbuttonEmpty", async () => { + const textBtn = await page.$('.btn') + await page.setData({ + text: '', + }) + expect(await textBtn.text()).toEqual('') + }) }) diff --git a/pages/component/button/button.uvue b/pages/component/button/button.uvue index 7a000f30eab6197672a6c332c6408e3c323c39ac..8e9e346ae0a865a8895a8813cecf2aa059668446 100644 --- a/pages/component/button/button.uvue +++ b/pages/component/button/button.uvue @@ -35,14 +35,14 @@ uni.navigateTo({ url: 'buttonstatus', }) - }, - //用于自动化测试 - checkUniButtonElement(): boolean { - const button = uni.getElementById("testButton") - if(button != null && button instanceof UniButtonElement) { - return true - } - return false + }, + //用于自动化测试 + checkUniButtonElement() : boolean { + const button = uni.getElementById("testButton") + if (button != null && button instanceof UniButtonElement) { + return true + } + return false } } } @@ -65,7 +65,7 @@ - + @@ -97,4 +97,9 @@ background-color: #179b16; border-color: #179b16; } + + .button-hover { + color: rgba(0, 0, 0, 0.6); + background-color: #dedede; + } diff --git a/pages/component/button/buttonstatus.uvue b/pages/component/button/buttonstatus.uvue index 7602f2a0b652a1eeee05cf68c069c7a1d3ea68f3..ecaeb94b0e6d1610d5089c81914134c44efbb08f 100644 --- a/pages/component/button/buttonstatus.uvue +++ b/pages/component/button/buttonstatus.uvue @@ -1,178 +1,195 @@ - - - - - diff --git a/pages/component/general-event/general-event.test.js b/pages/component/general-event/general-event.test.js index 4d6b63f857a1d396b93d0693641ac1b2f1c81ce3..46939cc7955786e5d899cd6cb704054850bc8d16 100644 --- a/pages/component/general-event/general-event.test.js +++ b/pages/component/general-event/general-event.test.js @@ -10,7 +10,7 @@ describe('event trigger sequence', () => { }) it('touch', async () => { - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { await el.touchstart({ touches: [{ identifier: 1, @@ -56,10 +56,10 @@ describe('event trigger sequence', () => { }) it('longPress', async () => { - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { await el.longpress() const data = await page.data() expect(data.onLongPressTime).toBeGreaterThan(0) } }) -}) +}) diff --git a/pages/component/image/image.test.js b/pages/component/image/image.test.js index 0c031b7235b1d266b6df20f2bb4d0abb671b385b..03378d848e0a45d37fe205b06686e52e734f7401 100644 --- a/pages/component/image/image.test.js +++ b/pages/component/image/image.test.js @@ -30,7 +30,7 @@ describe('component-native-image', () => { expect(await page.data('loadError')).toBe(true) }) - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { it('check-cookie', async () => { await page.setData({ autoTest: true, diff --git a/pages/component/input/input.test.js b/pages/component/input/input.test.js index be9d4e6c8fe5b23f737596e828b7bdb50939abb2..181d8b378b89437bc5893b91d4f95f5c0352c349 100644 --- a/pages/component/input/input.test.js +++ b/pages/component/input/input.test.js @@ -147,19 +147,19 @@ describe('component-native-input', () => { expect(await (await page.$('#uni-input-cursor-color')).attribute("cursor-color")).toBe("red") }) - it("maxlength default", async () => { - const input = await page.$('#uni-input-disable'); + it("maxlength", async () => { + const input = await page.$('#uni-input-maxlength'); let str = ""; for(let i = 0;i < 200;i++){ str += `${i}` } await page.setData({ - disableValue: str + inputMaxLengthValue: str }) let length = (await input.attribute("value")).length - expect(length).toBe(140) + expect(length).toBe(10) await page.setData({ - disableValue: "" + inputMaxLengthValue: "" }) }) diff --git a/pages/component/input/input.uvue b/pages/component/input/input.uvue index 52e85b2d1204875b8d4ba52ace82b0667de218a6..0d34c5f49b32cec3eb8e594827480d555dbbcd77 100644 --- a/pages/component/input/input.uvue +++ b/pages/component/input/input.uvue @@ -59,7 +59,7 @@ 设置禁用输入框 - + @@ -266,7 +266,6 @@ inputPasswordValue: "", inputFocusKeyBoardChangeValue: true, holdKeyboard: false, - disableValue: "" } }, methods: { 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 e7c489523aac3a977855f79bd6cc357323cecf29..a41dec907de727921fd1afa6d3f2dcb7e08284d0 100644 --- a/pages/component/scroll-view/scroll-view-custom-refresher-props.uvue +++ b/pages/component/scroll-view/scroll-view-custom-refresher-props.uvue @@ -1,6 +1,6 @@ @@ -112,12 +124,23 @@ export default { multiLineText: 'HBuilderX,轻巧、极速,极客编辑器;uni-app x,终极跨平台方案;uts,大一统语言;HBuilderX,轻巧、极速,极客编辑器;uni-app x,终极跨平台方案;uts,大一统语言', singleLineText: 'uni-app x,终极跨平台方案', + // 自动化测试 + autoTest: false, + nestedText: '三级节点文本', + emptyText: '空文本', + heightText: '设置高度文本' } }, methods: { // 自动化测试 - setTextNested() { - (this.$refs["text-nested"] as UniTextElement).value = "二级节点文字红色且背景色黄色"; + setNestedText() { + this.nestedText = "修改三级节点文本"; + }, + setEmptyText() { + this.emptyText = ""; + }, + setHeightText() { + this.heightText = "修改设置高度文本"; } } } diff --git a/pages/component/web-view-local/web-view-local.test.js b/pages/component/web-view-local/web-view-local.test.js index 767c77025422b3319fb57a94e628356f352444da..37c9e2c2bdd327ba9186b8643e7b29f2d6c61872 100644 --- a/pages/component/web-view-local/web-view-local.test.js +++ b/pages/component/web-view-local/web-view-local.test.js @@ -12,7 +12,7 @@ describe('component-native-web-view', () => { }); it('screenshot', async () => { - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { await page.waitFor(async () => { return await page.data('loadFinish') === true; }); diff --git a/pages/component/web-view/web-view.test.js b/pages/component/web-view/web-view.test.js index 3ab086250608610f10a810b0c78e7e86d2430d9d..7995ecc6d4f22535352eed4280872e74e8c34950 100644 --- a/pages/component/web-view/web-view.test.js +++ b/pages/component/web-view/web-view.test.js @@ -1,7 +1,7 @@ // uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/ describe('component-native-web-view', () => { - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { let page; beforeAll(async () => { page = await program.reLaunch('/pages/component/web-view/web-view'); diff --git a/pages/pages.test.js b/pages/pages.test.js index a90a6d9f938b607360e7f1ef095b559b75c45b8a..d7a13218bd8decd022629f6302e4cc297cd6418e 100755 --- a/pages/pages.test.js +++ b/pages/pages.test.js @@ -121,7 +121,7 @@ const pages = [ // '/pages/API/element-draw/element-draw', ] -if (process.env.uniTestPlatformInfo.startsWith('android')) { +if (process.env.uniTestPlatformInfo.startsWith('android')&& !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { // 规避 web 端不支持页面 pages.push( "/pages/component/list-view/list-view", @@ -133,18 +133,18 @@ if (process.env.uniTestPlatformInfo.startsWith('android')) { '/pages/template/pull-zoom-image/pull-zoom-image', '/pages/template/scroll-fold-nav/scroll-fold-nav', '/pages/template/scroll-sticky/scroll-sticky', - '/pages/template/custom-refresher/custom-refresher', - '/pages/template/custom-tab-bar/custom-tab-bar', + '/pages/template/custom-refresher/custom-refresher', + '/pages/template/custom-tab-bar/custom-tab-bar', '/pages/template/half-screen/half-screen', ) -} - -// 设置position: fixed的页面不能截取完整内容 -const notFullPages = [ - '/pages/CSS/layout/position', - '/pages/CSS/layout/z-index' -] - +} + +// 设置position: fixed的页面不能截取完整内容 +const notFullPages = [ + '/pages/CSS/layout/position', + '/pages/CSS/layout/z-index' +] + let page; describe("page screenshot test", () => { beforeAll(async () => { @@ -162,14 +162,14 @@ describe("page screenshot test", () => { }); test.each(pages)("%s", async () => { console.log("Taking screenshot: ", pageIndex, pages[pageIndex]); - let fullPage = true; - if (notFullPages.includes(pages[pageIndex])) { - fullPage = false; + let fullPage = true; + if (notFullPages.includes(pages[pageIndex])) { + fullPage = false; } const image = await program.screenshot({ fullPage: fullPage - }); + }); expect(image).toMatchImageSnapshot(); await page.waitFor(500); }); -}); +}); diff --git a/pages/template/custom-refresher/custom-refresher.uvue b/pages/template/custom-refresher/custom-refresher.uvue index 476aeea1482e0597bd0247c54458d21ffb272640..64db3a6d61fdb3b5102f9d4605f1154a17d97b48 100644 --- a/pages/template/custom-refresher/custom-refresher.uvue +++ b/pages/template/custom-refresher/custom-refresher.uvue @@ -3,6 +3,7 @@ :refresher-enabled="true" :refresher-triggered="refresherTriggered" refresher-default-style="none" @refresherpulling="onRefresherpulling" @refresherrefresh="onRefresherrefresh" + @refresherrestore="onRefreshrestore" :refresher-threshold="refresherThreshold" > @@ -43,9 +44,6 @@ onRefresherpulling(e:RefresherEvent){ // console.log('onRefresherpulling',e.detail.dy) this.pullingDistance = e.detail.dy - if (this.pullingDistance.toDouble() == 0.0) { - this.resetting = false; - } }, onRefresherrefresh(){ this.refresherTriggered = true @@ -53,12 +51,10 @@ this.refresherTriggered = false },1500) }, - // onRefresherrestore(e:RefresherEvent){ - // console.log('onRefresherrestore',e) - // }, - // onRefresherabort(e:RefresherEvent){ - // console.log('onRefresherabort',e) - // }, + onRefreshrestore() { + this.pullingDistance = 0 + this.resetting = false; + } } } diff --git a/pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js b/pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js index b3a0f718ad8ed53e5b009b9f5407bedb5da58dfa..355cc54dd130a716f904d238fdcc524ed9aef473 100644 --- a/pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js +++ b/pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js @@ -8,7 +8,7 @@ const pages = [ "pages/component/text/text-props", "pages/component/progress/progress", "pages/component/form/form", - "pages/component/button/button", + "pages/component/button/button", "pages/component/button/buttonstatus", "pages/component/radio/radio", "pages/component/rich-text/rich-text", @@ -237,7 +237,7 @@ const PAGE_PATH = describe("shot-compare", () => { let shouldCompareScreenShot = false - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { let version = process.env.uniTestPlatformInfo version = parseInt(version.split(" ")[1]) shouldCompareScreenShot = version > 9 @@ -246,7 +246,7 @@ describe("shot-compare", () => { if (!shouldCompareScreenShot) { it("other platform not support", async () => { expect(1).toBe(1); - }); + }); return } @@ -355,4 +355,4 @@ describe("shot-compare", () => { }, }); }); -}); +}); diff --git a/pages/webview-screenshot/webview-screenshot.test.js b/pages/webview-screenshot/webview-screenshot.test.js index faa41945ae0a3218afb09e7ae6e0f59851c479cf..d2e40ffa66a95d7ec0abc73fbc0b097f1b0bd9aa 100644 --- a/pages/webview-screenshot/webview-screenshot.test.js +++ b/pages/webview-screenshot/webview-screenshot.test.js @@ -236,7 +236,7 @@ const PAGE_PATH = describe("shot-compare", () => { let shouldCompareScreenShot = false - if (process.env.uniTestPlatformInfo.startsWith('android')) { + if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { let version = process.env.uniTestPlatformInfo version = parseInt(version.split(" ")[1]) shouldCompareScreenShot = version > 9 @@ -245,7 +245,7 @@ describe("shot-compare", () => { if (!shouldCompareScreenShot) { it("other platform not support", async () => { expect(1).toBe(1); - }); + }); return } let page = null; @@ -330,4 +330,4 @@ describe("shot-compare", () => { }, }); }); -}); +});