Add draft screen, helper widgets and Test

This commit is contained in:
shekhar-cis 2022-03-31 21:58:18 +05:30
parent 3b23977cbf
commit 31534f7bbb
Signed by untrusted user: shekhar-cis
GPG Key ID: F4F00AB04E83F9A7
4 changed files with 79 additions and 0 deletions

View File

@ -0,0 +1,58 @@
# pylint: disable=unused-argument, import-error, too-many-arguments
# pylint: disable=unnecessary-comprehension, no-member, no-name-in-module
"""
draft.py
==============
Draft screen
"""
from kivy.clock import Clock
from kivy.properties import (
ListProperty,
StringProperty
)
from kivy.uix.screenmanager import Screen
from kivy.app import App
from pybitmessage.bitmessagekivy.baseclass.common import (
show_limited_cnt, empty_screen_label,
kivy_state_variables
)
import logging
logger = logging.getLogger('default')
class Draft(Screen):
"""Draft screen class for kivy Ui"""
data = ListProperty()
account = StringProperty()
queryreturn = ListProperty()
has_refreshed = True
label_str = "yet no message for this account!!!!!!!!!!!!!"
def __init__(self, *args, **kwargs):
"""Method used for storing draft messages"""
super(Draft, self).__init__(*args, **kwargs)
self.kivy_state = kivy_state_variables()
if self.kivy_state.selected_address == '':
if App.get_running_app().identity_list:
self.kivy_state.selected_address = App.get_running_app().identity_list[0]
Clock.schedule_once(self.init_ui, 0)
def init_ui(self, dt=0):
"""Clock Schedule for method draft accounts"""
self.load_draft()
logger.debug(dt)
def load_draft(self, where="", what=""):
"""Load draft list for Draft messages"""
self.set_draft_count('0')
self.ids.ml.add_widget(empty_screen_label(self.label_str))
@staticmethod
def set_draft_count(Count):
"""Set the count of draft mails"""
draftCnt_obj = App.get_running_app().root.ids.content_drawer.ids.draft_cnt
draftCnt_obj.ids.badge_txt.text = show_limited_cnt(int(Count))

View File

@ -242,6 +242,8 @@ MDNavigationLayout:
id:id_trash
Allmails:
id:id_allmail
Draft:
id:id_draft
MDNavigationDrawer:
id: nav_drawer

View File

@ -60,5 +60,10 @@
"kv_string": "maildetail",
"name_screen": "mailDetail",
"Import": "from pybitmessage.bitmessagekivy.baseclass.maildetail import MailDetail"
},
"Draft": {
"kv_string": "draft",
"name_screen": "draft",
"Import": "from pybitmessage.bitmessagekivy.baseclass.draft import Draft"
}
}

View File

@ -12,6 +12,20 @@ class DraftMessage(TeleniumTestProcess):
test_subject = 'Test Subject text'
test_body = 'Hey, This is draft Message Body'
@ordered
def test_draft_screen(self):
"""Test draft screen is open"""
# Checking current Screen(Inbox screen)
self.assert_wait_no_except('//ScreenManager[@current]', timeout=15, value='inbox')
# Method to open side navbar
self.open_side_navbar()
# this is for opening Draft screen
self.cli.wait_click('//NavigationItem[@text=\"Draft\"]', timeout=2)
# Checking the drawer is in 'closed' state
self.assertExists('//MDNavigationDrawer[@status~=\"closed\"]', timeout=5)
# Checking Draft Screen
self.assertExists("//ScreenManager[@current=\"draft\"]", timeout=5)
@skip_screen_checks
@ordered
def test_save_message_to_draft(self):