diff --git a/pages/component/rich-text/rich-text-complex.test.js b/pages/component/rich-text/rich-text-complex.test.js new file mode 100644 index 0000000000000000000000000000000000000000..8c633e826b851a36a7e302214b7f2beb8dee81e7 --- /dev/null +++ b/pages/component/rich-text/rich-text-complex.test.js @@ -0,0 +1,72 @@ +const PAGE_PATH = '/pages/component/rich-text/rich-text-complex' + +describe('rich-text-test', () => { + + // 先屏蔽 android 及 web 平台 + if (process.env.uniTestPlatformInfo.startsWith('android') || process.env.uniTestPlatformInfo.startsWith('web')) { + it('other platform', () => { + expect(1).toBe(1) + }) + return + } + + let page + beforeAll(async () => { + page = await program.reLaunch(PAGE_PATH) + await page.waitFor(1500); + }) + + + it('click-event', async () => { + await program.tap({ + x: 210, + y: 280, + duration: 100 + }) + + await page.waitFor(1000); + const fViewClicked = await page.data('fViewClicked') + const selfClicked = await page.data('selfClicked') + expect(fViewClicked).toBe(true) + expect(selfClicked).toBe(true) + }) + + + it('itemclick-event', async () => { + await program.tap({ + x: 66, + y: 266, + duration: 100 + }) + + await page.waitFor(500); + + // 关闭弹窗逻辑各平台需要适配不同机型 + if (process.env.uniTestPlatformInfo.startsWith('IOS')) { + // 关闭弹窗 iPhone Pro 机型 + await program.tap({ + x: 200, + y: 433, + duration: 100 + }) + + // 关闭弹窗 iPhone ProMax 机型 + await program.tap({ + x: 220, + y: 476, + duration: 100 + }) + + // 关闭弹窗 iPhone mini 机型 + await program.tap({ + x: 186, + y: 400, + duration: 100 + }) + } + + const imageClicked = await page.data('imageClicked') + expect(imageClicked).toBe(true) + }) + +}) diff --git a/pages/component/rich-text/rich-text-complex.uvue b/pages/component/rich-text/rich-text-complex.uvue index 6e5b1c10db5e4501da6d91fbe9e2863709567ab9..2d802482315fb232e8cbb7f7f16daa9e65f8d2b4 100644 --- a/pages/component/rich-text/rich-text-complex.uvue +++ b/pages/component/rich-text/rich-text-complex.uvue @@ -4,8 +4,8 @@ - - + + @@ -17,6 +17,9 @@ export default { data() { return { + imageClicked: false, + fViewClicked: false, + selfClicked: false, htmlString: '

HBuilderX

HBuilderX,轻巧、极速,极客编辑器

HBuilderX,轻巧、极速,极客编辑器 HBuilderX,轻巧、极速,极客编辑器HBuilderX,轻巧、极速,极客编辑器HBuilderX,轻巧、极速,极客编辑器 HBuilderX,轻巧、极速,极客编辑器HBuilderX,轻巧、极速,极客编辑器

uni-app x,终极跨平台方案

uni-app x,终极跨平台方案 uni-app x,终极跨平台方案uni-appx,终极跨平台方案 uni-app x,终极跨平台方案 uni-app x,终极跨平台方案 uni-appx,终极跨平台方案

uniCloud,js serverless云服务

uniCloud,js serverless云服务 uniCloud,jsserverless云服务uniCloud,js serverless云服务 uniCloud,js serverless云服务 uniCloud,jsserverless云服务uniCloud,js serverless云服务

uts,大一统语言

uts,大一统语言 uts,大一统语言 uts,大一统语言uts,大一统语言uts,大一统语言 uts,大一统语言

uniMPSdk,让你的App具备小程序能力
uni-admin,开源、现成的全端管理后台
uni-app

' } }, @@ -26,6 +29,7 @@ let clicktext = ''; if (e.detail.src != null) { clicktext = '点击了图片,src = ' + e.detail.src; + this.imageClicked = true } else if (e.detail.href != null) { clicktext = '点击了链接,href = ' + e.detail.href; } @@ -34,9 +38,13 @@ showCancel:false }); }, - testClick(e:string) { - // 测试点击rich-text是否正常触发自身及父节点 click 事件 + fViewClick(e:string) { console.log(e) + this.fViewClicked = true + }, + selfClick(e:string) { + console.log(e) + this.selfClicked = true } } } diff --git a/pages/component/view/view.test.js b/pages/component/view/view.test.js new file mode 100644 index 0000000000000000000000000000000000000000..9f8756682cd4343b14213cb0b266fabde9dedcfd --- /dev/null +++ b/pages/component/view/view.test.js @@ -0,0 +1,45 @@ +const PAGE_PATH = '/pages/component/view/view' + +// 此用例仅用于模拟点击关闭iOS弹窗逻辑,无实际意义 +describe('view-test', () => { + + // 先屏蔽 android 及 web 平台 + if (process.env.uniTestPlatformInfo.startsWith('android') || process.env.uniTestPlatformInfo.startsWith('web')) { + it('other platform', () => { + expect(1).toBe(1) + }) + return + } + + let page + beforeAll(async () => { + page = await program.reLaunch(PAGE_PATH) + await page.waitFor(1000); + }) + + + it('itemclick-event', async () => { + // 关闭弹窗 iPhone Pro 机型 + await program.tap({ + x: 220, + y: 516, + duration: 100 + }) + + // 关闭弹窗 iPhone ProMax 机型 + await program.tap({ + x: 220, + y: 546, + duration: 100 + }) + + // 关闭弹窗 iPhone mini 机型 + await program.tap({ + x: 186, + y: 463, + duration: 100 + }) + expect(1).toBe(1) + }) + +}) diff --git a/testSequencer.js b/testSequencer.js index 262eb84cd0d4ef6bed40d4cb81a96c131db7bccf..4835bf8362a38cf7ab57e5cf7fbf521cfd531cb1 100644 --- a/testSequencer.js +++ b/testSequencer.js @@ -1,5 +1,6 @@ const Sequencer = require("@jest/test-sequencer").default const sortTestFilePaths = [ + "pages/component/view/view.test.js", "pages/API/pull-down-refresh/pull-down-refresh.test.js", "pages/component/global-events/global-events.test.js", "pages/component/list-view/list-view-refresh.test.js"