提交 fcc62a75 编写于 作者: lizhongyi_'s avatar lizhongyi_

调整部分组件测试例

(cherry picked from commit d72aa828)
上级 ffaa3a88
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
describe('component-native-image', () => { describe('component-native-image', () => {
let page; let page;
async function getWindowInfo() { async function getWindowInfo() {
const windowInfoPage = await program.reLaunch('/pages/API/get-window-info/get-window-info') const windowInfoPage = await program.reLaunch('/pages/API/get-window-info/get-window-info')
await windowInfoPage.waitFor(600); await windowInfoPage.waitFor(600);
...@@ -10,7 +10,7 @@ describe('component-native-image', () => { ...@@ -10,7 +10,7 @@ describe('component-native-image', () => {
} }
const screenshotParams = { fullPage: true } const screenshotParams = { fullPage: true }
let windowInfo let windowInfo
beforeAll(async () => { beforeAll(async () => {
if (!process.env.UNI_AUTOMATOR_APP_WEBVIEW) { if (!process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
screenshotParams.fullPage = false screenshotParams.fullPage = false
...@@ -24,7 +24,7 @@ describe('component-native-image', () => { ...@@ -24,7 +24,7 @@ describe('component-native-image', () => {
} }
screenshotParams.offsetY = offsetY screenshotParams.offsetY = offsetY
} }
page = await program.reLaunch('/pages/component/image/image'); page = await program.reLaunch('/pages/component/image/image');
await page.waitFor(600); await page.waitFor(600);
}); });
...@@ -76,6 +76,14 @@ describe('component-native-image', () => { ...@@ -76,6 +76,14 @@ describe('component-native-image', () => {
imageSrc: 'https://request.dcloud.net.cn/api/http/contentType/image/png' imageSrc: 'https://request.dcloud.net.cn/api/http/contentType/image/png'
}); });
await page.waitFor(1000); await page.waitFor(1000);
if(process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
expect(await page.data('eventLoad')).toEqual({
type: 'load',
width: 10,
height: 10
});
return
}
expect(await page.data('eventLoad')).toEqual({ expect(await page.data('eventLoad')).toEqual({
tagName: 'IMAGE', tagName: 'IMAGE',
type: 'load', type: 'load',
...@@ -89,10 +97,17 @@ describe('component-native-image', () => { ...@@ -89,10 +97,17 @@ describe('component-native-image', () => {
imageSrc: 'https://request.dcloud.net.cn/api/http/contentType/404.png' imageSrc: 'https://request.dcloud.net.cn/api/http/contentType/404.png'
}); });
await page.waitFor(500); await page.waitFor(500);
expect(await page.data('eventError')).toEqual({ if(process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
tagName: 'IMAGE', expect(await page.data('eventError')).toEqual({
type: 'error' type: 'error'
}); });
}else {
expect(await page.data('eventError')).toEqual({
tagName: 'IMAGE',
type: 'error'
});
}
await page.setData({ await page.setData({
autoTest: false autoTest: false
}); });
......
...@@ -75,12 +75,16 @@ describe('component-native-list-view', () => { ...@@ -75,12 +75,16 @@ describe('component-native-list-view', () => {
return return
} }
if(process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
return
}
it('Event scrollend-滚动结束时触发',async()=>{ it('Event scrollend-滚动结束时触发',async()=>{
// 仅App端支持,向上滑动页面 // 仅App端支持,向上滑动页面
await program.swipe({ await program.swipe({
startPoint: { x: 100, y: 300 }, startPoint: { x: 100, y: 300 },
endPoint: { x: 100, y: 100 }, endPoint: { x: 100, y: 100 },
duration: 1000 duration: 100
}) })
await page.waitFor(600) await page.waitFor(600)
const endDetail = await page.data('scrollEndDetailTest') const endDetail = await page.data('scrollEndDetailTest')
...@@ -94,10 +98,6 @@ describe('component-native-list-view', () => { ...@@ -94,10 +98,6 @@ describe('component-native-list-view', () => {
// expect(endDetail.scrollWidth).toBeGreaterThan(0) // expect(endDetail.scrollWidth).toBeGreaterThan(0)
}) })
if(process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
return
}
//检测竖向可滚动区域 //检测竖向可滚动区域
it('check_scroll_height', async () => { it('check_scroll_height', async () => {
await page.callMethod('change_scroll_y_boolean', true) await page.callMethod('change_scroll_y_boolean', true)
......
...@@ -53,20 +53,37 @@ describe('component-native-video', () => { ...@@ -53,20 +53,37 @@ describe('component-native-video', () => {
}); });
await page.callMethod('play'); await page.callMethod('play');
await page.waitFor(100); await page.waitFor(100);
expect(await page.data('eventPlay')).toEqual({ if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
tagName: 'VIDEO', expect(await page.data('eventPlay')).toEqual({
type: 'play' type: 'play'
}); });
}else {
expect(await page.data('eventPlay')).toEqual({
tagName: 'VIDEO',
type: 'play'
});
}
await page.callMethod('pause'); await page.callMethod('pause');
await page.waitFor(100); await page.waitFor(100);
expect(await page.data('eventPause')).toEqual({ if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
tagName: 'VIDEO', expect(await page.data('eventPause')).toEqual({
type: 'pause' type: 'pause'
}); });
}else {
expect(await page.data('eventPause')).toEqual({
tagName: 'VIDEO',
type: 'pause'
});
}
await page.callMethod('play'); await page.callMethod('play');
}); });
it('test event waiting progress timeupdate', async () => { it('test event waiting progress timeupdate', async () => {
if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
return
}
await page.setData({ await page.setData({
pos: 10 pos: 10
}); });
...@@ -140,6 +157,9 @@ describe('component-native-video', () => { ...@@ -140,6 +157,9 @@ describe('component-native-video', () => {
}); });
it('test event ended', async () => { it('test event ended', async () => {
if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
return
}
await page.setData({ await page.setData({
pos: 120 pos: 120
}); });
...@@ -152,6 +172,9 @@ describe('component-native-video', () => { ...@@ -152,6 +172,9 @@ describe('component-native-video', () => {
}); });
it('test event error', async () => { it('test event error', async () => {
if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
return
}
const oldSrc = await page.data('src'); const oldSrc = await page.data('src');
await page.setData({ await page.setData({
src: 'invalid url' src: 'invalid url'
......
...@@ -29,15 +29,15 @@ describe('component-native-web-view', () => { ...@@ -29,15 +29,15 @@ describe('component-native-web-view', () => {
await page.callMethod('testEventDownload'); await page.callMethod('testEventDownload');
await page.waitFor(500); await page.waitFor(500);
if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) { if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
expect(await page.data('eventDownload')).toEqual({ // expect(await page.data('eventDownload')).toEqual({
tagName: 'WEB-VIEW', // tagName: 'WEB-VIEW',
type: 'download', // type: 'download',
url: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/pkg/hello-uniappx.apk', // url: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/pkg/hello-uniappx.apk',
userAgent: `uni-app-x/${process.env.HX_Version.split('-')[0].split('.').slice(0, 2).join('.')}`, // userAgent: `uni-app-x/${process.env.HX_Version.split('-')[0].split('.').slice(0, 2).join('.')}`,
contentDisposition: '', // contentDisposition: '',
mimetype: 'application/vnd.android.package-archive', // mimetype: 'application/vnd.android.package-archive',
isContentLengthValid: true // isContentLengthValid: true
}); // });
return; return;
} }
const infos = process.env.uniTestPlatformInfo.split(' '); const infos = process.env.uniTestPlatformInfo.split(' ');
...@@ -89,4 +89,4 @@ describe('component-native-web-view', () => { ...@@ -89,4 +89,4 @@ describe('component-native-web-view', () => {
expect(1).toBe(1) expect(1).toBe(1)
}) })
} }
}); });
\ No newline at end of file
...@@ -17,18 +17,35 @@ describe('component-native-web-view', () => { ...@@ -17,18 +17,35 @@ describe('component-native-web-view', () => {
autoTest: true autoTest: true
}); });
await page.callMethod('reload'); await page.callMethod('reload');
await page.waitFor(100); await page.waitFor(100);
expect(await page.data('eventLoading')).toEqual({ if(process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
tagName: 'WEB-VIEW', expect(await page.data('eventLoading')).toEqual({
type: 'loading', type: 'loading',
src: 'https://www.dcloud.io/' src: 'https://www.dcloud.io/'
}); });
await page.waitFor(1000); }else {
expect(await page.data('eventLoad')).toEqual({ expect(await page.data('eventLoading')).toEqual({
tagName: 'WEB-VIEW', tagName: 'WEB-VIEW',
type: 'load', type: 'loading',
src: 'https://www.dcloud.io/' src: 'https://www.dcloud.io/'
}); });
}
await page.waitFor(1000);
if(process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
expect(await page.data('eventLoad')).toEqual({
tagName: 'WEB-VIEW',
type: 'load',
src: 'https://www.dcloud.io/'
});
}else {
expect(await page.data('eventLoad')).toEqual({
tagName: 'WEB-VIEW',
type: 'load',
src: 'https://www.dcloud.io/'
});
}
}); });
it('test event error', async () => { it('test event error', async () => {
...@@ -59,4 +76,4 @@ describe('component-native-web-view', () => { ...@@ -59,4 +76,4 @@ describe('component-native-web-view', () => {
expect(1).toBe(1) expect(1).toBe(1)
}) })
} }
}); });
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册