WIP[create_random_address]

This commit is contained in:
shekhar-cis 2021-09-24 20:25:27 +05:30
parent 7d2578e16a
commit 90dbeddc53
Signed by untrusted user: shekhar-cis
GPG Key ID: 8B2A6C8D5F7F1635

View File

@ -1,4 +1,5 @@
import os import os
import pdb
import tempfile import tempfile
from .telenium_process import TeleniumTestProcess, cleanup from .telenium_process import TeleniumTestProcess, cleanup
from .common import ordered from .common import ordered
@ -16,40 +17,42 @@ class CreateRandomAddress(TeleniumTestProcess):
@ordered @ordered
def test_login_screen(self): def test_login_screen(self):
"""Clicking on Proceed Button to Proceed to Next Screen.""" """Click on Proceed Button to Proceed to Next Screen."""
print("=====================Test - Login Screen=====================")
self.cli.sleep(8)
# Checking current Screen(Login screen) # Checking current Screen(Login screen)
self.assertExists("//Login[@name~=\"login\"]", timeout=3) 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 # Clicking on Proceed Next Button
self.cli.wait_click( self.cli.wait_click(
'//Screen[0]/BoxLayout[0]/AnchorLayout[3]/MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=2) '//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("//Random[@name~=\"random\"]", timeout=2) # 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)
@ordered @ordered
def test_random_screen(self): def test_random_screen(self):
"""Creating New Adress For New User.""" """Creating New Adress For New User."""
print("=====================Test - Create New Address=====================")
# 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):
random_label += choice(ascii_lowercase) random_label += choice(ascii_lowercase)
self.cli.setattr('//RandomBoxlayout/BoxLayout[0]/AnchorLayout[1]/MDTextField[0]', "text", random_label) self.cli.setattr('//RandomBoxlayout//AnchorLayout[1]/MDTextField[0]', "text", random_label)
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/BoxLayout[0]/AnchorLayout[2]/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)
self.assertExists("//ScreenManager[@current=\"myaddress\"]", timeout=5)
@ordered @ordered
def test_create_new_address(self): def test_create_new_address(self):
"""Clicking on Navigation Drawer To Open New Address""" """Clicking on Navigation Drawer To Open New Address"""
print("=====================Test - Create New Address=====================")
# New screen is opening and transition effect takes time so Sleep is used # New screen is opening and transition effect takes time so Sleep is used
self.cli.sleep(3)
# this is for opening Nav drawer # this is for opening Nav drawer
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3) self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3)
# checking state of Nav drawer # checking state of Nav drawer
@ -62,33 +65,32 @@ class CreateRandomAddress(TeleniumTestProcess):
self.cli.wait_click('//NavigationItem[@text=\"New address\"]', timeout=3) self.cli.wait_click('//NavigationItem[@text=\"New address\"]', timeout=3)
self.cli.sleep(1) self.cli.sleep(1)
# Checking current Screen(Login screen) # Checking current Screen(Login screen)
self.assertExists("//Login[@name~=\"login\"]", timeout=3) # self.assertExists("//Login[@name~=\"login\"]", timeout=3)
self.assertExists("//ScreenManager[@current=\"login\"]", timeout=5)
# Click on Proceed Next button to enter 'Random' Screen # Click on Proceed Next button to enter 'Random' Screen
self.cli.wait_click( self.cli.wait_click(
'//Screen[0]//MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=2) '//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("//Random[@name~=\"random\"]", timeout=1) # self.assertExists("//Random[@name~=\"random\"]", timeout=1)
self.assertExists("//ScreenManager[@current=\"random\"]", timeout=5)
# Executing above function to create new address # Executing above function to create new address
self.test_random_screen() self.test_random_screen()
@ordered @ordered
def test_select_address(self): def test_select_address(self):
"""Select First Address From Drawer-Box""" """Select First Address From Drawer-Box"""
print("=====================Test - Select First Address From Drawer-Box=======================")
self.cli.sleep(6)
# self.cli.execute('app.root.ids.nav_drawer.set_state("toggle")')
# this is for opening Nav drawer # this is for opening Nav drawer
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3) 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=2) self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=5)
# 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=3) self.assertCheckScrollUp('//ContentNavigationDrawer//ScrollView[0]', timeout=5)
# self.assertExists("//NavigationDrawerSubheader[@text~=\"Accounts\"]", timeout=2)
# Clicking on Address Dropdown # Clicking on Address Dropdown
self.cli.wait_click('//NavigationItem[0]/CustomSpinner[0]', timeout=2) self.cli.wait_click('//NavigationItem[0]/CustomSpinner[0]', timeout=5)
self.assertNotEqual('//NavigationItem[0]/CustomSpinner[@is_open]', False)
# Select address fron Address Dropdown # Select address fron Address Dropdown
self.cli.wait_click('//MySpinnerOption[0]', timeout=2) self.cli.wait_click('//MySpinnerOption[0]', timeout=5)
# Checking Landing Screen(Inbox) # Checking Landing Screen(Inbox)
self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=2) self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=5)