diff --git a/App.uvue b/App.uvue index 6c45fad85d9a6aaa2ccd4c6c686491b5230142de..8de34e7e1cac8f916da6dbc67046305ff3c31fad 100644 --- a/App.uvue +++ b/App.uvue @@ -67,10 +67,10 @@ uni.exit() } }, - // #endif onExit() { console.log('App Exit') }, + // #endif methods: { increasetLifeCycleNum() { setLifeCycleNum(state.lifeCycleNum + 100) diff --git a/pages.json b/pages.json index 6dc16e82f5414c3f4ca2d3f13def679361dd90d9..3d3004afbbb47e51543a7ea40536ebec9c6d92ef 100644 --- a/pages.json +++ b/pages.json @@ -458,6 +458,13 @@ "navigationBarTitleText": "文件管理" } }, + { + "path" : "pages/API/env/env", + "style" : + { + "navigationBarTitleText" : "env" + } + }, // #endif { "path": "pages/API/action-sheet/action-sheet", @@ -1273,6 +1280,41 @@ "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" + } + }, // #endif // #ifdef APP { @@ -1281,13 +1323,20 @@ "navigationBarTitleText": "日历" } }, + { + "path": "pages/API/theme-change/theme-change", + "style": { + "navigationBarTitleText": "主题切换", + "enablePullDownRefresh": false + } + }, + // #endif { "path": "pages/template/schema/schema", "style": { "navigationBarTitleText": "打开schema示例" } }, - // #endif // #ifdef APP-ANDROID { "path": "pages/template/share/share", @@ -1352,13 +1401,6 @@ "enablePullDownRefresh": false } }, - { - "path": "pages/API/theme-change/theme-change", - "style": { - "navigationBarTitleText": "主题切换", - "enablePullDownRefresh": false - } - }, { "path": "uni_modules/uni-pay-x/pages/success/success", "style": { @@ -1406,7 +1448,6 @@ "backgroundColorContent": "#fffae8" } }, - // #ifdef APP-ANDROID || WEB { "path" : "pages/API/resize-observer/resize-observer", "style" : @@ -1414,7 +1455,6 @@ "navigationBarTitleText" : "resize observer" } }, - // #endif { "path" : "pages/CSS/overflow/overflow-visible-event", "style" : @@ -1429,9 +1469,7 @@ "navigationBarTextStyle": "white", "navigationBarBackgroundColor": "#007AFF", "backgroundColorContent": "#efeff4", - "backgroundColor": "#efeff4", - "backgroundColorTop": "#F4F5F6", - "backgroundColorBottom": "#F4F5F6" + "backgroundColor": "#efeff4" }, "tabBar": { "color": "#7A7E83", diff --git a/pages/API/env/env.uvue b/pages/API/env/env.uvue new file mode 100644 index 0000000000000000000000000000000000000000..adce29875ced55fc07f18074c1537561466d39a6 --- /dev/null +++ b/pages/API/env/env.uvue @@ -0,0 +1,49 @@ + + + + + diff --git a/pages/API/get-battery-info/get-battery-info.uvue b/pages/API/get-battery-info/get-battery-info.uvue index 84c733122cd8c9ecef08ac92427092724fb49184..e55d296d8d38c0218e77ce15956040fcc8956f1d 100644 --- a/pages/API/get-battery-info/get-battery-info.uvue +++ b/pages/API/get-battery-info/get-battery-info.uvue @@ -1,28 +1,33 @@ - \ No newline at end of file diff --git a/pages/API/inner-audio/inner-audio-format.uvue b/pages/API/inner-audio/inner-audio-format.uvue new file mode 100644 index 0000000000000000000000000000000000000000..7b9fb1756de1bd5f9dff67bc9043372fa862fcba --- /dev/null +++ b/pages/API/inner-audio/inner-audio-format.uvue @@ -0,0 +1,120 @@ + + + + + diff --git a/pages/API/inner-audio/inner-audio-path.uvue b/pages/API/inner-audio/inner-audio-path.uvue new file mode 100644 index 0000000000000000000000000000000000000000..003320d640b9275da2366f991367730e9953b1b0 --- /dev/null +++ b/pages/API/inner-audio/inner-audio-path.uvue @@ -0,0 +1,91 @@ + + + + + diff --git a/pages/API/inner-audio/inner-audio.uvue b/pages/API/inner-audio/inner-audio.uvue new file mode 100644 index 0000000000000000000000000000000000000000..093c831ec7a7768072ab8b18ff044f3b42bec0c9 --- /dev/null +++ b/pages/API/inner-audio/inner-audio.uvue @@ -0,0 +1,193 @@ + + + diff --git a/pages/API/make-phone-call/make-phone-call.uvue b/pages/API/make-phone-call/make-phone-call.uvue new file mode 100644 index 0000000000000000000000000000000000000000..33b784a984192ffdb861d05e4a73c3887b12482b --- /dev/null +++ b/pages/API/make-phone-call/make-phone-call.uvue @@ -0,0 +1,51 @@ + + + + diff --git a/pages/API/map/map.test.js b/pages/API/map/map.test.js new file mode 100644 index 0000000000000000000000000000000000000000..4f19a170c32579d98c03ac237c0fc7b9a7d3dcf6 --- /dev/null +++ b/pages/API/map/map.test.js @@ -0,0 +1,51 @@ +let page; +describe('web-map', () => { + 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/map/map') + await page.waitFor('view'); + // 等待地图加载完成 + await page.waitFor(4000); + await page.setData({autoTest:true}) + }); + + it('Check MapMethods', async () => { + const mapMethods = ['changeScale', 'addMarkers', 'addPolyline', 'addPolygons', 'addCircles', + 'includePoint', 'handleTranslateMarker' + ] + for (var i = 0; i < mapMethods.length; i++) { + await page.callMethod(mapMethods[i]) + if (mapMethods[i] == 'handleTranslateMarker') { + await page.waitFor(2000); + } else { + await page.waitFor(500); + } + expect(await program.screenshot()).toSaveImageSnapshot(); + await page.waitFor(500); + } + }); + it('handleGetCenterLocation', async () => { + await page.callMethod('handleGetCenterLocation') + await page.waitFor(500); + const centerLocationRes = await page.data('getCenterLocationTest') + expect(centerLocationRes.latitude).not.toBeNull(); + expect(centerLocationRes.longitude).not.toBeNull(); + }); + it('handleGetRegion', async () => { + await page.callMethod('handleGetRegion') + await page.waitFor(500); + const regionRes = await page.data('getRegionTest') + const getRegionExpected = { + southwest: { latitude: 39.88334279187766, longitude: 116.31050146728515 }, + northeast: { latitude: 40.0149408585477, longitude: 116.56799353271484 }, + errMsg: 'getRegion:ok' + } + expect(regionRes).toEqual(expect.objectContaining(getRegionExpected)); + }); +}); diff --git a/pages/API/map/map.uvue b/pages/API/map/map.uvue new file mode 100644 index 0000000000000000000000000000000000000000..e2d03bba1493882c09a60eadbfa7a2d9238f9a40 --- /dev/null +++ b/pages/API/map/map.uvue @@ -0,0 +1,468 @@ + + + + + diff --git a/pages/API/resize-observer/resize-observer.test.js b/pages/API/resize-observer/resize-observer.test.js index 22160835196358c0332b10f71d7863294c9283e4..ad6de613af2bfc44912faf0f1d4dbf39d48b88f1 100644 --- a/pages/API/resize-observer/resize-observer.test.js +++ b/pages/API/resize-observer/resize-observer.test.js @@ -1,13 +1,5 @@ describe('api-resize-observer', () => { - if ( - !process.env.uniTestPlatformInfo.startsWith('android') && - !process.env.uniTestPlatformInfo.startsWith('web') - ) { - it('dummyTest', async () => { - expect(1).toBe(1) - }) - return - } + let page beforeAll(async () => { diff --git a/pages/API/resize-observer/resize-observer.uvue b/pages/API/resize-observer/resize-observer.uvue index d2377add5f940a4bcfabd86e00dacaefc8f84f28..b8a60099211c4e2a87ec626ff4b3f07638486cf6 100644 --- a/pages/API/resize-observer/resize-observer.uvue +++ b/pages/API/resize-observer/resize-observer.uvue @@ -4,13 +4,15 @@ + id="outBox" @click="outBoxClick"> - + + + 蓝色方块元素: @@ -34,7 +36,7 @@ boxDisplay: false, outBoxElement: null as UniElement | null, innerBoxElement: null as UniElement | null, - resizeObserver: null as UniResizeObserver | null, + resizeObserver: null as UniResizeObserver | null, outBoxElementOnResize: false } }, @@ -47,9 +49,10 @@ onReady() { if (this.resizeObserver == null) { this.resizeObserver = new UniResizeObserver((entries : Array) => { + entries.forEach(entry => { if (entry.target == this.outBoxElement) { - this.outBoxSizeInfo = this.analysisResizeObserverEntry(entry) + this.outBoxSizeInfo = this.analysisResizeObserverEntry(entry) this.outBoxElementOnResize = true } else if (entry.target == this.innerBoxElement) { this.innerBoxSizeInfo = this.analysisResizeObserverEntry(entry) @@ -63,7 +66,7 @@ this.innerBoxElement = uni.getElementById("innerBox") if (this.innerBoxElement != null) { this.resizeObserver!.observe(this.innerBoxElement!) - } + } this.boxDisplay = true } }, @@ -89,13 +92,13 @@ this.innerBoxElement!.style.setProperty("width", "80px") this.innerBoxElement!.style.setProperty("height", "80px") } - }, - //自动化测试专用 - setOutBoxMarginLeft(value: string) { - if (this.outBoxElement != null) { - this.outBoxElementOnResize = false - this.outBoxElement!.style.setProperty("margin-left", value) - } + }, + //自动化测试专用 + setOutBoxMarginLeft(value : string) { + if (this.outBoxElement != null) { + this.outBoxElementOnResize = false + this.outBoxElement!.style.setProperty("margin-left", value) + } }, toggleDisplay() { this.boxDisplay = !this.boxDisplay @@ -108,6 +111,15 @@ "contentBoxSize: \n{blockSize:" + contentBoxSize.blockSize + ", inlineSize:" + contentBoxSize.inlineSize + "}\n" + "devicePixelContentBoxSize: \n{blockSize:" + devicePixelContentBoxSize.blockSize + ", inlineSize:" + devicePixelContentBoxSize.inlineSize + "}\n" + "contentRect: \n{x:" + entry.contentRect.x + ", y:" + entry.contentRect.y + ", width:" + entry.contentRect.width + ", height:" + entry.contentRect.height + "}" + }, + cancelListen(){ + // this.resizeObserver?.unobserve() + this.resizeObserver!.unobserve(this.outBoxElement!) + this.resizeObserver!.unobserve(this.innerBoxElement!) + }, + goOnListen(){ + this.resizeObserver!.observe(this.outBoxElement!) + this.resizeObserver!.observe(this.innerBoxElement!) } } } diff --git a/pages/API/theme-change/theme-change.test.js b/pages/API/theme-change/theme-change.test.js new file mode 100644 index 0000000000000000000000000000000000000000..0dcdb3a3dc236ac010c9c98c6e7c0c1a1e6c647d --- /dev/null +++ b/pages/API/theme-change/theme-change.test.js @@ -0,0 +1,27 @@ +// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/ + +describe('API-theme-change', () => { + + let page; + const isApp = process.env.UNI_OS_NAME === "android" || process.env.UNI_OS_NAME === "ios"; + + if (!isApp) { + it('dummyTest', () => { + expect(1).toBe(1) + }) + return + } + + beforeAll(async () => { + page = await program.reLaunch('/pages/API/theme-change/theme-change') + await page.waitFor(600); + }); + + + + it("check-set-app-theme", async () => { + await page.callMethod('setAppTheme', "dark") + await page.waitFor(300) + expect(await page.data('appTheme')).toBe("dark") + }) +}); diff --git a/pages/API/theme-change/theme-change.uvue b/pages/API/theme-change/theme-change.uvue index 9c3b662aebad42b194792efba1834638b950496b..ad243c721ea5a75bf0292b852c2b81808e25d857 100644 --- a/pages/API/theme-change/theme-change.uvue +++ b/pages/API/theme-change/theme-change.uvue @@ -1,85 +1,107 @@ - - - -