From ab7ef314ef9887fc17cf542d70f5906612ec13d9 Mon Sep 17 00:00:00 2001 From: navjot Date: Wed, 17 Mar 2021 00:58:14 +0530 Subject: [PATCH] fixed xpaths of telenium test cases --- src/bitmessagekivy/mpybit.py | 12 ------------ src/bitmessagekivy/tests/telenium_process.py | 2 +- src/bitmessagekivy/tests/test_addressbook.py | 3 ++- src/bitmessagekivy/tests/test_allmail_message.py | 4 ++-- .../tests/test_create_random_address.py | 1 + src/bitmessagekivy/tests/test_draft_message.py | 10 +++++----- src/bitmessagekivy/tests/test_myaddress_screen.py | 6 +++--- src/bitmessagekivy/tests/test_sent_message.py | 6 +++--- src/bitmessagekivy/tests/test_trash_message.py | 3 ++- src/bitmessagemain.py | 7 ------- src/main_mock_test.py | 9 --------- src/{bitmessagemain_mock_test.py => main_test.py} | 8 ++++++-- 12 files changed, 25 insertions(+), 46 deletions(-) delete mode 100644 src/main_mock_test.py rename src/{bitmessagemain_mock_test.py => main_test.py} (88%) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 766f8546..bfc625f2 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -1,7 +1,3 @@ -import state -# import tempfile -# state.appdata = tempfile.gettempdir() -print('state.appdata (mpybit.py line no. (1))....................................', state.appdata) # pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument # pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation # pylint: disable=protected-access @@ -25,10 +21,6 @@ from debug import logger from functools import partial from helper_sql import sqlExecute, sqlQuery from kivymd.app import MDApp -import kivy -import kivymd -print('kivy version......................................', kivy.__version__) -print('kivymd version......................................', kivymd.__version__) from kivy.clock import Clock from kivy.core.clipboard import Clipboard from kivy.core.window import Window @@ -910,8 +902,6 @@ class DropDownWidget(BoxLayout): def send(self, navApp): """Send message from one address to another""" - print('in send check state.appdata................................') - print('state.appdata....................................', state.appdata) fromAddress = self.ids.ti.text.strip() toAddress = self.ids.txt_input.text.strip() subject = self.ids.subject.text.strip() @@ -1333,8 +1323,6 @@ class Random(Screen): def generateaddress(self, navApp): """Method for Address Generator""" # entered_label = str(self.ids.lab.text).strip() - print('address creation.........999999999999999999999999999') - print('state.appdata....................................', state.appdata) entered_label = str(self.ids.add_random_bx.children[0].ids.lab.text).strip() if not entered_label: self.ids.add_random_bx.children[0].ids.lab.focus = True diff --git a/src/bitmessagekivy/tests/telenium_process.py b/src/bitmessagekivy/tests/telenium_process.py index bf544dce..eafe0ff3 100644 --- a/src/bitmessagekivy/tests/telenium_process.py +++ b/src/bitmessagekivy/tests/telenium_process.py @@ -38,7 +38,7 @@ def set_temp_data(): class TeleniumTestProcess(TeleniumTestCase): """Setting Screen Functionality Testing""" - cmd_entrypoint = [os.path.join(os.path.abspath(os.getcwd()), 'main_mock_test.py')] + cmd_entrypoint = [os.path.join(os.path.abspath(os.getcwd()), 'main_test.py')] @classmethod def setUpClass(cls): diff --git a/src/bitmessagekivy/tests/test_addressbook.py b/src/bitmessagekivy/tests/test_addressbook.py index 294ea37b..d6d3922b 100644 --- a/src/bitmessagekivy/tests/test_addressbook.py +++ b/src/bitmessagekivy/tests/test_addressbook.py @@ -86,7 +86,7 @@ class AddressBook(TeleniumTestProcess): 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.click_on('//MDIconButton[2]') + self.cli.click_on('//MDActionTopAppBarButton[2]') self.cli.sleep(2) @ordered @@ -102,3 +102,4 @@ class AddressBook(TeleniumTestProcess): '//AddressBook/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]', 2) self.cli.sleep(2) self.cli.click_on('//AddressBook/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]//Button[0]') + self.cli.sleep(2) diff --git a/src/bitmessagekivy/tests/test_allmail_message.py b/src/bitmessagekivy/tests/test_allmail_message.py index c88bc9fe..7efad3f1 100644 --- a/src/bitmessagekivy/tests/test_allmail_message.py +++ b/src/bitmessagekivy/tests/test_allmail_message.py @@ -22,5 +22,5 @@ class AllMailMessage(TeleniumTestProcess): self.cli.sleep(4) self.cli.click_on('//Allmails[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]') self.cli.sleep(5) - self.cli.click_on('//MDToolbar/BoxLayout[2]/MDIconButton[1]') - self.cli.sleep(3) + self.cli.click_on('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[1]') + self.cli.sleep(5) diff --git a/src/bitmessagekivy/tests/test_create_random_address.py b/src/bitmessagekivy/tests/test_create_random_address.py index 32e4cffd..ab91af6d 100644 --- a/src/bitmessagekivy/tests/test_create_random_address.py +++ b/src/bitmessagekivy/tests/test_create_random_address.py @@ -69,3 +69,4 @@ class CreateRandomAddress(TeleniumTestProcess): self.cli.click_on('//NavigationItem[0]') self.cli.sleep(2) self.cli.click_on('//MySpinnerOption[0]') + self.cli.sleep(3) diff --git a/src/bitmessagekivy/tests/test_draft_message.py b/src/bitmessagekivy/tests/test_draft_message.py index a08bc3b1..80c5114b 100644 --- a/src/bitmessagekivy/tests/test_draft_message.py +++ b/src/bitmessagekivy/tests/test_draft_message.py @@ -29,7 +29,7 @@ class DraftMessage(TeleniumTestProcess): self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/BoxLayout[0]/MyTextInput[0]', "text",'BM-2cSsuH1bUWBski8bvdqnK2DivMqQCeQA1J') self.cli.sleep(3) # CLICK BACK-BUTTON - self.cli.click_on('//MDToolbar/BoxLayout[0]/MDIconButton[0]') + self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') self.cli.sleep(5) self.cli.click_on('//Inbox/ComposerButton[0]/MDFloatingActionButton[0]') self.cli.sleep(3) @@ -47,7 +47,7 @@ class DraftMessage(TeleniumTestProcess): self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', 'text', random_label) self.cli.sleep(0.2) # CLICK BACK-BUTTON - self.cli.click_on('//MDToolbar/BoxLayout[0]/MDIconButton[0]') + self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') self.cli.sleep(4) @ordered @@ -65,7 +65,7 @@ class DraftMessage(TeleniumTestProcess): self.cli.click_on('//Carousel[0]//TwoLineAvatarIconListItem[0]') self.cli.sleep(3) # CLICK EDIT BUTTON - self.cli.click_on('//MDToolbar/BoxLayout[2]/MDIconButton[0]') + self.cli.click_on('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[0]') self.cli.sleep(5) random_label="" for char in "Hey,This is draft Message Body": @@ -73,7 +73,7 @@ class DraftMessage(TeleniumTestProcess): self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]', 'text', random_label) self.cli.sleep(0.2) self.cli.sleep(3) - self.cli.click_on('//MDIconButton[2]') + self.cli.click_on('//MDActionTopAppBarButton[2]') self.cli.sleep(5) @ordered @@ -88,5 +88,5 @@ class DraftMessage(TeleniumTestProcess): self.cli.sleep(5) self.cli.click_on('//Carousel[0]//TwoLineAvatarIconListItem[0]') self.cli.sleep(5) - self.cli.click_on('//MDToolbar/BoxLayout[2]/MDIconButton[1]') + self.cli.click_on('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[1]') self.cli.sleep(2) diff --git a/src/bitmessagekivy/tests/test_myaddress_screen.py b/src/bitmessagekivy/tests/test_myaddress_screen.py index 62261ad9..7fd7da3e 100644 --- a/src/bitmessagekivy/tests/test_myaddress_screen.py +++ b/src/bitmessagekivy/tests/test_myaddress_screen.py @@ -29,7 +29,7 @@ class MyAddressScreen(TeleniumTestProcess): self.cli.sleep(3) self.cli.click_on('//MyaddDetailPopup/BoxLayout[1]/MDRaisedButton[1]/MDLabel[0]') self.cli.sleep(3) - self.cli.click_on('//MDToolbar/BoxLayout[0]/MDIconButton[0]') + self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') self.cli.sleep(3) @ordered @@ -51,5 +51,5 @@ class MyAddressScreen(TeleniumTestProcess): 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('//MDIconButton[2]') - self.cli.sleep(2) + self.cli.click_on('//MDActionTopAppBarButton[2]') + self.cli.sleep(4) diff --git a/src/bitmessagekivy/tests/test_sent_message.py b/src/bitmessagekivy/tests/test_sent_message.py index 5cf26005..6e0b8204 100644 --- a/src/bitmessagekivy/tests/test_sent_message.py +++ b/src/bitmessagekivy/tests/test_sent_message.py @@ -15,7 +15,7 @@ class SendMessage(TeleniumTestProcess): opens a pop-up(screen)which send message from sender to reciever """ print("=====================Test - Sending Message From Inbox Screen=====================") - self.cli.sleep(2) + self.cli.sleep(3) # self.cli.execute('app.root.ids.nav_drawer.set_state("toggle")') self.cli.execute('app.clickNavDrawer()') self.cli.sleep(2) @@ -61,7 +61,7 @@ class SendMessage(TeleniumTestProcess): self.cli.sleep(3) self.cli.click_on('//MDIconButton[2]') self.cli.sleep(3) - self.cli.click_on('//MDFlatButton[0]') + self.cli.click_on('//MDActionTopAppBarButton[2]') self.cli.sleep(3) @ordered @@ -93,7 +93,7 @@ class SendMessage(TeleniumTestProcess): 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('//MDIconButton[2]') + self.cli.click_on('//MDActionTopAppBarButton[2]') self.cli.sleep(5) self.cli.execute('app.clickNavDrawer()') self.cli.sleep(3) diff --git a/src/bitmessagekivy/tests/test_trash_message.py b/src/bitmessagekivy/tests/test_trash_message.py index ee6c6233..08c27fd4 100644 --- a/src/bitmessagekivy/tests/test_trash_message.py +++ b/src/bitmessagekivy/tests/test_trash_message.py @@ -17,5 +17,6 @@ class TrashMessage(TeleniumTestProcess): self.cli.sleep(4) self.cli.click_on('//Trash/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]//Button[0]') self.cli.sleep(2) - self.cli.click_on('//MDDialog/MDCard[0]/AnchorLayout[0]/MDBoxLayout[0]/MDFlatButton[0]') + # 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) diff --git a/src/bitmessagemain.py b/src/bitmessagemain.py index 32b7a92b..2f609074 100755 --- a/src/bitmessagemain.py +++ b/src/bitmessagemain.py @@ -150,9 +150,6 @@ class Main(object): def start(self): """Start main application""" # pylint: disable=too-many-statements,too-many-branches,too-many-locals - # import tempfile - # state.appdata = tempfile.gettempdir() - # print('line BABAL..........................153(state.appdata)...', state.appdata) _fixSocket() adjustHalfOpenConnectionsLimit() @@ -168,7 +165,6 @@ class Main(object): self.usage() sys.exit(2) - print('opts......................', opts) for opt, _ in opts: if opt in ("-h", "--help"): self.usage() @@ -259,9 +255,6 @@ class Main(object): singleWorkerThread.start() # Start the SQL thread - # import tempfile - # state.appdata = tempfile.gettempdir() - print('state.appdata (bitmessagemain)..........................(258)', state.appdata) sqlLookup = sqlThread() # DON'T close the main program even if there are threads left. # The closeEvent should command this thread to exit gracefully. diff --git a/src/main_mock_test.py b/src/main_mock_test.py deleted file mode 100644 index edd9ef3f..00000000 --- a/src/main_mock_test.py +++ /dev/null @@ -1,9 +0,0 @@ -"""This module is for thread start.""" -import state - -if __name__ == '__main__': - state.kivy = True - print("Kivy Loading......") - # from bitmessagemain import main - from bitmessagemain_mock_test import main - main() diff --git a/src/bitmessagemain_mock_test.py b/src/main_test.py similarity index 88% rename from src/bitmessagemain_mock_test.py rename to src/main_test.py index d7030116..161d4667 100644 --- a/src/bitmessagemain_mock_test.py +++ b/src/main_test.py @@ -1,11 +1,10 @@ +"""This module is for thread start.""" import state from bitmessagekivy.mpybit import NavigateApp from threads import addressGenerator, sqlThread def main(): if state.enableObjProc: - print('....................................................line(8)(sqlThread)') - # Start the address generation thread addressGeneratorThread = addressGenerator() # close the main program even if there are threads left @@ -20,3 +19,8 @@ def main(): state.kivyapp = NavigateApp() state.kivyapp.run() + + + +if __name__ == '__main__': + main()