提交 ba199899 编写于 作者: DCloud-yinjiacheng's avatar DCloud-yinjiacheng

更新image、video、web-view自动化测试用例

上级 af20178c
......@@ -75,9 +75,7 @@ describe('component-native-image', () => {
autoTest: true,
imageSrc: 'https://request.dcloud.net.cn/api/http/contentType/image/png'
});
await page.waitFor(async () => {
return await page.data('eventLoad');
});
await page.waitFor(300);
expect(await page.data('eventLoad')).toEqual({
tagName: 'IMAGE',
type: 'load',
......@@ -90,9 +88,7 @@ describe('component-native-image', () => {
await page.setData({
imageSrc: 'https://request.dcloud.net.cn/api/http/contentType/404.png'
});
await page.waitFor(async () => {
return await page.data('eventError');
});
await page.waitFor(300);
expect(await page.data('eventError')).toEqual({
tagName: 'IMAGE',
type: 'error'
......
......@@ -52,17 +52,13 @@ describe('component-native-video', () => {
autoTest: true
});
await page.callMethod('play');
await page.waitFor(async () => {
return await page.data('eventPlay');
});
await page.waitFor(100);
expect(await page.data('eventPlay')).toEqual({
tagName: 'VIDEO',
type: 'play'
});
await page.callMethod('pause');
await page.waitFor(async () => {
return await page.data('eventPause');
});
await page.waitFor(100);
expect(await page.data('eventPause')).toEqual({
tagName: 'VIDEO',
type: 'pause'
......@@ -75,38 +71,36 @@ describe('component-native-video', () => {
pos: 10
});
await page.callMethod('seek');
await page.waitFor(async () => {
return await page.data('eventWaiting');
});
await page.waitFor(100);
expect(await page.data('eventWaiting')).toEqual({
tagName: 'VIDEO',
type: 'waiting'
});
await page.waitFor(async () => {
return await page.data('eventProgress');
});
await page.waitFor(200);
expect(await page.data('eventProgress')).toEqual({
tagName: 'VIDEO',
type: 'progress',
buffered: 100
isBufferedValid: true
});
await page.waitFor(250);
const infos = process.env.uniTestPlatformInfo.split(' ');
const version = parseInt(infos[infos.length - 1]);
if (process.env.uniTestPlatformInfo.startsWith('android') && version > 5) {
await page.waitFor(200);
expect(await page.data('eventTimeupdate')).toEqual({
tagName: 'VIDEO',
type: 'timeupdate',
currentTime: 10,
duration: 121
});
}
});
it('test event fullscreenchange fullscreenclick controlstoggle', async () => {
if (process.env.uniTestPlatformInfo.startsWith('ios')) {
if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
return;
}
await page.callMethod('requestFullScreen');
await page.waitFor(async () => {
return await page.data('eventFullscreenchange');
});
await page.waitFor(500);
expect(await page.data('eventFullscreenchange')).toEqual({
tagName: 'VIDEO',
type: 'fullscreenchange',
......@@ -144,9 +138,7 @@ describe('component-native-video', () => {
pos: 120
});
await page.callMethod('seek');
await page.waitFor(async () => {
return await page.data('eventEnded');
});
await page.waitFor(2500);
expect(await page.data('eventEnded')).toEqual({
tagName: 'VIDEO',
type: 'ended'
......@@ -158,9 +150,7 @@ describe('component-native-video', () => {
await page.setData({
src: 'invalid url'
});
await page.waitFor(async () => {
return await page.data('eventError');
});
await page.waitFor(300);
expect(await page.data('eventError')).toEqual({
tagName: 'VIDEO',
type: 'error',
......
......@@ -447,7 +447,7 @@
this.eventProgress = {
"tagName": res.target?.tagName,
"type": res.type,
"buffered": res.detail.buffered
"isBufferedValid": res.detail.buffered > 0
};
}
},
......
......@@ -27,10 +27,8 @@ describe('component-native-web-view', () => {
autoTest: true
});
await page.callMethod('testEventDownload');
await page.waitFor(async () => {
return await page.data('eventDownload');
});
if (process.env.uniTestPlatformInfo.startsWith('ios')) {
await page.waitFor(500);
if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
expect(await page.data('eventDownload')).toEqual({
tagName: 'WEB-VIEW',
type: 'download',
......@@ -54,7 +52,7 @@ describe('component-native-web-view', () => {
mimetype: 'application/vnd.android.package-archive',
isContentLengthValid: true
});
} else { // 低版本webview内核,部分属性无有效值
} else if (version > 6) { // 低版本webview内核,部分属性无有效值
expect(await page.data('eventDownload')).toEqual({
tagName: 'WEB-VIEW',
type: 'download',
......@@ -68,10 +66,11 @@ describe('component-native-web-view', () => {
});
it('test event message', async () => {
const infos = process.env.uniTestPlatformInfo.split(' ');
const version = parseInt(infos[infos.length - 1]);
if (process.env.uniTestPlatformInfo.startsWith('android') && version > 6) {
await page.callMethod('testEventMessage');
await page.waitFor(async () => {
return await page.data('eventMessage');
});
await page.waitFor(200);
expect(await page.data('eventMessage')).toEqual({
tagName: 'WEB-VIEW',
type: 'message',
......@@ -79,6 +78,7 @@ describe('component-native-web-view', () => {
action: 'message'
}]
});
}
await page.setData({
autoTest: false
});
......
......@@ -17,17 +17,13 @@ describe('component-native-web-view', () => {
autoTest: true
});
await page.callMethod('reload');
await page.waitFor(async () => {
return await page.data('eventLoading');
});
await page.waitFor(100);
expect(await page.data('eventLoading')).toEqual({
tagName: 'WEB-VIEW',
type: 'loading',
src: 'https://www.dcloud.io/'
});
await page.waitFor(async () => {
return await page.data('eventLoad');
});
await page.waitFor(1000);
expect(await page.data('eventLoad')).toEqual({
tagName: 'WEB-VIEW',
type: 'load',
......@@ -36,12 +32,13 @@ describe('component-native-web-view', () => {
});
it('test event error', async () => {
const infos = process.env.uniTestPlatformInfo.split(' ');
const version = parseInt(infos[infos.length - 1]);
if (process.env.uniTestPlatformInfo.startsWith('android') && version > 5) {
await page.setData({
src: 'https://www.dclou.io/uni-app-x'
});
await page.waitFor(async () => {
return await page.data('eventError');
});
await page.waitFor(500);
expect(await page.data('eventError')).toEqual({
tagName: 'WEB-VIEW',
type: 'error',
......@@ -51,6 +48,7 @@ describe('component-native-web-view', () => {
fullUrl: 'https://www.dclou.io/uni-app-x',
src: 'https://www.dclou.io/uni-app-x'
});
}
await page.setData({
autoTest: false
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册