提交 d40c0162 编写于 作者: H hdx

nodes-info-test: 调整部分自动化测试仅在App平台生效

上级 9dbc5d86
const PAGE_PATH = '/pages/API/nodes-info/nodes-info' const PAGE_PATH = '/pages/API/nodes-info/nodes-info'
const RECT_LEFT = 15; const RECT_LEFT = 15;
const RECT_WIDTH = 150; const RECT_WIDTH = 150;
const RECT_HEIGHT = 100; const RECT_HEIGHT = 100;
describe('nodes-info', () => { describe('nodes-info', () => {
...@@ -16,12 +16,12 @@ describe('nodes-info', () => { ...@@ -16,12 +16,12 @@ describe('nodes-info', () => {
await btnGetNodeInfo.tap() await btnGetNodeInfo.tap()
await page.waitFor(50) await page.waitFor(50)
const data = await page.data() const data = await page.data()
// TODO 和浏览器的计算存在差异 // TODO 和浏览器的计算存在差异
const nodeInfo = data.nodeInfoList[0] const nodeInfo = data.nodeInfoList[0]
expect(Math.round(nodeInfo.left)).toBe(RECT_LEFT) expect(Math.round(nodeInfo.left)).toBe(RECT_LEFT)
expect(Math.round(nodeInfo.width)).toBe(RECT_WIDTH) expect(Math.round(nodeInfo.width)).toBe(RECT_WIDTH)
expect(Math.round(nodeInfo.height)).toBe(RECT_HEIGHT) expect(Math.round(nodeInfo.height)).toBe(RECT_HEIGHT)
}) })
it('get-all-node-info', async () => { it('get-all-node-info', async () => {
...@@ -32,22 +32,25 @@ describe('nodes-info', () => { ...@@ -32,22 +32,25 @@ describe('nodes-info', () => {
const data = await page.data() const data = await page.data()
const nodeInfo1 = data.nodeInfoList[0] const nodeInfo1 = data.nodeInfoList[0]
expect(Math.round(nodeInfo1.left)).toBe(RECT_LEFT) expect(Math.round(nodeInfo1.left)).toBe(RECT_LEFT)
expect(nodeInfo1.top > 220).toBe(true) expect(nodeInfo1.top > 220).toBe(true)
expect(Math.round(nodeInfo1.width)).toBe(RECT_WIDTH) expect(Math.round(nodeInfo1.width)).toBe(RECT_WIDTH)
expect(Math.round(nodeInfo1.height)).toBe(RECT_HEIGHT) expect(Math.round(nodeInfo1.height)).toBe(RECT_HEIGHT)
const nodeInfo2 = data.nodeInfoList[1] const nodeInfo2 = data.nodeInfoList[1]
expect(nodeInfo2.left > 180).toBe(true) expect(nodeInfo2.left > 180).toBe(true)
expect(nodeInfo2.top > 220).toBe(true) expect(nodeInfo2.top > 220).toBe(true)
expect(Math.round(nodeInfo2.width)).toBe(RECT_WIDTH) expect(Math.round(nodeInfo2.width)).toBe(RECT_WIDTH)
expect(Math.round(nodeInfo2.height)).toBe(RECT_HEIGHT) expect(Math.round(nodeInfo2.height)).toBe(RECT_HEIGHT)
})
//检测onResize获取BoundingClientRect信息是否有效
it('check_resizeRectValid', async () => {
const resizeRectValid = await page.data('resizeRectValid')
expect(resizeRectValid).toBe(true)
}) })
// #ifdef APP
//检测onResize获取BoundingClientRect信息是否有效
it('check_resizeRectValid', async () => {
const resizeRectValid = await page.data('resizeRectValid')
expect(resizeRectValid).toBe(true)
})
// #endif
}) })
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册