Add addressbook screen import and id/sc name
This commit is contained in:
parent
31534f7bbb
commit
364a9e814e
|
@ -13,7 +13,6 @@ import os
|
||||||
import logging
|
import logging
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
from kivy.clock import Clock
|
|
||||||
from kivy.properties import (
|
from kivy.properties import (
|
||||||
ListProperty,
|
ListProperty,
|
||||||
StringProperty
|
StringProperty
|
||||||
|
@ -49,12 +48,6 @@ class AddressBook(Screen, HelperAddressBook):
|
||||||
super(AddressBook, self).__init__(*args, **kwargs)
|
super(AddressBook, self).__init__(*args, **kwargs)
|
||||||
self.addbook_popup = None
|
self.addbook_popup = None
|
||||||
self.kivy_state = kivy_state_variables()
|
self.kivy_state = kivy_state_variables()
|
||||||
Clock.schedule_once(self.init_ui, 0)
|
|
||||||
|
|
||||||
def init_ui(self, dt=0):
|
|
||||||
"""Clock Schdule for method AddressBook"""
|
|
||||||
self.loadAddresslist(None, 'All', '')
|
|
||||||
logger.debug(dt)
|
|
||||||
|
|
||||||
def loadAddresslist(self, account, where="", what=""):
|
def loadAddresslist(self, account, where="", what=""):
|
||||||
"""Clock Schdule for method AddressBook"""
|
"""Clock Schdule for method AddressBook"""
|
||||||
|
|
|
@ -58,7 +58,7 @@ class AddAddressPopup(BoxLayout):
|
||||||
def checkAddress_valid(self, instance):
|
def checkAddress_valid(self, instance):
|
||||||
"""Checking address is valid or not"""
|
"""Checking address is valid or not"""
|
||||||
my_addresses = (
|
my_addresses = (
|
||||||
App.get_running_app().root.ids.content_drawer.ids.btn.values)
|
App.get_running_app().root.ids.content_drawer.ids.identity_dropdown.values)
|
||||||
add_book = [addr[1] for addr in kivy_helper_search.search_sql(
|
add_book = [addr[1] for addr in kivy_helper_search.search_sql(
|
||||||
folder="addressbook")]
|
folder="addressbook")]
|
||||||
entered_text = str(instance.text).strip()
|
entered_text = str(instance.text).strip()
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
required: True
|
required: True
|
||||||
icon_right: 'label'
|
icon_right: 'label'
|
||||||
helper_text_mode: "on_error"
|
helper_text_mode: "on_error"
|
||||||
on_text: root.checkLabel_valid(self)
|
# TODO: on_text: root.checkLabel_valid(self) is not used now but it will be used later
|
||||||
canvas.before:
|
canvas.before:
|
||||||
Color:
|
Color:
|
||||||
rgba: (0,0,0,1)
|
rgba: (0,0,0,1)
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
icon_right: 'book-plus'
|
icon_right: 'book-plus'
|
||||||
helper_text_mode: "on_error"
|
helper_text_mode: "on_error"
|
||||||
multiline: False
|
multiline: False
|
||||||
on_text: root.checkAddress_valid(self)
|
# TODO: on_text: root.checkAddress_valid(self) is not used now but it will be used later
|
||||||
canvas.before:
|
canvas.before:
|
||||||
Color:
|
Color:
|
||||||
rgba: (0,0,0,1)
|
rgba: (0,0,0,1)
|
||||||
|
|
|
@ -244,6 +244,8 @@ MDNavigationLayout:
|
||||||
id:id_allmail
|
id:id_allmail
|
||||||
Draft:
|
Draft:
|
||||||
id:id_draft
|
id:id_draft
|
||||||
|
AddressBook:
|
||||||
|
id:id_addressbook
|
||||||
|
|
||||||
MDNavigationDrawer:
|
MDNavigationDrawer:
|
||||||
id: nav_drawer
|
id: nav_drawer
|
||||||
|
|
|
@ -47,6 +47,11 @@
|
||||||
"name_screen": "trash",
|
"name_screen": "trash",
|
||||||
"Import": "from pybitmessage.bitmessagekivy.baseclass.trash import Trash"
|
"Import": "from pybitmessage.bitmessagekivy.baseclass.trash import Trash"
|
||||||
},
|
},
|
||||||
|
"Address Book": {
|
||||||
|
"kv_string": "addressbook",
|
||||||
|
"name_screen": "addressbook",
|
||||||
|
"Import": "from pybitmessage.bitmessagekivy.baseclass.addressbook import AddressBook"
|
||||||
|
},
|
||||||
"Popups": {
|
"Popups": {
|
||||||
"kv_string": "popup",
|
"kv_string": "popup",
|
||||||
"Import": "from pybitmessage.bitmessagekivy.baseclass.popup import *"
|
"Import": "from pybitmessage.bitmessagekivy.baseclass.popup import *"
|
||||||
|
|
|
@ -16,7 +16,7 @@ class AddressBook(TeleniumTestProcess):
|
||||||
test_subject = 'Test Subject'
|
test_subject = 'Test Subject'
|
||||||
test_body = 'Hey,This is draft Message Body from Address Book'
|
test_body = 'Hey,This is draft Message Body from Address Book'
|
||||||
|
|
||||||
@skip_screen_checks
|
# @skip_screen_checks
|
||||||
@ordered
|
@ordered
|
||||||
def test_save_address(self):
|
def test_save_address(self):
|
||||||
"""Saving a new Address On Address Book Screen/Window"""
|
"""Saving a new Address On Address Book Screen/Window"""
|
||||||
|
@ -28,78 +28,68 @@ class AddressBook(TeleniumTestProcess):
|
||||||
self.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]")
|
self.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]")
|
||||||
# assert for checking scroll function
|
# assert for checking scroll function
|
||||||
self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=5)
|
self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=5)
|
||||||
# this is for opening setting screen
|
# this is for opening addressbook screen
|
||||||
self.cli.wait_click('//NavigationItem[@text=\"Address Book\"]', timeout=5)
|
self.cli.wait_click('//NavigationItem[@text=\"Address Book\"]', timeout=5)
|
||||||
# Checking current screen
|
# Checking current screen
|
||||||
self.assertExists("//ScreenManager[@current=\"addressbook\"]", timeout=5)
|
self.assertExists("//ScreenManager[@current=\"addressbook\"]", timeout=5)
|
||||||
# This is for checking the Side nav Bar is closed
|
# This is for checking the Side nav Bar is closed
|
||||||
self.assertExists('//MDNavigationDrawer[@status~=\"closed\"]', timeout=5)
|
self.assertExists('//MDNavigationDrawer[@status~=\"closed\"]', timeout=5)
|
||||||
# Check for rendered button
|
# Check for rendered button
|
||||||
self.assertExists('//MDActionTopAppBarButton[@icon=\"account-plus\"]', timeout=5)
|
self.assertExists('//ActionTopAppBarButton[@icon=\"account-plus\"]', timeout=5)
|
||||||
# Click on "Account-Plus' Icon to open popup to save a new Address
|
# Click on "Account-Plus' Icon to open popup to save a new Address
|
||||||
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"account-plus\"]', timeout=5)
|
self.cli.wait_click('//ActionTopAppBarButton[@icon=\"account-plus\"]', timeout=5)
|
||||||
# Checking the Label Field shows Validation for empty string
|
# Checking the Label Field shows Validation for empty string
|
||||||
self.assertExists('//GrashofPopup/BoxLayout[0]/MDTextField[@hint_text=\"Label\"][@text=\"\"]', timeout=5)
|
self.assertExists('//AddAddressPopup/BoxLayout[0]/MDTextField[@hint_text=\"Label\"][@text=\"\"]', timeout=5)
|
||||||
# Checking the Address Field shows Validation for empty string
|
# Checking the Address Field shows Validation for empty string
|
||||||
self.assertExists('//GrashofPopup/BoxLayout[0]/MDTextField[@hint_text=\"Address\"][@text=\"\"]', timeout=5)
|
self.assertExists('//AddAddressPopup/BoxLayout[0]/MDTextField[@hint_text=\"Address\"][@text=\"\"]', timeout=5)
|
||||||
# Click On save Button to check Field validation
|
|
||||||
self.cli.wait_click('//MDRaisedButton[@text=\"Save\"]', timeout=5)
|
|
||||||
# Add an address Label to label Field
|
# Add an address Label to label Field
|
||||||
self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[@hint_text=\"Label\"]', 'text', self.test_label)
|
self.cli.setattr('//AddAddressPopup/BoxLayout[0]/MDTextField[@hint_text=\"Label\"]', 'text', self.test_label)
|
||||||
# Checking the Label Field should not be empty
|
# Checking the Label Field should not be empty
|
||||||
self.assertExists(
|
self.assertExists(
|
||||||
'//GrashofPopup/BoxLayout[0]/MDTextField[0][@text=\"{}\"]'.format(self.test_label), timeout=2)
|
'//AddAddressPopup/BoxLayout[0]/MDTextField[0][@text=\"{}\"]'.format(self.test_label), timeout=2)
|
||||||
# Add incorrect Address to Address Field to check validation
|
|
||||||
self.cli.setattr(
|
|
||||||
'//GrashofPopup/BoxLayout[0]/MDTextField[@hint_text=\"Address\"]',
|
|
||||||
'text', test_address['invalid_address'])
|
|
||||||
# Checking the Address Field should not be empty
|
|
||||||
self.assertExists(
|
|
||||||
'//GrashofPopup/BoxLayout[0]/MDTextField[1][@text=\"{}\"]'.format(test_address['invalid_address']),
|
|
||||||
timeout=2)
|
|
||||||
# Add Correct Address
|
# Add Correct Address
|
||||||
self.cli.setattr(
|
self.cli.setattr(
|
||||||
'//GrashofPopup/BoxLayout[0]/MDTextField[@hint_text=\"Address\"]', 'text',
|
'//AddAddressPopup/BoxLayout[0]/MDTextField[@hint_text=\"Address\"]', 'text',
|
||||||
test_address['autoresponder_address'])
|
test_address['autoresponder_address'])
|
||||||
# Checking the Address Field contains correct address
|
# Checking the Address Field contains correct address
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.cli.getattr('//GrashofPopup/BoxLayout[0]/MDTextField[1][@text]', 'text'),
|
self.cli.getattr('//AddAddressPopup/BoxLayout[0]/MDTextField[1][@text]', 'text'),
|
||||||
test_address['autoresponder_address'])
|
test_address['autoresponder_address'])
|
||||||
# Validating the Label field
|
# Validating the Label field
|
||||||
self.assertExists(
|
self.assertExists(
|
||||||
'//GrashofPopup/BoxLayout[0]/MDTextField[0][@text=\"{}\"]'.format(self.test_label), timeout=2)
|
'//AddAddressPopup/BoxLayout[0]/MDTextField[0][@text=\"{}\"]'.format(self.test_label), timeout=2)
|
||||||
# Validating the Valid Address is entered
|
# Validating the Valid Address is entered
|
||||||
self.assertExists(
|
self.assertExists(
|
||||||
'//GrashofPopup/BoxLayout[0]/MDTextField[1][@text=\"{}\"]'.format(
|
'//AddAddressPopup/BoxLayout[0]/MDTextField[1][@text=\"{}\"]'.format(
|
||||||
test_address['autoresponder_address']), timeout=3)
|
test_address['autoresponder_address']), timeout=3)
|
||||||
# Click on Save Button to save the address in address book
|
# Checking cancel button
|
||||||
self.cli.wait_click('//MDRaisedButton[@text=\"Save\"]', timeout=2)
|
self.assertExists('//MDRaisedButton[@text=\"Cancel\"]', timeout=5)
|
||||||
# Check Current Screen (Address Book)
|
# Click on 'Cancel' Button to dismiss the popup
|
||||||
|
self.cli.wait_click('//MDRaisedButton[@text=\"Cancel\"]', timeout=2)
|
||||||
|
# Checking current screen
|
||||||
self.assertExists("//ScreenManager[@current=\"addressbook\"]", timeout=5)
|
self.assertExists("//ScreenManager[@current=\"addressbook\"]", timeout=5)
|
||||||
# Checking new address should be added
|
|
||||||
self.assertExists('//SwipeToDeleteItem', timeout=5)
|
|
||||||
|
|
||||||
@skip_screen_checks
|
@skip_screen_checks
|
||||||
@ordered
|
@ordered
|
||||||
def test_dismiss_addressbook_popup(self):
|
def test_dismiss_addressbook_popup(self):
|
||||||
"""This method is to perform Dismiss add Address popup"""
|
"""This method is to perform Dismiss add Address popup"""
|
||||||
# Checking the "Address saving" Popup is not opened
|
# Checking the "Address saving" Popup is not opened
|
||||||
self.assertNotExists('//GrashofPopup', timeout=5)
|
self.assertNotExists('//AddAddressPopup', timeout=5)
|
||||||
# Checking the "Add account" Button is rendered
|
# Checking the "Add account" Button is rendered
|
||||||
self.assertExists('//MDActionTopAppBarButton[@icon=\"account-plus\"]', timeout=6)
|
self.assertExists('//ActionTopAppBarButton[@icon=\"account-plus\"]', timeout=6)
|
||||||
# Click on Account-Plus Icon to open popup for add Address
|
# Click on Account-Plus Icon to open popup for add Address
|
||||||
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"account-plus\"]', timeout=5)
|
self.cli.wait_click('//ActionTopAppBarButton[@icon=\"account-plus\"]', timeout=5)
|
||||||
# Add Label to label Field
|
# Add Label to label Field
|
||||||
self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[0]', 'text', 'test_label2')
|
self.cli.setattr('//AddAddressPopup/BoxLayout[0]/MDTextField[0]', 'text', 'test_label2')
|
||||||
# Checking the Label Field should not be empty
|
# Checking the Label Field should not be empty
|
||||||
self.assertExists(
|
self.assertExists(
|
||||||
'//GrashofPopup/BoxLayout[0]/MDTextField[0][@text=\"{}\"]'.format('test_label2'), timeout=2)
|
'//AddAddressPopup/BoxLayout[0]/MDTextField[0][@text=\"{}\"]'.format('test_label2'), timeout=2)
|
||||||
# Add Address to Address Field
|
# Add Address to Address Field
|
||||||
self.cli.setattr(
|
self.cli.setattr(
|
||||||
'//GrashofPopup/BoxLayout[0]/MDTextField[1]', 'text', test_address['recipient'])
|
'//AddAddressPopup/BoxLayout[0]/MDTextField[1]', 'text', test_address['recipient'])
|
||||||
# Checking the Address Field should not be empty
|
# Checking the Address Field should not be empty
|
||||||
self.assertExists(
|
self.assertExists(
|
||||||
'//GrashofPopup/BoxLayout[0]/MDTextField[1][@text=\"{}\"]'.format(test_address['recipient']),
|
'//AddAddressPopup/BoxLayout[0]/MDTextField[1][@text=\"{}\"]'.format(test_address['recipient']),
|
||||||
timeout=2)
|
timeout=2)
|
||||||
# Checking for "Cancel" button is rendered
|
# Checking for "Cancel" button is rendered
|
||||||
self.assertExists('//MDRaisedButton[@text=\"Cancel\"]', timeout=5)
|
self.assertExists('//MDRaisedButton[@text=\"Cancel\"]', timeout=5)
|
||||||
|
|
Reference in New Issue
Block a user