From 71468b831876d7865492607cf711913d63a686ac Mon Sep 17 00:00:00 2001 From: prachi Date: Thu, 23 Apr 2020 22:00:15 +0530 Subject: [PATCH] Create Test Case for Trash and AllMail Screen --- src/test_kivy_bitmessgae_app.py | 82 ++++++++++++++++++++------------- src/test_telenium_cases.py | 82 ++++++++++++++++++++++++++++++++- 2 files changed, 132 insertions(+), 32 deletions(-) diff --git a/src/test_kivy_bitmessgae_app.py b/src/test_kivy_bitmessgae_app.py index f213485a..3f65d61f 100644 --- a/src/test_kivy_bitmessgae_app.py +++ b/src/test_kivy_bitmessgae_app.py @@ -36,35 +36,55 @@ if __name__ == '__main__': TeleniumTestCase.start_process() TestBitMessageApp().runTest() print("==================start from first screen=====================") - TestBitMessageApp().test_login_screen() - TestBitMessageApp().test_random_screen() - obj_3=test_telenium_cases.TestCreateNewAddress() - obj_3.test_create_new_address() - TestBitMessageApp().test_random_screen() - obj=test_telenium_cases.TestSelectAddress() - obj.test_select_second_address() - obj.test_select_address() - obj_1=test_telenium_cases.TestSentMessage() - obj_1.test_select_sent() - obj_1.test_sent_multiple_message() - obj_inbox=test_telenium_cases.TestInboxMessage() - obj_inbox.test_select_inbox_of_second_address() - obj_inbox.test_show_inbox_message() - obj_inbox.test_delete_inbox_message() - obj_1.test_show_sent_messgae_list() - obj_1.test_serach_sent_messages() - obj_1.test_show_sent_message_body() - obj_1.test_delete_sent_message_body() - obj_1.test_delete_sent_message_from_list() - obj_1.test_archive_sent_message_from_list() - obj_2=test_telenium_cases.TestDraftMessage() - obj_2.test_select_draft_message() - obj_2.test_edit_draft_messgae() - obj_2.test_delete_draft_message() - obj_5=test_telenium_cases.TestAddressBookContact() - obj_5.test_save_address() - obj_5.test_cancel_address() - obj_5.test_send_message_to_addressbook() - obj_5.test_delete_address_from_address_contact() - + f=open("/home/cis/.config/PyBitmessage/keys.dat") + get_file=f.read() + find_address=get_file.find("label") + print(find_address) + if find_address != -1: + select_address=test_telenium_cases.TestSelectAddress() + select_address.test_check_already_created_address() + select_address.test_calling_all_methods() + sent_message=test_telenium_cases.TestSentMessage() + sent_message.test_select_sent() + sent_message.test_sent_multiple_message() + inbox_message=test_telenium_cases.TestInboxMessage() + inbox_message.test_all_inbox_method() + sent_message.test_all_sent_method() + # sent_message.test_archive_sent_message_from_list() + draft_message=test_telenium_cases.TestDraftMessage() + draft_message.test_all_draft_method() + trash_message=test_telenium_cases.TestTrashMessage() + trash_message.test_delete_trash_message() + all_mails=test_telenium_cases.TestAllMailsMessage() + all_mails.test_select_all_mails() + all_mails.test_delete_message_from_draft() + address_book=test_telenium_cases.TestAddressBookContact() + address_book.test_all_address_book_method() + else : + TestBitMessageApp().test_login_screen() + TestBitMessageApp().test_random_screen() + new_address=test_telenium_cases.TestCreateNewAddress() + new_address.test_create_new_address() + TestBitMessageApp().test_random_screen() + select_address=test_telenium_cases.TestSelectAddress() + select_address.test_calling_all_methods() + sent_message=test_telenium_cases.TestSentMessage() + sent_message.test_select_sent() + sent_message.test_sent_multiple_message() + inbox_message=test_telenium_cases.TestInboxMessage() + inbox_message.test_all_inbox_method() + sent_message.test_all_sent_method() + # sent_message.test_archive_sent_message_from_list() + draft_message=test_telenium_cases.TestDraftMessage() + draft_message.test_all_draft_method() + trash_message=test_telenium_cases.TestTrashMessage() + trash_message.test_delete_trash_message() + all_mails=test_telenium_cases.TestAllMailsMessage() + all_mails.test_select_all_mails() + all_mails.test_delete_message_from_draft() + address_book=test_telenium_cases.TestAddressBookContact() + address_book.test_all_address_book_method() + + + \ No newline at end of file diff --git a/src/test_telenium_cases.py b/src/test_telenium_cases.py index ca71daa5..42a83a9a 100644 --- a/src/test_telenium_cases.py +++ b/src/test_telenium_cases.py @@ -25,6 +25,15 @@ class TestSelectAddress(TeleniumTestCase): def runTest(self): print(self,"-------------Welcome To Kivy Testing Application second Page-------------") + def test_check_already_created_address(self): + time.sleep(6) + self.cli.execute('app.root.toggle_nav_drawer()') + time.sleep(4) + self.cli.drag("//NavigationDrawerSubheader[@text=\"All labels\"]","//NavigationDrawerIconButton[@text=\"All Mails\"]",1) + time.sleep(3) + self.cli.click_on('//NavigationDrawerIconButton[12]') + time.sleep(4) + def test_select_second_address(self): global data time.sleep(5) @@ -40,9 +49,15 @@ class TestSelectAddress(TeleniumTestCase): time.sleep(5) self.cli.click_on('//NavigationDrawerIconButton[0]') time.sleep(5) + self.cli.click_on('//NDBadgeLabel[1]') + time.sleep(5) self.cli.click_on('//NavigationDrawerIconButton[1]') time.sleep(5) + def test_calling_all_methods(self): + self.test_select_second_address() + self.test_select_address() + class TestInboxMessage(TestSelectAddress): def runTest(self): @@ -73,6 +88,11 @@ class TestInboxMessage(TestSelectAddress): self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Inbox[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]/RelativeLayout[1]/Button[0]') time.sleep(4) + def test_all_inbox_method(self): + self.test_select_inbox_of_second_address() + self.test_show_inbox_message() + self.test_delete_inbox_message() + class TestSentMessage(TestSelectAddress): def runTest(self): @@ -135,7 +155,7 @@ class TestSentMessage(TestSelectAddress): time.sleep(2) def test_show_sent_messgae_list(self): - time.sleep(5) + time.sleep(5) self.cli.execute('app.root.toggle_nav_drawer()') time.sleep(5) self.cli.click_on('//NavigationDrawerIconButton[0]') @@ -189,6 +209,13 @@ class TestSentMessage(TestSelectAddress): 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) + def test_all_sent_method(self): + self.test_show_sent_messgae_list() + self.test_serach_sent_messages() + self.test_show_sent_message_body() + self.test_delete_sent_message_body() + self.test_delete_sent_message_from_list() + class TestDraftMessage(TeleniumTestCase): def runTest(self): @@ -270,6 +297,52 @@ class TestDraftMessage(TeleniumTestCase): time.sleep(5) self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/Toolbar[0]/BoxLayout[2]/MDIconButton[1]/MDLabel[0]') time.sleep(2) + + def test_all_draft_method(self): + self.test_select_draft_message() + self.test_edit_draft_messgae() + self.test_delete_draft_message() + +class TestAllMailsMessage(TeleniumTestCase): + + def runTest(self): + print(self,"-------------Welcome To Kivy Testing Application Sixth Page-------------") + + def test_select_all_mails(self): + print("---------------Show All Mails----------------") + time.sleep(5) + self.cli.execute('app.root.toggle_nav_drawer()') + time.sleep(4) + self.cli.click_on('//NavigationDrawerIconButton[5]') + time.sleep(4) + + def test_delete_message_from_draft(self): + print("------------Delete Message From Mails-----------") + time.sleep(4) + self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Allmails[0]/Allmails[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]') + time.sleep(5) + self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/Toolbar[0]/BoxLayout[2]/MDIconButton[0]/MDLabel[0]') + time.sleep(3) + +class TestTrashMessage(TeleniumTestCase): + + def runTest(self): + print(self,"-------------Welcome To Kivy Testing Application Fifth Page-------------") + + def test_delete_trash_message(self): + print("---------Delete Trash Message Permanently-------------------") + time.sleep(6) + # self.cli.click_on('//NavigationDrawerIconButton[4]') + self.cli.execute('app.root.toggle_nav_drawer()') + time.sleep(4) + self.cli.click_on('//NavigationDrawerIconButton[4]') + time.sleep(4) + self.cli.drag('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Trash[0]/Trash[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]/RelativeLayout[1]/CustomTwoLineAvatarIconListItem[0]/BoxLayout[1]/AvatarSampleWidget[0]','/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Trash[0]/Trash[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]/RelativeLayout[1]/CustomTwoLineAvatarIconListItem[0]/BoxLayout[2]',1) + time.sleep(4) + self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Trash[0]/Trash[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]/RelativeLayout[1]/Button[0]') + time.sleep(5) + self.cli.click_on('//MDRaisedButton[0]') + time.sleep(4) class TestAddressBookContact(TeleniumTestCase): @@ -336,3 +409,10 @@ class TestAddressBookContact(TeleniumTestCase): self.cli.drag('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/AddressBook[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]/RelativeLayout[1]/CustomTwoLineAvatarIconListItem[0]/BoxLayout[1]/AvatarSampleWidget[0]','/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/AddressBook[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]/RelativeLayout[1]/CustomTwoLineAvatarIconListItem[0]/BoxLayout[2]',1) time.sleep(2) self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/AddressBook[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]/RelativeLayout[1]/Button[0]') + + def test_all_address_book_method(self): + self.test_save_address() + self.test_cancel_address() + self.test_send_message_to_addressbook() + self.test_delete_address_from_address_contact() +