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('videoSrcForTestWidth')
var height = await page.data('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;
expect(await page.data('videoInfoForTest')).toEqual({
width,
height,
isSizeReduce: false
});
return;
}
expect(await page.data('videoInfoForTest')).toEqual({
width,
height,
isSizeReduce: true
});
});
});