diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 2b2f9d56..dc69ff2f 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -152,8 +152,7 @@ class Inbox(Screen): for item in data: meny = TwoLineAvatarIconListItem( text=item['text'], secondary_text=item['secondary_text'], - theme_text_color='Custom', - text_color=NavigateApp().theme_cls.primary_color) + theme_text_color='Custom') meny.add_widget(AvatarSampleWidget( source='./images/text_images/{}.png'.format( avatarImageFirstLetter(item['secondary_text'].strip())))) @@ -300,6 +299,7 @@ class MyAddress(Screen): def init_ui(self, dt=0): """Clock schdule for method Myaddress accounts""" + self.addresses_list = state.kivyapp.variable_1 if state.searcing_text: self.ids.refresh_layout.scroll_y = 1.0 @@ -341,8 +341,7 @@ class MyAddress(Screen): for item in data: meny = TwoLineAvatarIconListItem( text=item['text'], secondary_text=item['secondary_text'], - theme_text_color='Custom', - text_color=NavigateApp().theme_cls.primary_color) + theme_text_color='Custom') meny.add_widget(AvatarSampleWidget( source='./images/text_images/{}.png'.format( avatarImageFirstLetter(item['text'].strip())))) @@ -449,8 +448,7 @@ class AddressBook(Screen): """Creating the mdList""" for item in self.queryreturn[start_index:end_index]: meny = TwoLineAvatarIconListItem( - text=item[0], secondary_text=item[1], theme_text_color='Custom', - text_color=NavigateApp().theme_cls.primary_color) + text=item[0], secondary_text=item[1], theme_text_color='Custom') meny.add_widget(AvatarSampleWidget( source='./images/text_images/{}.png'.format( avatarImageFirstLetter(item[0].strip())))) @@ -901,8 +899,7 @@ class Sent(Screen): for item in data: meny = TwoLineAvatarIconListItem( text=item['text'], secondary_text=item['secondary_text'], - theme_text_color='Custom', - text_color=NavigateApp().theme_cls.primary_color) + theme_text_color='Custom') meny.add_widget(AvatarSampleWidget( source='./images/text_images/{}.png'.format( avatarImageFirstLetter(item['secondary_text'].strip())))) @@ -1103,8 +1100,7 @@ class Trash(Screen): secondary_text=item[2][:50] + '........' if len( item[2]) >= 50 else (item[2] + ',' + item[3].replace( '\n', ''))[0:50] + '........', - theme_text_color='Custom', - text_color=NavigateApp().theme_cls.primary_color) + theme_text_color='Custom') img_latter = './images/text_images/{}.png'.format( item[2][0].upper() if (item[2][0].upper() >= 'A' and item[ 2][0].upper() <= 'Z') else '!') @@ -2151,8 +2147,7 @@ class Draft(Screen): for item in data: meny = TwoLineAvatarIconListItem( text='Draft', secondary_text=item['text'], - theme_text_color='Custom', - text_color=NavigateApp().theme_cls.primary_color) + theme_text_color='Custom') meny.add_widget(AvatarSampleWidget( source='./images/avatar.png')) meny.bind(on_press=partial( @@ -2325,8 +2320,7 @@ class Allmails(Screen): item[2]) >= 50 else ( item[2] + ',' + item[3].replace( '\n', ''))[0:50] + '........', - theme_text_color='Custom', - text_color=NavigateApp().theme_cls.primary_color) + theme_text_color='Custom') meny.add_widget(AvatarSampleWidget( source='./images/text_images/{}.png'.format( avatarImageFirstLetter(item[2].strip())))) diff --git a/src/test_kivy_bitmessgae_app.py b/src/test_kivy_bitmessgae_app.py new file mode 100644 index 00000000..6fdc5ec7 --- /dev/null +++ b/src/test_kivy_bitmessgae_app.py @@ -0,0 +1,56 @@ +import time +from telenium.tests import TeleniumTestCase +import random +import string +import os +import test_telenium_cases + + + +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_login_screen(self): + print(self,"---------------------------") + time.sleep(5) + # if not os.path.isdir("/home/cis/.config/PyBitmessage"): + 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) + 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) + + def test_random_screen(self): + # if not os.path.isdir("/home/cis/.config/PyBitmessage"): + 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) + 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)) + + + +if __name__ == '__main__': + TeleniumTestCase.start_process() + TestBitMessageApp().runTest() + TestBitMessageApp().test_login_screen() + TestBitMessageApp().test_random_screen() + obj=test_telenium_cases.TestSelectAddress() + obj.test_select_address() + obj_1=test_telenium_cases.TestSentMessage() + obj_1.test_select_sent() + obj_1.test_show_sent_messgae_list() + obj_1.test_sent_multiple_message() + 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() \ No newline at end of file diff --git a/src/test_telenium_cases.py b/src/test_telenium_cases.py new file mode 100644 index 00000000..69865093 --- /dev/null +++ b/src/test_telenium_cases.py @@ -0,0 +1,149 @@ +from telenium.tests import TeleniumTestCase +import time + + +class TestSelectAddress(TeleniumTestCase): + # import pdb;pdb.set_trace() + + def runTest(self): + print(self,"-------------Welcome To Kivy Testing Application second Page-------------") + + def test_select_address(self): + time.sleep(8) + self.cli.execute('app.root.toggle_nav_drawer()') + time.sleep(5) + # if self.cli.execute('app.root.toggle_nav_drawer()'): + # time.sleep(5) + self.cli.click_on('//NavigationDrawerIconButton[0]') + time.sleep(5) + # self.cli.wait_click('//NavigationDrawerIconButton[0]/CustomSpinner[0]') + # time.sleep(3) + self.cli.click_on('//NavigationDrawerIconButton[1]') + + +class TestSentMessage(TeleniumTestCase): + + def runTest(self): + print(self,"-------------Welcome To Kivy Testing Application Thirds Page-------------") + + def test_select_sent(self): + print("ek issue h solve krna hai----") + self.cli.execute('app.root.toggle_nav_drawer()') + time.sleep(5) + self.cli.click_on('//NavigationDrawerIconButton[1]') + time.sleep(3) + self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Inbox[0]/ComposerButton[0]/MDFloatingActionButton[0]/MDLabel[0]') + time.sleep(4) + 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) + 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) + self.cli.setattr('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Create[0]/DropDownWidget[0]/ScrollView[0]/BoxLayout[0]/MDTextField[0]','text','heyyyyyy') + time.sleep(3) + self.cli.setattr('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Create[0]/DropDownWidget[0]/ScrollView[0]/BoxLayout[0]/MDTextField[1]','text','how are you this is body') + time.sleep(2) + self.cli.click_on('//MDIconButton[2]') + time.sleep(2) + + def test_show_sent_messgae_list(self): + time.sleep(5) + self.cli.execute('app.root.toggle_nav_drawer()') + time.sleep(5) + self.cli.click_on('//NavigationDrawerIconButton[2]') + time.sleep(2) + + def test_sent_multiple_message(self): + print("---------ek issue h solve krna hai----") + time.sleep(3) + self.cli.execute('app.root.toggle_nav_drawer()') + time.sleep(5) + self.cli.click_on('//NavigationDrawerIconButton[1]') + time.sleep(3) + self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Inbox[0]/ComposerButton[0]/MDFloatingActionButton[0]/MDLabel[0]') + time.sleep(4) + 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) + 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) + self.cli.setattr('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Create[0]/DropDownWidget[0]/ScrollView[0]/BoxLayout[0]/MDTextField[0]','text','Second') + time.sleep(3) + self.cli.setattr('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Create[0]/DropDownWidget[0]/ScrollView[0]/BoxLayout[0]/MDTextField[1]','text','Hey This is Second Message Body') + time.sleep(2) + self.cli.click_on('//MDIconButton[2]') + # time.sleep(2) + time.sleep(5) + self.cli.execute('app.root.toggle_nav_drawer()') + time.sleep(5) + self.cli.click_on('//NavigationDrawerIconButton[2]') + time.sleep(2) + + def test_serach_sent_messages(self): + print("-------serach message---------") + time.sleep(1) + self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Sent[0]/BoxLayout[0]/SearchBar[0]/MDTextField[0]') + time.sleep(2) + self.cli.setattr('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Sent[0]/BoxLayout[0]/SearchBar[0]/MDTextField[0]','text','how') + time.sleep(2) + self.cli.send_keycode('Enter') + time.sleep(5) + self.cli.click_on('//MDIconButton[0]') + time.sleep(3) + + def test_show_sent_message_body(self): + print("-------------check message body------------") + time.sleep(5) + self.cli.click_on('//Carousel[0]') + time.sleep(5) + self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/Toolbar[0]/BoxLayout[0]/MDIconButton[0]/MDLabel[0]') + time.sleep(2) + + def test_delete_sent_message_body(self): + print("------------Delete messgae from message body option-----------------.") + time.sleep(2) + self.cli.click_on('//Carousel[0]') + 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]') + time.sleep(3) + # 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]') + time.sleep(5) + + def test_delete_sent_message_from_list(self): + print("-----------Delete messgae from message list-------------.") + 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) + 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]') + + def test_archive_sent_message_from_list(self): + # Swipe-Arrchive-Sent-Message + 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.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]') + + + +class DraftMessage(TeleniumTestCase): + + def select_draft_message(self): + self.cli.execute('app.root.toggle_nav_drawer()') + time.sleep(1) + self.cli.click_on('//NavigationDrawerIconButton[1]') + time.sleep(1) + self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Inbox[0]/ComposerButton[0]/MDFloatingActionButton[0]/MDLabel[0]') + 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) + 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) + # BACK-BUTTON + self.cli.click_on('/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/Toolbar[0]/BoxLayout[0]/MDIconButton[0]/MDLabel[0]') + + +# SelectAddress().test_select_address() +# cli.click_on('//NavigationDrawerIconButton[0]/CustomSpinner[@on_text="app.getCurrentAccountData(self.text)"]')