forked from LedgerHQ/app-monero
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_settings.py
More file actions
148 lines (141 loc) · 6.92 KB
/
test_settings.py
File metadata and controls
148 lines (141 loc) · 6.92 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
"""Verifies settings and information navigation
"""
from pathlib import Path
from ledgered.devices import Device, DeviceType
from ragger.firmware.touch.positions import POSITIONS
from ragger.navigator import Navigator, NavInsID, NavIns
TESTS_ROOT_DIR = Path(__file__).parent
def _get_settings_element_coordinates(device: Device, number):
return POSITIONS["ChoiceList"][device.type][number + 1]
def test_settings(navigator: Navigator, device: Device, test_name: str):
"""Verifies settings navigation
"""
instructions = []
if device.touchable:
instructions = [
# 0 (Main page)->Settings button = Page 1
NavInsID.USE_CASE_HOME_SETTINGS,
# 1 (Page 1)->Select Account = Select account
NavIns(NavInsID.TOUCH, _get_settings_element_coordinates(device, 0)),
# 2 (Select account)->Selecting account 2 = Page 1
NavIns(NavInsID.TOUCH, _get_settings_element_coordinates(device, 2)),
# 3 (Page 1)-> Select Account = Select account
NavIns(NavInsID.TOUCH, _get_settings_element_coordinates(device, 0)),
# 4 (Select account)-> Back = Page 1
NavInsID.USE_CASE_SETTINGS_SINGLE_PAGE_EXIT,
#5 (Page 1)-> Select Network = Select network
NavIns(NavInsID.TOUCH, _get_settings_element_coordinates(device, 1)),
#6 (Select network)-> Test network = Page 1
NavIns(NavInsID.TOUCH, _get_settings_element_coordinates(device, 2)),
#7 (Page 1)-> Select Network = Select network
NavIns(NavInsID.TOUCH, _get_settings_element_coordinates(device, 1)),
# 8 (Select account)-> Back = Page 1
NavInsID.USE_CASE_SETTINGS_SINGLE_PAGE_EXIT,
#9 (Page 1)-> Reset = Confirmation
NavIns(NavInsID.TOUCH, _get_settings_element_coordinates(device, 2)),
#10 (Confirmation)-> Reset = Text, Main page
NavInsID.USE_CASE_CHOICE_CONFIRM,
#11 (Main page)
NavInsID.WAIT_FOR_HOME_SCREEN,
# 12 (Main page)->Settings button = Page 1
NavInsID.USE_CASE_HOME_SETTINGS,
# 13 (Page 1)->Select Account = Select account
NavIns(NavInsID.TOUCH, _get_settings_element_coordinates(device, 0)),
# 14 (Select account)-> Back = Page 1
NavInsID.USE_CASE_SETTINGS_SINGLE_PAGE_EXIT,
#15 (Page 1)-> Select Network = Select network
NavIns(NavInsID.TOUCH, _get_settings_element_coordinates(device, 1)),
# 16 (Select account)-> Back = Page 1
NavInsID.USE_CASE_SETTINGS_SINGLE_PAGE_EXIT,
]
elif device.is_nano:
instructions = [
# Setting Account 2
NavInsID.RIGHT_CLICK, # = Settings HL
NavInsID.BOTH_CLICK, # = Settings LL
NavInsID.BOTH_CLICK, # = Select Account (0+)
NavInsID.RIGHT_CLICK, # = 1
NavInsID.RIGHT_CLICK, # = 2
NavInsID.BOTH_CLICK, # = Main page
# Verification Account 2
NavInsID.RIGHT_CLICK, # = Settings HL
NavInsID.BOTH_CLICK, # = Settings LL
NavInsID.BOTH_CLICK, # = Select Account (0, 2+)
NavInsID.RIGHT_CLICK, # = 1, 2+
NavInsID.RIGHT_CLICK, # = 2, 2+
NavInsID.RIGHT_CLICK, # = 3, 2+
NavInsID.RIGHT_CLICK, # = 4, 2+
NavInsID.RIGHT_CLICK, # = 5, 2+
NavInsID.RIGHT_CLICK, # = 6, 2+
NavInsID.RIGHT_CLICK, # = 7, 2+
NavInsID.RIGHT_CLICK, # = 8, 2+
NavInsID.RIGHT_CLICK, # = 9, 2+
NavInsID.RIGHT_CLICK, # = Abort, 2+
NavInsID.BOTH_CLICK, # = Main page
# Setting "Test Network"
NavInsID.RIGHT_CLICK, # = Settings HL
NavInsID.BOTH_CLICK, # = Settings LL
NavInsID.RIGHT_CLICK, # = Select Network
NavInsID.BOTH_CLICK, # = Select Network (Main Network, Stage Network+)
NavInsID.RIGHT_CLICK, # = Select Network (Stage Network, Stage Network+)
NavInsID.RIGHT_CLICK, # = Select Network (Test Network, Stage Network+)
NavInsID.BOTH_CLICK, # = Main page
# Verification "Test Network"
NavInsID.RIGHT_CLICK, # = Settings HL
NavInsID.BOTH_CLICK, # = Settings LL
NavInsID.RIGHT_CLICK, # = Select Network
NavInsID.BOTH_CLICK, # = Select Network (Main Network, Test Network+)
NavInsID.RIGHT_CLICK, # = Select Network (Stage Network, Test Network+)
NavInsID.RIGHT_CLICK, # = Select Network (Test Network, Test Network+)
NavInsID.RIGHT_CLICK, # = Select Network (Abort, Test Network+)
NavInsID.BOTH_CLICK, # = Main page
# Reset settings
NavInsID.RIGHT_CLICK, # = Settings HL
NavInsID.BOTH_CLICK, # = Settings LL
NavInsID.RIGHT_CLICK, # = Select Network
NavInsID.RIGHT_CLICK, # = Show 25 words
NavInsID.RIGHT_CLICK, # = Reset
NavInsID.BOTH_CLICK, # = Really reset
NavInsID.RIGHT_CLICK, # = No
NavInsID.RIGHT_CLICK, # = Yes
NavInsID.BOTH_CLICK, # = Main page
# Verification Account 0
NavInsID.RIGHT_CLICK, # = Settings HL
NavInsID.BOTH_CLICK, # = Settings LL
NavInsID.BOTH_CLICK, # = Select Account (0, 0+)
NavInsID.BOTH_CLICK, # = Main page
# Verification "Stage Network"
NavInsID.RIGHT_CLICK, # = Settings HL
NavInsID.BOTH_CLICK, # = Settings LL
NavInsID.RIGHT_CLICK, # = Select Network
NavInsID.BOTH_CLICK, # = Select Network (Main Network, Stage Network+)
]
navigator.navigate_and_compare(TESTS_ROOT_DIR,
test_name,
instructions,
screen_change_before_first_instruction = False)
def test_info(navigator: Navigator, device: Device, test_name: str):
"""Verifies info navigation
"""
instructions = []
if device.touchable:
instructions = [
# 0 (main page) -> Settings button = Page 1
NavInsID.USE_CASE_HOME_SETTINGS,
# 1 (Page 1) -> Right = Info 1
NavInsID.SWIPE_CENTER_TO_LEFT,
# 2 (Info 1) -> Right = Info 2
NavInsID.SWIPE_CENTER_TO_LEFT,
]
elif device.is_nano:
instructions = [
NavInsID.RIGHT_CLICK, # = Settings
NavInsID.RIGHT_CLICK, # = About
NavInsID.BOTH_CLICK, # = About Info
NavInsID.RIGHT_CLICK, # = Back
NavInsID.BOTH_CLICK, # = Main page
]
navigator.navigate_and_compare(TESTS_ROOT_DIR,
test_name,
instructions,
screen_change_before_first_instruction = False)