~aleteoryx/muditaos

ref: aedd6a7a3697af9836c71d9c34f5109cdafba641 muditaos/test/service-desktop-test/tests/developerMode.py -rw-r--r-- 843 bytes
aedd6a7a — Bartosz Cichocki [EGD-4319] Added test harness API (#993) 5 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
# For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
from harness.interface.defs import endpoint, method, status

from test_api import *
import time


def sendKey(key_code):
    msg, result_msg = prepare_message(endpoint["developerMode"], method["put"], status["OK"],
                                      {"keyPressed": key_code}, None)
    test = Test(self.serial, msg, result_msg)
    test.execute()


class DeveloperModeTest:
    def __init__(self, serial):
        self.serial = serial.get_serial()

    def run(self):
        # unlock the phone
        sendKey(key_codes["enter"])
        time.sleep(1)
        sendKey(key_codes["#"])
        time.sleep(1)

        for i in range(4):
            sendKey(3)
            time.sleep(1.5)

        return True