diff --git a/.travis-kivy.yml b/.travis-kivy.yml index 87c196a3..074aa6f8 100644 --- a/.travis-kivy.yml +++ b/.travis-kivy.yml @@ -13,5 +13,6 @@ addons: install: - pip3 install -r kivy-requirements.txt - python setup.py install + - export PYTHONWARNINGS=all script: - xvfb-run python3 tests-kivy.py diff --git a/setup.py b/setup.py index 2bf2aa2d..5ebace50 100644 --- a/setup.py +++ b/setup.py @@ -70,9 +70,11 @@ if __name__ == "__main__": 'pybitmessage.plugins', 'pybitmessage.pyelliptic', 'pybitmessage.storage', - 'pybitmessage.bitmessagekivy', ] + if sys.version_info[0] == 3: + packages.append('pybitmessage.bitmessagekivy') + # this will silently accept alternative providers of msgpack # if they are already installed diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 4f85e806..d999d6f3 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -13,7 +13,6 @@ class NavigateApp(App): def build(self): """Method builds the widget""" # pylint: disable=no-self-use - return Label(text="Hello World !") def clickNavDrawer(self): diff --git a/src/bitmessagekivy/tests/common.py b/src/bitmessagekivy/tests/common.py index 18f3bb00..4dee828a 100644 --- a/src/bitmessagekivy/tests/common.py +++ b/src/bitmessagekivy/tests/common.py @@ -3,6 +3,8 @@ This module is used for running test cases ui order. """ import unittest +from pybitmessage import state + def make_ordered_test(): """this method is for compairing and arranging in order""" @@ -22,3 +24,14 @@ def make_ordered_test(): ordered, compare = make_ordered_test() unittest.defaultTestLoader.sortTestMethodsUsing = compare + + +def skip_screen_checks(x): + """This methos is skipping current screen checks""" + def inner(y): + """Inner function""" + if not state.isKivyworking: + return unittest.skip('Kivy is not working') + else: + x(y) + return inner diff --git a/src/bitmessagekivy/tests/test_addressbook.py b/src/bitmessagekivy/tests/test_addressbook.py index 20be1c0a..eb92f027 100644 --- a/src/bitmessagekivy/tests/test_addressbook.py +++ b/src/bitmessagekivy/tests/test_addressbook.py @@ -1,5 +1,5 @@ from .telenium_process import TeleniumTestProcess -from .common import ordered +from .common import ordered, skip_screen_checks data = [ 'BM-2cWmjntZ47WKEUtocrdvs19y5CivpKoi1h', @@ -10,16 +10,18 @@ data = [ class AddressBook(TeleniumTestProcess): """AddressBook Screen Functionality Testing""" + @skip_screen_checks @ordered def test_save_address(self): """Save Address On Address Book Screen/Window""" print("=====================Test -Save Address In Address Book=====================") self.cli.sleep(6) - self.cli.execute('app.clickNavDrawer()') + self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') self.cli.sleep(4) self.cli.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]", 1) self.cli.sleep(3) self.cli.click_on('//NavigationItem[6]') + self.assertExists("//AddressBook[@name~=\"addressbook\"]", timeout=0) self.cli.sleep(4) self.cli.execute('app.addingtoaddressbook()') self.cli.sleep(3) @@ -53,7 +55,10 @@ class AddressBook(TeleniumTestProcess): self.cli.sleep(3) self.cli.click_on('//MDRaisedButton[0]') self.cli.sleep(4) + address_book_msgs = len(self.cli.select("//SwipeToDeleteItem")) + self.assertEqual(address_book_msgs, 1) + @skip_screen_checks @ordered def test_cancel_addressbook_popup(self): """Cancel Address""" @@ -66,7 +71,9 @@ class AddressBook(TeleniumTestProcess): self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[1]', 'text', data[0]) self.cli.sleep(3) self.cli.click_on('//MDRaisedButton[1]') + self.assertExists("//AddressBook[@name~=\"addressbook\"]", timeout=1) + @skip_screen_checks @ordered def test_send_message_to_addressbook(self): """Directly Send Message To The User""" @@ -76,6 +83,7 @@ class AddressBook(TeleniumTestProcess): '//AddressBook/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/SwipeToDeleteItem[0]') self.cli.sleep(3) self.cli.click_on('//MDRaisedButton[0]') + self.assertExists("//Create[@name~=\"create\"]", timeout=1) self.cli.sleep(3) self.cli.click_on( '//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]') @@ -91,16 +99,19 @@ class AddressBook(TeleniumTestProcess): '//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]', 'text', random_label) self.cli.sleep(0.2) self.cli.click_on('//MDActionTopAppBarButton[2]') - self.cli.sleep(2) + self.cli.sleep(4) + self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=1) + @skip_screen_checks @ordered def test_delete_address_from_address_contact(self): """Delete Address From Address Book""" print("=====================Test -Delete Address From Address Book=====================") - self.cli.sleep(3) - self.cli.execute('app.clickNavDrawer()') + self.cli.sleep(2) + self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') self.cli.sleep(3) self.cli.click_on('//NavigationItem[6]') + self.assertExists("//AddressBook[@name~=\"addressbook\"]", timeout=1) self.cli.sleep(3) self.cli.drag( '//MDList[0]/SwipeToDeleteItem[0]//TwoLineAvatarIconListItem[0]/BoxLayout[1]', @@ -108,4 +119,4 @@ class AddressBook(TeleniumTestProcess): self.cli.click_on('//MDList[0]/SwipeToDeleteItem[0]') self.cli.sleep(2) self.cli.click_on('//MDList[0]/SwipeToDeleteItem[0]//MDIconButton[0]') - self.cli.sleep(2) + self.assertExists("//AddressBook[@name~=\"addressbook\"]", timeout=2) diff --git a/src/bitmessagekivy/tests/test_allmail_message.py b/src/bitmessagekivy/tests/test_allmail_message.py index 0c34e474..1f82d349 100644 --- a/src/bitmessagekivy/tests/test_allmail_message.py +++ b/src/bitmessagekivy/tests/test_allmail_message.py @@ -1,20 +1,23 @@ from .telenium_process import TeleniumTestProcess -from .common import ordered +from .common import ordered, skip_screen_checks class AllMailMessage(TeleniumTestProcess): """AllMail Screen Functionality Testing""" + @skip_screen_checks @ordered def test_show_allmail_list(self): """Show All Messages on Mail Screen/Window""" print("=====================Test -Show Messages Of Mail Screen=====================") self.cli.sleep(5) - self.cli.execute('app.clickNavDrawer()') + self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') self.cli.sleep(4) self.cli.click_on('//NavigationItem[5]') self.cli.sleep(4) + self.assertExists("//Allmails[@name~=\"allmails\"]", timeout=2) + @skip_screen_checks @ordered def test_delete_message_from_allmail_list(self): """Delete Message From Message body of Mail Screen/Window""" @@ -22,6 +25,8 @@ class AllMailMessage(TeleniumTestProcess): self.cli.sleep(4) self.cli.click_on( '//Allmails[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/CutsomSwipeToDeleteItem[0]') + self.assertExists("//MailDetail[@name~=\"mailDetail\"]", timeout=0) self.cli.sleep(5) self.cli.click_on('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[1]') self.cli.sleep(5) + self.assertExists("//Allmails[@name~=\"allmails\"]", timeout=0) diff --git a/src/bitmessagekivy/tests/test_create_random_address.py b/src/bitmessagekivy/tests/test_create_random_address.py index 54e20f87..780f3591 100644 --- a/src/bitmessagekivy/tests/test_create_random_address.py +++ b/src/bitmessagekivy/tests/test_create_random_address.py @@ -2,7 +2,7 @@ import os import tempfile from .telenium_process import TeleniumTestProcess, cleanup -from .common import ordered +from .common import ordered, skip_screen_checks from random import choice from string import ascii_lowercase @@ -12,21 +12,24 @@ class CreateRandomAddress(TeleniumTestProcess): @classmethod def setUpClass(cls): - """overriding setupclass for cleaning temp storage.""" # pylint: disable=bad-super-call os.environ["BITMESSAGE_HOME"] = tempfile.gettempdir() cleanup() super(TeleniumTestProcess, cls).setUpClass() + @skip_screen_checks @ordered def test_login_screen(self): """Clicking on Proceed Button to Proceed to Next Screen.""" print("=====================Test - Login Screen=====================") self.cli.sleep(3) + self.assertExists("//Login[@name~=\"login\"]", timeout=1) self.cli.wait_click( '//ScreenManager[0]/Screen[0]/BoxLayout[0]/AnchorLayout[3]/MDFillRoundFlatIconButton[0]') self.cli.sleep(3) + self.assertExists("//Random[@name~=\"random\"]", timeout=1) + @skip_screen_checks @ordered def test_random_screen(self): """Creating New Adress For New User.""" @@ -45,30 +48,36 @@ class CreateRandomAddress(TeleniumTestProcess): self.cli.sleep(1) self.cli.wait_click('//RandomBoxlayout/BoxLayout[0]/AnchorLayout[2]/MDFillRoundFlatIconButton[0]') self.cli.sleep(5) + self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=3) + @skip_screen_checks @ordered def test_create_new_address(self): """Clicking on Navigation Drawer To Open New Address""" print("=====================Test - Create New Address=====================") self.cli.sleep(5) - self.cli.execute('app.root.ids.nav_drawer.set_state("toggle")') + # self.cli.execute('app.root.ids.nav_drawer.set_state("toggle")') + self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') self.cli.sleep(2) self.cli.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]", 1) self.cli.sleep(3) self.cli.click_on('//NavigationItem[9]') + self.assertExists("//Login[@name~=\"login\"]", timeout=1) self.cli.sleep(4) self.cli.wait_click( '''//Login/BoxLayout[0]/BoxLayout[0]/ScreenManager[0]/Screen[0]/BoxLayout[0]/AnchorLayout[3]''' '''/MDFillRoundFlatIconButton[0]''') + self.assertExists("//Random[@name~=\"random\"]", timeout=1) self.test_random_screen() + @skip_screen_checks @ordered def test_select_address(self): """Select First Address From Drawer-Box""" print("=====================Test - Select First Address From Drawer-Box=======================") self.cli.sleep(3) # self.cli.execute('app.root.ids.nav_drawer.set_state("toggle")') - self.cli.execute('app.clickNavDrawer()') + self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') self.cli.sleep(2) self.cli.drag("//NavigationItem[@text=\"Address Book\"]", "//NavigationItem[@text=\"Settings\"]", 1) self.cli.sleep(2) @@ -76,3 +85,4 @@ class CreateRandomAddress(TeleniumTestProcess): self.cli.sleep(2) self.cli.click_on('//MySpinnerOption[0]') self.cli.sleep(3) + self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=1) diff --git a/src/bitmessagekivy/tests/test_draft_message.py b/src/bitmessagekivy/tests/test_draft_message.py index 4e4467e9..6bb98c65 100644 --- a/src/bitmessagekivy/tests/test_draft_message.py +++ b/src/bitmessagekivy/tests/test_draft_message.py @@ -1,10 +1,11 @@ from .telenium_process import TeleniumTestProcess -from .common import ordered +from .common import ordered, skip_screen_checks class DraftMessage(TeleniumTestProcess): """Draft Screen Functionality Testing""" + @skip_screen_checks @ordered def test_save_draft_message(self): """Select A Draft Screen From Navigaion-Drawer-Box Then @@ -12,13 +13,15 @@ class DraftMessage(TeleniumTestProcess): print("=====================Test - Select A Draft Screen From Navigaion-Drawer-Box=====================") # OPEN NAVIGATION-DRAWER self.cli.sleep(4) - self.cli.execute('app.clickNavDrawer()') + self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') self.cli.sleep(2) # OPEN INBOX SCREEN self.cli.click_on('//NavigationItem[1]') + self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=2) self.cli.sleep(2) # CLICK ON PLUS ICON BUTTON self.cli.click_on('//Inbox/ComposerButton[0]/MDFloatingActionButton[0]') + self.assertExists("//Create[@name~=\"create\"]", timeout=2) self.cli.sleep(3) # SELECT - TO ADDRESS self.cli.click_on( @@ -32,8 +35,10 @@ class DraftMessage(TeleniumTestProcess): self.cli.sleep(3) # CLICK BACK-BUTTON self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') + self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=2) self.cli.sleep(5) self.cli.click_on('//Inbox/ComposerButton[0]/MDFloatingActionButton[0]') + self.assertExists("//Create[@name~=\"create\"]", timeout=2) self.cli.sleep(3) # SELECT - TO ADDRESS self.cli.click_on( @@ -53,24 +58,29 @@ class DraftMessage(TeleniumTestProcess): # CLICK BACK-BUTTON self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') self.cli.sleep(4) + self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=1) + @skip_screen_checks @ordered 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()') + self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') self.cli.sleep(4) # OPEN DRAFT SCREEN self.cli.click_on('//NavigationItem[3]') + self.assertExists("//Draft[@name~=\"draft\"]", timeout=2) self.cli.sleep(4) # SHOW DRAFT MESSAGE AND SELECT FIRST MESSAGE # self.cli.click_on('//Carousel[0]//TwoLineAvatarIconListItem[0]') self.cli.click_on('//SwipeToDeleteItem[0]//TwoLineAvatarIconListItem[0]') + self.assertExists("//MailDetail[@name~=\"mailDetail\"]", timeout=2) self.cli.sleep(3) # CLICK EDIT BUTTON self.cli.click_on('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[0]') + self.assertExists("//Create[@name~=\"create\"]", timeout=2) self.cli.sleep(5) random_label = "" for char in "Hey,This is draft Message Body": @@ -80,20 +90,25 @@ class DraftMessage(TeleniumTestProcess): self.cli.sleep(0.2) self.cli.sleep(3) self.cli.click_on('//MDActionTopAppBarButton[2]') - self.cli.sleep(5) + # self.cli.sleep(5) + self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=5) + @skip_screen_checks @ordered def test_delete_draft_message(self): """Delete A Message From List of Messages""" print("=====================Test - Delete A Message From List of Messages=====================") self.cli.sleep(5) # self.cli.execute('app.root.ids.nav_drawer.set_state("toggle")') - self.cli.execute('app.clickNavDrawer()') + self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') self.cli.sleep(4) self.cli.click_on('//NavigationItem[3]') + self.assertExists("//Draft[@name~=\"draft\"]", timeout=1) self.cli.sleep(5) self.cli.click_on('//SwipeToDeleteItem[0]//TwoLineAvatarIconListItem[0]') + self.assertExists("//MailDetail[@name~=\"mailDetail\"]", timeout=2) # self.cli.click_on('//Carousel[0]//TwoLineAvatarIconListItem[0]') self.cli.sleep(5) self.cli.click_on('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[1]') self.cli.sleep(5) + self.assertExists("//Draft[@name~=\"draft\"]", timeout=1) diff --git a/src/bitmessagekivy/tests/test_myaddress_screen.py b/src/bitmessagekivy/tests/test_myaddress_screen.py index c017b763..2b3967e5 100644 --- a/src/bitmessagekivy/tests/test_myaddress_screen.py +++ b/src/bitmessagekivy/tests/test_myaddress_screen.py @@ -1,5 +1,5 @@ from .telenium_process import TeleniumTestProcess -from .common import ordered +from .common import ordered, skip_screen_checks data = [ 'BM-2cWmjntZ47WKEUtocrdvs19y5CivpKoi1h', @@ -10,18 +10,21 @@ data = [ class MyAddressScreen(TeleniumTestProcess): """MyAddress Screen Functionality Testing""" + @skip_screen_checks @ordered def test_select_myaddress_list(self): """Select Address From List of Address""" print("=====================Test -Select Address From List of Address=====================") self.cli.sleep(4) - self.cli.execute('app.clickNavDrawer()') + self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') self.cli.sleep(3) self.cli.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]", 1) self.cli.sleep(3) self.cli.click_on('//NavigationItem[11]') self.cli.sleep(4) + self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=2) + @skip_screen_checks @ordered def test_show_Qrcode(self): """Show the Qr code of selected address""" @@ -32,10 +35,13 @@ class MyAddressScreen(TeleniumTestProcess): '''CustomTwoLineAvatarIconListItem[0]''') self.cli.sleep(3) self.cli.click_on('//MyaddDetailPopup/BoxLayout[1]/MDRaisedButton[1]/MDLabel[0]') + self.assertExists("//ShowQRCode[@name~=\"showqrcode\"]", timeout=2) self.cli.sleep(3) self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') self.cli.sleep(3) + self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=2) + @skip_screen_checks @ordered def test_send_message_from(self): """Send Message From Send Message From Button""" @@ -46,6 +52,7 @@ class MyAddressScreen(TeleniumTestProcess): '''CustomTwoLineAvatarIconListItem[0]''') self.cli.sleep(4) self.cli.click_on('//MyaddDetailPopup/BoxLayout[1]/MDRaisedButton[0]/MDLabel[0]') + self.assertExists("//Create[@name~=\"create\"]", timeout=2) self.cli.sleep(3) self.cli.setattr( '//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/BoxLayout[0]/MyTextInput', "text", data[1]) @@ -61,3 +68,4 @@ class MyAddressScreen(TeleniumTestProcess): self.cli.sleep(2) self.cli.click_on('//MDActionTopAppBarButton[2]') self.cli.sleep(4) + self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=2) diff --git a/src/bitmessagekivy/tests/test_network_screen.py b/src/bitmessagekivy/tests/test_network_screen.py index d0ab7ce5..1f267304 100644 --- a/src/bitmessagekivy/tests/test_network_screen.py +++ b/src/bitmessagekivy/tests/test_network_screen.py @@ -1,15 +1,18 @@ +# pylint: disable=too-few-public-methods + from .telenium_process import TeleniumTestProcess +from .common import skip_screen_checks class NetwrokStatusScreen(TeleniumTestProcess): """NetwrokStatus Screen Functionality Testing""" - # pylint: disable=too-few-public-methods + @skip_screen_checks def test_network_status(self): """Show NetwrokStatus""" print("=====================Test -Show NetwrokStatus=====================") self.cli.sleep(4) - self.cli.execute('app.clickNavDrawer()') + self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') self.cli.sleep(3) self.cli.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]", 1) self.cli.sleep(3) @@ -17,3 +20,4 @@ class NetwrokStatusScreen(TeleniumTestProcess): self.cli.sleep(4) self.cli.click_on('//NetworkStat/MDTabs[0]/MDTabsBar[0]/MDTabsScrollView[0]/MDGridLayout[0]/MDTabsLabel[1]') self.cli.sleep(4) + self.assertExists("//NetworkStat[@name~=\"networkstat\"]", timeout=2) diff --git a/src/bitmessagekivy/tests/test_payment_subscription.py b/src/bitmessagekivy/tests/test_payment_subscription.py index 23589a68..42328c45 100644 --- a/src/bitmessagekivy/tests/test_payment_subscription.py +++ b/src/bitmessagekivy/tests/test_payment_subscription.py @@ -1,19 +1,23 @@ +# pylint: disable=too-few-public-methods + from .telenium_process import TeleniumTestProcess +from .common import skip_screen_checks class PaymentScreen(TeleniumTestProcess): """SubscriptionPayment Screen Functionality Testing""" - # pylint: disable=too-few-public-methods + @skip_screen_checks def test_select_subscripton(self): """Select Subscripton From List of Subscriptons""" print("=====================Test -Select Subscripton From List of Subscriptons=====================") self.cli.sleep(4) - self.cli.execute('app.clickNavDrawer()') + self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') self.cli.sleep(3) self.cli.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]", 1) self.cli.sleep(3) self.cli.click_on('//NavigationItem[8]') + self.assertExists("//Payment[@name~=\"payment\"]", timeout=2) self.cli.sleep(3) self.cli.drag( '//Payment/BoxLayout[0]/ScrollView[0]/BoxLayout[0]/ProductCategoryLayout[0]/ProductLayout[1]', @@ -25,3 +29,4 @@ class PaymentScreen(TeleniumTestProcess): self.cli.sleep(2) self.cli.click_on('//MDRaisedButton[3]') self.cli.sleep(2) + self.assertExists("//Payment[@name~=\"payment\"]", timeout=2) diff --git a/src/bitmessagekivy/tests/test_sent_message.py b/src/bitmessagekivy/tests/test_sent_message.py index d15c1809..9abba0f7 100644 --- a/src/bitmessagekivy/tests/test_sent_message.py +++ b/src/bitmessagekivy/tests/test_sent_message.py @@ -1,5 +1,7 @@ +# pylint: disable=too-few-public-methods + from .telenium_process import TeleniumTestProcess -from .common import ordered +from .common import skip_screen_checks data = [ 'BM-2cWmjntZ47WKEUtocrdvs19y5CivpKoi1h', @@ -10,20 +12,22 @@ data = [ class SendMessage(TeleniumTestProcess): """Sent Screen Functionality Testing""" - @ordered + @skip_screen_checks def test_send_message_and_validation(self): """ Sending Message From Inbox Screen opens a pop-up(screen)which send message from sender to reciever """ + # pylint: disable=too-many-statements print("=======Test - Sending Message From Inbox Screen with validation Checks=======") self.cli.sleep(3) - # self.cli.execute('app.root.ids.nav_drawer.set_state("toggle")') - self.cli.execute('app.clickNavDrawer()') + self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') self.cli.sleep(2) self.cli.click_on('//NavigationItem[1]') + self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=2) self.cli.sleep(2) self.cli.click_on('//Inbox/ComposerButton[0]/MDFloatingActionButton[0]') + self.assertExists("//Create[@name~=\"create\"]", timeout=2) self.cli.sleep(3) self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/MyMDTextField[0]') self.cli.sleep(3) @@ -67,42 +71,9 @@ class SendMessage(TeleniumTestProcess): self.cli.sleep(3) self.cli.click_on('//MDActionTopAppBarButton[2]') self.cli.sleep(3) - - @ordered - 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=====================") - self.cli.sleep(3) - # self.cli.execute('app.root.ids.nav_drawer.set_state("toggle")') - self.cli.execute('app.clickNavDrawer()') - self.cli.sleep(5) - self.cli.click_on('//NavigationItem[1]') - self.cli.sleep(3) - self.cli.click_on('//Inbox/ComposerButton[0]/MDFloatingActionButton[0]') - self.cli.sleep(3) - self.cli.click_on( - '//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]') - self.cli.sleep(2) - self.cli.click_on('//MyTextInput[0]') - self.cli.sleep(3) - self.cli.setattr( - '//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/BoxLayout[0]/MyTextInput[0]', "text", data[0]) - self.cli.sleep(3) - self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', 'text', 'Second') - 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) - self.cli.sleep(0.2) - self.cli.sleep(2) - self.cli.click_on('//MDActionTopAppBarButton[2]') - self.cli.sleep(5) - self.cli.execute('app.clickNavDrawer()') + self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') self.cli.sleep(3) self.cli.click_on('//NavigationItem[2]') self.cli.sleep(3) + # total_sent_msgs = len(self.cli.select("//SwipeToDeleteItem")) + self.assertEqual(len(self.cli.select("//SwipeToDeleteItem")), 2) diff --git a/src/bitmessagekivy/tests/test_setting_screen.py b/src/bitmessagekivy/tests/test_setting_screen.py index af99139e..20fca257 100644 --- a/src/bitmessagekivy/tests/test_setting_screen.py +++ b/src/bitmessagekivy/tests/test_setting_screen.py @@ -1,17 +1,22 @@ +# pylint: disable=too-few-public-methods + from .telenium_process import TeleniumTestProcess +from .common import skip_screen_checks class SettingScreen(TeleniumTestProcess): """Setting Screen Functionality Testing""" - # pylint: disable=too-few-public-methods + @skip_screen_checks def test_setting_screen(self): """Show Setting Screen""" print("=====================Test -Show Setting Screen=====================") self.cli.sleep(3) - self.cli.execute('app.clickNavDrawer()') + # self.cli.wait_click("//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]", timeout=20) + self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') self.cli.sleep(3) self.cli.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]", 1) self.cli.sleep(3) self.cli.click_on('//NavigationItem[7]') - self.cli.sleep(4) + self.cli.sleep(2) + self.assertExists("//Setting[@name~=\"set\"]", timeout=2) diff --git a/src/bitmessagekivy/tests/test_trash_message.py b/src/bitmessagekivy/tests/test_trash_message.py index e30362ec..d2af6bc7 100644 --- a/src/bitmessagekivy/tests/test_trash_message.py +++ b/src/bitmessagekivy/tests/test_trash_message.py @@ -1,17 +1,21 @@ +# pylint: disable=too-few-public-methods + from .telenium_process import TeleniumTestProcess +from .common import skip_screen_checks class TrashMessage(TeleniumTestProcess): """Trash Screen Functionality Testing""" - # pylint: disable=too-few-public-methods + @skip_screen_checks def test_delete_trash_message(self): """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()') + self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') self.cli.sleep(4) self.cli.click_on('//NavigationItem[4]') + self.assertExists("//Trash[@name~=\"trash\"]", timeout=2) self.cli.sleep(4) self.cli.drag( '//MDList[0]/CutsomSwipeToDeleteItem[0]//TwoLineAvatarIconListItem[0]/BoxLayout[1]', @@ -22,4 +26,6 @@ class TrashMessage(TeleniumTestProcess): self.cli.sleep(2) self.cli.click_on('//MDDialog/MDCard[0]/AnchorLayout[0]/MDBoxLayout[0]/MDFlatButton[0]') # self.cli.click_on('//MDDialog/DialogFakeCard[0]/AnchorLayout[0]/MDBoxLayout[0]/MDFlatButton[0]') - self.cli.sleep(4) + self.cli.sleep(2) + total_trash_msgs = len(self.cli.select("//CutsomSwipeToDeleteItem")) + self.assertEqual(total_trash_msgs, 1) diff --git a/src/bmconfigparser.py b/src/bmconfigparser.py index c969d8fb..7e82ae89 100644 --- a/src/bmconfigparser.py +++ b/src/bmconfigparser.py @@ -10,8 +10,12 @@ from datetime import datetime from six import string_types from six.moves import configparser -from pybitmessage import state -from pybitmessage.singleton import Singleton +try: + import state + from singleton import Singleton +except ImportError: + from pybitmessage import state + from pybitmessage.singleton import Singleton SafeConfigParser = configparser.SafeConfigParser diff --git a/src/state.py b/src/state.py index b844bdd3..b3f52031 100644 --- a/src/state.py +++ b/src/state.py @@ -68,3 +68,5 @@ ackdataForWhichImWatching = {} thisapp = None """Singleton instance""" + +isKivyworking = False