added pupulate_test_data method

This commit is contained in:
shekhar-cis 2021-09-28 19:03:24 +05:30
parent 01ada595f9
commit 394ee583bf
Signed by untrusted user: shekhar-cis
GPG Key ID: 8B2A6C8D5F7F1635
2 changed files with 15 additions and 20 deletions

View File

@ -30,15 +30,6 @@ def cleanup(files=_files):
pass pass
def populate_test_data():
"""Set temp data in tmp directory"""
for file_name in tmp_db_file:
old_source_file = os.path.join(
os.path.abspath(os.path.dirname(__file__)), 'sampleData', file_name)
new_destination_file = os.path.join(os.environ['BITMESSAGE_HOME'], file_name)
shutil.copyfile(old_source_file, new_destination_file)
class TeleniumTestProcess(TeleniumTestCase): class TeleniumTestProcess(TeleniumTestCase):
"""Setting Screen Functionality Testing""" """Setting Screen Functionality Testing"""
cmd_entrypoint = [os.path.join(os.path.abspath(os.getcwd()), 'src', 'mock', 'kivy_main.py')] cmd_entrypoint = [os.path.join(os.path.abspath(os.getcwd()), 'src', 'mock', 'kivy_main.py')]
@ -47,9 +38,18 @@ class TeleniumTestProcess(TeleniumTestCase):
def setUpClass(cls): def setUpClass(cls):
"""Setupclass is for setting temp environment""" """Setupclass is for setting temp environment"""
os.environ["BITMESSAGE_HOME"] = tempfile.gettempdir() os.environ["BITMESSAGE_HOME"] = tempfile.gettempdir()
populate_test_data() cls.populate_test_data()
super(TeleniumTestProcess, cls).setUpClass() super(TeleniumTestProcess, cls).setUpClass()
@classmethod
def populate_test_data():
"""Set temp data in tmp directory"""
for file_name in tmp_db_file:
old_source_file = os.path.join(
os.path.abspath(os.path.dirname(__file__)), 'sampleData', file_name)
new_destination_file = os.path.join(os.environ['BITMESSAGE_HOME'], file_name)
shutil.copyfile(old_source_file, new_destination_file)
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
"""Ensures that pybitmessage stopped and removes files""" """Ensures that pybitmessage stopped and removes files"""

View File

@ -1,9 +1,7 @@
import os
import tempfile
from random import choice from random import choice
from string import ascii_lowercase from string import ascii_lowercase
from telenium.client import TeleniumHttpException from telenium.client import TeleniumHttpException
from .telenium_process import TeleniumTestProcess, cleanup from .telenium_process import TeleniumTestProcess
from .common import skip_screen_checks from .common import skip_screen_checks
from .common import ordered from .common import ordered
@ -12,10 +10,8 @@ class CreateRandomAddress(TeleniumTestProcess):
"""This is for testing randrom address creation""" """This is for testing randrom address creation"""
@classmethod @classmethod
def setUpClass(cls): def populate_test_data(cls):
os.environ["BITMESSAGE_HOME"] = tempfile.gettempdir() pass
cleanup()
super(TeleniumTestProcess, cls).setUpClass()
@skip_screen_checks @skip_screen_checks
@ordered @ordered
@ -24,11 +20,10 @@ class CreateRandomAddress(TeleniumTestProcess):
# 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')
# Clicking on Proceed Next Button # Clicking on Proceed Next Button
self.assertExists('//Screen[0]//MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=2) self.assertExists('//Screen[0]//MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=5)
self.cli.wait_click( self.cli.wait_click(
'//Screen[0]//MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=2) '//Screen[0]//MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=5)
# 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)
try: try:
self.assertExists("//ScreenManager[@current=\"random\"]", timeout=2) self.assertExists("//ScreenManager[@current=\"random\"]", timeout=2)
except TeleniumHttpException: except TeleniumHttpException: