From 38c283ba25f06fa308109648f94bf80d3c8ba348 Mon Sep 17 00:00:00 2001 From: osamacis Date: Thu, 10 Nov 2022 15:16:03 +0530 Subject: [PATCH] Add test cases for network screen --- .../tests/test_network_screen.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/bitmessagekivy/tests/test_network_screen.py b/src/bitmessagekivy/tests/test_network_screen.py index cc2eb727..ca398dc1 100644 --- a/src/bitmessagekivy/tests/test_network_screen.py +++ b/src/bitmessagekivy/tests/test_network_screen.py @@ -20,3 +20,31 @@ class NetworkStatusScreen(TeleniumTestProcess): 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=2) + # Checking the drawer is in 'closed' state + self.assertExists('//MDNavigationDrawer[@status~=\"closed\"]', timeout=5) + # Checking for current screen (Network Status) + self.assertExists("//NetworkStat[@name~=\"networkstat\"]", timeout=2) + # Checking state of Total Connections tab + self.assertExists( + '//NetworkStat/MDTabs[0]//MDTabsLabel[@text=\"Total connections\"][@state=\"down\"]', timeout=5 + ) + # Getting the value of total connections + total_connection_text = self.cli.getattr('//NetworkStat//MDRaisedButton[@text]', 'text') + # Splitting the string from total connection numbers + number_of_connections = int(total_connection_text.split(' ')[-1]) + # Checking Total connections + self.assertGreaterEqual(number_of_connections, 1) + # Checking the state of Process tab + self.assertExists( + '//NetworkStat/MDTabs[0]//MDTabsLabel[@text=\"Processes\"][@state=\"normal\"]', timeout=5 + ) + # Clicking on Processes Tab + self.cli.wait_click( + '//NetworkStat/MDTabs[0]//MDTabsLabel[@text=\"Processes\"]', timeout=1 + ) + # Checking the state of Process tab + self.assertExists( + '//NetworkStat/MDTabs[0]//MDTabsLabel[@text=\"Processes\"][@state=\"down\"]', timeout=5 + )