2021-09-27 16:33:44 +02:00
|
|
|
from .telenium_process import TeleniumTestProcess
|
|
|
|
from .common import skip_screen_checks
|
|
|
|
from .common import ordered
|
|
|
|
|
2021-10-13 15:59:44 +02:00
|
|
|
test_address = {'autoresponder_address': 'BM-2cVWtdUzPwF7UNGDrZftWuHWiJ6xxBpiSP'}
|
2021-09-27 16:33:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
class SendMessage(TeleniumTestProcess):
|
|
|
|
"""Sent Screen Functionality Testing"""
|
|
|
|
test_subject = 'Test Subject'
|
|
|
|
test_body = 'Hello, \n Hope your are doing good.\n\t This is test message body'
|
|
|
|
|
|
|
|
@skip_screen_checks
|
|
|
|
@ordered
|
|
|
|
def test_validate_empty_form(self):
|
|
|
|
"""
|
|
|
|
Sending Message From Inbox Screen
|
|
|
|
opens a pop-up(screen) which send message from sender to reciever
|
|
|
|
"""
|
2021-10-13 15:59:44 +02:00
|
|
|
# Checking current Screen(Inbox screen)
|
|
|
|
self.assert_wait_no_except('//ScreenManager[@current]', timeout=10, value='inbox')
|
2021-09-27 16:33:44 +02:00
|
|
|
# Click on Composer Icon(Plus icon)
|
|
|
|
self.cli.wait_click('//ComposerButton[0]/MDFloatingActionButton[@icon=\"plus\"]', timeout=2)
|
|
|
|
# Checking Message Composer Screen(Create)
|
|
|
|
self.assertExists("//ScreenManager[@current=\"create\"]", timeout=4)
|
|
|
|
# Checking State of Sender's Address Input Field (should be Empty)
|
|
|
|
self.assertExists('//DropDownWidget/ScrollView[0]//MDTextField[@text=\"\"]', timeout=3)
|
|
|
|
# Checking State of Receiver's Address Input Field (should be Empty)
|
|
|
|
self.assertExists('//DropDownWidget/ScrollView[0]//MyTextInput[@text=\"\"]', timeout=2)
|
|
|
|
# Checking State of Subject Input Field (shoudl be Empty)
|
|
|
|
self.assertExists('//DropDownWidget/ScrollView[0]//MyMDTextField[@text=\"\"]', timeout=2)
|
|
|
|
# Click on Send Icon to check validation working
|
|
|
|
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"send\"]', timeout=2)
|
|
|
|
# Checking validation Pop up is Opened
|
2021-10-13 15:59:44 +02:00
|
|
|
self.assertExists('//MDDialog[@open]', timeout=5)
|
|
|
|
# Checking the 'Ok' Button is rendered
|
|
|
|
self.assertExists('//MDFlatButton[@text=\"Ok\"]', timeout=5)
|
2021-10-01 17:07:04 +02:00
|
|
|
# Click "OK" button to dismiss the Popup
|
|
|
|
self.cli.wait_click('//MDFlatButton[@text=\"Ok\"]', timeout=5)
|
2021-10-13 15:59:44 +02:00
|
|
|
# Checking the pop is closed
|
|
|
|
self.assertNotExists('//MDDialog[@open]', timeout=5)
|
2021-09-27 16:33:44 +02:00
|
|
|
# Checking current screen after dialog dismiss
|
|
|
|
self.assertExists("//ScreenManager[@current=\"create\"]", timeout=10)
|
|
|
|
|
|
|
|
@skip_screen_checks
|
|
|
|
@ordered
|
|
|
|
def test_validate_half_filled_form(self):
|
|
|
|
"""
|
|
|
|
Validate the half filled form and press back button to save message in draft box.
|
|
|
|
"""
|
2021-10-13 15:59:44 +02:00
|
|
|
# Checking current screen (Msg composer screen)
|
2021-09-27 16:33:44 +02:00
|
|
|
self.assertExists("//ScreenManager[@current=\"create\"]", timeout=2)
|
|
|
|
# ADD SENDER'S ADDRESS
|
|
|
|
# Checking State of Sender's Address Input Field (Empty)
|
|
|
|
self.assertExists('//DropDownWidget/ScrollView[0]//MDTextField[@text=\"\"]', timeout=2)
|
|
|
|
# Assert to check Sender's address dropdown closed
|
|
|
|
is_open = self.cli.getattr('//Create//CustomSpinner[@is_open]', 'is_open')
|
|
|
|
self.assertEqual(is_open, False)
|
|
|
|
# Open Sender's Address DropDown
|
|
|
|
self.cli.wait_click('//Create//CustomSpinner[0]/ArrowImg[0]', timeout=5)
|
|
|
|
# Checking the Address Dropdown is in open State
|
|
|
|
is_open = self.cli.getattr('//Create//CustomSpinner[@is_open]', 'is_open')
|
|
|
|
# Select Sender's Address from Dropdown
|
|
|
|
self.cli.wait_click('//ComposerSpinnerOption[0]', timeout=3)
|
|
|
|
# Assert to check Sender's address dropdown closed
|
|
|
|
is_open = self.cli.getattr('//Create//CustomSpinner[@is_open]', 'is_open')
|
|
|
|
self.assertEqual(is_open, False)
|
2021-10-13 15:59:44 +02:00
|
|
|
# Checking the sender address is selected
|
|
|
|
sender_address = self.cli.getattr(
|
|
|
|
'//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[@text]', 'text')
|
|
|
|
self.assertExists(
|
|
|
|
'//DropDownWidget/ScrollView[0]//MDTextField[@text=\"{}\"]'.format(sender_address), timeout=2)
|
2021-09-27 16:33:44 +02:00
|
|
|
# Assert check for empty Subject Field
|
2021-10-13 15:59:44 +02:00
|
|
|
self.assertExists('//DropDownWidget/ScrollView[0]//MyMDTextField[@text=\"\"]', timeout=5)
|
2021-09-27 16:33:44 +02:00
|
|
|
# ADD SUBJECT
|
|
|
|
self.cli.setattr('//DropDownWidget/ScrollView[0]//MyMDTextField[0]', 'text', self.test_subject)
|
|
|
|
# Checking Subject Field is Entered
|
2021-10-13 15:59:44 +02:00
|
|
|
self.assertExists(
|
|
|
|
'//DropDownWidget/ScrollView[0]//MyMDTextField[@text=\"{}\"]'.format(self.test_subject), timeout=5)
|
2021-09-27 16:33:44 +02:00
|
|
|
# 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', self.test_body)
|
|
|
|
# Checking BODY is Entered
|
2021-10-13 15:59:44 +02:00
|
|
|
self.assertExists(
|
|
|
|
'//DropDownWidget/ScrollView[0]//ScrollView[0]/MDTextField[@text=\"{}\"]'.format(self.test_body),
|
|
|
|
timeout=2)
|
2021-09-27 16:33:44 +02:00
|
|
|
# click on send icon
|
2021-10-13 15:59:44 +02:00
|
|
|
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"send\"]', timeout=5)
|
2021-09-27 16:33:44 +02:00
|
|
|
# Checking validation Pop up is Opened
|
2021-10-01 17:07:04 +02:00
|
|
|
self.assertExists('//MDDialog', timeout=5)
|
|
|
|
# clicked on 'Ok' button to close popup
|
|
|
|
self.cli.wait_click('//MDFlatButton[@text=\"Ok\"]', timeout=5)
|
|
|
|
# Checking current screen after dialog dismiss
|
2021-09-27 16:33:44 +02:00
|
|
|
self.assertExists("//ScreenManager[@current=\"create\"]", timeout=5)
|
|
|
|
|
|
|
|
@skip_screen_checks
|
|
|
|
@ordered
|
|
|
|
def test_sending_msg_fully_filled_form(self):
|
|
|
|
"""
|
|
|
|
Sending message when all fields are filled
|
|
|
|
"""
|
|
|
|
# ADD RECEIVER ADDRESS
|
|
|
|
# Checking Receiver Address Field
|
|
|
|
self.assertExists('//DropDownWidget/ScrollView[0]//MyTextInput[@text=\"\"]', timeout=2)
|
|
|
|
# Entering Receiver Address
|
2021-10-13 15:59:44 +02:00
|
|
|
self.cli.setattr(
|
|
|
|
'//DropDownWidget/ScrollView[0]//MyTextInput[0]', "text", test_address['autoresponder_address'])
|
2021-09-27 16:33:44 +02:00
|
|
|
# Checking Receiver Address filled or not
|
2021-10-13 15:59:44 +02:00
|
|
|
self.assertExists(
|
|
|
|
'//DropDownWidget/ScrollView[0]//MyTextInput[@text=\"{}\"]'.format(
|
|
|
|
test_address['autoresponder_address']), timeout=5)
|
2021-09-27 16:33:44 +02:00
|
|
|
# Clicking on send icon
|
|
|
|
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"send\"]', timeout=5)
|
|
|
|
# Checking the current screen
|
|
|
|
self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=10)
|
|
|
|
|
|
|
|
@skip_screen_checks
|
|
|
|
@ordered
|
|
|
|
def test_sent_box(self):
|
|
|
|
"""
|
|
|
|
Checking Message in Sent Screen after sending a Message.
|
|
|
|
"""
|
|
|
|
# this is for opening Nav drawer
|
2021-10-22 13:40:42 +02:00
|
|
|
self.open_side_navbar()
|
2021-09-27 16:33:44 +02:00
|
|
|
# Clicking on Sent Tab
|
|
|
|
self.cli.wait_click('//NavigationItem[@text=\"Sent\"]', timeout=5)
|
|
|
|
# Checking current screen; Sent
|
|
|
|
self.assertExists("//ScreenManager[@current=\"sent\"]", timeout=5)
|
|
|
|
# Checking number of Sent messages
|
|
|
|
total_sent_msgs = len(self.cli.select("//SwipeToDeleteItem"))
|
|
|
|
self.assertEqual(total_sent_msgs, 3)
|