diff --git a/src/bitmessagekivy/kv/msg_composer.kv b/src/bitmessagekivy/kv/msg_composer.kv index 917feb01..b648a792 100644 --- a/src/bitmessagekivy/kv/msg_composer.kv +++ b/src/bitmessagekivy/kv/msg_composer.kv @@ -62,13 +62,10 @@ size_hint_y: None font_size: '15sp' color: color_font - required: True # height: self.parent.height/2 current_hint_text_color: 0,0,0,0.5 height: 100 hint_text: app.tr._('Type or Scan QR code for recipients address') - helper_text_mode: "on_focus" - canvas.before: Color: rgba: (0,0,0,1) diff --git a/src/bitmessagekivy/tests/test_allmail_message.py b/src/bitmessagekivy/tests/test_allmail_message.py index 88d565a4..919f2e39 100644 --- a/src/bitmessagekivy/tests/test_allmail_message.py +++ b/src/bitmessagekivy/tests/test_allmail_message.py @@ -1,4 +1,3 @@ -from requests.packages.urllib3.util import Timeout, timeout from .telenium_process import TeleniumTestProcess from .common import ordered @@ -32,7 +31,7 @@ class AllMailMessage(TeleniumTestProcess): '//MDList[0]/CutsomSwipeToDeleteItem[0]', timeout=2) # Assert for checking Current Screen(Mail Detail) self.assertExists("//MailDetail[@name~=\"mailDetail\"]", timeout=2) - # CLicking on Trash-Can icon to delete Message + # CLicking on Trash-Can icon to delete Message self.cli.wait_click('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[1]', timeout=2) - # After deleting msg, screen is redirected to All mail screen + # After deleting msg, screen is redirected to All mail screen 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 f51ba188..8f5864ae 100644 --- a/src/bitmessagekivy/tests/test_create_random_address.py +++ b/src/bitmessagekivy/tests/test_create_random_address.py @@ -20,31 +20,31 @@ class CreateRandomAddress(TeleniumTestProcess): 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.sleep(10) + # Checking current Screen(Login screen) + self.assertExists("//Login[@name~=\"login\"]", timeout=3) + # Clicking on Proceed Next Button 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) + '//Screen[0]/BoxLayout[0]/AnchorLayout[3]/MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=2) + # Checking Current Screen(Random Screen) after Clicking on Proceed Next Button + self.assertExists("//Random[@name~=\"random\"]", timeout=2) + @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]') - self.cli.sleep(3) - self.cli.wait_click('//RandomBoxlayout/BoxLayout[0]/AnchorLayout[2]/MDFillRoundFlatIconButton[0]') - self.cli.sleep(3) - self.cli.click_on('//RandomBoxlayout/BoxLayout[0]/AnchorLayout[1]/MDTextField[0]') - self.cli.sleep(3) + # Clicking on Label Text Field to give address name + self.cli.wait_click('//RandomBoxlayout/BoxLayout[0]/AnchorLayout[1]/MDTextField[0]', timeout=2) + # Generating Label Randomly random_label = "" for _ in range(10): random_label += choice(ascii_lowercase) self.cli.setattr('//RandomBoxlayout/BoxLayout[0]/AnchorLayout[1]/MDTextField[0]', "text", random_label) - self.cli.sleep(0.2) - self.cli.sleep(1) - self.cli.wait_click('//RandomBoxlayout/BoxLayout[0]/AnchorLayout[2]/MDFillRoundFlatIconButton[0]') - self.cli.sleep(5) + self.cli.sleep(0.1) + # Click on Proceed Next button to generate random Address + self.cli.wait_click('//RandomBoxlayout/BoxLayout[0]/AnchorLayout[2]/MDFillRoundFlatIconButton[0]', timeout=2) + # Checking My Address Screen self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=3) @ordered @@ -52,32 +52,44 @@ class CreateRandomAddress(TeleniumTestProcess): """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.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) + # this is for opening Nav drawer + self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3) + # checking state of Nav drawer + self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=2) + # Scroll Down to get New Address Tab + self.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]") + # Checking state of scrolled screen + self.assertExists('//NavigationItem[@text=\"New address\"]', timeout=3) + # Clicking on New Address Tab + self.cli.wait_click('//NavigationItem[@text=\"New address\"]', timeout=3) + self.cli.sleep(1) + # Checking current Screen(Login screen) + self.assertExists("//Login[@name~=\"login\"]", timeout=3) + # Click on Proceed Next button to enter 'Random' Screen self.cli.wait_click( - '''//Login/BoxLayout[0]/BoxLayout[0]/ScreenManager[0]/Screen[0]/BoxLayout[0]/AnchorLayout[3]''' - '''/MDFillRoundFlatIconButton[0]''') + '//Screen[0]/BoxLayout[0]/AnchorLayout[3]/MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=2) + # Checking Current Screen(Random Screen) after Clicking on Proceed Next Button self.assertExists("//Random[@name~=\"random\"]", timeout=1) + # Executing above function to create new address self.test_random_screen() @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.sleep(6) # 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=\"Address Book\"]", "//NavigationItem[@text=\"Settings\"]", 1) - self.cli.sleep(2) - self.cli.click_on('//NavigationItem[0]') - self.cli.sleep(2) - self.cli.click_on('//MySpinnerOption[0]') - self.cli.sleep(3) - self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=1) + # this is for opening Nav drawer + self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3) + # checking state of Nav drawer + self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=2) + # Scrolling up to get address dropdown + self.drag("//NavigationItem[@text=\"Address Book\"]", "//NavigationItem[@text=\"Settings\"]") + # Checking scroll state + self.assertExists("//NavigationDrawerSubheader[@text~=\"Accounts\"]", timeout=2) + # Clicking on Address Dropdown + self.cli.wait_click('//NavigationItem[0]/CustomSpinner[0]', timeout=2) + # Select address fron Address Dropdown + self.cli.wait_click('//MySpinnerOption[0]', timeout=2) + # Checking Landing Screen(Inbox) + self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=2) \ No newline at end of file diff --git a/src/bitmessagekivy/tests/test_draft_message.py b/src/bitmessagekivy/tests/test_draft_message.py index a892e89c..b2551c1a 100644 --- a/src/bitmessagekivy/tests/test_draft_message.py +++ b/src/bitmessagekivy/tests/test_draft_message.py @@ -10,55 +10,83 @@ class DraftMessage(TeleniumTestProcess): """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 - self.cli.sleep(4) - self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') - self.cli.sleep(2) - # OPEN INBOX SCREEN - self.cli.click_on('//NavigationItem[1]') + self.cli.sleep(8) + # this is for opening Nav drawer + self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3) + # checking state of Nav drawer + self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=2) + # Click to open Inbox + self.cli.wait_click('//NavigationItem[@text=\"Inbox\"]', timeout=2) + # Checking Inbox Screen 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( - '//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) - # ADD FROM MESSAGE - 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]/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( - '//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]') + # Due to animation and transition effect, it needed some halt otherwise it fails self.cli.sleep(1) - self.cli.click_on('//MyTextInput[0]') - self.cli.sleep(3) - # ADD FROM MESSAGE - self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/RelativeLayout[0]/BoxLayout[0]/MyTextInput', - "text", 'BM-2cSsuH1bUWBski8bvdqnK2DivMqQCeQA1J') - self.cli.sleep(4) - # Add SUBJECT - random_label = "" - for char in "Another Draft message": - random_label += char - self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', 'text', random_label) - self.cli.sleep(0.2) + # Click on Composer Icon(Plus icon) + self.cli.wait_click('//ComposerButton[0]/MDFloatingActionButton[@icon=\"plus\"]', timeout=2) + # Checking Message Composer Screen(Create) + self.assertExists("//Create[@name~=\"create\"]", timeout=4) + # ADD SENDER'S ADDRESS + # Checking State of Sender's Address Input Field (Empty) + self.assertExists('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/MDTextField[@text=\"\"]', timeout=2) + # Open Sender's Address DropDown + self.cli.wait_click( + '//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]', timeout=2) + # Due to animation and transition effect, it needed some halt otherwise it fails + self.cli.sleep(2) + # SENDER FIELD + # Select Sender's Address from Dropdown + self.cli.wait_click( + '//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]', timeout=2) + self.cli.click_on('//ComposerSpinnerOption[0]') + # Assert to check Sender's address dropdown open or not + self.assertNotEqual('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/MDTextField[0]', '') + # RECEIVER FIELD + # Checking Receiver Address Field + self.assertExists('//DropDownWidget/ScrollView[0]/BoxLayout[0]/RelativeLayout[0]/BoxLayout[0]/MyTextInput[@text=\"\"]', timeout=2) + # Entering Receiver Address + self.cli.setattr( + '//DropDownWidget/ScrollView[0]/BoxLayout[0]/RelativeLayout[0]/BoxLayout[0]/MyTextInput[0]', "text", 'BM-2cSsuH1bUWBski8bvdqnK2DivMqQCeQA1J') + # Checking Receiver Address filled or not + self.assertNotEqual('//DropDownWidget/ScrollView[0]/BoxLayout[0]/RelativeLayout[0]/BoxLayout[0]/MyTextInput[0]', '') # CLICK BACK-BUTTON - self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') - self.cli.sleep(4) - self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=1) + self.cli.wait_click('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]', timeout=2) + # Checking current screen(Login) after BACK Press + self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=2) + self.cli.sleep(0.5) + # Click on Composer Icon(Plus icon) + self.cli.wait_click('//ComposerButton[0]/MDFloatingActionButton[@icon=\"plus\"]', timeout=2) + # Checking Message Composer Screen(Create) + self.assertExists("//Create[@name~=\"create\"]", timeout=4) + # ADD SENDER'S ADDRESS + # Checking State of Sender's Address Input Field (Empty) + self.assertExists('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/MDTextField[@text=\"\"]', timeout=2) + # Open Sender's Address DropDown + self.cli.wait_click( + '//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]', timeout=2) + # Due to animation and transition effect, it needed some halt otherwise it fails + self.cli.sleep(2) + # Select Sender's Address from Dropdown + self.cli.wait_click( + '//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]', timeout=2) + self.cli.click_on('//ComposerSpinnerOption[0]') + # Assert to check Sender's address dropdown open or not + self.assertNotEqual('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/MDTextField[0]', '') + # RECEIVER FIELD + # Checking Receiver Address Field + self.assertExists('//DropDownWidget/ScrollView[0]/BoxLayout[0]/RelativeLayout[0]/BoxLayout[0]/MyTextInput[@text=\"\"]', timeout=2) + # Entering Receiver Address + self.cli.setattr( + '//DropDownWidget/ScrollView[0]/BoxLayout[0]/RelativeLayout[0]/BoxLayout[0]/MyTextInput[0]', "text", 'BM-2cSsuH1bUWBski8bvdqnK2DivMqQCeQA1J') + # Checking Receiver Address filled or not + self.assertNotEqual('//DropDownWidget/ScrollView[0]/BoxLayout[0]/RelativeLayout[0]/BoxLayout[0]/MyTextInput[0]', '') + # ADD SUBJECT + self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', 'text', 'Another Draft message') + # Checking Subject Field is Entered + self.assertExists('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[@text=\"Another Draft message\"]', timeout=2) + # CLICK BACK-BUTTON + self.cli.wait_click('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]', timeout=2) + # Checking current screen(Login) after BACK Press + self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=2) @ordered def test_edit_and_resend_draft_messgae(self): @@ -66,47 +94,54 @@ class DraftMessage(TeleniumTestProcess): make changes and send it.""" print("=====================Test - Edit A Message From Draft Screen=====================") # OPEN NAVIGATION-DRAWER - self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') - self.cli.sleep(4) - # OPEN DRAFT SCREEN - self.cli.click_on('//NavigationItem[3]') + # this is for opening Nav drawer + self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3) + # checking state of Nav drawer + self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=2) + # Click to open Draft Screen + self.cli.wait_click('//NavigationItem[@text=\"Draft\"]', timeout=2) + # Checking Draft Screen self.assertExists("//Draft[@name~=\"draft\"]", timeout=2) - self.cli.sleep(4) + # Due to animation and transition effect, it needed some halt otherwise it fails + self.cli.sleep(1) # SHOW DRAFT MESSAGE AND SELECT FIRST MESSAGE # self.cli.click_on('//Carousel[0]//TwoLineAvatarIconListItem[0]') - self.cli.click_on('//SwipeToDeleteItem[0]//TwoLineAvatarIconListItem[0]') + self.cli.wait_click('//SwipeToDeleteItem[0]//TwoLineAvatarIconListItem[0]', timeout=2) + # Checking current screen Mail Detail self.assertExists("//MailDetail[@name~=\"mailDetail\"]", timeout=2) - self.cli.sleep(3) # CLICK EDIT BUTTON - self.cli.click_on('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[0]') + self.cli.wait_click('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[0]', timeout=2) + # Checking Current Screen 'Create' self.assertExists("//Create[@name~=\"create\"]", timeout=2) - 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]/MDTextField[0]', - 'text', random_label) - self.cli.sleep(0.2) - self.cli.sleep(3) - self.cli.click_on('//MDActionTopAppBarButton[2]') - # self.cli.sleep(5) + # ADD MESSAGE BODY + self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[0]', + 'text', 'Hey,This is draft Message Body') + # Checking Message body is Entered + self.assertNotEqual('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[0]', '') + # Click on Send Icon + self.cli.wait_click('//MDActionTopAppBarButton[2]', timeout=3) + # After Click send, Screen is redirected to Inbox screen self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=5) @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.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.cli.sleep(2) + # OPEN NAVIGATION-DRAWER + # this is for opening Nav drawer + self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3) + # checking state of Nav drawer + self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=2) + # Click to open Draft Screen + self.cli.wait_click('//NavigationItem[@text=\"Draft\"]', timeout=2) + # Checking Draft Screen + self.assertExists("//Draft[@name~=\"draft\"]", timeout=2) + self.cli.sleep(1) + self.cli.wait_click('//SwipeToDeleteItem[0]//TwoLineAvatarIconListItem[0]', timeout=3) + # Checking Current screen is Mail Detail + self.assertExists("//MailDetail[@name~=\"mailDetail\"]", timeout=3) + # Click on trash-can icon to delete + self.cli.wait_click('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[1]', timeout=2) + # After Deleting, Screen is redirected to Draft screen 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 e670fff8..1c74a1d2 100644 --- a/src/bitmessagekivy/tests/test_myaddress_screen.py +++ b/src/bitmessagekivy/tests/test_myaddress_screen.py @@ -1,3 +1,4 @@ +from requests.packages.urllib3.util import timeout from .telenium_process import TeleniumTestProcess from .common import ordered @@ -15,84 +16,120 @@ class MyAddressScreen(TeleniumTestProcess): """Select Address From List of Address""" print("=====================Test -Select Address From List of Address=====================") self.cli.sleep(12) - 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) + + # this is for checking current screen + self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=3) + # this is for opening Nav drawer + self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=2) + # checking state of Nav drawer + self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=2) + # this is for scrolling Nav drawer + self.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]") + # assert for checking scroll function + self.assertExists('//NavigationItem[@text=\"My addresses\"]', timeout=2) + # this is for opening setting screen + self.cli.wait_click('//NavigationItem[@text=\"My addresses\"]', timeout=2) + # Checking current screen self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=2) - @ordered - def test_show_Qrcode(self): - """Show the Qr code of selected address""" - print("=====================Test -Show QR code of selected address=====================") - self.cli.sleep(4) - self.cli.click_on( - '''//MyAddress/BoxLayout[0]/FloatLayout[0]/MDScrollViewRefreshLayout[0]/MDList[0]/''' - '''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) - - - @ordered - def test_send_message_from(self): - """Send Message From Send Message From Button""" - print("=====================Test -Send Message From Send Message From Button=====================") - self.cli.sleep(4) - self.cli.click_on( - '''//MyAddress/BoxLayout[0]/FloatLayout[0]/MDScrollViewRefreshLayout[0]/MDList[0]/''' - '''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]/RelativeLayout[0]/BoxLayout[0]/MyTextInput', "text", data[1]) - self.cli.sleep(3) - self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', 'text', 'Hey') - 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]/MDTextField[0]', 'text', random_label) - self.cli.sleep(0.2) - self.cli.sleep(2) - self.cli.click_on('//MDActionTopAppBarButton[2]') - self.cli.sleep(4) - self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=2) - - @ordered - def test_disable_address(self): - """Disable Addresses""" + # ADDRESS DISABLED + self.cli.wait_click('//Thumb', timeout=2) self.cli.sleep(5) - 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(3) - # ADDRESS DISABLED - self.cli.click_on('//Thumb') - self.cli.sleep(3) - # CLICK ON DISABLE ACCOUNT TO OPEN POPUP - self.cli.click_on('//MyAddress/BoxLayout[0]/FloatLayout[0]/MDScrollViewRefreshLayout[0]/MDList[0]/CustomTwoLineAvatarIconListItem[0]') - self.cli.sleep(3) - self.cli.click_on('//MDFlatButton[@text=\"ok\"]') - self.cli.sleep(3) - self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') - self.cli.sleep(3) - # ADDRESS ENABLED - self.cli.click_on('//Thumb') - self.cli.sleep(3) - self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=5) + # is_active = self.cli.getattr('//Thumb', 'active') + # print(is_active, '-------------------///////////////////////////////////////////*************/*/*/**/-------------------------*******************------') + self.cli.sleep(5) + + # self.assertExists('//ToggleBtn[0]/Thumb[@active=\"False\"]', timeout=2) + # @ordered + # def test_show_Qrcode(self): + # """Show the Qr code of selected address""" + # print("=====================Test -Show QR code of selected address=====================") + # # Checking current screen + # self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=2) + # # Click on Address to open popup + # self.cli.wait_click('//MDList[0]/CustomTwoLineAvatarIconListItem[0]', timeout=2) + # # Check the Popup is opened + # self.assertExists('//MyaddDetailPopup/BoxLayout[1]/MDRaisedButton[1]/MDLabel[@text=\"Show QR code\"]', timeout=2) + # # Cick on 'Show QR code' button to view QR Code + # self.cli.wait_click('//MyaddDetailPopup/BoxLayout[1]/MDRaisedButton[1]/MDLabel[0]') + # # Check Current screen is QR Code screen + # self.assertExists("//ShowQRCode[@name~=\"showqrcode\"]", timeout=2) + # # Click on BACK button + # self.cli.wait_click('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]', timeout=2) + # # Checking current screen(My Address) after BACK press + # self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=2) + # @ordered + # def test_send_message_from(self): + # """Send Message From Send Message From Button""" + # print("=====================Test -Send Message From Send Message From Button=====================") + # self.cli.sleep(2) + # # Checking current screen + # self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=2) + # # Click on Address to open popup + # self.cli.wait_click('//MDList[0]/CustomTwoLineAvatarIconListItem[0]', timeout=2) + # # Checking Popup Opened + # self.assertExists('//MyaddDetailPopup/BoxLayout[1]/MDRaisedButton[0]/MDLabel[@text=\"Send message from\"]', timeout=2) + # # Click on Send Message Button to redirect Create Screen + # self.cli.wait_click('//MyaddDetailPopup/BoxLayout[1]/MDRaisedButton[0]/MDLabel[0]', timeout=2) + # # Checking Current screen(Create ) + # self.assertExists("//Create[@name~=\"create\"]", timeout=2) + # # Entering Receiver Address + # self.cli.setattr( + # '//DropDownWidget/ScrollView[0]/BoxLayout[0]/RelativeLayout[0]/BoxLayout[0]/MyTextInput[0]', "text", data[1]) + # # Checking Receiver Address filled or not + # self.assertNotEqual('//DropDownWidget/ScrollView[0]/BoxLayout[0]/RelativeLayout[0]/BoxLayout[0]/MyTextInput[0]', '') + # # ADD SUBJECT + # self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', 'text', 'Hey this is Demo Subject') + # # Checking Subject Field is Entered + # # self.assertExists('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[@text=\"Hey this is Demo Subject\"]', timeout=2) + # self.assertNotEqual('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', '') + # # ADD MESSAGE BODY + # self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[0]', + # 'text', 'Hey,i am sending message directly from MyAddress book') + # # Checking Message body is Entered + # self.assertNotEqual('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[0]', '') + # # Click on Send Icon + # self.cli.wait_click('//MDActionTopAppBarButton[2]', timeout=3) + # self.cli.sleep(2) # Send Messages takes 2 seconds to send message so need to user sleep + # # Checking Current screen after Send a message + # self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=3) + + # @ordered + # def test_disable_address(self): + # """Disable Addresses""" + # self.cli.sleep(2) + # # this is for checking current screen + # self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=3) + # # this is for opening Nav drawer + # self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=2) + # # checking state of Nav drawer + # self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=2) + # # this is for scrolling Nav drawer + # self.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]") + # # assert for checking scroll function + # self.assertExists('//NavigationItem[@text=\"My addresses\"]', timeout=2) + # # this is for opening setting screen + # self.cli.wait_click('//NavigationItem[@text=\"My addresses\"]', timeout=2) + # # Checking current screen + # self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=2) + + # # ADDRESS DISABLED + # self.cli.wait_click('//Thumb', timeout=2) + # is_active = self.cli.getattr('//Thumb', 'active') + # print(is_active, '--------------------------------------------*******************------') + # # self.assertExists('//ToggleBtn[0]/Thumb[@active=\"False\"]', timeout=2) + + # # CLICKING ON DISABLE ACCOUNT TO OPEN POPUP + # self.cli.wait_click('//MyAddress/BoxLayout[0]/FloatLayout[0]/MDScrollViewRefreshLayout[0]/MDList[0]/CustomTwoLineAvatarIconListItem[0]', timeout=2) + # # Checking the pop is Opened + # self.assertExists('//MDDialog[@text=\"Address is not currently active. Please click on Toggle button to active it.\"]', timeout=2) + # # Clicking on 'Ok' Button To Dismiss the pop + # self.cli.wait_click('//MDFlatButton[@text=\"Ok\"]', timeout=2) + # # ADDRESS ENABLED + # self.cli.wait_click('//Thumb', timeout=2) + # # self.assertExists('//Thumb[@active=\"False\"]', timeout=2) + # self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=5) diff --git a/src/bitmessagekivy/tests/test_network_screen.py b/src/bitmessagekivy/tests/test_network_screen.py index 2bafa74e..8c9de519 100644 --- a/src/bitmessagekivy/tests/test_network_screen.py +++ b/src/bitmessagekivy/tests/test_network_screen.py @@ -1,4 +1,3 @@ -from requests.packages.urllib3.util import timeout from .telenium_process import TeleniumTestProcess @@ -28,4 +27,3 @@ class NetwrokStatusScreen(TeleniumTestProcess): self.cli.wait_click('//NetworkStat/MDTabs[0]//MDTabsLabel[1]', timeout=1) # Checking for current screen (Network Status) 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 8f40f4d0..d208b5d6 100644 --- a/src/bitmessagekivy/tests/test_payment_subscription.py +++ b/src/bitmessagekivy/tests/test_payment_subscription.py @@ -1,5 +1,4 @@ from time import time -from requests.packages.urllib3.util import timeout from .telenium_process import TeleniumTestProcess @@ -17,10 +16,8 @@ class PaymentScreen(TeleniumTestProcess): # Dragging from sent to inbox to get Payment tab. self.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]") self.assertExists('//NavigationItem[@text=\"Network status\"]', timeout=3) - - # assert for checking scroll funcation + # assert for checking scroll function scroll_distance = self.cli.getattr('//ContentNavigationDrawer//ScrollView[0]', 'scroll_y') - self.assertCheckScrollDown(scroll_distance, 0.0, timeout=3) self.assertExists('//NavigationItem[@text=\"Purchase\"]', timeout=3) # this is for opening Payment screen @@ -30,7 +27,7 @@ class PaymentScreen(TeleniumTestProcess): self.drag( '//ProductCategoryLayout[0]/ProductLayout[1]', '//ProductCategoryLayout[0]/ProductLayout[0]') - # assert for checking scroll funcation + # assert for checking scroll function scroll_distance = self.cli.getattr('//Payment//ScrollView[0]', 'scroll_y') self.assertCheckScrollDown(scroll_distance, 0.0, timeout=3) self.assertExists('//MDRaisedButton[3]', timeout=3) @@ -38,7 +35,4 @@ class PaymentScreen(TeleniumTestProcess): self.click_on('//ScrollView[0]/ListItemWithLabel[0]', seconds=1) self.click_on('//MDRaisedButton[3]', seconds=1) self.assertExists("//Payment[@name~=\"payment\"]", timeout=2) - - - - + \ No newline at end of file diff --git a/src/bitmessagekivy/tests/test_sent_message.py b/src/bitmessagekivy/tests/test_sent_message.py index 3bb1b314..f0de9c3b 100644 --- a/src/bitmessagekivy/tests/test_sent_message.py +++ b/src/bitmessagekivy/tests/test_sent_message.py @@ -1,3 +1,4 @@ +from time import time from .telenium_process import TeleniumTestProcess from .common import ordered @@ -17,63 +18,95 @@ class SendMessage(TeleniumTestProcess): opens a pop-up(screen)which send message from sender to reciever """ 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.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') - self.cli.sleep(2) - self.cli.click_on('//NavigationItem[1]') + self.cli.sleep(8) + # this is for opening Nav drawer + self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3) + # checking state of Nav drawer + self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=2) + # Click to open Inbox + self.cli.wait_click('//NavigationItem[@text=\"Inbox\"]', timeout=2) + # Checking Inbox Screen self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=2) + # Due to animation and transition effect, it needed some halt otherwise it fails + self.cli.sleep(1) + # Click on Composer Icon(Plus icon) + self.cli.wait_click('//ComposerButton[0]/MDFloatingActionButton[@icon=\"plus\"]', timeout=2) + # Checking Message Composer Screen(Create) + self.assertExists("//Create[@name~=\"create\"]", timeout=4) + # Click on Sender's Address Input Field to check validation + self.cli.wait_click('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/MDTextField[0]', timeout=2) + # Checking State of Sender's Address Input Field (Empty) + self.assertExists('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/MDTextField[@text=\"\"]', timeout=2) + # Due to MDTextField on focus line effect, it takes time to animate, so sleep is required + self.cli.sleep(0.5) + # Click on Receiver's Address Field to check validation + self.cli.wait_click('//DropDownWidget/ScrollView[0]/BoxLayout[0]/RelativeLayout[0]/BoxLayout[0]/MyTextInput[0]', timeout=2) + # Checking State of Receiver's Address Input Field (Empty) + self.assertExists('//DropDownWidget/ScrollView[0]/BoxLayout[0]/RelativeLayout[0]/BoxLayout[0]/MyTextInput[@text=\"\"]', timeout=2) + # Click on Subject Field to check validation + self.cli.wait_click('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', timeout=2) + # Checking State of Subject Input Field (Empty) + self.assertExists('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[@text=\"\"]', timeout=2) + # Click on Send Icon to check validation working + self.cli.wait_click('//MDActionTopAppBarButton[2]', timeout=2) + # Checking validation Pop up is Opened + self.assertExists('//MDDialog[@text=\"Please fill the form completely\"]', timeout=2) + # Click on 'Ok' to dismiss the Popup + self.cli.wait_click('//MDFlatButton[0]', timeout=2) + # Checking Pop up is closed + self.assertExists("//Create[@name~=\"create\"]", timeout=4) + # ADD SENDER'S ADDRESS + # Checking State of Sender's Address Input Field (Empty) + self.assertExists('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/MDTextField[@text=\"\"]', timeout=2) + # Open Sender's Address DropDown + self.cli.wait_click( + '//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]', timeout=2) + # Due to animation and transition effect, it needed some halt otherwise it fails 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]/MDTextField') - self.cli.sleep(3) - self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/MyTextInput[0]') - self.cli.sleep(3) - self.cli.setattr( - '//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/MyTextInput[0]', "text", "second add") - self.cli.sleep(3) - self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]') - self.cli.sleep(4) - self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]') - self.cli.sleep(4) - self.cli.click_on('//MDActionTopAppBarButton[2]') - self.cli.sleep(3) - self.cli.click_on('//MDFlatButton[0]') - self.cli.sleep(5) - 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.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]') - self.cli.sleep(2) + # Select Sender's Address from Dropdown + self.cli.wait_click( + '//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]', timeout=2) + self.cli.click_on('//ComposerSpinnerOption[0]') + # Assert to check Sender's address dropdown open or not + self.assertNotEqual('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/MDTextField[0]', '') # ADD SUBJECT self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', 'text', 'heyyyyyy') - self.cli.sleep(3) - self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[0]') - self.cli.sleep(4) + # Checking Subject Field is Entered + self.assertExists('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[@text=\"heyyyyyy\"]', timeout=2) + # Checking BODY Field(EMPTY) + self.assertExists('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[@text=\"\"]', timeout=2) # ADD BODY - 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]/MDTextField[0]', 'text', random_label) - self.cli.sleep(0.2) - self.cli.sleep(3) - self.cli.click_on('//MDActionTopAppBarButton[2]') - self.cli.sleep(3) - self.cli.click_on('//MDFlatButton[0]') - self.cli.sleep(6) + self.cli.setattr( + '//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[0]', 'text', 'how are you this is message body') + # Checking BODY is Entered + self.assertExists('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[@text=\"how are you this is message body\"]', timeout=2) + # click on send icon + self.cli.wait_click('//MDActionTopAppBarButton[2]', timeout=2) + # Checking validation so Pop up is Opened + self.assertExists('//MDDialog[@text=\"Please fill the form completely\"]', timeout=2) + # Pop clicked on ok + self.cli.wait_click('//MDFlatButton[0]', timeout=2) + # ADD RECEIVER ADDRESS + # Checking Receiver Address Field + self.assertExists('//DropDownWidget/ScrollView[0]/BoxLayout[0]/RelativeLayout[0]/BoxLayout[0]/MyTextInput[@text=\"\"]', timeout=2) + # Entering Receiver Address self.cli.setattr( '//DropDownWidget/ScrollView[0]/BoxLayout[0]/RelativeLayout[0]/BoxLayout[0]/MyTextInput[0]', "text", data[0]) - self.cli.sleep(3) - self.cli.click_on('//MDActionTopAppBarButton[2]') - self.cli.sleep(3) - self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') - self.cli.sleep(3) - self.cli.click_on('//NavigationItem[2]') - self.cli.sleep(3) + # Checking Receiver Address filled or not + self.assertNotEqual('//DropDownWidget/ScrollView[0]/BoxLayout[0]/RelativeLayout[0]/BoxLayout[0]/MyTextInput[0]', '') + # Clicking on send icon + self.cli.wait_click('//MDActionTopAppBarButton[2]', timeout=4) + # Checking screen(Inbox) after sending message + self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=4) + # this is for opening Nav drawer + self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3) + # checking state of Nav drawer + self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=2) + # Clicking on Sent Tab + self.cli.wait_click('//NavigationItem[@text=\"Sent\"]', timeout=3) + # Checking current screen; Sent + self.assertExists("//Sent[@name~=\"sent\"]", timeout=3) + self.cli.sleep(1) + # Checking number of Sent messages total_sent_msgs = len(self.cli.select("//SwipeToDeleteItem")) self.assertEqual(total_sent_msgs, 2) diff --git a/src/bitmessagekivy/tests/test_trash_message.py b/src/bitmessagekivy/tests/test_trash_message.py index b2bf13de..bbd20794 100644 --- a/src/bitmessagekivy/tests/test_trash_message.py +++ b/src/bitmessagekivy/tests/test_trash_message.py @@ -35,7 +35,7 @@ class TrashMessage(TeleniumTestProcess): '//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[1]', '//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]') self.click_on('//MDList[0]/CutsomSwipeToDeleteItem[0]', seconds=1) - # Checking the Trash Icon after swipe. + # Checking the Trash Icon after swipe. self.assertExists("//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[@icon~=\"trash-can\"]", timeout=2) # clicking on Trash Box icon to delete message. self.cli.wait_click('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[0]', timeout=2)