added create_new_address_test

This commit is contained in:
shekhar-cis 2021-09-27 17:21:42 +05:30
parent 90dbeddc53
commit cde4019561
Signed by untrusted user: shekhar-cis
GPG Key ID: F4F00AB04E83F9A7
3 changed files with 41 additions and 13 deletions

View File

@ -1,4 +1,3 @@
from turtle import pd
from bitmessagekivy.get_platform import platform
from bitmessagekivy import kivy_helper_search
from helper_sql import sqlExecute

View File

@ -8,6 +8,7 @@ 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',
@ -99,4 +100,21 @@ class TeleniumTestProcess(TeleniumTestCase):
return False
if timeout > 0 and time() - start > timeout:
raise Exception("Timeout")
sleep(0.1)
sleep(0.1)
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)
break
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.2)

View File

@ -20,17 +20,18 @@ class CreateRandomAddress(TeleniumTestProcess):
"""Click on Proceed Button to Proceed to Next Screen."""
# Checking current Screen(Login screen)
self.assert_wait_no_except('//ScreenManager[@current]', timeout=15, value='login')
# This is for checking the Side nav Bar is closed
self.assertExists('//MDNavigationDrawer[@status~=\"closed\"]', timeout=5)
# Clicking on Proceed Next Button
self.assertExists('//Screen[0]//MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=2)
self.cli.wait_click(
'//Screen[0]//MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=2)
# Checking Current Screen(Random Screen) after Clicking on Proceed Next Button
# self.assertExists("//Random[@name~=\"random\"]", timeout=2)
self.assertExists("//ScreenManager[@current=\"random\"]", timeout=5)
self.cli.wait_click(
'//Screen[0]//MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=2)
try:
self.assertExists("//ScreenManager[@current=\"random\"]", timeout=2)
except:
self.cli.wait_click(
'//Screen[0]//MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=5)
self.assertExists("//ScreenManager[@current=\"random\"]", timeout=2)
@ordered
def test_random_screen(self):
@ -62,6 +63,7 @@ class CreateRandomAddress(TeleniumTestProcess):
# Checking state of scrolled screen
self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=3)
# Clicking on New Address Tab
self.assertExists('//NavigationItem[@text=\"New address\"]', timeout=5)
self.cli.wait_click('//NavigationItem[@text=\"New address\"]', timeout=3)
self.cli.sleep(1)
# Checking current Screen(Login screen)
@ -79,6 +81,10 @@ class CreateRandomAddress(TeleniumTestProcess):
@ordered
def test_select_address(self):
"""Select First Address From Drawer-Box"""
# 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
@ -87,10 +93,15 @@ class CreateRandomAddress(TeleniumTestProcess):
self.drag("//NavigationItem[@text=\"Address Book\"]", "//NavigationItem[@text=\"Settings\"]")
# Checking scroll state
self.assertCheckScrollUp('//ContentNavigationDrawer//ScrollView[0]', timeout=5)
# Clicking on Address Dropdown
# Click to open Address Dropdown
self.cli.wait_click('//NavigationItem[0]/CustomSpinner[0]', timeout=5)
# Checking the state of dropdown (Should be open)
self.assertNotEqual('//NavigationItem[0]/CustomSpinner[@is_open]', False)
# Select address fron Address Dropdown
self.cli.wait_click('//MySpinnerOption[0]', timeout=5)
# Checking Landing Screen(Inbox)
self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=5)
try:
# Select address fron Address Dropdown
self.cli.wait_click('//MySpinnerOption[0]', timeout=5)
# Checking current screen
self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=5)
except:
self.cli.wait_click('//MySpinnerOption[0]', timeout=5)
self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=5)