1import logging
2import time
3
4import pytest
5
6
7class Test:
8    camera_ability_name = 'com.ohos.camera.MainAbility'
9    camera_bundle_name = 'com.ohos.camera'
10    photo_ability_name = 'com.ohos.photos.MainAbility'
11    photo_bundle_name = 'com.ohos.photos'
12
13    @pytest.mark.parametrize('setup_teardown', [camera_bundle_name], indirect=True)
14    def test(self, setup_teardown, device):
15        logging.info('sart camera app')
16        device.start_ability(self.camera_bundle_name, self.camera_ability_name)
17        device.save_snapshot_to_local('{}_camera_step1.jpeg'.format(device.sn))
18
19        logging.info('click shot button')
20        device.click(360, 1095)
21        time.sleep(2)
22        device.save_snapshot_to_local('{}_camera_step2.jpeg'.format(device.sn))
23
24        logging.info('switch to record mode')
25        device.click(430, 980)
26        time.sleep(2)
27        device.save_snapshot_to_local('{}_camera_step3.jpeg'.format(device.sn))
28
29        logging.info('click shot button')
30        device.click(360, 1095)
31        time.sleep(5)
32        device.save_snapshot_to_local('{}_camera_step4.jpeg'.format(device.sn))
33
34        logging.info('stop recoding')
35        device.hdc_shell(f'uitest uiInput click 320 1095')
36        time.sleep(3)
37        device.save_snapshot_to_local('{}_camera_step5.jpeg'.format(device.sn))
38
39        logging.info('click left behind button in order to switch to gallery app')
40        device.click(200, 1095)
41        time.sleep(5)
42        device.save_snapshot_to_local('{}_camera_step6.jpeg'.format(device.sn))
43        device.assert_process_running(self.photo_bundle_name)
44