added format() in myaddressbook test

This commit is contained in:
shekhar-cis 2021-10-13 17:23:14 +05:30
parent 7abb2bc55c
commit de0bc59b18
Signed by untrusted user: shekhar-cis
GPG Key ID: 8B2A6C8D5F7F1635

View File

@ -2,41 +2,86 @@ from .telenium_process import TeleniumTestProcess
from .common import ordered from .common import ordered
data = [ test_address = {
'BM-2cWmjntZ47WKEUtocrdvs19y5CivpKoi1h', 'recipient': 'BM-2cVpswZo8rWLXDVtZEUNcDQvnvHJ6TLRYr'
'BM-2cVpswZo8rWLXDVtZEUNcDQvnvHJ6TLRYr' }
]
class MyAddressScreen(TeleniumTestProcess): class MyAddressScreen(TeleniumTestProcess):
"""MyAddress Screen Functionality Testing""" """MyAddress Screen Functionality Testing"""
subject = 'Hey this is Demo Subject'
body = 'Hey i am sending message directly from MyAddress book'
@ordered @ordered
def test_select_myaddress_list(self): def test_select_myaddress_list(self):
"""Select Address From List of Address""" """Select Address From List of Address"""
print("=====================Test -Select Address From List of Address=====================") # This is for checking Current screen
self.cli.sleep(8) self.assert_wait_no_except('//ScreenManager[@current]', timeout=15, value='inbox')
# this is for checking current screen # This is for checking the Side nav Bar is closed
self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=3) 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=2) self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=5)
# checking state of Nav drawer # checking state of Nav drawer
self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=2) self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=5)
# this is for scrolling Nav drawer # this is for scrolling Nav drawer
self.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]") self.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]")
# assert for checking scroll function # assert for checking scroll function
self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=3) self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=3)
# self.assertExists('//NavigationItem[@text=\"My addresses\"]', timeout=2) # this is for opening My Address screen
# this is for opening setting screen
self.cli.wait_click('//NavigationItem[@text=\"My addresses\"]', timeout=2) self.cli.wait_click('//NavigationItem[@text=\"My addresses\"]', timeout=2)
# Checking current screen # Checking current screen
self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=2) self.assertExists("//ScreenManager[@current=\"myaddress\"]", timeout=3)
@ordered @ordered
def test_show_Qrcode(self): 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]', '')
self.assertExists('//DropDownWidget//MyTextInput[@text=\"{}\"]'.format(test_address['recipient']), timeout=5)
# 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]', '')
self.assertExists('//DropDownWidget/ScrollView[0]//MyMDTextField[@text=\"{}\"]'.format(self.subject), timeout=5)
# 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]', '')
self.assertExists('//DropDownWidget/ScrollView[0]//ScrollView[0]/MDTextField[@text=\"{}\"]'.format(self.body), timeout=5)
# Click on Send Icon
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"send\"]', timeout=5)
# Check for redirected screen (Inbox Screen)
self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=7)
@ordered
def test_show_qrcode(self):
"""Show the Qr code of selected address""" """Show the Qr code of selected address"""
print("=====================Test -Show 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 # Checking current screen
self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=2) self.assertExists("//ScreenManager[@current=\"myaddress\"]", timeout=3)
# Click on Address to open popup # Click on Address to open popup
self.cli.wait_click('//MDList[0]/CustomTwoLineAvatarIconListItem[0]', timeout=2) self.cli.wait_click('//MDList[0]/CustomTwoLineAvatarIconListItem[0]', timeout=2)
# Check the Popup is opened # Check the Popup is opened
@ -44,77 +89,33 @@ class MyAddressScreen(TeleniumTestProcess):
# Cick on 'Show QR code' button to view QR Code # Cick on 'Show QR code' button to view QR Code
self.cli.wait_click('//MyaddDetailPopup//MDLabel[@text=\"Show QR code\"]') self.cli.wait_click('//MyaddDetailPopup//MDLabel[@text=\"Show QR code\"]')
# Check Current screen is QR Code screen # Check Current screen is QR Code screen
self.assertExists("//ShowQRCode[@name~=\"showqrcode\"]", timeout=2) self.assertExists("//ScreenManager[@current=\"showqrcode\"]", timeout=2)
# Click on BACK button # Click on BACK button
self.cli.wait_click('//MDToolbar//MDActionTopAppBarButton[@icon=\"arrow-left\"]', timeout=2) self.cli.wait_click('//MDToolbar//MDActionTopAppBarButton[@icon=\"arrow-left\"]', timeout=2)
# Checking current screen(My Address) after BACK press # Checking current screen(My Address) after BACK press
self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=2) self.assertExists("//ScreenManager[@current=\"myaddress\"]", timeout=3)
@ordered @ordered
def test_send_message_from(self): def test_sent_box(self):
"""Send Message From Send Message From Button""" """
print("=====================Test -Send Message From Send Message From Button=====================") Checking Message in Sent Screen after sending a Message.
self.cli.sleep(2) """
# Checking current screen # Checking current screen
self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=2) 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[0]', timeout=2)
# Checking Current screen(Create)
self.assertExists("//Create[@name~=\"create\"]", timeout=2)
# Entering Receiver Address
self.cli.setattr(
'//DropDownWidget/ScrollView[0]//MyTextInput[0]', "text", data[1])
# Checking Receiver Address filled or not
self.assertNotEqual('//DropDownWidget//MyTextInput[0]', '')
# ADD SUBJECT
self.cli.setattr('//DropDownWidget/ScrollView[0]//MyMDTextField[0]', 'text', 'Hey this is Demo 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', 'Hey,i am sending message directly from MyAddress book')
# 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)
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)
@ordered
def test_disable_address(self):
"""Disable Addresses"""
self.cli.sleep(3)
# this is for checking current screen
self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=4)
# this is for opening Nav drawer # this is for opening Nav drawer
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=4) self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3)
# checking state of Nav drawer # checking state of Nav drawer
self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=4) self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=2)
# this is for scrolling Nav drawer # this is for scrolling Nav drawer
self.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]") self.drag("//NavigationItem[@text=\"Purchase\"]", "//NavigationItem[@text=\"My addresses\"]")
# assert for checking scroll function # assert for checking scroll function
self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=4) self.assertCheckScrollUp('//ContentNavigationDrawer//ScrollView[0]', timeout=3)
# self.assertExists('//NavigationItem[@text=\"My addresses\"]', timeout=4) # Clicking on Sent Tab
# this is for opening setting screen self.cli.wait_click('//NavigationItem[@text=\"Sent\"]', timeout=3)
self.cli.wait_click('//NavigationItem[@text=\"My addresses\"]', timeout=4) # Checking current screen; Sent
# Checking current screen self.assertExists("//ScreenManager[@current=\"sent\"]", timeout=3)
self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=4) # Checking the message is rendered in sent box screen
# ADDRESS DISABLED self.assertExists('//SwipeToDeleteItem', timeout=5)
self.cli.sleep(1) # Checking messages count in sent box
self.cli.wait_click('//Thumb', timeout=2) total_sent_msgs = len(self.cli.select("//SwipeToDeleteItem"))
# CLICKING ON DISABLE ACCOUNT TO OPEN POPUP self.assertEqual(total_sent_msgs, 1)
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)
self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=2)