kivy-test cases [Network, Setting, All Mails]
This commit is contained in:
parent
6681fc4ae8
commit
97a60e4d5d
Binary file not shown.
|
@ -8,6 +8,8 @@ import tempfile
|
|||
from time import time, sleep
|
||||
|
||||
from telenium.tests import TeleniumTestCase
|
||||
from telenium.client import TeleniumHttpException
|
||||
|
||||
|
||||
_files = (
|
||||
'keys.dat', 'debug.log', 'messages.dat', 'knownnodes.dat',
|
||||
|
@ -63,6 +65,23 @@ class TeleniumTestProcess(TeleniumTestCase):
|
|||
pass
|
||||
cleanup()
|
||||
|
||||
def assert_wait_no_except(self, selector, timeout=-1, value='inbox'):
|
||||
"""This method is to check the application is launched."""
|
||||
start = time()
|
||||
deadline = start + timeout
|
||||
while time() < deadline:
|
||||
try:
|
||||
if self.cli.getattr(selector, 'current') == value:
|
||||
self.assertTrue(selector, value)
|
||||
return True
|
||||
except TeleniumHttpException:
|
||||
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.1)
|
||||
|
||||
def drag(self, xpath1, xpath2):
|
||||
"""this method is for dragging"""
|
||||
self.cli.drag(xpath1, xpath2, 1)
|
||||
|
|
40
src/bitmessagekivy/tests/test_allmail_message.py
Normal file
40
src/bitmessagekivy/tests/test_allmail_message.py
Normal file
|
@ -0,0 +1,40 @@
|
|||
from .telenium_process import TeleniumTestProcess
|
||||
from .common import skip_screen_checks
|
||||
from .common import ordered
|
||||
|
||||
|
||||
class AllMailMessage(TeleniumTestProcess):
|
||||
"""AllMail Screen Functionality Testing"""
|
||||
|
||||
@skip_screen_checks
|
||||
@ordered
|
||||
def test_show_allmail_list(self):
|
||||
"""Show All Messages on Mail Screen/Window"""
|
||||
# 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 id 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=3)
|
||||
# checking state of Nav drawer
|
||||
self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=5)
|
||||
# this is for opening All Mail screen
|
||||
self.cli.wait_click('//NavigationItem[@text=\"All Mails\"]', timeout=5)
|
||||
# Assert for checking Current Screen(All mail)
|
||||
self.assertExists("//ScreenManager[@current=\"allmails\"]", timeout=5)
|
||||
|
||||
@skip_screen_checks
|
||||
@ordered
|
||||
def test_delete_message_from_allmail_list(self):
|
||||
"""Delete Message From Message body of Mail Screen/Window"""
|
||||
# click on a Message to get message details screen
|
||||
self.cli.wait_click(
|
||||
'//MDList[0]/CustomSwipeToDeleteItem[0]', timeout=3)
|
||||
# Assert for checking Current Screen(Mail Detail)
|
||||
self.assertExists("//ScreenManager[@current=\"mailDetail\"]", timeout=5)
|
||||
# CLicking on Trash-Can icon to delete Message
|
||||
self.cli.wait_click('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[@icon=\"delete-forever\"]', timeout=5)
|
||||
# After deleting msg, screen is redirected to All mail screen
|
||||
self.assertExists("//ScreenManager[@current=\"allmails\"]", timeout=5)
|
34
src/bitmessagekivy/tests/test_network_screen.py
Normal file
34
src/bitmessagekivy/tests/test_network_screen.py
Normal file
|
@ -0,0 +1,34 @@
|
|||
# pylint: disable=too-few-public-methods
|
||||
|
||||
from .telenium_process import TeleniumTestProcess
|
||||
from .common import skip_screen_checks
|
||||
|
||||
|
||||
class NetworkStatusScreen(TeleniumTestProcess):
|
||||
"""NetwrokStatus Screen Functionality Testing"""
|
||||
|
||||
@skip_screen_checks
|
||||
def test_network_status(self):
|
||||
"""Show NetwrokStatus"""
|
||||
# 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 id 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=5)
|
||||
# Clicking on Network Status tab
|
||||
self.cli.wait_click('//NavigationItem[@text=\"Network status\"]', timeout=5)
|
||||
# checking current screen
|
||||
self.assertExists("//ScreenManager[@current=\"networkstat\"]", timeout=5)
|
||||
# Clicking on Processes Tab
|
||||
self.cli.wait_click('//NetworkStat/MDTabs[0]//MDTabsLabel[@text=\"Processes\"]', timeout=3)
|
||||
# this is for checking current screen
|
||||
self.assertExists("//ScreenManager[@current=\"networkstat\"]", timeout=3)
|
|
@ -10,19 +10,21 @@ class SettingScreen(TeleniumTestProcess):
|
|||
@skip_screen_checks
|
||||
def test_setting_screen(self):
|
||||
"""Show Setting Screen"""
|
||||
print("=====================Test -Show Setting Screen=====================")
|
||||
self.cli.sleep(3)
|
||||
# this is for checking current screen
|
||||
self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=2)
|
||||
# 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 id 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=2)
|
||||
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=5)
|
||||
# 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
|
||||
self.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]")
|
||||
# assert for checking scroll funcation
|
||||
self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=3)
|
||||
# assert for checking scroll function
|
||||
self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=5)
|
||||
# this is for opening setting screen
|
||||
self.cli.wait_click('//NavigationItem[@text=\"Settings\"]', timeout=1)
|
||||
self.cli.wait_click('//NavigationItem[@text=\"Settings\"]', timeout=3)
|
||||
# Checking current screen
|
||||
self.assertExists("//Setting[@name~=\"set\"]", timeout=2)
|
||||
self.assertExists("//ScreenManager[@current=\"set\"]", timeout=2)
|
||||
|
|
Reference in New Issue
Block a user