Test case for delet message from sent screen

This commit is contained in:
prachi 2020-04-17 21:43:48 +05:30
parent 6607238d7f
commit 09575af860
No known key found for this signature in database
GPG Key ID: 2940E6901747AAAF
4 changed files with 75 additions and 75 deletions

View File

@ -71,6 +71,11 @@ def toast(text):
toast(text) toast(text)
return return
class CustomTwoLineAvatarIconListItem(TwoLineAvatarIconListItem):
def __init__(self, **kwargs):
super(CustomTwoLineAvatarIconListItem, self).__init__(**kwargs)
self.text_color=[0.12, 0.58, 0.95, 1]
class Navigatorss(MDNavigationDrawer): class Navigatorss(MDNavigationDrawer):
"""Navigator class (image, title and logo)""" """Navigator class (image, title and logo)"""
@ -150,7 +155,7 @@ class Inbox(Screen):
"""This method is used to create the mdList""" """This method is used to create the mdList"""
total_message = len(self.ids.ml.children) total_message = len(self.ids.ml.children)
for item in data: for item in data:
meny = TwoLineAvatarIconListItem( meny = CustomTwoLineAvatarIconListItem(
text=item['text'], secondary_text=item['secondary_text'], text=item['text'], secondary_text=item['secondary_text'],
theme_text_color='Custom') theme_text_color='Custom')
meny.add_widget(AvatarSampleWidget( meny.add_widget(AvatarSampleWidget(
@ -339,7 +344,7 @@ class MyAddress(Screen):
'text': BMConfigParser().get(address, 'label'), 'text': BMConfigParser().get(address, 'label'),
'secondary_text': address}) 'secondary_text': address})
for item in data: for item in data:
meny = TwoLineAvatarIconListItem( meny = CustomTwoLineAvatarIconListItem(
text=item['text'], secondary_text=item['secondary_text'], text=item['text'], secondary_text=item['secondary_text'],
theme_text_color='Custom') theme_text_color='Custom')
meny.add_widget(AvatarSampleWidget( meny.add_widget(AvatarSampleWidget(
@ -447,7 +452,7 @@ class AddressBook(Screen):
def set_mdList(self, start_index, end_index): def set_mdList(self, start_index, end_index):
"""Creating the mdList""" """Creating the mdList"""
for item in self.queryreturn[start_index:end_index]: for item in self.queryreturn[start_index:end_index]:
meny = TwoLineAvatarIconListItem( meny = CustomTwoLineAvatarIconListItem(
text=item[0], secondary_text=item[1], theme_text_color='Custom') text=item[0], secondary_text=item[1], theme_text_color='Custom')
meny.add_widget(AvatarSampleWidget( meny.add_widget(AvatarSampleWidget(
source='./images/text_images/{}.png'.format( source='./images/text_images/{}.png'.format(
@ -897,7 +902,7 @@ class Sent(Screen):
"""This method is used to create the mdList""" """This method is used to create the mdList"""
total_sent_msg = len(self.ids.ml.children) total_sent_msg = len(self.ids.ml.children)
for item in data: for item in data:
meny = TwoLineAvatarIconListItem( meny = CustomTwoLineAvatarIconListItem(
text=item['text'], secondary_text=item['secondary_text'], text=item['text'], secondary_text=item['secondary_text'],
theme_text_color='Custom') theme_text_color='Custom')
meny.add_widget(AvatarSampleWidget( meny.add_widget(AvatarSampleWidget(
@ -1095,7 +1100,7 @@ class Trash(Screen):
"""This method is used to create the mdlist""" """This method is used to create the mdlist"""
total_trash_msg = len(self.ids.ml.children) total_trash_msg = len(self.ids.ml.children)
for item in self.trash_messages: for item in self.trash_messages:
meny = TwoLineAvatarIconListItem( meny = CustomTwoLineAvatarIconListItem(
text=item[1], text=item[1],
secondary_text=item[2][:50] + '........' if len( secondary_text=item[2][:50] + '........' if len(
item[2]) >= 50 else (item[2] + ',' + item[3].replace( item[2]) >= 50 else (item[2] + ',' + item[3].replace(
@ -2145,7 +2150,7 @@ class Draft(Screen):
third_text) > 25 else third_text, third_text) > 25 else third_text,
'ackdata': mail[5]}) 'ackdata': mail[5]})
for item in data: for item in data:
meny = TwoLineAvatarIconListItem( meny = CustomTwoLineAvatarIconListItem(
text='Draft', secondary_text=item['text'], text='Draft', secondary_text=item['text'],
theme_text_color='Custom') theme_text_color='Custom')
meny.add_widget(AvatarSampleWidget( meny.add_widget(AvatarSampleWidget(
@ -2314,7 +2319,7 @@ class Allmails(Screen):
"""This method is used to create mdList for allmaills""" """This method is used to create mdList for allmaills"""
data_exist = len(self.ids.ml.children) data_exist = len(self.ids.ml.children)
for item in self.all_mails: for item in self.all_mails:
meny = TwoLineAvatarIconListItem( meny = CustomTwoLineAvatarIconListItem(
text=item[1], text=item[1],
secondary_text=item[2][:50] + '........' if len( secondary_text=item[2][:50] + '........' if len(
item[2]) >= 50 else ( item[2]) >= 50 else (

View File

@ -17,7 +17,9 @@ class TestBitMessageApp(TeleniumTestCase):
def test_login_screen(self): def test_login_screen(self):
print(self,"---------------------------") print(self,"---------------------------")
time.sleep(5) time.sleep(5)
# if not os.path.isdir("/home/cis/.config/PyBitmessage"): # if os.path.isdir("/home/cis/.config/PyBitmessage"):
# pass
# else:
print("first screen") print("first screen")
self.cli.drag("/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Login[0]/ScrollView[0]/BoxLayout[0]/MDCheckbox[0]","/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Login[0]/ScrollView[0]/BoxLayout[0]/BoxLayout[0]",2) self.cli.drag("/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Login[0]/ScrollView[0]/BoxLayout[0]/MDCheckbox[0]","/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Login[0]/ScrollView[0]/BoxLayout[0]/BoxLayout[0]",2)
time.sleep(5) time.sleep(5)
@ -25,7 +27,9 @@ class TestBitMessageApp(TeleniumTestCase):
time.sleep(5) time.sleep(5)
def test_random_screen(self): def test_random_screen(self):
# if not os.path.isdir("/home/cis/.config/PyBitmessage"): # if os.path.isdir("/home/cis/.config/PyBitmessage"):
# pass
# else:
self.cli.setattr(u'/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Random[0]/ScrollView[0]/BoxLayout[0]/MDTextField[0]', "text", self.generate_random_string()) self.cli.setattr(u'/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Random[0]/ScrollView[0]/BoxLayout[0]/MDTextField[0]', "text", self.generate_random_string())
time.sleep(5) time.sleep(5)
self.cli.wait_click(u'/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Random[0]/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/AnchorLayout[0]/MDRaisedButton[0]/MDLabel[0]') self.cli.wait_click(u'/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Random[0]/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/AnchorLayout[0]/MDRaisedButton[0]/MDLabel[0]')
@ -37,6 +41,9 @@ class TestBitMessageApp(TeleniumTestCase):
letters = string.ascii_letters letters = string.ascii_letters
return ''.join(random.choice(letters) for i in range(10)) return ''.join(random.choice(letters) for i in range(10))
# lettersAndDigits = string.ascii_letters + string.digits
# return ''.join((random.choice(lettersAndDigits) for i in range(10)))
if __name__ == '__main__': if __name__ == '__main__':
@ -54,4 +61,6 @@ if __name__ == '__main__':
obj_1.test_show_sent_message_body() obj_1.test_show_sent_message_body()
obj_1.test_delete_sent_message_body() obj_1.test_delete_sent_message_body()
obj_1.test_archive_sent_message_from_list() obj_1.test_archive_sent_message_from_list()
obj_2=test_telenium_cases.TestDraftMessage()
obj_2.test_select_draft_message()

View File

@ -1,5 +1,8 @@
from telenium.tests import TeleniumTestCase from telenium.tests import TeleniumTestCase
import time import time
import random
import string
import os
class TestSelectAddress(TeleniumTestCase): class TestSelectAddress(TeleniumTestCase):
@ -11,12 +14,8 @@ class TestSelectAddress(TeleniumTestCase):
time.sleep(8) time.sleep(8)
self.cli.execute('app.root.toggle_nav_drawer()') self.cli.execute('app.root.toggle_nav_drawer()')
time.sleep(5) time.sleep(5)
# if self.cli.execute('app.root.toggle_nav_drawer()'):
# time.sleep(5)
self.cli.click_on('//NavigationDrawerIconButton[0]') self.cli.click_on('//NavigationDrawerIconButton[0]')
time.sleep(5) time.sleep(5)
# self.cli.wait_click('//NavigationDrawerIconButton[0]/CustomSpinner[0]')
# time.sleep(3)
self.cli.click_on('//NavigationDrawerIconButton[1]') self.cli.click_on('//NavigationDrawerIconButton[1]')
@ -103,9 +102,9 @@ class TestSentMessage(TeleniumTestCase):
def test_delete_sent_message_body(self): def test_delete_sent_message_body(self):
print("------------Delete messgae from message body option-----------------.") print("------------Delete messgae from message body option-----------------.")
time.sleep(2) time.sleep(2)
self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Sent[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]/RelativeLayout[2]/TwoLineAvatarIconListItem[0]/BoxLayout[2]') self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Sent[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]/RelativeLayout[2]/CustomTwoLineAvatarIconListItem[0]/BoxLayout[2]')
# time.sleep(2) # time.sleep(2)
# self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Sent[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]/RelativeLayout[2]/TwoLineAvatarIconListItem[0]/BoxLayout[1]') # self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Sent[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]/RelativeLayout[2]/CustomTwoLineAvatarIconListItem[0]/BoxLayout[1]')
time.sleep(3) time.sleep(3)
# self.cli.click_on('//MDIconButton[1]') # self.cli.click_on('//MDIconButton[1]')
self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/Toolbar[0]/BoxLayout[2]/MDIconButton[0]/MDLabel[0]') self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/Toolbar[0]/BoxLayout[2]/MDIconButton[0]/MDLabel[0]')
@ -114,7 +113,7 @@ class TestSentMessage(TeleniumTestCase):
def test_delete_sent_message_from_list(self): def test_delete_sent_message_from_list(self):
print("-----------Delete messgae from message list-------------.") print("-----------Delete messgae from message list-------------.")
time.sleep(5) time.sleep(5)
self.cli.drag('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Sent[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]/RelativeLayout[2]/TwoLineAvatarIconListItem[0]/BoxLayout[1]','/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Sent[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]/RelativeLayout[1]/Button[0]',1) self.cli.drag('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Sent[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]/RelativeLayout[2]/CustomTwoLineAvatarIconListItem[0]/BoxLayout[1]','/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Sent[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]/RelativeLayout[1]/Button[0]',1)
time.sleep(4) time.sleep(4)
self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Sent[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]/RelativeLayout[1]/Button[0]') self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Sent[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]/RelativeLayout[1]/Button[0]')
@ -122,8 +121,52 @@ class TestSentMessage(TeleniumTestCase):
print("-----------Archive Message From Message List-----------") print("-----------Archive Message From Message List-----------")
# Swipe-Arrchive-Sent-Message # Swipe-Arrchive-Sent-Message
time.sleep(7) time.sleep(7)
self.cli.drag('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Sent[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]/RelativeLayout[2]/TwoLineAvatarIconListItem[0]/BoxLayout[0]','/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Sent[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]/RelativeLayout[0]/Button[0]',1) self.cli.drag('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Sent[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]/RelativeLayout[2]/CustomTwoLineAvatarIconListItem[0]/BoxLayout[0]','/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Sent[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]/RelativeLayout[0]/Button[0]',1)
time.sleep(2) time.sleep(2)
self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Sent[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]/RelativeLayout[1]/Button[0]') self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Sent[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]/RelativeLayout[1]/Button[0]')
time.sleep(4) time.sleep(4)
class TestDraftMessage(TeleniumTestCase):
def runTest(self):
print(self,"-------------Welcome To Kivy Testing Application Fourth Page-------------")
def test_select_draft_message(self):
print("----------Show Draft Message--------------------")
# OPEN NAVIGATION-DRAWER
time.sleep(4)
self.cli.execute('app.root.toggle_nav_drawer()')
time.sleep(2)
# OPEN INBOX SCREEN
self.cli.click_on('//NavigationDrawerIconButton[1]')
time.sleep(2)
# CLICK ON PLUS ICON BUTTON
self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Inbox[0]/ComposerButton[0]/MDFloatingActionButton[0]/MDLabel[0]')
time.sleep(3)
# SELECT - TO ADDRESS
self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Create[0]/DropDownWidget[0]/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]')
time.sleep(2)
self.cli.click_on('//MyTextInput[0]')
time.sleep(3)
# ADD FROM MESSAGE
self.cli.setattr('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Create[0]/DropDownWidget[0]/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/MyTextInput[0]',"text",'BM-2cSsuH1bUWBski8bvdqnK2DivMqQCeQA1J')
time.sleep(3)
# CLICK BACK-BUTTON
self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/Toolbar[0]/BoxLayout[0]/MDIconButton[0]/MDLabel[0]')
time.sleep(5)
self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Inbox[0]/ComposerButton[0]/MDFloatingActionButton[0]/MDLabel[0]')
time.sleep(3)
# SELECT - TO ADDRESS
self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Create[0]/DropDownWidget[0]/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]')
time.sleep(1)
self.cli.click_on('//MyTextInput[0]')
time.sleep(3)
# ADD FROM MESSAGE
self.cli.setattr('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Create[0]/DropDownWidget[0]/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/MyTextInput[0]',"text",'BM-2cSsuH1bUWBski8bvdqnK2DivMqQCeQA1J')
time.sleep(4)
self.cli.setattr('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Create[0]/DropDownWidget[0]/ScrollView[0]/BoxLayout[0]/MDTextField[0]','text','Another Draft message')
time.sleep(5)
# CLICK BACK-BUTTON
self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/Toolbar[0]/BoxLayout[0]/MDIconButton[0]/MDLabel[0]')
time.sleep(4)

View File

@ -1,57 +0,0 @@
import time
from telenium.tests import TeleniumTestCase
import random
import string
class TestBitMessageApp(TeleniumTestCase):
cmd_entrypoint = [u'/home/cis/peterwork_new/PyBitmessage/src/main.py']
def runTest(self):
print(self,"-------------Welcome To Kivy Testing Application-------------")
def test_press_button(self):
print(self,"---------------------------")
time.sleep(5)
self.cli.drag("/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Login[0]/ScrollView[0]/BoxLayout[0]/MDCheckbox[0]","/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Login[0]/ScrollView[0]/BoxLayout[0]/BoxLayout[0]",2)
time.sleep(5)
self.cli.wait_click(u'/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Login[0]/ScrollView[0]/BoxLayout[0]/BoxLayout[2]/AnchorLayout[0]/MDRaisedButton[0]/MDLabel[0]')
time.sleep(5)
self.cli.setattr(u'/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Random[0]/ScrollView[0]/BoxLayout[0]/MDTextField[0]', "text", self.generate_random_string())
time.sleep(5)
def test_next_button(self):
self.cli.wait_click(u'/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Random[0]/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/AnchorLayout[0]/MDRaisedButton[0]/MDLabel[0]')
time.sleep(5)
def generate_random_string(self):
"""Generate a random string of fixed length """
# return ''.join(random.choice(letters) for i in range(stringLength))
letters = string.ascii_letters
return ''.join(random.choice(letters) for i in range(10))
def test_create_screen(self):
# TYPE-OR-SELECT-SENDER-ADDRESS
self.cli.wait_click(u'/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Create[0]/DropDownWidget[1]/ScrollView[0]/BoxLayout[0]/BoxLayout[4]/MDTextField[1]')
# SELECT
self.cli.wait_click(u'/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Create[0]/DropDownWidget[1]/ScrollView[0]/BoxLayout[0]/BoxLayout[4]/BoxLayout[0]/CustomSpinner[0]')
#TYPE-OR-SCAN-OR-SELECT-CODE-FOR-RECEIPINT-ADDRESS
self.cli.wait_click(u'/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Create[0]/DropDownWidget[1]/ScrollView[0]/BoxLayout[0]/BoxLayout[3]/MyTextInput[1]')
#
self.cli.wait_click(u'/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Create[0]/DropDownWidget[1]/ScrollView[0]/BoxLayout[0]/BoxLayout[3]/RV[0]')
# SELECT
self.cli.wait_click(u'/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Create[0]/DropDownWidget[1]/ScrollView[0]/BoxLayout[0]/MDTextField[2]')
# BODY
self.cli.wait_click(u'/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Create[0]/DropDownWidget[1]/ScrollView[0]/BoxLayout[0]/MDTextField[1]')
if __name__ == '__main__':
TeleniumTestCase.start_process()
TestBitMessageApp().runTest()
TestBitMessageApp().test_press_button()
TestBitMessageApp().test_next_button()