From d62d464b61a8b6fc433074d1660e6c92136948b0 Mon Sep 17 00:00:00 2001 From: navjot Date: Fri, 12 Mar 2021 00:18:09 +0530 Subject: [PATCH] worked on removing time.sleep methods from all the test cases --- src/bitmessagekivy/tests/telenium_process.py | 1 + src/bitmessagekivy/tests/test_addressbook.py | 72 ++++++++-------- .../tests/test_allmail_message.py | 17 ++-- .../tests/test_create_random_address.py | 34 ++++---- .../tests/test_draft_message.py | 57 +++++++------ .../tests/test_myaddress_screen.py | 33 ++++---- .../tests/test_network_screen.py | 11 ++- .../tests/test_payment_subscription.py | 17 ++-- src/bitmessagekivy/tests/test_sent_message.py | 83 +++++++++---------- .../tests/test_setting_screen.py | 13 +-- .../tests/test_trash_message.py | 17 ++-- 11 files changed, 169 insertions(+), 186 deletions(-) diff --git a/src/bitmessagekivy/tests/telenium_process.py b/src/bitmessagekivy/tests/telenium_process.py index 9d351f94..bf544dce 100644 --- a/src/bitmessagekivy/tests/telenium_process.py +++ b/src/bitmessagekivy/tests/telenium_process.py @@ -3,6 +3,7 @@ import shutil import tempfile from telenium.tests import TeleniumTestCase +from threads import addressGenerator, sqlThread _files = ( diff --git a/src/bitmessagekivy/tests/test_addressbook.py b/src/bitmessagekivy/tests/test_addressbook.py index dcff126a..294ea37b 100644 --- a/src/bitmessagekivy/tests/test_addressbook.py +++ b/src/bitmessagekivy/tests/test_addressbook.py @@ -13,92 +13,92 @@ class AddressBook(TeleniumTestProcess): def test_save_address(self): """Save Address On Address Book Screen/Window""" print("=====================Test -Save Address In Address Book=====================") - time.sleep(6) + self.cli.sleep(6) self.cli.execute('app.clickNavDrawer()') - time.sleep(4) + self.cli.sleep(4) self.cli.drag("//NavigationItem[@text=\"Sent\"]","//NavigationItem[@text=\"Inbox\"]",1) - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//NavigationItem[6]') - time.sleep(4) + self.cli.sleep(4) self.cli.execute('app.addingtoaddressbook()') - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//GrashofPopup/BoxLayout[0]/MDTextField[0]') - time.sleep(4) + self.cli.sleep(4) self.cli.click_on('//GrashofPopup/BoxLayout[0]/MDTextField[1]') - time.sleep(4) + self.cli.sleep(4) self.cli.click_on('//MDRaisedButton[0]') - time.sleep(4) + self.cli.sleep(4) self.cli.click_on('//GrashofPopup/BoxLayout[0]/MDTextField[0]') - time.sleep(3) + self.cli.sleep(3) self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[0]','text','peter') - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//MDRaisedButton[0]') - time.sleep(4) + self.cli.sleep(4) self.cli.click_on('//GrashofPopup/BoxLayout[0]/MDTextField[1]') - time.sleep(3) + self.cli.sleep(3) self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[1]','text','sectorAppartment') - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//MDRaisedButton[0]') - time.sleep(5) + self.cli.sleep(5) self.cli.click_on('//GrashofPopup/BoxLayout[0]/MDTextField[1]') - time.sleep(3) + self.cli.sleep(3) self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[1]','text',data[0]) - time.sleep(3) + self.cli.sleep(3) self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[1]','text','') - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//MDRaisedButton[0]') - time.sleep(4) + self.cli.sleep(4) self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[1]','text','BM-2cX78L9CZpb6GGC3rRVizYiUBwHELMLybd') - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//MDRaisedButton[0]') - time.sleep(4) + self.cli.sleep(4) @ordered def test_cancel_address(self): """Cancel Address""" print("=====================Test -Cancel Address=====================") - time.sleep(3) + self.cli.sleep(3) self.cli.execute('app.addingtoaddressbook()') - time.sleep(3) + self.cli.sleep(3) self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[0]','text','prachi') - time.sleep(3) + self.cli.sleep(3) self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[1]','text',data[0]) - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//MDRaisedButton[1]') @ordered def test_send_message_to_addressbook(self): """Directly Send Message To The User""" print("=====================Test -Directly Send Message To The User=====================") - time.sleep(4) + self.cli.sleep(4) self.cli.click_on('//AddressBook/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]') - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//MDRaisedButton[0]') - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]') - time.sleep(2) + self.cli.sleep(2) self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/BoxLayout[0]/MyTextInput[0]') - time.sleep(3) + self.cli.sleep(3) self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', 'text', 'Second') - time.sleep(3) + self.cli.sleep(3) random_label="" for char in "Hey This is Message From Address Book": random_label += char self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]', 'text', random_label) - time.sleep(0.2) + self.cli.sleep(0.2) self.cli.click_on('//MDIconButton[2]') - time.sleep(2) + self.cli.sleep(2) @ordered def test_delete_address_from_address_contact(self): """Delete Address From Address Book""" print("=====================Test -Delete Address From Address Book=====================") - time.sleep(3) + self.cli.sleep(3) self.cli.execute('app.clickNavDrawer()') - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//NavigationItem[6]') - time.sleep(3) + self.cli.sleep(3) self.cli.drag('//AddressBook/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]//TwoLineAvatarIconListItem[0]/BoxLayout[0]', '//AddressBook/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]', 2) - time.sleep(2) + self.cli.sleep(2) self.cli.click_on('//AddressBook/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]//Button[0]') diff --git a/src/bitmessagekivy/tests/test_allmail_message.py b/src/bitmessagekivy/tests/test_allmail_message.py index 71003a59..c88bc9fe 100644 --- a/src/bitmessagekivy/tests/test_allmail_message.py +++ b/src/bitmessagekivy/tests/test_allmail_message.py @@ -1,4 +1,3 @@ -import time from bitmessagekivy.tests.telenium_process import TeleniumTestProcess from .common import ordered @@ -7,21 +6,21 @@ class AllMailMessage(TeleniumTestProcess): """AllMail Screen Functionality Testing""" @ordered - def test_select_all_mails(self): + def test_show_allmail_list(self): """Show All Messages on Mail Screen/Window""" print("=====================Test -Show Messages Of Mail Screen=====================") - time.sleep(5) + self.cli.sleep(5) self.cli.execute('app.clickNavDrawer()') - time.sleep(4) + self.cli.sleep(4) self.cli.click_on('//NavigationItem[5]') - time.sleep(4) + self.cli.sleep(4) @ordered - def test_delete_message_from_draft(self): + def test_delete_message_from_allmail_list(self): """Delete Message From Message body of Mail Screen/Window""" print("=====================Test -Delete Messages Of Mail Screen=====================") - time.sleep(4) + self.cli.sleep(4) self.cli.click_on('//Allmails[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]') - time.sleep(5) + self.cli.sleep(5) self.cli.click_on('//MDToolbar/BoxLayout[2]/MDIconButton[1]') - time.sleep(3) + self.cli.sleep(3) diff --git a/src/bitmessagekivy/tests/test_create_random_address.py b/src/bitmessagekivy/tests/test_create_random_address.py index f97b378c..32e4cffd 100644 --- a/src/bitmessagekivy/tests/test_create_random_address.py +++ b/src/bitmessagekivy/tests/test_create_random_address.py @@ -1,6 +1,5 @@ import os import tempfile -import time from bitmessagekivy.tests.telenium_process import TeleniumTestProcess, cleanup from .common import ordered @@ -12,7 +11,6 @@ class CreateRandomAddress(TeleniumTestProcess): @classmethod def setUpClass(cls): - print('ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ', __file__) os.environ["BITMESSAGE_HOME"] = tempfile.gettempdir() cleanup() super(TeleniumTestProcess, cls).setUpClass() @@ -21,40 +19,40 @@ class CreateRandomAddress(TeleniumTestProcess): def test_login_screen(self): """Clicking on Proceed Button to Proceed to Next Screen.""" print("=====================Test - Login Screen=====================") - time.sleep(3) + self.cli.sleep(3) self.cli.wait_click('//Login/BoxLayout[0]/BoxLayout[0]/ScreenManager[0]/Screen[0]/BoxLayout[0]/AnchorLayout[3]/MDFillRoundFlatIconButton[0]') - time.sleep(3) + self.cli.sleep(3) @ordered def test_random_screen(self): """Creating New Adress For New User.""" print("=====================Test - Create New Address=====================") self.cli.click_on('//RandomBoxlayout/BoxLayout[0]/AnchorLayout[1]/MDTextField[0]') - time.sleep(3) + self.cli.sleep(3) self.cli.wait_click('//RandomBoxlayout/BoxLayout[0]/AnchorLayout[2]/MDFillRoundFlatIconButton[0]') - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//RandomBoxlayout/BoxLayout[0]/AnchorLayout[1]/MDTextField[0]') - time.sleep(3) + self.cli.sleep(3) random_label = "" for _ in range(10): random_label += choice(ascii_lowercase) self.cli.setattr('//RandomBoxlayout/BoxLayout[0]/AnchorLayout[1]/MDTextField[0]', "text", random_label) - time.sleep(0.2) - time.sleep(1) + self.cli.sleep(0.2) + self.cli.sleep(1) self.cli.wait_click('//RandomBoxlayout/BoxLayout[0]/AnchorLayout[2]/MDFillRoundFlatIconButton[0]') - time.sleep(5) + self.cli.sleep(5) @ordered def test_create_new_address(self): """Clicking on Navigation Drawer To Open New Address""" print("=====================Test - Create New Address=====================") - time.sleep(5) + self.cli.sleep(5) self.cli.execute('app.root.ids.nav_drawer.set_state("toggle")') - time.sleep(2) + self.cli.sleep(2) self.cli.drag("//NavigationItem[@text=\"Sent\"]","//NavigationItem[@text=\"Inbox\"]",1) - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//NavigationItem[9]') - time.sleep(4) + self.cli.sleep(4) self.cli.wait_click('//Login/BoxLayout[0]/BoxLayout[0]/ScreenManager[0]/Screen[0]/BoxLayout[0]/AnchorLayout[3]/MDFillRoundFlatIconButton[0]') self.test_random_screen() @@ -62,12 +60,12 @@ class CreateRandomAddress(TeleniumTestProcess): def test_select_address(self): """Select First Address From Drawer-Box""" print("=====================Test - Select First Address From Drawer-Box=======================") - time.sleep(3) + self.cli.sleep(3) # self.cli.execute('app.root.ids.nav_drawer.set_state("toggle")') self.cli.execute('app.clickNavDrawer()') - time.sleep(2) + self.cli.sleep(2) self.cli.drag("//NavigationItem[@text=\"Address Book\"]","//NavigationItem[@text=\"Settings\"]",1) - time.sleep(2) + self.cli.sleep(2) self.cli.click_on('//NavigationItem[0]') - time.sleep(2) + self.cli.sleep(2) self.cli.click_on('//MySpinnerOption[0]') diff --git a/src/bitmessagekivy/tests/test_draft_message.py b/src/bitmessagekivy/tests/test_draft_message.py index abbd3880..a08bc3b1 100644 --- a/src/bitmessagekivy/tests/test_draft_message.py +++ b/src/bitmessagekivy/tests/test_draft_message.py @@ -1,4 +1,3 @@ -import time from bitmessagekivy.tests.telenium_process import TeleniumTestProcess from .common import ordered @@ -7,87 +6,87 @@ class DraftMessage(TeleniumTestProcess): """Draft Screen Functionality Testing""" @ordered - def test_select_draft_message(self): + def test_save_draft_message(self): """Select A Draft Screen From Navigaion-Drawer-Box Then Send a drafted message """ print("=====================Test - Select A Draft Screen From Navigaion-Drawer-Box=====================") # OPEN NAVIGATION-DRAWER - time.sleep(4) + self.cli.sleep(4) self.cli.execute('app.clickNavDrawer()') - time.sleep(2) + self.cli.sleep(2) # OPEN INBOX SCREEN self.cli.click_on('//NavigationItem[1]') - time.sleep(2) + self.cli.sleep(2) # CLICK ON PLUS ICON BUTTON self.cli.click_on('//Inbox/ComposerButton[0]/MDFloatingActionButton[0]') - time.sleep(3) + self.cli.sleep(3) # SELECT - TO ADDRESS self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]') - time.sleep(2) + self.cli.sleep(2) self.cli.click_on('//MyTextInput[0]') - time.sleep(3) + self.cli.sleep(3) # ADD FROM MESSAGE self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/BoxLayout[0]/MyTextInput[0]', "text",'BM-2cSsuH1bUWBski8bvdqnK2DivMqQCeQA1J') - time.sleep(3) + self.cli.sleep(3) # CLICK BACK-BUTTON self.cli.click_on('//MDToolbar/BoxLayout[0]/MDIconButton[0]') - time.sleep(5) + self.cli.sleep(5) self.cli.click_on('//Inbox/ComposerButton[0]/MDFloatingActionButton[0]') - time.sleep(3) + self.cli.sleep(3) # SELECT - TO ADDRESS self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]') - time.sleep(1) + self.cli.sleep(1) self.cli.click_on('//MyTextInput[0]') - time.sleep(3) + self.cli.sleep(3) # ADD FROM MESSAGE self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/BoxLayout[0]/MyTextInput[0]', "text",'BM-2cSsuH1bUWBski8bvdqnK2DivMqQCeQA1J') - time.sleep(4) + self.cli.sleep(4) random_label="" for char in "Another Draft message": random_label += char self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', 'text', random_label) - time.sleep(0.2) + self.cli.sleep(0.2) # CLICK BACK-BUTTON self.cli.click_on('//MDToolbar/BoxLayout[0]/MDIconButton[0]') - time.sleep(4) + self.cli.sleep(4) @ordered - def test_edit_draft_messgae(self): + def test_edit_and_resend_draft_messgae(self): """Select A Message From List of Messages Then make changes and send it.""" print("=====================Test - Edit A Message From Draft Screen=====================") # OPEN NAVIGATION-DRAWER self.cli.execute('app.clickNavDrawer()') - time.sleep(4) + self.cli.sleep(4) # OPEN DRAFT SCREEN self.cli.click_on('//NavigationItem[3]') - time.sleep(4) + self.cli.sleep(4) # SHOW DRAFT MESSAGE AND SELECT FIRST MESSAGE self.cli.click_on('//Carousel[0]//TwoLineAvatarIconListItem[0]') - time.sleep(3) + self.cli.sleep(3) # CLICK EDIT BUTTON self.cli.click_on('//MDToolbar/BoxLayout[2]/MDIconButton[0]') - time.sleep(5) + self.cli.sleep(5) random_label="" for char in "Hey,This is draft Message Body": random_label += char self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]', 'text', random_label) - time.sleep(0.2) - time.sleep(3) + self.cli.sleep(0.2) + self.cli.sleep(3) self.cli.click_on('//MDIconButton[2]') - time.sleep(5) + self.cli.sleep(5) @ordered def test_delete_draft_message(self): """Delete A Message From List of Messages""" print("=====================Test - Delete A Message From List of Messages=====================") - time.sleep(5) + self.cli.sleep(5) # self.cli.execute('app.root.ids.nav_drawer.set_state("toggle")') self.cli.execute('app.clickNavDrawer()') - time.sleep(4) + self.cli.sleep(4) self.cli.click_on('//NavigationItem[3]') - time.sleep(5) + self.cli.sleep(5) self.cli.click_on('//Carousel[0]//TwoLineAvatarIconListItem[0]') - time.sleep(5) + self.cli.sleep(5) self.cli.click_on('//MDToolbar/BoxLayout[2]/MDIconButton[1]') - time.sleep(2) + self.cli.sleep(2) diff --git a/src/bitmessagekivy/tests/test_myaddress_screen.py b/src/bitmessagekivy/tests/test_myaddress_screen.py index bf3cd9a9..62261ad9 100644 --- a/src/bitmessagekivy/tests/test_myaddress_screen.py +++ b/src/bitmessagekivy/tests/test_myaddress_screen.py @@ -1,4 +1,3 @@ -import time from bmconfigparser import BMConfigParser from bitmessagekivy.tests.telenium_process import TeleniumTestProcess from .common import ordered @@ -13,44 +12,44 @@ class MyAddressScreen(TeleniumTestProcess): def test_select_myaddress_list(self): """Select Address From List of Address""" print("=====================Test -Select Address From List of Address=====================") - time.sleep(4) + self.cli.sleep(4) self.cli.execute('app.clickNavDrawer()') - time.sleep(3) + self.cli.sleep(3) self.cli.drag("//NavigationItem[@text=\"Sent\"]","//NavigationItem[@text=\"Inbox\"]",1) - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//NavigationItem[11]') - time.sleep(4) + self.cli.sleep(4) @ordered def test_show_Qrcode(self): """Show the Qr code of selected address""" print("=====================Test -Show QR code of selected address=====================") - time.sleep(4) + self.cli.sleep(4) self.cli.click_on('//MyAddress/BoxLayout[0]/FloatLayout[0]/MDScrollViewRefreshLayout[0]/MDList[0]/CustomTwoLineAvatarIconListItem[0]') - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//MyaddDetailPopup/BoxLayout[1]/MDRaisedButton[1]/MDLabel[0]') - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//MDToolbar/BoxLayout[0]/MDIconButton[0]') - time.sleep(3) + self.cli.sleep(3) @ordered def test_send_message_from(self): """Send Message From Send Message From Button""" print("=====================Test -Send Message From Send Message From Button=====================") - time.sleep(4) + self.cli.sleep(4) self.cli.click_on('//MyAddress/BoxLayout[0]/FloatLayout[0]/MDScrollViewRefreshLayout[0]/MDList[0]/CustomTwoLineAvatarIconListItem[0]') - time.sleep(4) + self.cli.sleep(4) self.cli.click_on('//MyaddDetailPopup/BoxLayout[1]/MDRaisedButton[0]/MDLabel[0]') - time.sleep(3) + self.cli.sleep(3) self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/BoxLayout[0]/MyTextInput', "text", data[1]) - time.sleep(3) + self.cli.sleep(3) self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', 'text', 'Hey') - time.sleep(3) + self.cli.sleep(3) random_label="" for char in "Hey,i am sending message directly from MyAddress book": random_label += char self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]', 'text', random_label) - time.sleep(0.2) - time.sleep(2) + self.cli.sleep(0.2) + self.cli.sleep(2) self.cli.click_on('//MDIconButton[2]') - time.sleep(2) + self.cli.sleep(2) diff --git a/src/bitmessagekivy/tests/test_network_screen.py b/src/bitmessagekivy/tests/test_network_screen.py index 78705f67..d0185389 100644 --- a/src/bitmessagekivy/tests/test_network_screen.py +++ b/src/bitmessagekivy/tests/test_network_screen.py @@ -1,4 +1,3 @@ -import time from bitmessagekivy.tests.telenium_process import TeleniumTestProcess @@ -8,12 +7,12 @@ class NetwrokStatusScreen(TeleniumTestProcess): def test_network_status(self): """Show NetwrokStatus""" print("=====================Test -Show NetwrokStatus=====================") - time.sleep(4) + self.cli.sleep(4) self.cli.execute('app.clickNavDrawer()') - time.sleep(3) + self.cli.sleep(3) self.cli.drag("//NavigationItem[@text=\"Sent\"]","//NavigationItem[@text=\"Inbox\"]",1) - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//NavigationItem[10]') - time.sleep(4) + self.cli.sleep(4) self.cli.click_on('//NetworkStat/MDTabs[0]/MDTabsBar[0]/MDTabsScrollView[0]/MDGridLayout[0]/MDTabsLabel[1]') - time.sleep(4) + self.cli.sleep(4) diff --git a/src/bitmessagekivy/tests/test_payment_subscription.py b/src/bitmessagekivy/tests/test_payment_subscription.py index 961839f2..7f8341eb 100644 --- a/src/bitmessagekivy/tests/test_payment_subscription.py +++ b/src/bitmessagekivy/tests/test_payment_subscription.py @@ -1,4 +1,3 @@ -import time from bitmessagekivy.tests.telenium_process import TeleniumTestProcess @@ -8,19 +7,19 @@ class PaymentScreen(TeleniumTestProcess): def test_select_subscripton(self): """Select Subscripton From List of Subscriptons""" print("=====================Test -Select Subscripton From List of Subscriptons=====================") - time.sleep(4) + self.cli.sleep(4) self.cli.execute('app.clickNavDrawer()') - time.sleep(3) + self.cli.sleep(3) self.cli.drag("//NavigationItem[@text=\"Sent\"]","//NavigationItem[@text=\"Inbox\"]",1) - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//NavigationItem[8]') - time.sleep(3) + self.cli.sleep(3) self.cli.drag('//Payment/BoxLayout[0]/ScrollView[0]/BoxLayout[0]/ProductCategoryLayout[0]/ProductLayout[1]', '//Payment/BoxLayout[0]/ScrollView[0]/BoxLayout[0]/ProductCategoryLayout[0]/ProductLayout[0]', 1) - time.sleep(2) + self.cli.sleep(2) self.cli.click_on('//MDRaisedButton[3]') - time.sleep(2) + self.cli.sleep(2) self.cli.click_on('//ListItemWithLabel[0]') - time.sleep(2) + self.cli.sleep(2) self.cli.click_on('//MDRaisedButton[3]') - time.sleep(2) + self.cli.sleep(2) diff --git a/src/bitmessagekivy/tests/test_sent_message.py b/src/bitmessagekivy/tests/test_sent_message.py index 1658c7c7..5cf26005 100644 --- a/src/bitmessagekivy/tests/test_sent_message.py +++ b/src/bitmessagekivy/tests/test_sent_message.py @@ -1,106 +1,101 @@ -import os -import queues -import shutil -import tempfile -import time - from bitmessagekivy.tests.telenium_process import TeleniumTestProcess from bmconfigparser import BMConfigParser from .common import ordered data = BMConfigParser().addresses() + class SendMessage(TeleniumTestProcess): """Sent Screen Functionality Testing""" @ordered - def test_send_message_to_same_address(self): + def test_send_message_and_validation(self): """ Sending Message From Inbox Screen opens a pop-up(screen)which send message from sender to reciever """ print("=====================Test - Sending Message From Inbox Screen=====================") - time.sleep(2) + self.cli.sleep(2) # self.cli.execute('app.root.ids.nav_drawer.set_state("toggle")') self.cli.execute('app.clickNavDrawer()') - time.sleep(1) + self.cli.sleep(2) self.cli.click_on('//NavigationItem[1]') - time.sleep(1) + self.cli.sleep(2) self.cli.click_on('//Inbox/ComposerButton[0]/MDFloatingActionButton[0]') - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/MyMDTextField[0]') - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/MyTextInput[0]') - time.sleep(3) + self.cli.sleep(3) self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/MyTextInput[0]', "text", "second add") - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]') - time.sleep(4) + self.cli.sleep(4) self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]') - time.sleep(4) + self.cli.sleep(4) self.cli.click_on('//MDIconButton[2]') - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//MDFlatButton[0]') - time.sleep(5) + self.cli.sleep(5) self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]') - time.sleep(2) + self.cli.sleep(2) self.cli.click_on('//MyTextInput[0]') - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]') - time.sleep(2) + self.cli.sleep(2) self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', 'text', 'heyyyyyy') - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]') - time.sleep(4) + self.cli.sleep(4) random_label="" for char in "how are you this is message body": random_label += char self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]','text',random_label) - time.sleep(0.2) - time.sleep(3) + self.cli.sleep(0.2) + self.cli.sleep(3) self.cli.click_on('//MDIconButton[2]') - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//MDFlatButton[0]') - time.sleep(6) + self.cli.sleep(6) self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/BoxLayout[0]/MyTextInput[0]',"text", data[0]) - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//MDIconButton[2]') - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//MDFlatButton[0]') - time.sleep(3) + self.cli.sleep(3) @ordered - def test_sent_multiple_message(self): + def test_sent_multiple_messages(self): """ Sending Second Message From Inbox Screen for testing the search and delete functionality for two messages on the screen """ print("=====================Test - Sending Message From Inbox Screen=====================") - time.sleep(3) + self.cli.sleep(3) # self.cli.execute('app.root.ids.nav_drawer.set_state("toggle")') self.cli.execute('app.clickNavDrawer()') - time.sleep(5) + self.cli.sleep(5) self.cli.click_on('//NavigationItem[1]') - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//Inbox/ComposerButton[0]/MDFloatingActionButton[0]') - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]') - time.sleep(2) + self.cli.sleep(2) self.cli.click_on('//MyTextInput[0]') - time.sleep(3) + self.cli.sleep(3) self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/BoxLayout[0]/MyTextInput[0]', "text", data[0]) - time.sleep(3) + self.cli.sleep(3) self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', 'text', 'Second') - time.sleep(3) + self.cli.sleep(3) random_label="" for char in "Hey This Is Second Message Body": random_label += char self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]',"text",random_label) - time.sleep(0.2) - time.sleep(2) + self.cli.sleep(0.2) + self.cli.sleep(2) self.cli.click_on('//MDIconButton[2]') - time.sleep(5) + self.cli.sleep(5) self.cli.execute('app.clickNavDrawer()') - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//NavigationItem[2]') - time.sleep(3) + self.cli.sleep(3) diff --git a/src/bitmessagekivy/tests/test_setting_screen.py b/src/bitmessagekivy/tests/test_setting_screen.py index 0767ddec..b3773cb3 100644 --- a/src/bitmessagekivy/tests/test_setting_screen.py +++ b/src/bitmessagekivy/tests/test_setting_screen.py @@ -1,21 +1,16 @@ -import time from bitmessagekivy.tests.telenium_process import TeleniumTestProcess class SettingScreen(TeleniumTestProcess): """Setting Screen Functionality Testing""" - - # @classmethod - # def setUpClass(cls): - # super(SettingScreen, cls).setUpClass() def test_setting_screen(self): """Show Setting Screen""" print("=====================Test -Show Setting Screen=====================") - time.sleep(4) + self.cli.sleep(3) self.cli.execute('app.clickNavDrawer()') - time.sleep(3) + self.cli.sleep(3) self.cli.drag("//NavigationItem[@text=\"Sent\"]","//NavigationItem[@text=\"Inbox\"]",1) - time.sleep(3) + self.cli.sleep(3) self.cli.click_on('//NavigationItem[7]') - time.sleep(2) + self.cli.sleep(2) diff --git a/src/bitmessagekivy/tests/test_trash_message.py b/src/bitmessagekivy/tests/test_trash_message.py index 5edd6814..ee6c6233 100644 --- a/src/bitmessagekivy/tests/test_trash_message.py +++ b/src/bitmessagekivy/tests/test_trash_message.py @@ -1,4 +1,3 @@ -import time from bitmessagekivy.tests.telenium_process import TeleniumTestProcess @@ -6,17 +5,17 @@ class TrashMessage(TeleniumTestProcess): """Trash Screen Functionality Testing""" def test_delete_trash_message(self): - """Delete Message From List of Message Permanently Of Trash Screen/Window""" - print("=====================Test -Delete Messages Of Trash Screen=====================") - time.sleep(6) + """Delete Trash message permanently from trash message listing""" + print("=====================Test -Delete Message From Trash Message Listing=====================") + self.cli.sleep(4) self.cli.execute('app.clickNavDrawer()') - time.sleep(4) + self.cli.sleep(4) self.cli.click_on('//NavigationItem[4]') - time.sleep(4) + self.cli.sleep(4) self.cli.drag('//Trash/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]//TwoLineAvatarIconListItem[0]/BoxLayout[0]', '//Trash/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]', 2) - time.sleep(4) + self.cli.sleep(4) self.cli.click_on('//Trash/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]//Button[0]') - time.sleep(2) + self.cli.sleep(2) self.cli.click_on('//MDDialog/MDCard[0]/AnchorLayout[0]/MDBoxLayout[0]/MDFlatButton[0]') - time.sleep(4) + self.cli.sleep(4)