In test cases assertEqual replaced with assertExist

This commit is contained in:
osamacis 2022-11-28 19:13:02 +05:30
parent d17eb6aeb9
commit 2d327352e2
No known key found for this signature in database
GPG Key ID: 15F978BEFADAB9E1
2 changed files with 24 additions and 14 deletions

View File

@ -64,6 +64,11 @@ class MyAddressScreen(TeleniumTestProcess):
) )
# Clicking on 'Ok' Button To Dismiss the popup # Clicking on 'Ok' Button To Dismiss the popup
self.cli.wait_click('//MDFlatButton[@text=\"Ok\"]', timeout=5) self.cli.wait_click('//MDFlatButton[@text=\"Ok\"]', timeout=5)
# Check the thumb button on address
self.assertExists(
"//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test2\"]//ToggleBtn/Thumb",
timeout=5
)
# Clicking on toggle button to enable the address # Clicking on toggle button to enable the address
self.cli.wait_click( self.cli.wait_click(
"//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test2\"]//ToggleBtn/Thumb", "//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test2\"]//ToggleBtn/Thumb",
@ -72,7 +77,7 @@ class MyAddressScreen(TeleniumTestProcess):
# Checking the address is enabled # Checking the address is enabled
self.assertExists( self.assertExists(
"//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test2\"]//ToggleBtn[@active=true]", "//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test2\"]//ToggleBtn[@active=true]",
timeout=5 timeout=15
) )
# Checking the current screen is MyAddress # Checking the current screen is MyAddress
self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=5) self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=5)
@ -80,13 +85,16 @@ class MyAddressScreen(TeleniumTestProcess):
@ordered @ordered
def test_show_Qrcode(self): def test_show_Qrcode(self):
"""Show the Qr code of selected address""" """Show the Qr code of selected address"""
# Checking labels from addresss list
first_label = self.cli.getattr('//MyAddress//MDList[0]/CustomTwoLineAvatarIconListItem[1][@text]', 'text')
second_label = self.cli.getattr('//MyAddress//MDList[0]/CustomTwoLineAvatarIconListItem[0][@text]', 'text')
# Checking first label # Checking first label
self.assertEqual(first_label, 'test1') self.assertExists(
'//MyAddress//MDList[0]/CustomTwoLineAvatarIconListItem[1][@text=\"test1\"]',
timeout=5
)
# Checking second label # Checking second label
self.assertEqual(second_label, 'test2') self.assertExists(
'//MyAddress//MDList[0]/CustomTwoLineAvatarIconListItem[0][@text=\"test2\"]',
timeout=5
)
# Click on Address to open popup # Click on Address to open popup
self.cli.wait_click('//MDList[0]/CustomTwoLineAvatarIconListItem[@text=\"test1\"]', timeout=5) self.cli.wait_click('//MDList[0]/CustomTwoLineAvatarIconListItem[@text=\"test1\"]', timeout=5)
# Check the Popup is opened # Check the Popup is opened

View File

@ -13,7 +13,7 @@ class PaymentScreen(TeleniumTestProcess):
# Dragging from sent to inbox to get Payment tab # Dragging from sent to inbox to get Payment tab
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=5)
# this is for opening Payment screen # this is for opening Payment screen
self.cli.wait_click('//NavigationItem[@text=\"Purchase\"]', timeout=5) self.cli.wait_click('//NavigationItem[@text=\"Purchase\"]', timeout=5)
# Checking the navbar is in closed state # Checking the navbar is in closed state
@ -25,18 +25,20 @@ class PaymentScreen(TeleniumTestProcess):
'//ProductCategoryLayout[0]/ProductLayout[0]', '//ProductCategoryLayout[0]/ProductLayout[0]',
'//ProductCategoryLayout[0]/ProductLayout[1]') '//ProductCategoryLayout[0]/ProductLayout[1]')
# assert for checking scroll function # assert for checking scroll function
self.assertCheckScrollDown('//Payment//ScrollView[0]', timeout=3) self.assertCheckScrollDown('//Payment//ScrollView[0]', timeout=5)
# Scrolling Up Product list # Scrolling Up Product list
self.drag( self.drag(
'//ProductCategoryLayout[0]/ProductLayout[1]', '//ProductCategoryLayout[0]/ProductLayout[1]',
'//ProductCategoryLayout[0]/ProductLayout[0]') '//ProductCategoryLayout[0]/ProductLayout[0]')
# assert for checking scroll function # assert for checking scroll function
self.assertCheckScrollDown('//Payment//ScrollView[0]', timeout=3) self.assertCheckScrollDown('//Payment//ScrollView[0]', timeout=5)
# Click on BUY Button # Click on BUY Button
self.cli.wait_click('//MDRaisedButton[@text=\"BUY\"]', timeout=2) self.cli.wait_click('//MDRaisedButton[@text=\"BUY\"]', timeout=5)
# assert check the buying option popup is closed # CLick on the Payment Method
self.assertExists('//PaymentMethodLayout[@disabled=false]', timeout=5) self.cli.click_on('//ScrollView[0]//ListItemWithLabel[0]')
# Check pop up is opened
self.assertExists('//PaymentMethodLayout[@disabled=false]', timeout=10)
# Click out side to dismiss the popup # Click out side to dismiss the popup
self.cli.wait_click('//MDRaisedButton[3]', timeout=2) self.cli.wait_click('//MDRaisedButton[5]', timeout=5)
# Checking Current screen(Payment screen) # Checking Current screen(Payment screen)
self.assertExists("//ScreenManager[@current=\"payment\"]", timeout=3) self.assertExists("//ScreenManager[@current=\"payment\"]", timeout=5)