diff --git a/pages.json b/pages.json index 222021051f9aa15037ba25bdb0396ccd44d84ce3..dbe42b899ed87405efccc0f7e5da9a463cdb8121 100644 --- a/pages.json +++ b/pages.json @@ -307,6 +307,12 @@ "style": { "navigationBarTitleText": "获取节点" } + }, + { + "path": "pages/API/get-element-by-id/get-element-by-id-multiple-root-node", + "style": { + "navigationBarTitleText": "获取节点-多根节点" + } }, { "path": "pages/API/nodes-info/nodes-info", diff --git a/pages/API/get-element-by-id/get-element-by-id-multiple-root-node.test.js b/pages/API/get-element-by-id/get-element-by-id-multiple-root-node.test.js new file mode 100644 index 0000000000000000000000000000000000000000..c7863eb97bf1e8162ee2e593138ac71e5829a995 --- /dev/null +++ b/pages/API/get-element-by-id/get-element-by-id-multiple-root-node.test.js @@ -0,0 +1,22 @@ +const PAGE_PATH = + "/pages/API/get-element-by-id/get-element-by-id-multiple-root-node"; +let page; + +describe("getElementByIdForMultipleRootNode", () => { + beforeAll(async () => { + page = await program.reLaunch(PAGE_PATH); + await page.waitFor(1000); + }); + it("getElementByNotExistId", async () => { + const res = await page.callMethod("getElementByNotExistId"); + expect(res).toBe(null); + }); + it("changeStyle", async () => { + await page.callMethod("changePageHeadBackgroundColor"); + await page.callMethod("changeTextColor"); + await page.callMethod("changeViewStyle"); + await page.waitFor(500); + const image = await program.screenshot(); + expect(image).toMatchImageSnapshot(); + }); +}); \ No newline at end of file diff --git a/pages/API/get-element-by-id/get-element-by-id-multiple-root-node.uvue b/pages/API/get-element-by-id/get-element-by-id-multiple-root-node.uvue new file mode 100644 index 0000000000000000000000000000000000000000..66165ecba60ffaafb9eb4150684a790940a727c1 --- /dev/null +++ b/pages/API/get-element-by-id/get-element-by-id-multiple-root-node.uvue @@ -0,0 +1,52 @@ + + + diff --git a/pages/API/get-element-by-id/get-element-by-id.test.js b/pages/API/get-element-by-id/get-element-by-id.test.js index 34cd75ede394262db4f4eca5e5921d75e472b8c2..00a5f2e78b5a9b162277838a30b2ff502e656ae0 100644 --- a/pages/API/get-element-by-id/get-element-by-id.test.js +++ b/pages/API/get-element-by-id/get-element-by-id.test.js @@ -3,17 +3,18 @@ let page; describe("getElementById", () => { beforeAll(async () => { - page = await program.navigateTo(PAGE_PATH); + page = await program.reLaunch(PAGE_PATH); await page.waitFor(1000); }); it("getElementByNotExistId", async () => { const res = await page.callMethod("getElementByNotExistId"); - expect(!!res).toBe(false); + expect(res).toBe(null); }); it("changeStyle", async () => { await page.callMethod("changePageHeadBackgroundColor"); await page.callMethod("changeTextColor"); await page.callMethod("changeViewStyle"); + await page.waitFor(500); const image = await program.screenshot(); expect(image).toMatchImageSnapshot(); }); diff --git a/pages/API/get-element-by-id/get-element-by-id.uvue b/pages/API/get-element-by-id/get-element-by-id.uvue index 4ef31ce36fcbbf20a9a906e32062cc0635f4a480..6201accdf94dc243112b723d977c1ab5db41efd9 100644 --- a/pages/API/get-element-by-id/get-element-by-id.uvue +++ b/pages/API/get-element-by-id/get-element-by-id.uvue @@ -1,53 +1,59 @@ - - - + + +