Resolved sleep and added assert to check widget is rendered

This commit is contained in:
shekhar-cis 2021-10-07 17:55:06 +05:30
parent bb1843fdcc
commit 712a5b601c
Signed by untrusted user: shekhar-cis
GPG Key ID: 8B2A6C8D5F7F1635

View File

@ -3,7 +3,7 @@ from .common import skip_screen_checks
from .common import ordered
test_address = {
'wrong_address': 'BM-2cWmjntZ47WKEUtocrdvs19y5CivpKoi1h',
'invalid_address': 'BM-2cWmjntZ47WKEUtocrdvs19y5CivpKoi1',
'autoresponder_address': 'BM-2cVWtdUzPwF7UNGDrZftWuHWiJ6xxBpiSP',
'recipient': 'BM-2cVpswZo8rWLXDVtZEUNcDQvnvHJ6TLRYr',
'sender': 'BM-2cVpswZo8rWLXDVtZEUNcDQvnvHJ6TLRYr'
@ -12,7 +12,7 @@ test_address = {
class AddressBook(TeleniumTestProcess):
"""AddressBook Screen Functionality Testing"""
test_label = 'Test Label 1'
test_label = 'Auto Responder'
test_subject = 'Test Subject'
test_body = 'Hey,This is draft Message Body from Address Book'
@ -26,7 +26,7 @@ class AddressBook(TeleniumTestProcess):
self.assertExists('//MDNavigationDrawer[@status~=\"closed\"]', timeout=5)
# This is for checking the menu button is appeared
self.assertExists('//MDActionTopAppBarButton[@icon~=\"menu\"]', timeout=5)
# this is for opening Nav drawer
# This is for opening Nav drawer
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=5)
# checking state of Nav drawer
self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=5)
@ -58,33 +58,39 @@ class AddressBook(TeleniumTestProcess):
# Add incorrect Address to Address Field to check validation
self.cli.setattr(
'//GrashofPopup/BoxLayout[0]/MDTextField[@hint_text=\"Address\"]',
'text', test_address['wrong_address'])
'text', test_address['invalid_address'])
# Checking the Address Field should not be empty
self.assertEqual(
self.cli.getattr('//GrashofPopup/BoxLayout[0]/MDTextField[1][@text]', 'text'),
test_address['wrong_address'])
# Click on Save Button to check the address is correct or not
self.cli.wait_click('//MDRaisedButton[@text=\"Save\"]')
test_address['invalid_address'])
# Add Correct Address
self.cli.setattr(
'//GrashofPopup/BoxLayout[0]/MDTextField[@hint_text=\"Address\"]', 'text',
test_address['autoresponder_address'])
# Checking the Address Field should not be empty
# Checking the Address Field contains correct address
self.assertEqual(
self.cli.getattr('//GrashofPopup/BoxLayout[0]/MDTextField[1][@text]', 'text'),
test_address['autoresponder_address'])
# Click on Save Button to save the address in address book
self.cli.wait_click('//MDRaisedButton[@text=\"Save\"]', timeout=2)
# Validating the Label field
self.assertExists('//GrashofPopup/BoxLayout[0]/MDTextField[0][@text=\"Auto Responder\"]', timeout=3)
# Validating the Valid Address is entered
self.assertExists(
'//GrashofPopup/BoxLayout[0]/MDTextField[1][@text=\"BM-2cVWtdUzPwF7UNGDrZftWuHWiJ6xxBpiSP\"]', timeout=3)
# Check Current Screen (Address Book)
self.assertExists("//ScreenManager[@current=\"addressbook\"]", timeout=5)
# Checking new address should be added
address_in_addressbook = len(self.cli.select("//SwipeToDeleteItem"))
self.assertEqual(address_in_addressbook, 1)
self.assertExists('//SwipeToDeleteItem', timeout=5)
@skip_screen_checks
@ordered
def test_dismiss_addressbook_popup(self):
"""This method is to perform Dismiss add Address popup"""
# Checking the "Address saving" Popup is not opened
self.assertNotExists('//GrashofPopup', timeout=5)
# Checking the "Add account" Button is rendered
self.assertExists('//MDActionTopAppBarButton[@icon=\"account-plus\"]', timeout=6)
# Click on Account-Plus Icon to open popup for add Address
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"account-plus\"]', timeout=5)
# Add Label to label Field
@ -95,7 +101,9 @@ class AddressBook(TeleniumTestProcess):
self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[1]', 'text', test_address['recipient'])
# Checking the Address Field should not be empty
self.assertNotEqual('//GrashofPopup/BoxLayout[0]/MDTextField[@hint_text=\"Address\"]', '')
# Click on 'Cancel' Button
# Checking for "Cancel" button is rendered
self.assertExists('//MDRaisedButton[@text=\"Cancel\"]', timeout=5)
# Click on 'Cancel' Button to dismiss the popup
self.cli.wait_click('//MDRaisedButton[@text=\"Cancel\"]', timeout=2)
# Check Current Screen (Address Book)
self.assertExists("//ScreenManager[@current=\"addressbook\"]", timeout=5)
@ -104,41 +112,20 @@ class AddressBook(TeleniumTestProcess):
@ordered
def test_send_message_to_saved_address(self):
"""This method is to send msg to the saved address from addressbook"""
self.cli.sleep(1) # TODO: Taking time to render the saved address # pylint: disable=fixme
# Checking the Message detail Dialog box is not opened
self.assertNotExists('//MDDialog', timeout=3)
# Checking the saved address is rendered
self.assertExists('//AddressBook/BoxLayout[0]//SwipeToDeleteItem[0]', timeout=5)
# Click on a Address to open address Details popup
self.cli.wait_click('//AddressBook/BoxLayout[0]//SwipeToDeleteItem[0]', timeout=5)
# Checking the pop is opened
# Checking the Message detail Dialog is opened
self.assertExists('//MDDialog', timeout=3)
# Checking the buttons are rendered
self.assertExists('//MDRaisedButton', timeout=5)
# Click on the Send to message Button
self.cli.wait_click('//MDRaisedButton[0]', timeout=5)
# Redirected to message composer screen(create)
self.assertExists("//ScreenManager[@current=\"create\"]", timeout=5)
# Add Sender's Address
self.cli.setattr(
'//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/MDTextField[0]',
'text', test_address['sender'])
# Checking the Sender's Field is Entered
self.assertEqual(
self.cli.getattr(
'//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/MDTextField[@text]',
'text'), test_address['sender'])
# ADD SUBJECT
self.cli.setattr(
'//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', 'text', self.test_subject)
# Checking Subject Field is Entered
self.assertEqual(
self.cli.getattr(
'//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[@text]', 'text'), self.test_subject)
# ADD MESSAGE BODY
self.cli.setattr(
'//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[0]', 'text', self.test_body)
# Checking Message body should not be empty
self.assertEqual(
self.cli.getattr(
'//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[0]', 'text'), self.test_body)
# Click on Send Icon
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"send\"]', timeout=5)
# After Click send, Screen is redirected to Inbox screen
self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=8)
# Checking the Address is populated to recipient field when we try to send message to saved address.
self.assertExists(
'//DropDownWidget/ScrollView[0]//MyTextInput[@text="BM-2cVWtdUzPwF7UNGDrZftWuHWiJ6xxBpiSP"]', timeout=5)