1/* 2* Copyright (C) 2023 Huawei Device Co., Ltd. 3* Licensed under the Apache License, Version 2.0 (the "License"); 4* you may not use this file except in compliance with the License. 5* You may obtain a copy of the License at 6* 7* http://www.apache.org/licenses/LICENSE-2.0 8* 9* Unless required by applicable law or agreed to in writing, software 10* distributed under the License is distributed on an "AS IS" BASIS, 11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12* See the License for the specific language governing permissions and 13* limitations under the License. 14*/ 15 16import hilog from '@ohos.hilog'; 17import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; 18import {Driver, ON, MatchPattern} from '@ohos.UiTest'; 19import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry' 20 21const TAG: string = 'VideoPlayer'; 22const abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); 23const BUNDLE = 'VideoPlayer_'; 24 25export default function abilityTest() { 26 27 describe('ActsAbilityTest', () => { 28 29 /** 30 * open_sample 31 */ 32 it(BUNDLE +'StartAbility_001', 0, async (done: Function) => { 33 hilog.info(0x0, TAG, 'StartAbility_001 start'); 34 await abilityDelegator.startAbility({ 35 bundleName: 'com.samples.videoplayer', 36 abilityName: 'EntryAbility' 37 }) 38 hilog.info(0x0, TAG, 'StartAbility_001 end'); 39 done(); 40 }) 41 42 /** 43 * music_last 44 */ 45 it(BUNDLE + 'music_last', 0, async (done: Function) => { 46 hilog.info(0x0, TAG, 'music_last start'); 47 let driver = await Driver.create(); 48 await driver.delayMs(1000); 49 await driver.assertComponentExist(ON.id('music_last')); 50 let lastButton = await driver.findComponent(ON.id('music_last')); 51 await lastButton.click(); 52 await driver.delayMs(1000); 53 54 await driver.assertComponentExist(ON.id('music_play_or_pause')); 55 let playOrPause = await driver.findComponent(ON.id('music_play_or_pause')); 56 await playOrPause.click(); 57 await driver.delayMs(1000); 58 await playOrPause.click(); 59 await driver.delayMs(1000); 60 61 await driver.assertComponentExist(ON.id('music_next')); 62 let nextButton = await driver.findComponent(ON.id('music_next')); 63 await nextButton.click(); 64 await driver.delayMs(1000); 65 hilog.info(0x0, TAG, 'music_last end'); 66 done(); 67 }) 68 }) 69}