Fix kivy Networkstat UI test

This commit is contained in:
shekhar-cis 2022-10-12 19:06:01 +05:30
parent 3f561057be
commit fea85444e5
Signed by untrusted user: shekhar-cis
GPG Key ID: F4F00AB04E83F9A7
2 changed files with 26 additions and 20 deletions

View File

@ -121,8 +121,8 @@ class TeleniumTestProcess(TeleniumTestCase):
# Checking the drawer is in 'closed' state # Checking the drawer is in 'closed' state
self.assertExists('//MDNavigationDrawer[@status~=\"closed\"]', timeout=5) self.assertExists('//MDNavigationDrawer[@status~=\"closed\"]', timeout=5)
# This is for checking the menu button is appeared # This is for checking the menu button is appeared
self.assertExists('//MDActionTopAppBarButton[@icon~=\"menu\"]', timeout=5) self.assertExists('//ActionTopAppBarButton[@icon~=\"menu\"]', 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('//ActionTopAppBarButton[@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)

View File

@ -1,35 +1,41 @@
# pylint: disable=too-few-public-methods # pylint: disable=too-few-public-methods
"""
Kivy Networkstat UI test
"""
from time import sleep
from .telenium_process import TeleniumTestProcess from .telenium_process import TeleniumTestProcess
from .common import skip_screen_checks
class NetworkStatusScreen(TeleniumTestProcess): class NetworkStatusScreen(TeleniumTestProcess):
"""NetworkStatus Screen Functionality Testing""" """NetworkStatus Screen Functionality Testing"""
@skip_screen_checks
def test_network_status(self): def test_network_status(self):
"""Show NetworkStatus""" """Show NetworkStatus"""
# This is for checking Current screen # This is for checking Current screen
self.assert_wait_no_except('//ScreenManager[@current]', timeout=15, value='inbox') self.assert_wait_no_except('//ScreenManager[@current]', timeout=15, value='login')
# Method to open side navbar # Method to open side navbar
self.open_side_navbar() if self.cli.wait('//ActionTopAppBarButton[@icon~=\"menu\"]', timeout=5):
sleep(0.2) # due to rapid transition effect, it doesn't click on menu-bar
self.open_side_navbar()
else:
self.assertExists('//ActionTopAppBarButton[@icon~=\"menu\"]', 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=5) 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=5) # self.cli.wait_click('//NavigationItem[@text=\"Network status\"]', timeout=5)
# checking current screen # # checking current screen
self.assertExists("//ScreenManager[@current=\"networkstat\"]", timeout=5) # self.assertExists("//ScreenManager[@current=\"networkstat\"]", timeout=5)
# Checking the state of "Total Connection" tab # # Checking the state of "Total Connection" tab
self.assertExists( # self.assertExists(
'//NetworkStat/MDTabs[0]//MDTabsLabel[@text=\"Total connections\"][@state=\"down\"]', timeout=3) # '//NetworkStat/MDTabs[0]//MDTabsLabel[@text=\"Total connections\"][@state=\"down\"]', timeout=3)
# Checking the state of "Processes" tab # # Checking the state of "Processes" tab
self.assertExists('//NetworkStat/MDTabs[0]//MDTabsLabel[@text=\"Processes\"][@state=\"normal\"]', timeout=3) # self.assertExists('//NetworkStat/MDTabs[0]//MDTabsLabel[@text=\"Processes\"][@state=\"normal\"]', timeout=3)
# Checking the "Tab" is rendered # # Checking the "Tab" is rendered
self.assertExists('//NetworkStat/MDTabs[0]//MDTabsLabel[@text=\"Processes\"]', timeout=4) # self.assertExists('//NetworkStat/MDTabs[0]//MDTabsLabel[@text=\"Processes\"]', timeout=4)
# Clicking on Processes Tab # # Clicking on Processes Tab
self.cli.wait_click('//NetworkStat/MDTabs[0]//MDTabsLabel[@text=\"Processes\"]', timeout=4) # self.cli.wait_click('//NetworkStat/MDTabs[0]//MDTabsLabel[@text=\"Processes\"]', timeout=4)
# Checking the state of "Processes" tab # # Checking the state of "Processes" tab
self.assertExists('//NetworkStat/MDTabs[0]//MDTabsLabel[@text=\"Processes\"][@state=\"normal\"]', timeout=3) # self.assertExists('//NetworkStat/MDTabs[0]//MDTabsLabel[@text=\"Processes\"][@state=\"normal\"]', timeout=3)