def setup_class(cls, **kwargs): """Setup class (suite) to be executed""" super(TestControlDropdown, cls).setup_class(config=settings(file_path="qacode/configs/"), skip_force=SKIP_CONTROLS) cls.add_property('app', cls.cfg_app('qadmin')) # page cls.add_property('page', cls.cfg_page('qacode_login')) cls.add_property('url', cls.page.get('url')) cls.add_property('form_login', cls.cfg_control('form_login')) cls.add_property('txt_username', cls.cfg_control('txt_username')) cls.add_property('txt_password', cls.cfg_control('txt_password')) cls.add_property('btn_submit', cls.cfg_control('btn_submit')) # page_inputs cls.add_property('page_inputs', cls.cfg_page('qacode_inputs')) cls.add_property('url_inputs', cls.page_inputs.get('url')) cls.add_property('dd_base', cls.cfg_control('dd_base')) cls.add_property('dd_multiple', cls.cfg_control('dd_multiple')) # start setup cls.bot.navigation.get_url(cls.url) # login txt_username = cls.bot.navigation.find_element( cls.txt_username.get('selector')) txt_password = cls.bot.navigation.find_element( cls.txt_password.get('selector')) btn_submit = cls.bot.navigation.find_element( cls.btn_submit.get('selector')) txt_username.send_keys('admin') txt_password.send_keys('admin') btn_submit.click()
def browser(): CFG = settings(file_path="qacode/configs/", file_name="settings.json") bot = None try: bot = BotBase(**CFG) yield bot except Exception as err: raise err finally: if bot: bot.close()
def setup_method(self, test_method): """Configure self.attribute""" super(TestPageBase, self).setup_method(test_method, config=settings(file_path="qacode/configs/")) self.add_property('app', self.cfg_app('qadmin')) # page self.add_property('page', self.cfg_page('qacode_logout')) self.add_property('url', self.page.get('url')) self.add_property('btn_logout', self.cfg_control('btn_logout')) self.add_property('btn_login', self.cfg_control('btn_login')) self.add_property('page_base', self.cfg_page('qacode_login')) self.bot.navigation.get_url(self.page_base.get('url'))
def __init__(self, **kwargs): """Create new Bot browser based on options object what can be (help for each option can be found on settings.json) Arguments: settings {dict} -- configuracion obtained from JSON file to dict instance Raises: CoreException -- Fail at instance Log class CoreException -- settings is None CoreException -- settings.get('mode') is not in [local, remote] """ self.settings = kwargs.get("bot") # default read from qacode.configs, file named 'settings.json' if not self.settings: self.settings = settings().get('bot') self._load()
def setup_method(self, test_method, close=True): """Configure self.attribute""" super(TestNavBase, self).setup_method(test_method, config=settings(file_path="qacode/configs/")) self.add_property('app', self.cfg_app('qadmin')) self.add_property('page', self.cfg_page('qacode_login')) self.add_property('txt_username', self.cfg_control('txt_username')) self.add_property('txt_password', self.cfg_control('txt_password')) self.add_property('btn_submit', self.cfg_control('btn_submit')) self.add_property('lst_ordered', self.cfg_control('lst_ordered')) self.add_property('lst_ordered_child', self.cfg_control('lst_ordered_child')) self.add_property('dd_menu_data', self.cfg_control('dd_menu_data')) self.add_property('dd_menu_data_lists', self.cfg_control('dd_menu_data_lists')) self.add_property('btn_click_invisible', self.cfg_control('btn_click_invisible')) self.add_property('btn_click_visible', self.cfg_control('btn_click_visible')) self.add_property('title_buttons', self.cfg_control('title_buttons'))
def setup_method(self, test_method): """Configure self.attribute""" super(TestControlBase, self).setup_method(test_method, config=settings(file_path="qacode/configs/")) self.add_property('app', self.cfg_app('qadmin')) self.add_property('page', self.cfg_page('qacode_login')) self.add_property('url', self.page.get('url')) self.add_property('txt_username', self.cfg_control('txt_username')) self.add_property('txt_password', self.cfg_control('txt_password')) self.add_property('btn_submit', self.cfg_control('btn_submit')) self.add_property('form_login', self.cfg_control('form_login')) self.add_property('lst_ordered', self.cfg_control('lst_ordered')) self.add_property('lst_ordered_child', self.cfg_control('lst_ordered_child')) self.add_property('dd_menu_data', self.cfg_control('dd_menu_data')) self.add_property('dd_menu_data_lists', self.cfg_control('dd_menu_data_lists')) self.bot.navigation.get_url(self.url, wait_for_load=10) self.add_property('btn_click_invisible', self.cfg_control('btn_click_invisible')) self.add_property('btn_click_visible', self.cfg_control('btn_click_visible')) self.add_property('title_buttons', self.cfg_control('title_buttons'))
def setup_class(cls, **kwargs): """Setup class (suite) to be executed""" super(TestControlTable, cls).setup_class(config=settings(file_path="qacode/configs/"), skip_force=SKIP_CONTROLS) cls.add_property('app', cls.cfg_app('qadmin')) # page cls.add_property('page', cls.cfg_page('qacode_login')) cls.add_property('url', cls.page.get('url')) cls.add_property('form_login', cls.cfg_control('form_login')) cls.add_property('txt_username', cls.cfg_control('txt_username')) cls.add_property('txt_password', cls.cfg_control('txt_password')) cls.add_property('btn_submit', cls.cfg_control('btn_submit')) # page_inputs cls.add_property('page_inputs', cls.cfg_page('qacode_inputs')) cls.add_property('url_inputs', cls.page_inputs.get('url')) cls.add_property('dd_base', cls.cfg_control('dd_base')) cls.add_property('dd_menu_data', cls.cfg_control('dd_menu_data')) cls.add_property('dd_menu_data_lists', cls.cfg_control('dd_menu_data_lists')) cls.add_property('tbl_ok', cls.cfg_control('tbl_ok')) cls.add_property('tbl_html5_ok', cls.cfg_control('tbl_html5_ok')) cls.add_property('tbl_html_tbodies_ok', cls.cfg_control('tbl_html_tbodies_ok'))
def setup_class(cls, **kwargs): """Setup class (suite) to be executed""" super(TestNavBase, cls).setup_class(config=settings(file_path="qacode/configs/"), skip_force=SKIP_NAVS)
# -*- coding: utf-8 -*- """Package for suites and tests related to bots.modules package""" import pytest from qacode.core.bots.modules.nav_base import NavBase from qacode.core.exceptions.core_exception import CoreException from qacode.core.testing.asserts import Assert from qacode.core.testing.test_info import TestInfoBotUnique from qacode.utils import settings from selenium.webdriver.remote.webelement import WebElement ASSERT = Assert() SETTINGS = settings(file_path="qacode/configs/") SKIP_NAVS = SETTINGS['tests']['skip']['bot_navigations'] SKIP_NAVS_MSG = 'bot_navigations DISABLED by config file' class TestNavBase(TestInfoBotUnique): """Test Suite for class NavBase""" app = None page = None @classmethod def setup_class(cls, **kwargs): """Setup class (suite) to be executed""" super(TestNavBase, cls).setup_class(config=settings(file_path="qacode/configs/"), skip_force=SKIP_NAVS) def setup_method(self, test_method, close=True):
def setup_method(self, test_method): """TODO: doc method""" super(TestTestInfoBase, self).setup_method( test_method, config=settings(file_path="qacode/configs/"))
def setup_class(cls, **kwargs): """Setup class (suite) to be executed""" super(TestTestInfoBotUnique, cls).setup_class(config=settings(file_path="qacode/configs/"), skip_force=SKIP_BOT_UNIQUE)
def setup_method(self, test_method): """Setup test_method to be executed""" super(TestBotBase, self).setup_method(test_method, config=settings(file_path="qacode/configs/"), skip_force=SKIP)
def setup_method(self, test_method): """Configure self.attribute""" super(TestControlTable, self).setup_method(test_method, config=settings(file_path="qacode/configs/")) self.setup_login_to_data()
def setup_method(self, test_method): """Configure self.attribute""" super(TestReporterTestlink, self).setup_method( test_method, config=settings(file_path="qacode/configs/"))
def setup_method(self, test_method): """Configure self.attribute""" super(TestControlDropdown, self).setup_method(test_method, config=settings(file_path="qacode/configs/"))