From 72709c663683624907f935b3fc43b32209a791ab Mon Sep 17 00:00:00 2001 From: duqingquan Date: Tue, 17 Oct 2023 11:27:01 +0800 Subject: [PATCH] =?UTF-8?q?element=20takesnapshot=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=8C=96=E6=B5=8B=E8=AF=95=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../element-takesnapshot.test.js | 30 +++++++++++++++++++ .../element-takesnapshot.uvue | 14 ++++----- 2 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 pages/API/element-takesnapshot/element-takesnapshot.test.js diff --git a/pages/API/element-takesnapshot/element-takesnapshot.test.js b/pages/API/element-takesnapshot/element-takesnapshot.test.js new file mode 100644 index 00000000..673f2f78 --- /dev/null +++ b/pages/API/element-takesnapshot/element-takesnapshot.test.js @@ -0,0 +1,30 @@ +const PAGE_PATH = "/pages/API/element-takesnapshot/element-takesnapshot"; + + +describe("element-takesnapshot", () => { + let page; + function getData(key = '') { + return new Promise(async (resolve, reject) => { + const data = await page.data() + resolve(key ? data[key] : data) + }) + } + + + beforeAll(async () => { + page = await program.reLaunch(PAGE_PATH) + await page.waitFor(600); + }); + + + it("takeSnapshot", async () => { + await page.waitFor(600) + let btnTakeSnapshot = await page.$('.btn-TakeSnapshot') + await btnTakeSnapshot.tap() + page.waitFor(600) + const image = await getData('snapImage') + console.log(image) + ///storage/emulated/0/Android/data/io.dcloud.uniappx/apps/__UNI__3584C99/cache/temp/screenshot/1697513148915.png + expect(image.length).toBeGreaterThan(20) + }); +}); diff --git a/pages/API/element-takesnapshot/element-takesnapshot.uvue b/pages/API/element-takesnapshot/element-takesnapshot.uvue index 786be868..8f87f215 100644 --- a/pages/API/element-takesnapshot/element-takesnapshot.uvue +++ b/pages/API/element-takesnapshot/element-takesnapshot.uvue @@ -4,14 +4,14 @@ this is text this is view - - - + + + -- GitLab