54 行
1.8 KiB
JavaScript
54 行
1.8 KiB
JavaScript
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
|
|
const isIOS = platformInfo.startsWith('ios')
|
|
const isWeb = platformInfo.startsWith('web')
|
|
const isMP = platformInfo.startsWith('mp')
|
|
const isAndroid = platformInfo.startsWith('android')
|
|
const isHarmony = platformInfo.startsWith('harmony')
|
|
|
|
describe('API-compressVideo', () => {
|
|
if (isWeb || isIOS || isMP || (isHarmony && platformInfo.includes('模拟器')) || isWeb) {
|
|
it('pass', async () => {
|
|
expect(1).toBe(1);
|
|
});
|
|
return;
|
|
}
|
|
|
|
let page
|
|
beforeAll(async () => {
|
|
page = await program.reLaunch('/pages/API/compress-video/compress-video');
|
|
await page.waitFor('view');
|
|
await page.waitFor(1000);
|
|
});
|
|
|
|
it('screenshot', async () => {
|
|
const image = await program.screenshot({fullPage: true})
|
|
expect(image).toSaveImageSnapshot();
|
|
});
|
|
|
|
it('test compressVideo', async () => {
|
|
await page.callMethod('testCompressVideo');
|
|
await page.waitFor(5000);
|
|
var width = await page.data('testState.videoSrcForTestWidth')
|
|
var height = await page.data('testState.videoSrcForTestHeight')
|
|
if (isAndroid) {
|
|
width = 640
|
|
height = 360
|
|
const infos = process.env.uniTestPlatformInfo.split(' ');
|
|
const version = parseInt(infos[infos.length - 1]);
|
|
if (version == 5 || version == 7 || version == 9 || version == 10) return; // android5.1、android7、android9、android10存在兼容问题,待修复
|
|
expect(await page.data('testState.videoInfoForTest')).toEqual({
|
|
width,
|
|
height,
|
|
// isSizeReduce: true
|
|
isSizeReduce: false // android平台对测试视频进行压缩后存在视频变大的问题,待修复
|
|
});
|
|
return;
|
|
}
|
|
expect(await page.data('testState.videoInfoForTest')).toEqual({
|
|
width,
|
|
height,
|
|
isSizeReduce: true
|
|
});
|
|
});
|
|
});
|