Skip to content

Commit 364a9e8

Browse files
committed
Add addressbook screen import and id/sc name
1 parent 31534f7 commit 364a9e8

File tree

6 files changed

+34
-44
lines changed

6 files changed

+34
-44
lines changed

src/bitmessagekivy/baseclass/addressbook.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import logging
1414
from functools import partial
1515

16-
from kivy.clock import Clock
1716
from kivy.properties import (
1817
ListProperty,
1918
StringProperty
@@ -49,12 +48,6 @@ def __init__(self, *args, **kwargs):
4948
super(AddressBook, self).__init__(*args, **kwargs)
5049
self.addbook_popup = None
5150
self.kivy_state = kivy_state_variables()
52-
Clock.schedule_once(self.init_ui, 0)
53-
54-
def init_ui(self, dt=0):
55-
"""Clock Schdule for method AddressBook"""
56-
self.loadAddresslist(None, 'All', '')
57-
logger.debug(dt)
5851

5952
def loadAddresslist(self, account, where="", what=""):
6053
"""Clock Schdule for method AddressBook"""

src/bitmessagekivy/baseclass/popup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def __init__(self, **kwargs):
5858
def checkAddress_valid(self, instance):
5959
"""Checking address is valid or not"""
6060
my_addresses = (
61-
App.get_running_app().root.ids.content_drawer.ids.btn.values)
61+
App.get_running_app().root.ids.content_drawer.ids.identity_dropdown.values)
6262
add_book = [addr[1] for addr in kivy_helper_search.search_sql(
6363
folder="addressbook")]
6464
entered_text = str(instance.text).strip()

src/bitmessagekivy/kv/popup.kv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
required: True
3030
icon_right: 'label'
3131
helper_text_mode: "on_error"
32-
on_text: root.checkLabel_valid(self)
32+
# TODO: on_text: root.checkLabel_valid(self) is not used now but it will be used later
3333
canvas.before:
3434
Color:
3535
rgba: (0,0,0,1)
@@ -40,7 +40,7 @@
4040
icon_right: 'book-plus'
4141
helper_text_mode: "on_error"
4242
multiline: False
43-
on_text: root.checkAddress_valid(self)
43+
# TODO: on_text: root.checkAddress_valid(self) is not used now but it will be used later
4444
canvas.before:
4545
Color:
4646
rgba: (0,0,0,1)

src/bitmessagekivy/main.kv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ MDNavigationLayout:
244244
id:id_allmail
245245
Draft:
246246
id:id_draft
247+
AddressBook:
248+
id:id_addressbook
247249

248250
MDNavigationDrawer:
249251
id: nav_drawer

src/bitmessagekivy/screens_data.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747
"name_screen": "trash",
4848
"Import": "from pybitmessage.bitmessagekivy.baseclass.trash import Trash"
4949
},
50+
"Address Book": {
51+
"kv_string": "addressbook",
52+
"name_screen": "addressbook",
53+
"Import": "from pybitmessage.bitmessagekivy.baseclass.addressbook import AddressBook"
54+
},
5055
"Popups": {
5156
"kv_string": "popup",
5257
"Import": "from pybitmessage.bitmessagekivy.baseclass.popup import *"

src/bitmessagekivy/tests/test_addressbook.py

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class AddressBook(TeleniumTestProcess):
1616
test_subject = 'Test Subject'
1717
test_body = 'Hey,This is draft Message Body from Address Book'
1818

19-
@skip_screen_checks
19+
# @skip_screen_checks
2020
@ordered
2121
def test_save_address(self):
2222
"""Saving a new Address On Address Book Screen/Window"""
@@ -28,78 +28,68 @@ def test_save_address(self):
2828
self.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]")
2929
# assert for checking scroll function
3030
self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=5)
31-
# this is for opening setting screen
31+
# this is for opening addressbook screen
3232
self.cli.wait_click('//NavigationItem[@text=\"Address Book\"]', timeout=5)
3333
# Checking current screen
3434
self.assertExists("//ScreenManager[@current=\"addressbook\"]", timeout=5)
3535
# This is for checking the Side nav Bar is closed
3636
self.assertExists('//MDNavigationDrawer[@status~=\"closed\"]', timeout=5)
3737
# Check for rendered button
38-
self.assertExists('//MDActionTopAppBarButton[@icon=\"account-plus\"]', timeout=5)
38+
self.assertExists('//ActionTopAppBarButton[@icon=\"account-plus\"]', timeout=5)
3939
# Click on "Account-Plus' Icon to open popup to save a new Address
40-
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"account-plus\"]', timeout=5)
40+
self.cli.wait_click('//ActionTopAppBarButton[@icon=\"account-plus\"]', timeout=5)
4141
# Checking the Label Field shows Validation for empty string
42-
self.assertExists('//GrashofPopup/BoxLayout[0]/MDTextField[@hint_text=\"Label\"][@text=\"\"]', timeout=5)
42+
self.assertExists('//AddAddressPopup/BoxLayout[0]/MDTextField[@hint_text=\"Label\"][@text=\"\"]', timeout=5)
4343
# Checking the Address Field shows Validation for empty string
44-
self.assertExists('//GrashofPopup/BoxLayout[0]/MDTextField[@hint_text=\"Address\"][@text=\"\"]', timeout=5)
45-
# Click On save Button to check Field validation
46-
self.cli.wait_click('//MDRaisedButton[@text=\"Save\"]', timeout=5)
44+
self.assertExists('//AddAddressPopup/BoxLayout[0]/MDTextField[@hint_text=\"Address\"][@text=\"\"]', timeout=5)
4745
# Add an address Label to label Field
48-
self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[@hint_text=\"Label\"]', 'text', self.test_label)
46+
self.cli.setattr('//AddAddressPopup/BoxLayout[0]/MDTextField[@hint_text=\"Label\"]', 'text', self.test_label)
4947
# Checking the Label Field should not be empty
5048
self.assertExists(
51-
'//GrashofPopup/BoxLayout[0]/MDTextField[0][@text=\"{}\"]'.format(self.test_label), timeout=2)
52-
# Add incorrect Address to Address Field to check validation
53-
self.cli.setattr(
54-
'//GrashofPopup/BoxLayout[0]/MDTextField[@hint_text=\"Address\"]',
55-
'text', test_address['invalid_address'])
56-
# Checking the Address Field should not be empty
57-
self.assertExists(
58-
'//GrashofPopup/BoxLayout[0]/MDTextField[1][@text=\"{}\"]'.format(test_address['invalid_address']),
59-
timeout=2)
49+
'//AddAddressPopup/BoxLayout[0]/MDTextField[0][@text=\"{}\"]'.format(self.test_label), timeout=2)
6050
# Add Correct Address
6151
self.cli.setattr(
62-
'//GrashofPopup/BoxLayout[0]/MDTextField[@hint_text=\"Address\"]', 'text',
52+
'//AddAddressPopup/BoxLayout[0]/MDTextField[@hint_text=\"Address\"]', 'text',
6353
test_address['autoresponder_address'])
6454
# Checking the Address Field contains correct address
6555
self.assertEqual(
66-
self.cli.getattr('//GrashofPopup/BoxLayout[0]/MDTextField[1][@text]', 'text'),
56+
self.cli.getattr('//AddAddressPopup/BoxLayout[0]/MDTextField[1][@text]', 'text'),
6757
test_address['autoresponder_address'])
6858
# Validating the Label field
6959
self.assertExists(
70-
'//GrashofPopup/BoxLayout[0]/MDTextField[0][@text=\"{}\"]'.format(self.test_label), timeout=2)
60+
'//AddAddressPopup/BoxLayout[0]/MDTextField[0][@text=\"{}\"]'.format(self.test_label), timeout=2)
7161
# Validating the Valid Address is entered
7262
self.assertExists(
73-
'//GrashofPopup/BoxLayout[0]/MDTextField[1][@text=\"{}\"]'.format(
63+
'//AddAddressPopup/BoxLayout[0]/MDTextField[1][@text=\"{}\"]'.format(
7464
test_address['autoresponder_address']), timeout=3)
75-
# Click on Save Button to save the address in address book
76-
self.cli.wait_click('//MDRaisedButton[@text=\"Save\"]', timeout=2)
77-
# Check Current Screen (Address Book)
65+
# Checking cancel button
66+
self.assertExists('//MDRaisedButton[@text=\"Cancel\"]', timeout=5)
67+
# Click on 'Cancel' Button to dismiss the popup
68+
self.cli.wait_click('//MDRaisedButton[@text=\"Cancel\"]', timeout=2)
69+
# Checking current screen
7870
self.assertExists("//ScreenManager[@current=\"addressbook\"]", timeout=5)
79-
# Checking new address should be added
80-
self.assertExists('//SwipeToDeleteItem', timeout=5)
8171

8272
@skip_screen_checks
8373
@ordered
8474
def test_dismiss_addressbook_popup(self):
8575
"""This method is to perform Dismiss add Address popup"""
8676
# Checking the "Address saving" Popup is not opened
87-
self.assertNotExists('//GrashofPopup', timeout=5)
77+
self.assertNotExists('//AddAddressPopup', timeout=5)
8878
# Checking the "Add account" Button is rendered
89-
self.assertExists('//MDActionTopAppBarButton[@icon=\"account-plus\"]', timeout=6)
79+
self.assertExists('//ActionTopAppBarButton[@icon=\"account-plus\"]', timeout=6)
9080
# Click on Account-Plus Icon to open popup for add Address
91-
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"account-plus\"]', timeout=5)
81+
self.cli.wait_click('//ActionTopAppBarButton[@icon=\"account-plus\"]', timeout=5)
9282
# Add Label to label Field
93-
self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[0]', 'text', 'test_label2')
83+
self.cli.setattr('//AddAddressPopup/BoxLayout[0]/MDTextField[0]', 'text', 'test_label2')
9484
# Checking the Label Field should not be empty
9585
self.assertExists(
96-
'//GrashofPopup/BoxLayout[0]/MDTextField[0][@text=\"{}\"]'.format('test_label2'), timeout=2)
86+
'//AddAddressPopup/BoxLayout[0]/MDTextField[0][@text=\"{}\"]'.format('test_label2'), timeout=2)
9787
# Add Address to Address Field
9888
self.cli.setattr(
99-
'//GrashofPopup/BoxLayout[0]/MDTextField[1]', 'text', test_address['recipient'])
89+
'//AddAddressPopup/BoxLayout[0]/MDTextField[1]', 'text', test_address['recipient'])
10090
# Checking the Address Field should not be empty
10191
self.assertExists(
102-
'//GrashofPopup/BoxLayout[0]/MDTextField[1][@text=\"{}\"]'.format(test_address['recipient']),
92+
'//AddAddressPopup/BoxLayout[0]/MDTextField[1][@text=\"{}\"]'.format(test_address['recipient']),
10393
timeout=2)
10494
# Checking for "Cancel" button is rendered
10595
self.assertExists('//MDRaisedButton[@text=\"Cancel\"]', timeout=5)

0 commit comments

Comments
 (0)