Skip to content

Commit 0c76e76

Browse files
Marek Niepiekloniepiekm
authored andcommitted
[CP-914] Update factory reset test
Moved the test out form pytest/service-desktop Improved test scenario to check for the onboarding screen Used Factory Reset API for Harness
1 parent 97f79cf commit 0c76e76

File tree

3 files changed

+36
-15
lines changed

3 files changed

+36
-15
lines changed

test/harness

test/pytest/service-desktop/test_factory_reset.py

Lines changed: 0 additions & 14 deletions
This file was deleted.

test/pytest/test_factory_reset.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
2+
# For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
3+
import pytest
4+
import time
5+
6+
from harness import log
7+
from harness.utils import Timeout
8+
from harness.interface.defs import status
9+
from harness.api.factory import FactoryReset
10+
from harness.rt_harness_discovery import get_harness_automatic
11+
12+
def phone_in_onboarding(harness):
13+
14+
# assert that we are in ApplicationOnBoarding
15+
log.debug("Assert that we are in ApplicationOnBoarding")
16+
assert harness.get_application_name() == "ApplicationOnBoarding"
17+
18+
@pytest.mark.rt1051
19+
@pytest.mark.usefixtures("phone_unlocked")
20+
def test_factory_reset(harness):
21+
ret = FactoryReset().run(harness)
22+
23+
assert ret.requestDone == True
24+
25+
try:
26+
with Timeout.limit(seconds=30):
27+
log.info("Please, power-cycle the DUT")
28+
harness.connection.watch_port_reboot(20)
29+
harness = get_harness_automatic(20)
30+
except Timeout as e:
31+
log.error("Factory reset timeout reached")
32+
33+
time.sleep(5) # wait for the DUT to be ready
34+
35+
phone_in_onboarding(harness)

0 commit comments

Comments
 (0)