Kivy test case[My Address screen]

This commit is contained in:
shekhar-cis 2021-08-18 18:05:57 +05:30
parent 4d1bca76a8
commit 98ce5d793c
Signed by untrusted user: shekhar-cis
GPG Key ID: 8B2A6C8D5F7F1635
2 changed files with 135 additions and 0 deletions

View File

@ -100,3 +100,17 @@ class TeleniumTestProcess(TeleniumTestCase):
if timeout > 0 and time() - start > timeout: if timeout > 0 and time() - start > timeout:
raise Exception("Timeout") raise Exception("Timeout")
sleep(0.1) sleep(0.1)
def assertCheckScrollUp(self, selector, timeout=-1):
"""this method is for checking scroll UP"""
start = time()
while True:
scroll_distance = self.cli.getattr(selector, 'scroll_y')
if scroll_distance < 1.0:
self.assertGreaterEqual(scroll_distance, 0.0)
return True
if timeout == -1:
return False
if timeout > 0 and time() - start > timeout:
raise Exception("Timeout")
sleep(0.1)

View File

@ -0,0 +1,121 @@
from .telenium_process import TeleniumTestProcess
from .common import skip_screen_checks
from .common import ordered
test_address = {
'recipient': 'BM-2cVpswZo8rWLXDVtZEUNcDQvnvHJ6TLRYr'
}
class MyAddressScreen(TeleniumTestProcess):
"""MyAddress Screen Functionality Testing"""
subject = 'Hey this is Demo Subject'
body = 'Hey,i am sending message directly from MyAddress book'
@skip_screen_checks
@ordered
def test_select_myaddress_list(self):
"""Select Address From List of Address"""
# This is for checking Current screen
self.assert_wait_no_except('//ScreenManager[@current]', timeout=15, value='inbox')
# This is for checking the Side nav Bar is closed
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
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=5)
# checking state of Nav drawer
self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=5)
# this is for scrolling Nav drawer
self.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]")
# assert for checking scroll function
self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=3)
# this is for opening My Address screen
self.cli.wait_click('//NavigationItem[@text=\"My addresses\"]', timeout=2)
# Checking current screen
self.assertExists("//ScreenManager[@current=\"myaddress\"]", timeout=3)
@skip_screen_checks
@ordered
def test_send_message_from(self):
"""Send Message From send Button"""
# This is for checking Current screen
self.assertExists("//ScreenManager[@current=\"myaddress\"]", timeout=3)
# Click on Address to open popup
self.cli.wait_click('//MDList[0]/CustomTwoLineAvatarIconListItem[0]', timeout=2)
# Checking Popup Opened
self.assertExists('//MyaddDetailPopup//MDLabel[@text=\"Send message from\"]', timeout=2)
# Click on Send Message Button to redirect Create Screen
self.cli.wait_click('//MyaddDetailPopup//MDRaisedButton[0]/MDLabel[@text=\"Send message from\"]', timeout=2)
# Checking Current screen(Create)
self.assertExists("//ScreenManager[@current=\"create\"]", timeout=2)
# Entering Receiver Address
self.cli.setattr(
'//DropDownWidget/ScrollView[0]//MyTextInput[0]', "text", test_address['recipient'])
# Checking Receiver Address filled or not
self.assertNotEqual('//DropDownWidget//MyTextInput[0]', '')
# ADD SUBJECT
self.cli.setattr('//DropDownWidget/ScrollView[0]//MyMDTextField[0]', 'text', self.subject)
# Checking Subject Field is Entered
self.assertNotEqual('//DropDownWidget/ScrollView[0]//MyMDTextField[0]', '')
# ADD MESSAGE BODY
self.cli.setattr(
'//DropDownWidget/ScrollView[0]//ScrollView[0]/MDTextField[0]', 'text',
self.body)
# Checking Message body is Entered
self.assertNotEqual('//DropDownWidget/ScrollView[0]//ScrollView[0]/MDTextField[@text]', '')
# Click on Send Icon
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"send\"]', timeout=3)
# Check for redirected screen (Inbox Screen)
self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=7)
@skip_screen_checks
@ordered
def test_show_qrcode(self):
"""Show the Qr code of selected address"""
# This is for checking the Side nav Bar is closed
self.assertExists('//MDNavigationDrawer[@status~=\"closed\"]', timeout=5)
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=\"My addresses\"]', timeout=3)
# Checking current screen
self.assertExists("//ScreenManager[@current=\"myaddress\"]", timeout=3)
# Click on Address to open popup
self.cli.wait_click('//MDList[0]/CustomTwoLineAvatarIconListItem[0]', timeout=2)
# Check the Popup is opened
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("//ScreenManager[@current=\"showqrcode\"]", timeout=2)
# Click on BACK button
self.cli.wait_click('//MDToolbar//MDActionTopAppBarButton[@icon=\"arrow-left\"]', timeout=2)
# Checking current screen(My Address) after BACK press
self.assertExists("//ScreenManager[@current=\"myaddress\"]", timeout=3)
@skip_screen_checks
@ordered
def test_sent_box(self):
"""
Checking Message in Sent Screen after sending a Message.
"""
# Checking current screen
self.assertExists("//ScreenManager[@current=\"myaddress\"]", timeout=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)
# this is for scrolling Nav drawer
self.drag("//NavigationItem[@text=\"Purchase\"]", "//NavigationItem[@text=\"My addresses\"]")
# assert for checking scroll function
self.assertCheckScrollUp('//ContentNavigationDrawer//ScrollView[0]', timeout=3)
# Clicking on Sent Tab
self.cli.wait_click('//NavigationItem[@text=\"Sent\"]', timeout=3)
# Checking current screen; Sent
self.assertExists("//ScreenManager[@current=\"sent\"]", timeout=3)
# Checking number of messages in sent box
total_sent_msgs = len(self.cli.select("//SwipeToDeleteItem"))
self.assertEqual(total_sent_msgs, 1)