removed 2nd create address method & method name changed

This commit is contained in:
shekhar-cis 2021-09-30 21:38:29 +05:30
parent 4ec5b70d82
commit f757e7efbf
Signed by untrusted user: shekhar-cis
GPG Key ID: 8B2A6C8D5F7F1635

View File

@ -16,10 +16,14 @@ class CreateRandomAddress(TeleniumTestProcess):
@skip_screen_checks @skip_screen_checks
@ordered @ordered
def test_login_screen(self): # This method tests the landing screen when the app runs first time and
# 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=15, value='login') self.assert_wait_no_except('//ScreenManager[@current]', timeout=15, value='login')
# Click on "Proceed Next" Button to "generate random label for address" screen
# Some widgets cannot renders suddenly and become not functional so we used loop with a timeout.
start = time() start = time()
deadline = start + 2 deadline = start + 2
while time() < deadline: while time() < deadline:
@ -33,10 +37,11 @@ class CreateRandomAddress(TeleniumTestProcess):
@skip_screen_checks @skip_screen_checks
@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 # Click on Label Text Field to give address Label
# Generating Label Randomly self.cli.wait_click('//RandomBoxlayout/BoxLayout[0]/AnchorLayout[1]/MDTextField[0]', timeout=2)
# Enter a Label Randomly
random_label = "" random_label = ""
for _ in range(10): for _ in range(10):
random_label += choice(ascii_lowercase) random_label += choice(ascii_lowercase)
@ -44,40 +49,24 @@ class CreateRandomAddress(TeleniumTestProcess):
self.cli.sleep(0.1) self.cli.sleep(0.1)
# Click on Proceed Next button to generate random Address # Click on Proceed Next button to generate random Address
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 after creating a address
# self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=3)
self.assertExists("//ScreenManager[@current=\"myaddress\"]", timeout=5) self.assertExists("//ScreenManager[@current=\"myaddress\"]", timeout=5)
# Validating the new address is created,
@skip_screen_checks # because the process takes time to generate new address so we used loop with a timout.
@ordered num_of_addresses = len(self.cli.select('//MDList[0]/CustomTwoLineAvatarIconListItem'))
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)
break
except TeleniumHttpException: except TeleniumHttpException:
# Checking Current Screen(Random Screen) after Clicking on "Proceed Next" Button continue
self.assertExists("//ScreenManager[@current=\"random\"]", timeout=5)
# This method is to create random label
self.test_random_screen()
@skip_screen_checks @skip_screen_checks
@ordered @ordered
def test_select_address(self): def test_set_default_address(self):
"""Select First Address From Drawer-Box""" """Select First Address From Drawer-Box"""
# Checking current screen # Checking current screen
self.assertExists("//ScreenManager[@current=\"myaddress\"]", timeout=5) self.assertExists("//ScreenManager[@current=\"myaddress\"]", timeout=5)
@ -89,17 +78,14 @@ 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)
# Scrolling up to get address dropdown
self.drag("//NavigationItem[@text=\"Address Book\"]", "//NavigationItem[@text=\"Settings\"]")
# Checking scroll state
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) # Checking the dropdown option is exist
# Assert to check the address dropwdown open 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')
# Check the state of dropdown.
self.assertEqual(is_open, True) self.assertEqual(is_open, True)
# Select address from address dropdown # Selection of an address to set as a default address.
self.cli.wait_click('//MySpinnerOption[0]', timeout=5) self.cli.wait_click('//MySpinnerOption[0]', timeout=5)
# Checking current screen # Checking current screen
self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=5) self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=5)