From dd5830505e5f87f33c8a701acf295ef2111eb79c Mon Sep 17 00:00:00 2001 From: shekhar-cis Date: Thu, 22 Jul 2021 15:34:32 +0530 Subject: [PATCH] added assert for popup and drag --- src/bitmessagekivy/tests/test_addressbook.py | 40 ++++++++------- .../tests/test_allmail_message.py | 5 +- .../tests/test_create_random_address.py | 10 ++-- .../tests/test_draft_message.py | 49 ++++++++++--------- .../tests/test_myaddress_screen.py | 36 ++++++-------- .../tests/test_payment_subscription.py | 3 ++ src/bitmessagekivy/tests/test_sent_message.py | 8 +-- .../tests/test_trash_message.py | 23 +++------ 8 files changed, 81 insertions(+), 93 deletions(-) diff --git a/src/bitmessagekivy/tests/test_addressbook.py b/src/bitmessagekivy/tests/test_addressbook.py index 7c730c82..7bc2d57f 100644 --- a/src/bitmessagekivy/tests/test_addressbook.py +++ b/src/bitmessagekivy/tests/test_addressbook.py @@ -7,7 +7,6 @@ data = [ 'BM-2cVpswZo8rWLXDVtZEUNcDQvnvHJ6TLRYr' ] - class AddressBook(TeleniumTestProcess): """AddressBook Screen Functionality Testing""" @@ -15,8 +14,7 @@ class AddressBook(TeleniumTestProcess): def test_save_address(self): """Save Address On Address Book Screen/Window""" print("=====================Test -Save Address In Address Book=====================") - self.cli.sleep(12) - + self.cli.sleep(3) # this is for checking current screen self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=3) # this is for opening Nav drawer @@ -34,25 +32,25 @@ class AddressBook(TeleniumTestProcess): # Click on Account-Plus Icon to opeb popup for add Address self.cli.execute('app.addingtoaddressbook()') # Click on Label field to check validation - self.cli.wait_click('//GrashofPopup/BoxLayout[0]/MDTextField[0]', timeout=2) + self.cli.wait_click('//GrashofPopup/BoxLayout[0]/MDTextField[@hint_text=\"Label\"]', timeout=2) # Checking the Label Field shows Validation for empty string self.assertExists('//GrashofPopup/BoxLayout[0]/MDTextField[@text=\"\"]', timeout=2) # # Click on Address Field - self.cli.wait_click('//GrashofPopup/BoxLayout[0]/MDTextField[1]', timeout=2) + self.cli.wait_click('//GrashofPopup/BoxLayout[0]/MDTextField[@hint_text=\"Address\"]', timeout=2) # Checking the Address Field shows Validation for empty string self.assertExists('//GrashofPopup/BoxLayout[0]/MDTextField[@text=\"\"]', timeout=2) # Click On save Button to check Field validation self.cli.wait_click('//MDRaisedButton[0]', timeout=2) # Add Label to label Field - self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[0]', 'text', 'test1') + self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[@hint_text=\"Label\"]', 'text', 'test1') # Add incorrect Address to Address Field to check validation - self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[1]', 'text', data[0]) + self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[@hint_text=\"Address\"]', 'text', data[0]) # Click on Save Button to check the address is correct or not - self.cli.wait_click('//MDRaisedButton[0]') + self.cli.wait_click('//MDRaisedButton[@text=\"Save\"]') # Add Correct Address - self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[1]', 'text', 'BM-2cX78L9CZpb6GGC3rRVizYiUBwHELMLybd') + self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[@hint_text=\"Address\"]', 'text', 'BM-2cX78L9CZpb6GGC3rRVizYiUBwHELMLybd') # Click on Save Button - self.cli.wait_click('//MDRaisedButton[0]', timeout=2) + self.cli.wait_click('//MDRaisedButton[@text=\"Save\"]', timeout=2) # Check Current Screen (Address Book) self.assertExists("//AddressBook[@name~=\"addressbook\"]", timeout=2) # Checking Number of addresses increased @@ -92,7 +90,7 @@ class AddressBook(TeleniumTestProcess): # Open and select Sender's Address from DropDown self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/MDTextField[0]', 'text', 'BM-2cVpswZo8rWLXDVtZEUNcDQvnvHJ6TLRYr') # Checking the Sender's Field is Entered - self.assertNotEqual('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/MDTextField[0]', '') + self.assertNotEqual('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/MDTextField[@text]', '') # ADD SUBJECT self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', 'text', 'Demo Subject') # Checking Subject Field is Entered @@ -101,9 +99,9 @@ class AddressBook(TeleniumTestProcess): self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[0]', 'text', 'Hey,This is draft Message Body from Address Book') # Checking Message body is Entered - self.assertNotEqual('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[0]', '') + self.assertNotEqual('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[@text]', '') # Click on Send Icon - self.cli.wait_click('//MDActionTopAppBarButton[2]', timeout=3) + self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"send\"]', timeout=3) # After Click send, Screen is redirected to Inbox screen self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=5) @@ -122,10 +120,16 @@ class AddressBook(TeleniumTestProcess): # Checking current screen self.assertExists("//AddressBook[@name~=\"addressbook\"]", timeout=2) # Swipe to delete - self.cli.drag( - '//MDList[0]/SwipeToDeleteItem[0]//TwoLineAvatarIconListItem[0]/BoxLayout[1]', - '//MDList[0]/SwipeToDeleteItem[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]',2) + self.assertTrue('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[@disabled]', 'True') + self.cli.sleep(1) + self.drag( + '//MDList[0]//TwoLineAvatarIconListItem[0]/BoxLayout[1]', + '//MDList[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]') # Click on trash-can icon - self.cli.click_on('//MDList[0]/SwipeToDeleteItem[0]//MDIconButton[0]') + self.cli.wait_click('//MDList[0]//SwipeToDeleteItem[0]', timeout=3) + # Checking the trash icon is acrivated + self.assertTrue('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[@disabled]', 'False') + # Click on trash icon + self.cli.click_on('//MDList[0]//MDIconButton[@icon=\"delete-forever\"]') # Checking current screen - self.assertExists("//AddressBook[@name~=\"addressbook\"]", timeout=2) \ No newline at end of file + 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 ecc22dc2..e5561cfd 100644 --- a/src/bitmessagekivy/tests/test_allmail_message.py +++ b/src/bitmessagekivy/tests/test_allmail_message.py @@ -1,7 +1,6 @@ from .telenium_process import TeleniumTestProcess from .common import ordered - class AllMailMessage(TeleniumTestProcess): """AllMail Screen Functionality Testing""" @@ -33,6 +32,4 @@ class AllMailMessage(TeleniumTestProcess): # CLicking on Trash-Can icon to delete Message self.cli.wait_click('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[@icon=\"delete-forever\"]', timeout=5) # After deleting msg, screen is redirected to All mail screen - self.assertExists("//Allmails[@name~=\"allmails\"]", timeout=5) - - + self.assertExists("//Allmails[@name~=\"allmails\"]", timeout=5) diff --git a/src/bitmessagekivy/tests/test_create_random_address.py b/src/bitmessagekivy/tests/test_create_random_address.py index e1e7e6b6..35fe59f7 100644 --- a/src/bitmessagekivy/tests/test_create_random_address.py +++ b/src/bitmessagekivy/tests/test_create_random_address.py @@ -1,12 +1,10 @@ import os import tempfile - from .telenium_process import TeleniumTestProcess, cleanup from .common import ordered from random import choice from string import ascii_lowercase - class CreateRandomAddress(TeleniumTestProcess): """This is for testing randrom address creation""" @@ -29,7 +27,6 @@ class CreateRandomAddress(TeleniumTestProcess): # 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.""" @@ -51,7 +48,8 @@ class CreateRandomAddress(TeleniumTestProcess): def test_create_new_address(self): """Clicking on Navigation Drawer To Open New Address""" print("=====================Test - Create New Address=====================") - self.cli.sleep(5) + # New screen is opening and transition effect takes time so Sleep is used + self.cli.sleep(3) # this is for opening Nav drawer self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3) # checking state of Nav drawer @@ -67,7 +65,7 @@ class CreateRandomAddress(TeleniumTestProcess): self.assertExists("//Login[@name~=\"login\"]", timeout=3) # Click on Proceed Next button to enter 'Random' Screen self.cli.wait_click( - '//Screen[0]/BoxLayout[0]/AnchorLayout[3]/MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=2) + '//Screen[0]//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 @@ -93,4 +91,4 @@ class CreateRandomAddress(TeleniumTestProcess): # 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 + self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=2) diff --git a/src/bitmessagekivy/tests/test_draft_message.py b/src/bitmessagekivy/tests/test_draft_message.py index b2551c1a..cdcd74d1 100644 --- a/src/bitmessagekivy/tests/test_draft_message.py +++ b/src/bitmessagekivy/tests/test_draft_message.py @@ -27,29 +27,29 @@ class DraftMessage(TeleniumTestProcess): 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) + self.assertExists('//DropDownWidget/ScrollView[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) + '//DropDownWidget/ScrollView[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) + '//DropDownWidget/ScrollView[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]', '') + self.assertNotEqual('//DropDownWidget/ScrollView[0]//MDTextField[@text]', '') # RECEIVER FIELD # Checking Receiver Address Field - self.assertExists('//DropDownWidget/ScrollView[0]/BoxLayout[0]/RelativeLayout[0]/BoxLayout[0]/MyTextInput[@text=\"\"]', timeout=2) + self.assertExists('//DropDownWidget/ScrollView[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') + '//DropDownWidget/ScrollView[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]', '') + self.assertNotEqual('//DropDownWidget/ScrollView[0]//MyTextInput[@text]', '') # CLICK BACK-BUTTON - self.cli.wait_click('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]', timeout=2) + self.cli.wait_click('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[@icon=\"arrow-left\"]', timeout=2) # Checking current screen(Login) after BACK Press self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=2) self.cli.sleep(0.5) @@ -59,32 +59,34 @@ class DraftMessage(TeleniumTestProcess): 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) + self.assertExists('//DropDownWidget/ScrollView[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) + '//Create//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) + '//DropDownWidget/ScrollView[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]', '') + self.assertNotEqual('//DropDownWidget/ScrollView[0]//MDTextField[@text]', '') + # RECEIVER FIELD # Checking Receiver Address Field - self.assertExists('//DropDownWidget/ScrollView[0]/BoxLayout[0]/RelativeLayout[0]/BoxLayout[0]/MyTextInput[@text=\"\"]', timeout=2) + self.assertExists('//DropDownWidget/ScrollView[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') + '//DropDownWidget/ScrollView[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]', '') + self.assertNotEqual('//DropDownWidget/ScrollView[0]//MyTextInput[@text]', '') # ADD SUBJECT - self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', 'text', 'Another Draft message') + self.cli.setattr('//DropDownWidget/ScrollView[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) + self.assertExists('//DropDownWidget/ScrollView[0]//MyMDTextField[@text=\"Another Draft message\"]', timeout=2) # CLICK BACK-BUTTON - self.cli.wait_click('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]', timeout=2) + self.cli.wait_click('//MDToolbar//MDActionTopAppBarButton[@icon=\"arrow-left\"]', timeout=2) # Checking current screen(Login) after BACK Press self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=2) @@ -105,21 +107,20 @@ class DraftMessage(TeleniumTestProcess): # 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.wait_click('//SwipeToDeleteItem[0]//TwoLineAvatarIconListItem[0]', timeout=2) # Checking current screen Mail Detail self.assertExists("//MailDetail[@name~=\"mailDetail\"]", timeout=2) # CLICK EDIT BUTTON - self.cli.wait_click('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[0]', timeout=2) + self.cli.wait_click('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[@icon=\"pencil\"]', timeout=2) # Checking Current Screen 'Create' self.assertExists("//Create[@name~=\"create\"]", timeout=2) # ADD MESSAGE BODY - self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[0]', + self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[@text]', 'text', 'Hey,This is draft Message Body') # Checking Message body is Entered - self.assertNotEqual('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[0]', '') + self.assertNotEqual('//DropDownWidget/ScrollView[0]//ScrollView[0]/MDTextField[@text]', '') # Click on Send Icon - self.cli.wait_click('//MDActionTopAppBarButton[2]', timeout=3) + self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"send\"]', timeout=3) # After Click send, Screen is redirected to Inbox screen self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=5) @@ -142,6 +143,6 @@ class DraftMessage(TeleniumTestProcess): # 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) + self.cli.wait_click('//MDToolbar//MDActionTopAppBarButton[@icon=\"delete-forever\"]', 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 8a1e774a..1476dad3 100644 --- a/src/bitmessagekivy/tests/test_myaddress_screen.py +++ b/src/bitmessagekivy/tests/test_myaddress_screen.py @@ -8,7 +8,6 @@ data = [ 'BM-2cVpswZo8rWLXDVtZEUNcDQvnvHJ6TLRYr' ] - class MyAddressScreen(TeleniumTestProcess): """MyAddress Screen Functionality Testing""" @@ -17,7 +16,6 @@ class MyAddressScreen(TeleniumTestProcess): """Select Address From List of Address""" print("=====================Test -Select Address From List of Address=====================") self.cli.sleep(12) - # this is for checking current screen self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=3) # this is for opening Nav drawer @@ -34,7 +32,6 @@ class MyAddressScreen(TeleniumTestProcess): # Checking current screen self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=2) - @ordered def test_show_Qrcode(self): """Show the Qr code of selected address""" @@ -44,17 +41,16 @@ class MyAddressScreen(TeleniumTestProcess): # 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]') + self.assertExists('//MyaddDetailPopup//MDLabel[@text=\"Show QR code\"]', timeout=2) + # Cick on 'Show QR code' button to view QR Code + self.cli.wait_click('//MyaddDetailPopup//MDLabel[@text=\"Show QR code\"]') # 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) + self.cli.wait_click('//MDToolbar//MDActionTopAppBarButton[@icon=\"arrow-left\"]', 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""" @@ -65,28 +61,27 @@ class MyAddressScreen(TeleniumTestProcess): # 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) + self.assertExists('//MyaddDetailPopup//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.cli.wait_click('//MyaddDetailPopup//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]) + '//DropDownWidget/ScrollView[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]', '') + self.assertNotEqual('//DropDownWidget//MyTextInput[0]', '') # ADD SUBJECT - self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', 'text', 'Hey this is Demo Subject') + self.cli.setattr('//DropDownWidget/ScrollView[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]', '') + self.assertNotEqual('//DropDownWidget/ScrollView[0]//MyMDTextField[0]', '') # ADD MESSAGE BODY - self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[0]', + self.cli.setattr('//DropDownWidget/ScrollView[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]', '') + self.assertNotEqual('//DropDownWidget/ScrollView[0]//ScrollView[0]/MDTextField[@text]', '') # Click on Send Icon - self.cli.wait_click('//MDActionTopAppBarButton[2]', timeout=3) + self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"send\"]', 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) @@ -114,11 +109,12 @@ class MyAddressScreen(TeleniumTestProcess): self.cli.sleep(1) self.cli.wait_click('//Thumb', timeout=2) # CLICKING ON DISABLE ACCOUNT TO OPEN POPUP - self.click_on('//MyAddress/BoxLayout[0]/FloatLayout[0]/MDScrollViewRefreshLayout[0]/MDList[0]/CustomTwoLineAvatarIconListItem[0]', seconds=2) + self.click_on('//MyAddress//MDList[0]/CustomTwoLineAvatarIconListItem[0]', seconds=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.click_on('//MDFlatButton[@text=\"Ok\"]', seconds=2) + self.assertNotExists('//MDDialog[@text=\"Address is not currently active. Please click on Toggle button to active it.\"]', timeout=2) # ADDRESS ENABLED self.click_on('//Thumb', seconds=2) # self.assertExists('//Thumb[@active=\"False\"]', timeout=2) diff --git a/src/bitmessagekivy/tests/test_payment_subscription.py b/src/bitmessagekivy/tests/test_payment_subscription.py index 51f921f4..441122f5 100644 --- a/src/bitmessagekivy/tests/test_payment_subscription.py +++ b/src/bitmessagekivy/tests/test_payment_subscription.py @@ -30,6 +30,9 @@ class PaymentScreen(TeleniumTestProcess): '//ProductCategoryLayout[0]/ProductLayout[0]') # assert for checking scroll function self.assertCheckScrollDown('//Payment//ScrollView[0]', timeout=3) + self.cli.sleep(2) + print(self.cli.getattr('//Payment//MDCustomBottomSheet//MDBottomSheet[0]', 'animation'), 'pop is open or not ----------------------------------------------````````````````````````````````````````````````````````````~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~') + self.cli.sleep(2) # Click on BUY Button self.cli.wait_click('//MDRaisedButton[@text=\"BUY\"]', timeout=2) # CLick on the Payment Method diff --git a/src/bitmessagekivy/tests/test_sent_message.py b/src/bitmessagekivy/tests/test_sent_message.py index d90a4661..6caec3fc 100644 --- a/src/bitmessagekivy/tests/test_sent_message.py +++ b/src/bitmessagekivy/tests/test_sent_message.py @@ -7,7 +7,6 @@ data = [ 'BM-2cVpswZo8rWLXDVtZEUNcDQvnvHJ6TLRYr' ] - class SendMessage(TeleniumTestProcess): """Sent Screen Functionality Testing""" @@ -74,10 +73,11 @@ class SendMessage(TeleniumTestProcess): # Checking BODY Field(EMPTY) self.assertExists('//DropDownWidget/ScrollView[0]//ScrollView[0]/MDTextField[@text=\"\"]', timeout=2) # ADD BODY - self.cli.setattr( - '//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[0]', 'text', 'how are you this is message body') + 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) + 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[@icon=\"send\"]', timeout=2) # Checking validation so Pop up is Opened diff --git a/src/bitmessagekivy/tests/test_trash_message.py b/src/bitmessagekivy/tests/test_trash_message.py index 57b45433..d4401808 100644 --- a/src/bitmessagekivy/tests/test_trash_message.py +++ b/src/bitmessagekivy/tests/test_trash_message.py @@ -1,25 +1,12 @@ -from datetime import datetime -from os import wait -from socket import timeout -from time import sleep - -from telenium.mods.telenium_client import selectFirst, kivythread, TeleniumMotionEvent, nextid, telenium_input, run_telenium - from .telenium_process import TeleniumTestProcess - class TrashMessage(TeleniumTestProcess): - - def smart_click(self, click_on, sleep): - click_on = self.cli.click_on(click_on) - sleep = self.cli.sleep(sleep) - """Trash Screen Functionality Testing""" 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(8) + self.cli.sleep(3) # this is for opening Nav drawer self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=5) # checking state of Nav drawer @@ -29,14 +16,16 @@ class TrashMessage(TeleniumTestProcess): # self.cli.click_on('//NavigationItem[4]') # Checking Trash Screen self.assertExists("//Trash[@name~=\"trash\"]", timeout=5) - # Transition Effect taking time, so halt is required + # Transition Effect taking time, so halt is required self.cli.sleep(2) - # Checking Popup is closed - self.assertEqual(self.cli.getattr('//MDList[0]/CutsomSwipeToDeleteItem[0]', '_opens_process'), False) + # Checking Trash Icon is in disable state + self.assertTrue('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[@disabled]', 'True') # This is for swiping message to activate delete icon. self.drag( '//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[1]', '//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]') + # Assert to check the drag is worked (Trash icon Activated) + self.assertTrue('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[@disabled]', 'False') # Checking Popup is Opened self.assertEqual(self.cli.getattr('//MDList[0]/CutsomSwipeToDeleteItem[0]', '_opens_process'), True) self.click_on('//MDList[0]/CutsomSwipeToDeleteItem[0]', seconds=1)