This commit is contained in:
shekhar-cis 2021-08-20 15:39:53 +05:30
parent ba7eb7eb3e
commit 8936194c5d
Signed by untrusted user: shekhar-cis
GPG Key ID: 8B2A6C8D5F7F1635
10 changed files with 343 additions and 149 deletions

View File

@ -0,0 +1,120 @@
my address test
from .telenium_process import TeleniumTestProcess
from .common import ordered
data = [
'BM-2cWmjntZ47WKEUtocrdvs19y5CivpKoi1h',
'BM-2cVpswZo8rWLXDVtZEUNcDQvnvHJ6TLRYr'
]
class MyAddressScreen(TeleniumTestProcess):
"""MyAddress Screen Functionality Testing"""
@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)
@ordered
def test_show_Qrcode(self):
"""Show the Qr code of selected address"""
# 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)
@ordered
def test_send_message_from(self):
"""Send Message From send Button"""
# This is for checking Current screen
self.assert_wait_no_except('//ScreenManager[@current]', timeout=5, value='myaddress')
# 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("//ScreenManager[@current=\"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.assert_wait_no_except('//ScreenManager[@current]', timeout=5, value='inbox')
@ordered
def test_disable_address(self):
"""Disable Addresses"""
# this is for checking current screen
self.assert_wait_no_except('//ScreenManager[@current]', timeout=5, value='inbox')
# this is for opening Nav drawer
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=4)
# checking state of Nav drawer
self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=4)
# 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=4)
# this is for opening setting screen
self.cli.wait_click('//NavigationItem[@text=\"My addresses\"]', timeout=4)
# Checking current screen
self.assertExists("//ScreenManager[@current=\"myaddress\"]", timeout=3)
# ADDRESS DISABLED
# self.cli.sleep(1)
self.cli.wait_click('//Thumb', timeout=2)
# CLICKING ON DISABLE ACCOUNT TO OPEN POPUP
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("//ScreenManager[@current=\"myaddress\"]", timeout=3)

View File

@ -6,8 +6,7 @@ import os
import shutil import shutil
import tempfile import tempfile
from time import time, sleep from time import time, sleep
from turtle import Turtle, pd from telenium.client import TeleniumHttpException
from telenium.tests import TeleniumTestCase from telenium.tests import TeleniumTestCase
_files = ( _files = (
@ -64,15 +63,50 @@ class TeleniumTestProcess(TeleniumTestCase):
pass pass
cleanup() cleanup()
def assertCheck_app_launch(self, selector, timeout=-1): def assert_wait_no_except(self, selector, timeout=-1, value='inbox'):
"""This method is written to check the application is launched otherwise it will wait untill timeout value""" """This method is to check the application is launched."""
while timeout > 0: start = time()
deadline = start + timeout
while time() < deadline:
try: try:
self.assertTrue(selector, 'inbox') if self.cli.getattr(selector, 'current') == value:
timeout -= 0.3 self.assertTrue(selector, value)
except: break
raise Exception("Timeout") except TeleniumHttpException:
sleep(0.3) sleep(0.1)
continue
finally:
# Finally Sleep is used to make the menu button funcationlly available for the click process.
# (because Transition is little bit slow)
sleep(0.2)
def swipe_drag(self, is_drag_open, timeout=-1):
start = time()
deadline = start + timeout
while time() < deadline:
try:
if is_drag_open:
print('except --------------1', is_drag_open)
self.cli.wait_click('//MDList[0]/CustomSwipeToDeleteItem[0]/MDCardSwipeLayerBox[0]')
self.assertEqual(is_drag_open, True)
self.cli.wait_click('//MDList[0]/CustomSwipeToDeleteItem[0]//MDIconButton[@icon=\"trash-can\"]', timeout=5)
print('except --------------2', is_drag_open)
break
else:
print('except --------------3', is_drag_open)
self.cli.drag(
'//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[1]',
'//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]', 1)
print('except --------------4', is_drag_open)
# self.cli.wait_click('//MDList[0]/CustomSwipeToDeleteItem[0]/MDCardSwipeLayerBox[0]')
print('except --------------5', is_drag_open)
sleep(0.2)
continue
except TeleniumHttpException:
print('------------------6-')
sleep(0.2)
continue
# self.assertEqual(is_drag_open, True)
# self.cli.wait_click('//MDList[0]/CustomSwipeToDeleteItem[0]//MDIconButton[@icon=\"trash-can\"]', timeout=5)
def click_on(self, xpath, seconds=0.3): def click_on(self, xpath, seconds=0.3):
"""this method is used for on_click event with time""" """this method is used for on_click event with time"""
@ -110,4 +144,4 @@ class TeleniumTestProcess(TeleniumTestCase):
return False return False
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)

View File

@ -7,13 +7,12 @@ class AllMailMessage(TeleniumTestProcess):
@ordered @ordered
def test_show_allmail_list(self): def test_show_allmail_list(self):
"""Show All Messages on Mail Screen/Window""" """Show All Messages on Mail Screen/Window"""
try: # This is for checking Current screen
# checking current screen self.assert_wait_no_except('//ScreenManager[@current]', timeout=15, value='inbox')
self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=5) # This is for checking the Side nav Bar id closed
except: self.assertExists('//MDNavigationDrawer[@status~=\"closed\"]', timeout=5)
self.cli.sleep(8) # This is for checking the menu button is appeared
# checking current screen self.assertExists('//MDActionTopAppBarButton[@icon~=\"menu\"]', timeout=5)
self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=5)
# this is for opening Nav drawer # this is for opening Nav drawer
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3) self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3)
# checking state of Nav drawer # checking state of Nav drawer

View File

@ -4,6 +4,9 @@ from .telenium_process import TeleniumTestProcess, cleanup
from .common import ordered from .common import ordered
from random import choice from random import choice
from string import ascii_lowercase from string import ascii_lowercase
from time import time, sleep
from telenium.client import TeleniumHttpException
class CreateRandomAddress(TeleniumTestProcess): class CreateRandomAddress(TeleniumTestProcess):
"""This is for testing randrom address creation""" """This is for testing randrom address creation"""
@ -13,19 +16,35 @@ class CreateRandomAddress(TeleniumTestProcess):
os.environ["BITMESSAGE_HOME"] = tempfile.gettempdir() os.environ["BITMESSAGE_HOME"] = tempfile.gettempdir()
cleanup() cleanup()
super(TeleniumTestProcess, cls).setUpClass() super(TeleniumTestProcess, cls).setUpClass()
@ordered @ordered
def test_login_screen(self): def test_login_screen(self):
"""Clicking on Proceed Button to Proceed to Next Screen.""" """Clicking on Proceed Button to Proceed to Next Screen."""
print("=====================Test - Login Screen=====================") # This is for checking Current screen
self.cli.sleep(8) self.assert_wait_no_except('//ScreenManager[@current]', timeout=20, value='login')
# Checking current Screen(Login screen) # self.assertExists("//Login[@name~=\"login\"]", timeout=3)
self.assertExists("//Login[@name~=\"login\"]", timeout=3)
# Clicking on Proceed Next Button # Clicking on Proceed Next Button
self.cli.wait_click( # self.assertExists("//ScreenManager[@current=\"login\"]", timeout=5)
'//Screen[0]/BoxLayout[0]/AnchorLayout[3]/MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=2) print(self.cli.getattr('//ScreenManager[@current]', 'current'), '--------------------------------------')
get_screen_value = self.cli.getattr('//ScreenManager[@current]', 'current')
start = time()
deadline = start + 5
while time() < deadline:
self.cli.click_on(
'//Screen[0]/BoxLayout[0]/AnchorLayout[3]/MDFillRoundFlatIconButton[@text=\"Proceed Next\"]')
try:
if self.cli.getattr('//ScreenManager[@current]', 'current') == 'random':
self.assertTrue(get_screen_value, 'random')
break
except TeleniumHttpException:
sleep(0.1)
continue
raise AssertionError('timeout')
# Checking Current Screen(Random Screen) after Clicking on Proceed Next Button # Checking Current Screen(Random Screen) after Clicking on Proceed Next Button
self.assertExists("//Random[@name~=\"random\"]", timeout=2) print(self.cli.getattr('//ScreenManager[@current]', 'current'), '--------------------------------------')
self.assert_wait_no_except('//ScreenManager[@current]', timeout=15, value='random')
@ordered @ordered
def test_random_screen(self): def test_random_screen(self):

View File

@ -1,42 +1,42 @@
from .telenium_process import TeleniumTestProcess from .telenium_process import TeleniumTestProcess
from .common import ordered from .common import ordered
data = [ data = [
'BM-2cWmjntZ47WKEUtocrdvs19y5CivpKoi1h', 'BM-2cWmjntZ47WKEUtocrdvs19y5CivpKoi1h',
'BM-2cVpswZo8rWLXDVtZEUNcDQvnvHJ6TLRYr' 'BM-2cVpswZo8rWLXDVtZEUNcDQvnvHJ6TLRYr'
] ]
class MyAddressScreen(TeleniumTestProcess): class MyAddressScreen(TeleniumTestProcess):
"""MyAddress Screen Functionality Testing""" """MyAddress Screen Functionality Testing"""
@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_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=====================")
# 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,19 +44,17 @@ 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_send_message_from(self):
"""Send Message From Send Message From Button""" """Send Message From send Button"""
print("=====================Test -Send Message From Send Message From Button=====================") # This is for checking Current screen
self.cli.sleep(2) self.assert_wait_no_except('//ScreenManager[@current]', timeout=5, value='myaddress')
# Checking current screen
self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=2)
# 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)
# Checking Popup Opened # Checking Popup Opened
@ -64,57 +62,23 @@ class MyAddressScreen(TeleniumTestProcess):
# Click on Send Message Button to redirect Create Screen # Click on Send Message Button to redirect Create Screen
self.cli.wait_click('//MyaddDetailPopup//MDRaisedButton[0]/MDLabel[0]', timeout=2) self.cli.wait_click('//MyaddDetailPopup//MDRaisedButton[0]/MDLabel[0]', timeout=2)
# Checking Current screen(Create) # Checking Current screen(Create)
self.assertExists("//Create[@name~=\"create\"]", timeout=2) self.assertExists("//ScreenManager[@current=\"create\"]", timeout=2)
# Entering Receiver Address # Entering Receiver Address
self.cli.setattr( self.cli.setattr(
'//DropDownWidget/ScrollView[0]//MyTextInput[0]', "text", data[1]) '//DropDownWidget/ScrollView[0]//MyTextInput[0]', "text", data[1])
# Checking Receiver Address filled or not # Checking Receiver Address filled or not
self.assertNotEqual('//DropDownWidget//MyTextInput[0]', '') self.assertNotEqual('//DropDownWidget//MyTextInput[0]', '')
# ADD SUBJECT # ADD SUBJECT
self.cli.setattr('//DropDownWidget/ScrollView[0]//MyMDTextField[0]', 'text', 'Hey this is Demo Subject') self.cli.setattr('//DropDownWidget/ScrollView[0]//MyMDTextField[0]', 'text', 'Hey this is Demo Subject')
# Checking Subject Field is Entered # Checking Subject Field is Entered
self.assertNotEqual('//DropDownWidget/ScrollView[0]//MyMDTextField[0]', '') self.assertNotEqual('//DropDownWidget/ScrollView[0]//MyMDTextField[0]', '')
# ADD MESSAGE BODY # ADD MESSAGE BODY
self.cli.setattr('//DropDownWidget/ScrollView[0]//ScrollView[0]/MDTextField[0]', self.cli.setattr(
'text', 'Hey,i am sending message directly from MyAddress book') '//DropDownWidget/ScrollView[0]//ScrollView[0]/MDTextField[0]', 'text',
'Hey,i am sending message directly from MyAddress book')
# Checking Message body is Entered # Checking Message body is Entered
self.assertNotEqual('//DropDownWidget/ScrollView[0]//ScrollView[0]/MDTextField[@text]', '') self.assertNotEqual('//DropDownWidget/ScrollView[0]//ScrollView[0]/MDTextField[@text]', '')
# Click on Send Icon # Click on Send Icon
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"send\"]', timeout=3) 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 Sending a message
# Checking Current screen after Send a message self.assert_wait_no_except('//ScreenManager[@current]', timeout=5, value='inbox')
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
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=4)
# checking state of Nav drawer
self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=4)
# 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=4)
# self.assertExists('//NavigationItem[@text=\"My addresses\"]', timeout=4)
# this is for opening setting screen
self.cli.wait_click('//NavigationItem[@text=\"My addresses\"]', timeout=4)
# Checking current screen
self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=4)
# ADDRESS DISABLED
self.cli.sleep(1)
self.cli.wait_click('//Thumb', timeout=2)
# CLICKING ON DISABLE ACCOUNT TO OPEN POPUP
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)

View File

@ -6,25 +6,25 @@ class NetworkStatusScreen(TeleniumTestProcess):
def test_network_status(self): def test_network_status(self):
"""Show Netwrok Status""" """Show Netwrok Status"""
try: # This is for checking Current screen
# checking current screen self.assert_wait_no_except('//ScreenManager[@current]', timeout=15, value='inbox')
self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=5) # This is for checking the Side nav Bar id closed
except: self.assertExists('//MDNavigationDrawer[@status~=\"closed\"]', timeout=5)
self.cli.sleep(8) # This is for checking the menu button is appeared
self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=5) 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=5)
# Clicking on Network Status tab # Clicking on Network Status tab
self.cli.wait_click('//NavigationItem[@text=\"Network status\"]', timeout=2) self.cli.wait_click('//NavigationItem[@text=\"Network status\"]', timeout=5)
# checking current screen # checking current screen
self.assertExists("//ScreenManager[@current=\"networkstat\"]", timeout=2) self.assertExists("//ScreenManager[@current=\"networkstat\"]", timeout=5)
# Clicking on Processes Tab # Clicking on Processes Tab
self.cli.wait_click('//NetworkStat/MDTabs[0]//MDTabsLabel[@text=\"Processes\"]', timeout=2) self.cli.wait_click('//NetworkStat/MDTabs[0]//MDTabsLabel[@text=\"Processes\"]', timeout=3)
# this is for checking current screen # this is for checking current screen
self.assertExists("//ScreenManager[@current=\"networkstat\"]", timeout=2) self.assertExists("//ScreenManager[@current=\"networkstat\"]", timeout=3)

View File

@ -1,22 +1,21 @@
from requests import sessions
from .telenium_process import TeleniumTestProcess from .telenium_process import TeleniumTestProcess
class PaymentScreen(TeleniumTestProcess): class PaymentScreen(TeleniumTestProcess):
"""SubscriptionPayment Screen Functionality Testing""" """SubscriptionPayment Screen Functionality Testing"""
def test_select_subscripton(self): def test_select_subscription(self):
"""Select Subscripton From List of Subscriptons""" """Select Subscription From List of Subscriptions"""
try: # This is for checking Current screen
# checking current screen self.assert_wait_no_except('//ScreenManager[@current]', timeout=15, value='inbox')
self.assertExists("//Scre enManager[@current=\"inbox\"]", timeout=5) # This is for checking the Side nav Bar id closed
except: self.assertExists('//MDNavigationDrawer[@status~=\"closed\"]', timeout=5)
self.cli.sleep(8) # This is for checking the menu button is appeared
self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=5) 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=3) 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)
# 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
@ -24,9 +23,11 @@ class PaymentScreen(TeleniumTestProcess):
# this is for opening Payment screen # this is for opening Payment screen
self.cli.wait_click('//NavigationItem[@text=\"Purchase\"]', timeout=2) self.cli.wait_click('//NavigationItem[@text=\"Purchase\"]', timeout=2)
# Assert for checking Current Screen # Assert for checking Current Screen
self.assertExists("//ScreenManager[@current=\"payment\"]", timeout=3) # self.assertExists("//ScreenManager[@current=\"payment\"]", timeout=3)
self.assert_wait_no_except('//ScreenManager[@current]', timeout=2, value='Payment')
# Scrolling Down Product list # Scrolling Down Product list
self.click_on('//ProductCategoryLayout[0]/ProductLayout[1]', seconds=1) self.cli.wait_click('//ProductCategoryLayout[0]/ProductLayout[1]', timeout=3)
# self.click_on('//ProductCategoryLayout[0]/ProductLayout[1]', seconds=1)
self.drag( self.drag(
'//ProductCategoryLayout[0]/ProductLayout[1]', '//ProductCategoryLayout[0]/ProductLayout[1]',
'//ProductCategoryLayout[0]/ProductLayout[0]') '//ProductCategoryLayout[0]/ProductLayout[0]')
@ -34,10 +35,12 @@ class PaymentScreen(TeleniumTestProcess):
self.assertCheckScrollDown('//Payment//ScrollView[0]', timeout=3) self.assertCheckScrollDown('//Payment//ScrollView[0]', timeout=3)
# 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=2)
self.assert_wait_no_except('//ScreenManager[@current]', timeout=2, value='payment')
# CLick on the Payment Method # CLick on the Payment Method
self.cli.click_on('//ScrollView[0]/ListItemWithLabel[0]') self.cli.click_on('//ScrollView[0]/ListItemWithLabel[0]')
# Check pop up is opened # Check pop up is opened
self.assertEqual(self.cli.getattr('//PaymentMethodLayout/BoxLayout[0]/MDLabel[0]', 'text'), 'Select Payment Method') self.assertEqual(self.cli.getattr('//PaymentMethodLayout/BoxLayout[0]/MDLabel[0]', 'text'),
'Select Payment Method')
# 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[3]', timeout=2)
# Checking Current screen(Payment screen) # Checking Current screen(Payment screen)

View File

@ -16,7 +16,6 @@ class SendMessage(TeleniumTestProcess):
Sending Message From Inbox Screen Sending Message From Inbox Screen
opens a pop-up(screen)which send message from sender to reciever opens a pop-up(screen)which send message from sender to reciever
""" """
print("=======Test - Sending Message From Inbox Screen with validation Checks=======")
self.cli.sleep(8) self.cli.sleep(8)
# this is for opening Nav drawer # this is for opening Nav drawer
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3) self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3)

View File

@ -6,15 +6,16 @@ class SettingScreen(TeleniumTestProcess):
def test_setting_screen(self): def test_setting_screen(self):
"""Show Setting Screen""" """Show Setting Screen"""
# self.cli.sleep(8) # This is for checking Current screen
self.assertCheck_app_launch('//ScreenManager[@current]', timeout=5) self.assert_wait_no_except('//ScreenManager[@current]', timeout=15, value='inbox')
# print(self.assertTrue('//ScreenManager[@current]', 'inbox'), "self.assertTrue('//ScreenManager[@current]', 'inbox')self.assertTrue('//ScreenManager[@current]', 'inbox')self.assertTrue('//ScreenManager[@current]', 'inbox')self.assertTrue('//ScreenManager[@current]', 'inbox')") # This is for checking the Side nav Bar id closed
# self.assertTrue('//ScreenManager[@current]', 'inbox') self.assertExists('//MDNavigationDrawer[@status~=\"closed\"]', timeout=5)
# self.assertCheck_app_launch('//ScreenManager[@current=\"inbox\"]', 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

View File

@ -1,3 +1,4 @@
from time import sleep
from .telenium_process import TeleniumTestProcess from .telenium_process import TeleniumTestProcess
@ -6,43 +7,97 @@ class TrashMessage(TeleniumTestProcess):
def test_delete_trash_message(self): def test_delete_trash_message(self):
"""Delete Trash message permanently from trash message listing""" """Delete Trash message permanently from trash message listing"""
try: # This is for checking Current screen
# checking current screen self.assert_wait_no_except('//ScreenManager[@current]', timeout=18, value='inbox')
self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=5) # This is for checking the Side nav Bar id closed
except: self.assertExists('//MDNavigationDrawer[@status~=\"closed\"]', timeout=5)
self.cli.sleep(8) # This is for checking the menu button is appeared
# checking current screen self.assertExists('//MDActionTopAppBarButton[@icon~=\"menu\"]', timeout=5)
self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=5)
# this is for opening Nav drawer # this is for opening Nav drawer
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=5) 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=5) self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=5)
# this is for opening Trash screen # this is for opening Trash screen
self.click_on('//NavigationItem[@text=\"Trash\"]', seconds=2) self.cli.wait_click('//NavigationItem[@text=\"Trash\"]', timeout=3)
# checking current screen(Trash Screen) # checking current screen(Trash Screen)
self.assertExists("//ScreenManager[@current=\"trash\"]", timeout=3) # self.assertExists("//ScreenManager[@current=\"trash\"]", timeout=3)
# Checking Trash Icon is in disable state self.assert_wait_no_except('//ScreenManager[@current]', timeout=5, value='trash')
self.assertTrue('//MDList[0]/CustomSwipeToDeleteItem[0]//MDIconButton[@disabled]', 'True') self.cli.sleep(2)
# This is for swiping message to activate delete icon. self.cli.drag(
self.drag(
'//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[1]', '//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[1]',
'//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]') '//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]', 1)
# Checking Trash Icon is in disable state
# self.assertTrue('//MDList[0]/CustomSwipeToDeleteItem[0]//MDIconButton[@disabled]', False)
# is_trash_icon = self.cli.getattr('//Trash//MDList[0]/CustomSwipeToDeleteItem[0]/MDCardSwipeLayerBox[0]/MDIconButton[@disabled]', 'disabled')
# self.assertEqual(is_trash_icon, True)
# is_drag_open = self.cli.getattr('//Trash//MDList[0]/CustomSwipeToDeleteItem[@_opens_process]', '_opens_process')
# self.assertEqual(is_drag_open, False)
# print(is_drag_open, '=s--------------------------------------1')
# self.cli.sleep(3)
# self.cli.wait_click('//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[1]', timeout=5)
# This is for swiping message to activate delete icon.
# self.swipe_drag(is_trash_icon, timeout=5)
# self.swipe_drag(is_drag_open, timeout=5)
# self.cli.sleep(1)
# self.cli.wait_click('//MDList[0]/CustomSwipeToDeleteItem[0]/MDCardSwipeLayerBox[0]', timeout=2)
# self.cli.drag(
# '//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[1]',
# '//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]', 1)
# self.cli.wait_click('//MDList[0]/CustomSwipeToDeleteItem[0]/MDCardSwipeLayerBox[0]', timeout=2)
# is_drag_open = self.cli.getattr('//Trash//MDList[0]/CustomSwipeToDeleteItem[@_opens_process]', '_opens_process')
# self.assertEqual(is_drag_open, False)
# print(is_drag_open, '--------------------------------------2')
# Assert to check the drag is worked (Trash icon Activated) # Assert to check the drag is worked (Trash icon Activated)
self.assertTrue('//MDList[0]/CustomSwipeToDeleteItem[0]//MDIconButton[@disabled]', 'False') # self.assertExists("//MDList[0]/CustomSwipeToDeleteItem[0]//MDIconButton[@icon~=\"trash-can\"]", timeout=2)
# self.cli.wait_click('//MDList[0]/CustomSwipeToDeleteItem[0]/MDCardSwipeLayerBox[0]')
# self.assertEqual(is_trash_icon, False)
# self.assertEqual(is_trash_icon, False)
# Checking the Trash Icon after swipe. # Checking the Trash Icon after swipe.
self.assertExists("//MDList[0]/CustomSwipeToDeleteItem[0]//MDIconButton[@icon~=\"trash-can\"]", timeout=2)
# Clicking on Trash icon to open Confirm delete pop up # Clicking on Trash icon to open Confirm delete pop up
self.click_on('//MDList[0]/CustomSwipeToDeleteItem[0]', seconds=1) # self.cli.wait_click('//MDList[0]/Cust omSwipeToDeleteItem[0]', timeout=3)
# Checking Confirm delete Popup is Opened # checking current screen(Trash Screen)
self.assertTrue('//MDList[0]/CustomSwipeToDeleteItem[@_opens_process]', 'True') # self.cli.sleep(3)
# clicking on Trash Box icon to delete message. # self.cli.wait_click('//NavigationItem[@text=\"Trash\"]', timeout=3)
self.cli.wait_click('//MDList[0]/CustomSwipeToDeleteItem[0]//MDIconButton[0]', timeout=2) # self.cli.sleep(3)
# Checking the popup screen is closed.
self.assertTrue('//MDList[0]/CustomSwipeToDeleteItem[@_opens_process]', 'False') # Checking Confirm delete Popup is Opened
# Clicking on 'Yes' Button on Popup to confirm delete. # self.assertTrue('//MDList[0]/CustomSwipeToDeleteItem[@_opens_process]', True)
self.click_on('//MDFlatButton[@text=\"Yes\"]', seconds=1.1)
# clicking on Trash Box icon to delete message.
# self.cli.click_on('//MDList[0]/CustomSwipeToDeleteItem[0]//MDIconButton[@icon=\"trash-can\"]')
# self.assertEqual(is_drag_open, True)
sleep(5)
self.cli.click_on('//Trash//MDList[0]/CustomSwipeToDeleteItem[0]//MDIconButton[@icon=\"trash-can\"]')
print(self.cli.getattr('//Trash//MDList[0]/CustomSwipeToDeleteItem[0]//MDIconButton[@icon]', 'icon'), '=====================icon')
# self.assert_wait_no_except('//ScreenManager[@current]', timeout=6, value='trash')
sleep(5)
# Checking the popup screen is closed.
# self.cli.wait_click('//MDList[0]/CustomSwipeToDeleteItem[0]//MDIconButton[@icon=\"trash-can\"]', timeout=5)
# is_drag_open = self.cli.getattr('//Trash//MDList[0]/CustomSwipeToDeleteItem[@_opens_process]', '_opens_process')
# self.assertEqual(is_drag_open, False)
# print(is_drag_open, '--------------------------------------3')
# self.assertTrue('//MDList[0]/CustomSwipeToDeleteItem[@_opens_process]', True)
self.assert_wait_no_except('//ScreenManager[@current]', timeout=15, value='trash')
is_trash_icon = self.cli.getattr('//Trash//MDList[0]/CustomSwipeToDeleteItem[0]/MDCardSwipeLayerBox[0]/MDIconButton[@disabled]', 'disabled')
# self.cli.sleep(10)
is_trash_icon = self.cli.getattr('//Trash//MDList[0]/CustomSwipeToDeleteItem[0]/MDCardSwipeLayerBox[0]/MDIconButton[@disabled]', 'disabled')
# self.cli.wait_click('//MDList[0]/CustomSwipeToDeleteItem[0]//MDIconButton[@icon=\"trash-can\"]', timeout=5)
is_drag_open = self.cli.getattr('//Trash//MDList[0]/CustomSwipeToDeleteItem[@_opens_process]', '_opens_process')
# self.assertEqual(is_drag_open, False)
# print(is_drag_open, '--------------------------------------4')
# Clicking on 'Yes' Button on Popup to confirm delete.
# self.cli.wait_click('//MDFlatButton[@text=\"Yes\"]', timeout=5)
# checking current screen(Trash Screen) # checking current screen(Trash Screen)
self.assertExists("//ScreenManager[@current=\"trash\"]", timeout=2)
total_trash_msgs = len(self.cli.select("//CustomSwipeToDeleteItem")) total_trash_msgs = len(self.cli.select("//CustomSwipeToDeleteItem"))
# Checking messages count after delete. # Checking messages count after delete.
self.assertEqual(total_trash_msgs, 1) self.assertEqual(total_trash_msgs, 1)