removed sleep(), added assert to check widget is rendered
This commit is contained in:
parent
4e96464e30
commit
3f10348620
|
@ -27,49 +27,61 @@ class DraftMessage(TeleniumTestProcess):
|
||||||
# ADD SUBJECT
|
# ADD SUBJECT
|
||||||
self.cli.setattr('//DropDownWidget/ScrollView[0]//MyMDTextField[0]', 'text', self.test_subject)
|
self.cli.setattr('//DropDownWidget/ScrollView[0]//MyMDTextField[0]', 'text', self.test_subject)
|
||||||
# Checking Subject Field is Entered
|
# Checking Subject Field is Entered
|
||||||
self.assertNotEqual('//DropDownWidget/ScrollView[0]//MyMDTextField[@text]', '')
|
self.assertExists(
|
||||||
|
'//DropDownWidget/ScrollView[0]//MyMDTextField[@text=\"{}\"]'.format(self.test_subject), timeout=5)
|
||||||
# ADD MESSAGE BODY
|
# ADD MESSAGE BODY
|
||||||
self.cli.setattr(
|
self.cli.setattr(
|
||||||
'//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[@text]',
|
'//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[@text]',
|
||||||
'text', self.test_body)
|
'text', self.test_body)
|
||||||
# Checking Message body is Entered
|
# Checking Message body is Entered
|
||||||
self.assertNotEqual('//DropDownWidget/ScrollView[0]//ScrollView[0]/MDTextField[@text]', '')
|
self.assertExists(
|
||||||
# Click on Send Icon
|
'//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[@text=\"{}\"]'.format(
|
||||||
|
self.test_body), timeout=5)
|
||||||
|
# Click on "Send" Icon
|
||||||
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"send\"]', timeout=5)
|
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"send\"]', timeout=5)
|
||||||
# Checking validation Pop up is Opened
|
# Checking validation Pop up is Opened
|
||||||
self.assertExists('//MDDialog', timeout=5)
|
self.assertExists('//MDDialog', timeout=5)
|
||||||
# Click "OK" button to dismiss the Popup
|
# Click "OK" button to dismiss the Popup
|
||||||
self.cli.wait_click('//MDFlatButton[@text=\"Ok\"]', timeout=5)
|
self.cli.wait_click('//MDFlatButton[@text=\"Ok\"]', timeout=5)
|
||||||
|
# Checking validation Pop up is Closed
|
||||||
|
self.assertNotExists('//MDDialog', timeout=5)
|
||||||
# RECEIVER FIELD
|
# RECEIVER FIELD
|
||||||
# Checking Receiver Address Field
|
# Checking Receiver Address Field
|
||||||
self.assertExists('//DropDownWidget/ScrollView[0]//MyTextInput[@text=\"\"]', timeout=5)
|
self.assertExists('//DropDownWidget/ScrollView[0]//MyTextInput[@text=\"\"]', timeout=5)
|
||||||
# Entering Receiver Address
|
# Entering Receiver Address
|
||||||
self.cli.setattr(
|
self.cli.setattr(
|
||||||
'//DropDownWidget/ScrollView[0]//MyTextInput[0]', "text", test_address['receiver'])
|
'//DropDownWidget/ScrollView[0]//MyTextInput[0]', "text", test_address['auto_responder'])
|
||||||
# Checking Receiver Address filled or not
|
# Checking Receiver Address filled or not
|
||||||
self.assertNotEqual('//DropDownWidget/ScrollView[0]//MyTextInput[@text]', '')
|
self.assertExists(
|
||||||
|
'//DropDownWidget/ScrollView[0]//MyTextInput[@text=\"{}\"]'.format(test_address['auto_responder']),
|
||||||
|
timeout=2)
|
||||||
|
# Checking the sender's Field is empty
|
||||||
|
self.assertExists('//DropDownWidget/ScrollView[0]//BoxLayout[1]/MDTextField[@text=\"\"]', timeout=3)
|
||||||
# Assert to check Sender's address dropdown open or not
|
# Assert to check Sender's address dropdown open or not
|
||||||
self.assertNotEqual('//DropDownWidget/ScrollView[0]//MDTextField[@text]', '')
|
self.assertEqual(self.cli.getattr('//Create//CustomSpinner[@is_open]', 'is_open'), False)
|
||||||
is_open = self.cli.getattr('//Create//CustomSpinner[@is_open]', 'is_open')
|
|
||||||
self.assertEqual(is_open, False)
|
|
||||||
# Open Sender's Address DropDown
|
# Open Sender's Address DropDown
|
||||||
self.cli.wait_click('//Create//CustomSpinner[0]/ArrowImg[0]', timeout=5)
|
self.cli.wait_click('//Create//CustomSpinner[0]/ArrowImg[0]', timeout=5)
|
||||||
# Select Sender's Address from Dropdown
|
# Checking the status of dropdown
|
||||||
|
self.assertEqual(self.cli.getattr('//Create//CustomSpinner[@is_open]', 'is_open'), False)
|
||||||
|
# Checking the dropdown option is rendered
|
||||||
|
self.assertExists('//ComposerSpinnerOption[0]', timeout=5)
|
||||||
|
# Select Sender's Address from Dropdown options
|
||||||
self.cli.wait_click('//ComposerSpinnerOption[0]', timeout=5)
|
self.cli.wait_click('//ComposerSpinnerOption[0]', timeout=5)
|
||||||
# Assert to check Sender's address dropdown closed
|
# Assert to check Sender address dropdown closed
|
||||||
is_open = self.cli.getattr('//Create//CustomSpinner[@is_open]', 'is_open')
|
self.assertEqual(self.cli.getattr('//Create//CustomSpinner[@is_open]', 'is_open'), False)
|
||||||
self.assertEqual(is_open, False)
|
# Checking sender address is selected
|
||||||
|
sender_address = self.cli.getattr('//DropDownWidget/ScrollView[0]//BoxLayout[1]/MDTextField[@text]', 'text')
|
||||||
|
self.assertExists(
|
||||||
|
'//DropDownWidget/ScrollView[0]//BoxLayout[1]/MDTextField[@text=\"{}\"]'.format(sender_address), timeout=3)
|
||||||
# CLICK BACK-BUTTON
|
# CLICK BACK-BUTTON
|
||||||
self.cli.wait_click(
|
self.cli.wait_click('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[@icon=\"arrow-left\"]', timeout=5)
|
||||||
'//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[@icon=\"arrow-left\"]', timeout=5)
|
# Checking current screen(Login) after "BACK" Press
|
||||||
# Checking current screen(Login) after BACK Press
|
|
||||||
self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=5)
|
self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=5)
|
||||||
|
|
||||||
@skip_screen_checks
|
@skip_screen_checks
|
||||||
@ordered
|
@ordered
|
||||||
def test_edit_and_resend_draft_messgae(self):
|
def test_edit_and_resend_draft_messgae(self):
|
||||||
"""Select A Message From Draft Messages Then
|
"""Click on a Drafted message to send message"""
|
||||||
make changes and sending it."""
|
|
||||||
# OPEN NAVIGATION-DRAWER
|
# OPEN NAVIGATION-DRAWER
|
||||||
# this is for opening Nav drawer
|
# this is for opening Nav drawer
|
||||||
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=5)
|
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=5)
|
||||||
|
@ -77,48 +89,55 @@ class DraftMessage(TeleniumTestProcess):
|
||||||
self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=5)
|
self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=5)
|
||||||
# Click to open Draft Screen
|
# Click to open Draft Screen
|
||||||
self.cli.wait_click('//NavigationItem[@text=\"Draft\"]', timeout=5)
|
self.cli.wait_click('//NavigationItem[@text=\"Draft\"]', timeout=5)
|
||||||
|
# checking state of Nav drawer
|
||||||
|
self.assertExists("//MDNavigationDrawer[@state~=\"close\"]", timeout=5)
|
||||||
# Checking Draft Screen
|
# Checking Draft Screen
|
||||||
self.assertExists("//ScreenManager[@current=\"draft\"]", timeout=5)
|
self.assertExists("//ScreenManager[@current=\"draft\"]", timeout=5)
|
||||||
|
|
||||||
# Checking messages in draft box
|
# Checking messages in draft box
|
||||||
self.assertExists('//SwipeToDeleteItem[0]//TwoLineAvatarIconListItem', timeout=5)
|
self.assertEqual(len(self.cli.select('//SwipeToDeleteItem[0]//TwoLineAvatarIconListItem')), 1)
|
||||||
self.cli.sleep(1)
|
# Wait to render the widget
|
||||||
# Click on a drafted msg to show details
|
self.cli.wait('//SwipeToDeleteItem[0]//TwoLineAvatarIconListItem[0]', timeout=3)
|
||||||
|
# Click on a Message to view its details (Message Detail screen)
|
||||||
self.cli.wait_click('//SwipeToDeleteItem[0]//TwoLineAvatarIconListItem[0]', timeout=5)
|
self.cli.wait_click('//SwipeToDeleteItem[0]//TwoLineAvatarIconListItem[0]', timeout=5)
|
||||||
# Checking current screen Mail Detail
|
# Checking current screen Mail Detail
|
||||||
self.assertExists("//ScreenManager[@current=\"mailDetail\"]", timeout=5)
|
self.assertExists("//ScreenManager[@current=\"mailDetail\"]", timeout=3)
|
||||||
# CLICK on EDIT BUTTON
|
|
||||||
|
# CLICK on EDIT(Pencil) BUTTON
|
||||||
self.cli.wait_click('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[@icon=\"pencil\"]', timeout=5)
|
self.cli.wait_click('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[@icon=\"pencil\"]', timeout=5)
|
||||||
# Checking Current Screen 'Create'; composer screen.
|
# Checking Current Screen 'Create'; composer screen.
|
||||||
self.assertExists("//ScreenManager[@current=\"create\"]", timeout=5)
|
self.assertExists("//ScreenManager[@current=\"create\"]", timeout=10)
|
||||||
# Click on Send Icon to send msg
|
# Checking the recipient is in the receiver field
|
||||||
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"send\"]', timeout=5)
|
self.assertExists(
|
||||||
# Redirected to the inbox screen
|
'//DropDownWidget/ScrollView[0]//MyTextInput[@text=\"{}\"]'.format(test_address['auto_responder']),
|
||||||
self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=5)
|
timeout=2)
|
||||||
|
# Checking the sender address is in the sender field
|
||||||
|
sender_address = self.cli.getattr('//DropDownWidget/ScrollView[0]//BoxLayout[1]/MDTextField[@text]', 'text')
|
||||||
|
self.assertExists(
|
||||||
|
'//DropDownWidget/ScrollView[0]//BoxLayout[1]/MDTextField[@text=\"{}\"]'.format(sender_address), timeout=3)
|
||||||
|
# Checking the subject text is in the subject field
|
||||||
|
self.assertExists(
|
||||||
|
'//DropDownWidget/ScrollView[0]//MyMDTextField[@text=\"{}\"]'.format(self.test_subject), timeout=5)
|
||||||
|
# Checking the Body text is in the Body field
|
||||||
|
self.assertExists(
|
||||||
|
'//DropDownWidget/ScrollView[0]//ScrollView[0]/MDTextField[@text=\"{}\"]'.format(self.test_body),
|
||||||
|
timeout=5)
|
||||||
|
# CLICK BACK-BUTTON to autosave msg in draft screen
|
||||||
|
self.cli.wait_click('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[@icon=\"arrow-left\"]', timeout=5)
|
||||||
|
# Checking current screen(Login) after BACK Press
|
||||||
|
self.assertExists("//ScreenManager[@current=\"draft\"]", timeout=5)
|
||||||
|
|
||||||
@skip_screen_checks
|
@skip_screen_checks
|
||||||
@ordered
|
@ordered
|
||||||
def test_delete_draft_message(self):
|
def test_delete_draft_message(self):
|
||||||
"""Deleting a Drafted Message"""
|
"""Deleting a Drafted Message"""
|
||||||
# Checking current screen
|
# Checking current screen is Draft Screen
|
||||||
self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=5)
|
|
||||||
# Saving a msg to draft to perform delete operation
|
|
||||||
self.test_save_message_to_draft()
|
|
||||||
# OPEN NAVIGATION-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)
|
|
||||||
# Click to open Draft Screen
|
|
||||||
self.cli.wait_click('//NavigationItem[@text=\"Draft\"]', timeout=5)
|
|
||||||
# Checking Draft Screen
|
|
||||||
self.assertExists("//ScreenManager[@current=\"draft\"]", timeout=5)
|
self.assertExists("//ScreenManager[@current=\"draft\"]", timeout=5)
|
||||||
self.cli.sleep(1) # TODO: Remove sleep(), need to wait to render the msg # pylint: disable=W0511
|
# Checking the trash idcon is rendered
|
||||||
# Click on a message to show msg details
|
self.assertExists('//MDList[0]//MDIconButton[@icon=\"trash-can\"]', timeout=5)
|
||||||
self.cli.wait_click('//SwipeToDeleteItem[0]//TwoLineAvatarIconListItem[0]', timeout=5)
|
# Click on trash icon to delete the message.
|
||||||
# Checking Current screen is Mail Detail
|
self.cli.wait_click('//MDList[0]//MDIconButton[@icon=\"trash-can\"]', timeout=5)
|
||||||
self.assertExists("//ScreenManager[@current=\"mailDetail\"]", timeout=5)
|
# Checking the message is deleted
|
||||||
# Click on trash-can icon to delete
|
self.assertEqual(len(self.cli.select('//SwipeToDeleteItem[0]//TwoLineAvatarIconListItem[0]')), 0)
|
||||||
self.cli.wait_click('//MDToolbar//MDActionTopAppBarButton[@icon=\"delete-forever\"]', timeout=5)
|
|
||||||
# After Deleting, Screen is redirected to Draft screen
|
# After Deleting, Screen is redirected to Draft screen
|
||||||
self.assertExists("//ScreenManager[@current=\"draft\"]", timeout=10)
|
self.assertExists("//ScreenManager[@current=\"draft\"]", timeout=10)
|
||||||
|
|
Reference in New Issue
Block a user