Added Dragging assert in all Test Cases
This commit is contained in:
parent
e239a6de0d
commit
86b772865b
|
@ -74,7 +74,7 @@ class TeleniumTestProcess(TeleniumTestCase):
|
|||
self.cli.sleep(0.3)
|
||||
|
||||
def assertCheckScrollDown(self, selector, timeout=-1):
|
||||
"""this method is for checking scroll"""
|
||||
"""this method is for checking scroll Down"""
|
||||
start = time()
|
||||
while True:
|
||||
scroll_distance = self.cli.getattr(selector, 'scroll_y')
|
||||
|
@ -86,3 +86,17 @@ class TeleniumTestProcess(TeleniumTestCase):
|
|||
if timeout > 0 and time() - start > timeout:
|
||||
raise Exception("Timeout")
|
||||
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)
|
|
@ -31,11 +31,8 @@ class AddressBook(TeleniumTestProcess):
|
|||
self.cli.wait_click('//NavigationItem[@text=\"Address Book\"]', timeout=2)
|
||||
# Checking current screen
|
||||
self.assertExists("//AddressBook[@name~=\"addressbook\"]", timeout=2)
|
||||
|
||||
# Click on Account-Plus Icon to opeb popup for add Address
|
||||
self.cli.execute('app.addingtoaddressbook()')
|
||||
# Checking the popup opened
|
||||
# self.assertExists("//GrashofPopup/MDRaisedButton[@text=\"Save\"]", timeout=4)
|
||||
# Click on Label field to check validation
|
||||
self.cli.wait_click('//GrashofPopup/BoxLayout[0]/MDTextField[0]', timeout=2)
|
||||
# Checking the Label Field shows Validation for empty string
|
||||
|
@ -114,8 +111,6 @@ class AddressBook(TeleniumTestProcess):
|
|||
def test_delete_address_from_address_contact(self):
|
||||
"""Delete Address From Address Book"""
|
||||
print("=====================Test -Delete Address From Address Book=====================")
|
||||
|
||||
|
||||
# this is for checking current screen
|
||||
self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=3)
|
||||
# this is for opening Nav drawer
|
||||
|
@ -126,12 +121,11 @@ class AddressBook(TeleniumTestProcess):
|
|||
self.cli.wait_click('//NavigationItem[@text=\"Address Book\"]', timeout=2)
|
||||
# Checking current screen
|
||||
self.assertExists("//AddressBook[@name~=\"addressbook\"]", timeout=2)
|
||||
self.cli.sleep(3)
|
||||
|
||||
# Swipe to delete
|
||||
self.cli.drag(
|
||||
'//MDList[0]/SwipeToDeleteItem[0]//TwoLineAvatarIconListItem[0]/BoxLayout[1]',
|
||||
'//MDList[0]/SwipeToDeleteItem[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]',2)
|
||||
self.cli.sleep(3)
|
||||
|
||||
self.cli.wait_click(
|
||||
'//AddressBook/BoxLayout[0]//SwipeToDeleteItem[0]', timeout=2)
|
||||
# Click on trash-can icon
|
||||
self.cli.click_on('//MDList[0]/SwipeToDeleteItem[0]//MDIconButton[0]')
|
||||
# Checking current screen
|
||||
self.assertExists("//AddressBook[@name~=\"addressbook\"]", timeout=2)
|
|
@ -59,7 +59,7 @@ class CreateRandomAddress(TeleniumTestProcess):
|
|||
# Scroll Down to get New Address Tab
|
||||
self.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]")
|
||||
# Checking state of scrolled screen
|
||||
self.assertExists('//NavigationItem[@text=\"New address\"]', timeout=3)
|
||||
self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=3)
|
||||
# Clicking on New Address Tab
|
||||
self.cli.wait_click('//NavigationItem[@text=\"New address\"]', timeout=3)
|
||||
self.cli.sleep(1)
|
||||
|
@ -86,7 +86,8 @@ class CreateRandomAddress(TeleniumTestProcess):
|
|||
# Scrolling up to get address dropdown
|
||||
self.drag("//NavigationItem[@text=\"Address Book\"]", "//NavigationItem[@text=\"Settings\"]")
|
||||
# Checking scroll state
|
||||
self.assertExists("//NavigationDrawerSubheader[@text~=\"Accounts\"]", timeout=2)
|
||||
self.assertCheckScrollUp('//ContentNavigationDrawer//ScrollView[0]', timeout=3)
|
||||
# self.assertExists("//NavigationDrawerSubheader[@text~=\"Accounts\"]", timeout=2)
|
||||
# Clicking on Address Dropdown
|
||||
self.cli.wait_click('//NavigationItem[0]/CustomSpinner[0]', timeout=2)
|
||||
# Select address fron Address Dropdown
|
||||
|
|
|
@ -17,18 +17,27 @@ class PaymentScreen(TeleniumTestProcess):
|
|||
self.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]")
|
||||
# assert for checking scroll function
|
||||
self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=3)
|
||||
self.assertExists('//NavigationItem[@text=\"Purchase\"]', timeout=3)
|
||||
# this is for opening Payment screen
|
||||
self.click_on('//NavigationItem[@text=\"Purchase\"]', seconds=2)
|
||||
self.cli.wait_click('//NavigationItem[@text=\"Purchase\"]', timeout=2)
|
||||
# Assert for checking Current Screen
|
||||
self.assertExists("//Payment[@name~=\"payment\"]", timeout=4)
|
||||
self.assertExists("//Payment[@name~=\"payment\"]", timeout=3)
|
||||
# Scrolling Down Product list
|
||||
self.cli.sleep(0.5)
|
||||
self.drag(
|
||||
'//ProductCategoryLayout[0]/ProductLayout[1]',
|
||||
'//ProductCategoryLayout[0]/ProductLayout[0]')
|
||||
# assert for checking scroll function
|
||||
self.assertExists('//MDRaisedButton[3]', timeout=3)
|
||||
self.assertCheckScrollDown('//Payment//ScrollView[0]', timeout=3)
|
||||
# Click on BUY Button
|
||||
self.cli.wait_click('//MDRaisedButton[@text=\"BUY\"]', timeout=2)
|
||||
self.click_on('//ScrollView[0]/ListItemWithLabel[0]', seconds=1)
|
||||
self.click_on('//MDRaisedButton[3]', seconds=1)
|
||||
# Checking the pop up opend by clicking on BUY button
|
||||
# self.assertExists('//PaymentMethodLayout/BoxLayout[0]/MDLabel[@text=\"Select Payment Method\"]', timeout=2)
|
||||
# CLick on the Payment Method
|
||||
self.cli.click_on('//ScrollView[0]/ListItemWithLabel[0]')
|
||||
# Click checked
|
||||
# self.assertExists('//PaymentMethodLayout/BoxLayout[0]/MDLabel[@text=\"Select Payment Method\"]', timeout=2)
|
||||
# Click out side to dismiss the popup
|
||||
self.cli.wait_click('//MDRaisedButton[3]', timeout=2)
|
||||
# Checking Current screen(Payment screen)
|
||||
self.assertExists("//Payment[@name~=\"payment\"]", timeout=2)
|
||||
|
Reference in New Issue
Block a user