Skip to content

Commit 39a5c9c

Browse files
committed
Add test case for myaddress, showing QR code and Send message from send button
1 parent 54e7687 commit 39a5c9c

File tree

2 files changed

+142
-1
lines changed

2 files changed

+142
-1
lines changed

src/bitmessagekivy/baseclass/myaddress.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def update_addressBook_on_scroll(self, my_addresses):
161161

162162
def myadd_detail(self, fromaddress, label, *args):
163163
"""Load myaddresses details"""
164-
if config.get(fromaddress, 'enabled'):
164+
if config.getboolean(fromaddress, 'enabled'):
165165
obj = MyaddDetailPopup()
166166
self.address_label = obj.address_label = label
167167
self.text_address = obj.address = fromaddress
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
from .telenium_process import TeleniumTestProcess
2+
from .common import ordered
3+
4+
5+
data = [
6+
'BM-2cWmjntZ47WKEUtocrdvs19y5CivpKoi1h',
7+
'BM-2cVpswZo8rWLXDVtZEUNcDQvnvHJ6TLRYr'
8+
]
9+
10+
11+
class MyAddressScreen(TeleniumTestProcess):
12+
"""MyAddress Screen Functionality Testing"""
13+
@ordered
14+
def test_myaddress_screen(self):
15+
"""Open MyAddress Screen"""
16+
# Checking current Screen(Inbox screen)
17+
self.assert_wait_no_except('//ScreenManager[@current]', timeout=15, value='inbox')
18+
# Method to open side navbar
19+
self.open_side_navbar()
20+
# this is for scrolling Nav drawer
21+
self.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]")
22+
# assert for checking scroll function
23+
self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=10)
24+
# Checking My address label on side nav bar
25+
self.assertExists('//NavigationItem[@text=\"My addresses\"]', timeout=5)
26+
# this is for opening setting screen
27+
self.cli.wait_click('//NavigationItem[@text=\"My addresses\"]', timeout=5)
28+
# Checking current screen
29+
self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=5)
30+
31+
@ordered
32+
def test_disable_address(self):
33+
"""Disable Addresses"""
34+
# Dragging for loading addreses
35+
self.drag(
36+
'//MyAddress//MDList[0]/CustomTwoLineAvatarIconListItem[@text=\"test2\"]',
37+
'//MyAddress//MDList[0]/CustomTwoLineAvatarIconListItem[@text=\"test1\"]'
38+
)
39+
# Checking list of Addresses
40+
self.assertExists("//MyAddress//CustomTwoLineAvatarIconListItem", timeout=5)
41+
# Checking the Toggle button is rendered on addresses
42+
self.assertExists("//MyAddress//CustomTwoLineAvatarIconListItem//ToggleBtn", timeout=5)
43+
# Clicking on the Toggle button of first address to make it disable
44+
self.assertExists(
45+
"//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test2\"]//ToggleBtn[@active=true]",
46+
timeout=5
47+
)
48+
# Clicking on Toggle button of first address
49+
self.cli.wait_click(
50+
"//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test2\"]//ToggleBtn/Thumb",
51+
timeout=5
52+
)
53+
# Checking the address is disabled
54+
self.assertExists(
55+
"//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test2\"]//ToggleBtn[@active=false]",
56+
timeout=5
57+
)
58+
# CLICKING ON DISABLE ACCOUNT TO OPEN POPUP
59+
self.cli.wait_click("//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test2\"]", timeout=5)
60+
# Checking the popup is Opened
61+
self.assertExists(
62+
'//MDDialog[@text=\"Address is not currently active. Please click on Toggle button to active it.\"]',
63+
timeout=5
64+
)
65+
# Clicking on 'Ok' Button To Dismiss the popup
66+
self.cli.wait_click('//MDFlatButton[@text=\"Ok\"]', timeout=5)
67+
# Clicking on toggle button to enable the address
68+
self.cli.wait_click(
69+
"//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test2\"]//ToggleBtn/Thumb",
70+
timeout=5
71+
)
72+
# Checking the address is enabled
73+
self.assertExists(
74+
"//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test2\"]//ToggleBtn[@active=true]",
75+
timeout=5
76+
)
77+
# Checking the current screen is MyAddress
78+
self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=5)
79+
80+
@ordered
81+
def test_show_Qrcode(self):
82+
"""Show the Qr code of selected address"""
83+
# Checking labels from addresss list
84+
first_label = self.cli.getattr('//MyAddress//MDList[0]/CustomTwoLineAvatarIconListItem[1][@text]', 'text')
85+
second_label = self.cli.getattr('//MyAddress//MDList[0]/CustomTwoLineAvatarIconListItem[0][@text]', 'text')
86+
# Checking first label
87+
self.assertEqual(first_label, 'test1')
88+
# Checking second label
89+
self.assertEqual(second_label, 'test2')
90+
# Click on Address to open popup
91+
self.cli.wait_click('//MDList[0]/CustomTwoLineAvatarIconListItem[@text=\"test1\"]', timeout=5)
92+
# Check the Popup is opened
93+
self.assertExists('//MyaddDetailPopup//MDLabel[@text=\"Show QR code\"]', timeout=5)
94+
# Cick on 'Show QR code' button to view QR Code
95+
self.cli.wait_click('//MyaddDetailPopup//MDLabel[@text=\"Show QR code\"]')
96+
# Check Current screen is QR Code screen
97+
self.assertExists("//ShowQRCode[@name~=\"showqrcode\"]", timeout=2)
98+
# Check BACK button
99+
self.assertExists('//ActionTopAppBarButton[@icon~=\"arrow-left\"]', timeout=5)
100+
# Click on BACK button
101+
self.cli.wait_click('//ActionTopAppBarButton[@icon~=\"arrow-left\"]', timeout=5)
102+
# Checking current screen(My Address) after BACK press
103+
self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=5)
104+
105+
@ordered
106+
def test_send_message_from(self):
107+
"""Send Message From Send Message From Button"""
108+
# this is for scrolling Myaddress screen
109+
self.drag(
110+
'//MyAddress//MDList[0]/CustomTwoLineAvatarIconListItem[@text=\"test2\"]',
111+
'//MyAddress//MDList[0]/CustomTwoLineAvatarIconListItem[@text=\"test1\"]'
112+
)
113+
# Checking the addresses
114+
self.assertExists(
115+
'//MyAddress//MDList[0]/CustomTwoLineAvatarIconListItem[@text=\"test1\"]',
116+
timeout=5
117+
)
118+
# Click on Address to open popup
119+
self.cli.wait_click('//MDList[0]/CustomTwoLineAvatarIconListItem[@text=\"test1\"]', timeout=5)
120+
# Checking Popup Opened
121+
self.assertExists('//MyaddDetailPopup//MDLabel[@text=\"Send message from\"]', timeout=5)
122+
# Click on Send Message Button to redirect Create Screen
123+
self.cli.wait_click('//MyaddDetailPopup//MDRaisedButton[0]/MDLabel[0]', timeout=2)
124+
# Checking Current screen(Create)
125+
self.assertExists("//Create[@name~=\"create\"]", timeout=2)
126+
# Entering Receiver Address
127+
self.cli.setattr(
128+
'//DropDownWidget/ScrollView[0]//MyTextInput[0]', "text", data[1])
129+
# Checking Receiver Address filled or not
130+
self.assertNotEqual('//DropDownWidget//MyTextInput[0]', '')
131+
# ADD SUBJECT
132+
self.cli.setattr('//DropDownWidget/ScrollView[0]//MyMDTextField[0]', 'text', 'Hey this is Demo Subject')
133+
# Checking Subject Field is Entered
134+
self.assertNotEqual('//DropDownWidget/ScrollView[0]//MyMDTextField[0]', '')
135+
# ADD MESSAGE BODY
136+
self.cli.setattr(
137+
'//DropDownWidget/ScrollView[0]//ScrollView[0]/MDTextField[0]',
138+
'text', 'Hey,i am sending message directly from MyAddress book'
139+
)
140+
# Checking Message body is Entered
141+
self.assertNotEqual('//DropDownWidget/ScrollView[0]//ScrollView[0]/MDTextField[@text]', '')

0 commit comments

Comments
 (0)