removed 2nd create address method

This commit is contained in:
shekhar-cis 2021-09-30 21:29:55 +05:30
parent 3afe1bdb71
commit 3d8992aed3
Signed by untrusted user: shekhar-cis
GPG Key ID: 8B2A6C8D5F7F1635

View File

@ -1,5 +1,6 @@
from time import time from time import time
from telenium.client import TeleniumHttpException from telenium.client import TeleniumHttpException
from telenium.tests import TeleniumTestCase
from .telenium_process import TeleniumTestProcess from .telenium_process import TeleniumTestProcess
from .common import ordered from .common import ordered
from random import choice from random import choice
@ -13,11 +14,13 @@ class CreateRandomAddress(TeleniumTestProcess):
pass pass
@ordered @ordered
def test_login_screen(self): # This method tests the landing screen when the app runs first time and
# import pdb; pdb.set_trace() # the landing screen should be "login" where we can create new address
def test_landing_screen(self):
"""Click on Proceed Button to Proceed to Next Screen.""" """Click on Proceed Button to Proceed to Next Screen."""
# Checking current Screen(Login screen) # Checking current Screen(Login screen)
self.assert_wait_no_except('//ScreenManager[@current]', timeout=20, value='login') self.assert_wait_no_except('//ScreenManager[@current]', timeout=15, value='login')
# Clicking on Proceed Next Button # Clicking on Proceed Next Button
# print(self.cli.getattr('//Screen[0]//AnchorLayout[1]//Check[@active]', 'active'), '------------------------') # print(self.cli.getattr('//Screen[0]//AnchorLayout[1]//Check[@active]', 'active'), '------------------------')
# is_checked = self.cli.getattr('//Screen[0]//AnchorLayout[1]//Check[@active]', 'active') # is_checked = self.cli.getattr('//Screen[0]//AnchorLayout[1]//Check[@active]', 'active')
@ -53,10 +56,10 @@ class CreateRandomAddress(TeleniumTestProcess):
self.assertExists("//ScreenManager[@current=\"random\"]", timeout=5) self.assertExists("//ScreenManager[@current=\"random\"]", timeout=5)
@ordered @ordered
def test_random_screen(self): def test_generate_random_address_label(self):
"""Creating New Adress For New User.""" """Creating New Adress For New User."""
# Clicking on Label Text Field to give address name # Clicking on Label Text Field to give address name
# self.cli.wait_click('//RandomBoxlayout/BoxLayout[0]/AnchorLayout[1]/MDTextField[0]', timeout=2) self.cli.wait_click('//RandomBoxlayout/BoxLayout[0]/AnchorLayout[1]/MDTextField[0]', timeout=2)
# Generating Label Randomly # Generating Label Randomly
random_label = "" random_label = ""
for _ in range(10): for _ in range(10):
@ -67,42 +70,61 @@ class CreateRandomAddress(TeleniumTestProcess):
self.cli.wait_click('//RandomBoxlayout//MDFillRoundFlatIconButton[0]', timeout=2) self.cli.wait_click('//RandomBoxlayout//MDFillRoundFlatIconButton[0]', timeout=2)
# Checking My Address Screen # Checking My Address Screen
# self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=3) # self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=3)
# import pdb; pdb.set_trace()
self.assertExists("//ScreenManager[@current=\"myaddress\"]", timeout=5) self.assertExists("//ScreenManager[@current=\"myaddress\"]", timeout=5)
num_of_addresses = len(self.cli.select('//MDList[0]/CustomTwoLineAvatarIconListItem'))
@ordered
def test_create_new_address(self):
"""Clicking on Navigation Drawer To Open New Address"""
# CLick to Open side Nav drawer
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3)
# checking state of Nav drawer
self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=2)
# Scroll Down to get New Address Tab
self.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]")
# Checking state of scrolled screen
self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=3)
self.assertExists('//NavigationItem[@text=\"New address\"]', timeout=5)
# Clicking on New Address Tab
self.cli.wait_click('//NavigationItem[@text=\"New address\"]', timeout=3)
start = time() start = time()
deadline = start + 2 deadline = start + 6
while time() < deadline: while time() < deadline:
try: try:
# Clicking on Proceed Next Button to redirect to "random" screen if num_of_addresses >= 1:
self.cli.wait_click('//Screen[0]//MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=5) self.assertEqual(num_of_addresses, 1)
except: break
# Checking Current Screen(Random Screen) after Clicking on "Proceed Next" Button except TeleniumHttpException:
self.assertExists("//ScreenManager[@current=\"random\"]", timeout=5) print('iexcept------------------------------------------')
# Checking current Screen(Login screen) continue
# self.assertExists("//Login[@name~=\"login\"]", timeout=3) print(len(self.cli.select('//MDList[0]/CustomTwoLineAvatarIconListItem')), '>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
# self.assertExists("//ScreenManager[@current=\"login\"]", timeout=5) # # Clicking on Proceed Next Button to redirect to "random" screen
# Click on Proceed Next button to enter 'Random' Screen # self.cli.sleep(5)
# self.cli.wait_click( # except:
# '//Screen[0]//MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=2) # # Checking Current Screen(Random Screen) after Clicking on "Proceed Next" Button
# Checking Current Screen(Random Screen) after Clicking on Proceed Next Button # self.assertExists("//ScreenManager[@current=\"random\"]", timeout=5)
# self.assertExists("//Random[@name~=\"random\"]", timeout=1)
# self.assertExists("//ScreenManager[@current=\"random\"]", timeout=5) # @ordered
# Executing above function to create new address # def test_create_new_address(self):
self.test_random_screen() # """Clicking on Navigation Drawer To Open New Address"""
# # CLick to Open side Nav drawer
# self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3)
# # checking state of Nav drawer
# self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=2)
# # Scroll Down to get New Address Tab
# self.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]")
# # Checking state of scrolled screen
# self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=3)
# self.assertExists('//NavigationItem[@text=\"New address\"]', timeout=5)
# # Clicking on New Address Tab
# self.cli.wait_click('//NavigationItem[@text=\"New address\"]', timeout=3)
# start = time()
# deadline = start + 2
# while time() < deadline:
# try:
# # Clicking on Proceed Next Button to redirect to "random" screen
# self.cli.wait_click('//Screen[0]//MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=5)
# except:
# # Checking Current Screen(Random Screen) after Clicking on "Proceed Next" Button
# self.assertExists("//ScreenManager[@current=\"random\"]", timeout=5)
# # Checking current Screen(Login screen)
# # self.assertExists("//Login[@name~=\"login\"]", timeout=3)
# # self.assertExists("//ScreenManager[@current=\"login\"]", timeout=5)
# # Click on Proceed Next button to enter 'Random' Screen
# # 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=1)
# # self.assertExists("//ScreenManager[@current=\"random\"]", timeout=5)
# # Executing above function to create new address
# self.test_random_screen()
@ordered @ordered
def test_select_address(self): def test_select_address(self):
@ -117,16 +139,17 @@ class CreateRandomAddress(TeleniumTestProcess):
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)
# self.cli.sleep(2)
# Scrolling up to get address dropdown # Scrolling up to get address dropdown
self.drag("//NavigationItem[@text=\"Address Book\"]", "//NavigationItem[@text=\"Settings\"]") # self.drag("//NavigationItem[@text=\"Address Book\"]", "//NavigationItem[@text=\"Settings\"]")
# Checking scroll state # Checking scroll state
self.assertCheckScrollUp('//ContentNavigationDrawer//ScrollView[0]', timeout=5) # self.assertCheckScrollUp('//ContentNavigationDrawer//ScrollView[0]', timeout=5)
# Click to open Address Dropdown # Click to open Address Dropdown
self.cli.wait_click('//NavigationItem[0]/CustomSpinner[0]', timeout=5) self.cli.wait_click('//NavigationItem[0]/CustomSpinner[0]', timeout=5)
self.assertExists('//MySpinnerOption', timeout=5) self.assertExists('//MySpinnerOption[0]', timeout=5)
is_open = self.cli.getattr('//NavigationItem[0]/CustomSpinner[@is_open]', 'is_open') is_open = self.cli.getattr('//NavigationItem[0]/CustomSpinner[@is_open]', 'is_open')
print(is_open, '----------------------------------<true>') print(is_open, '----------------------------------<true>')
# import pdb; pdb.set_trace() # self.cli.sleep(2)
self.assertEqual(is_open, True) self.assertEqual(is_open, True)
self.cli.wait_click('//MySpinnerOption[0]', timeout=5) self.cli.wait_click('//MySpinnerOption[0]', timeout=5)
# is_open = self.cli.getattr('//NavigationItem[0]/CustomSpinner[@is_open]', 'is_open') # is_open = self.cli.getattr('//NavigationItem[0]/CustomSpinner[@is_open]', 'is_open')
@ -135,4 +158,4 @@ class CreateRandomAddress(TeleniumTestProcess):
# self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=5) # self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=5)
# Checking the state of dropdown (Should be open) # Checking the state of dropdown (Should be open)
# self.assertNotEqual('//NavigationItem[0]/CustomSpinner[@is_open]', False) # self.assertNotEqual('//NavigationItem[0]/CustomSpinner[@is_open]', False)
self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=5) self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=5)