import sys import os.path from robot.libraries.String import String _here = os.path.dirname(__file__) string = String() _here = string.fetch_from_left(_here, "tests") sys.path.insert(0, os.path.abspath(os.path.join(_here))) from globals import config from pagefactory.homepage import Loginpage as elem from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as ec from selenium.webdriver.common.by import By from globals.functions import Functions import random import time class Loginpage(object): def __init__(self, browser='chrome'): self.browser = browser self.driver = None self.wait = WebDriverWait(self.driver, 10) self.func = Functions(self.driver) self.choice = None self.selected_category = None self.random_category_text = None self.login_url = "https://bank.paysera.com/en/login"
import sys import os.path import json from robot.libraries.String import String _here = os.path.dirname(__file__) string = String() _here = string.fetch_from_left(_here, "mv_skill_test") sys.path.insert(0, os.path.abspath(os.path.join(_here))) from PageObjectLibrary import PageObject class Helpers(PageObject): def input_data(self, locator, data): self.se2lib.input_text(locator, data) def click_button(self, locator): self.se2lib.click_element(locator)
import sys, os import json from robot.libraries.String import String _here = os.path.dirname(__file__) _string = String() _here = _string.fetch_from_left(_here, "assurity") sys.path.insert(0, os.path.abspath(os.path.join(_here))) class TestLibUtils(object): def __init__(self): self.data = self.load_json() def get_base_url(self, app=None): return self.data['base_url'][app] def get_endpoints(self, endpoint=None): return self.data['endpoints'][endpoint] def get_expected_val(self, value=None): return self.data['expected_value'][value] def load_json(self): script_dir = os.path.dirname(__file__) file_path = os.path.join(script_dir, '../resources/test_data.json') data = json.load(open(file_path)) return data #assertions def assert_equal(self, actual_val, expected_val): log = 'Actual Value = ' + str(
import sys import os.path from robot.libraries.String import String _here = os.path.dirname(__file__) string = String() _here = string.fetch_from_left(_here, "drivers") sys.path.insert(0, os.path.abspath(os.path.join(_here))) import platform class Paths(object): def __init__(self): self.platform = None def get_path_of(self, browser: str = 'chrome'): if browser.lower() == 'chrome': return Chrome().PATH elif browser.lower() == 'firefox': return Firefox().PATH class Platform: @staticmethod def get_platform() -> str: if platform.system().lower() == 'darwin': return "macos" elif platform.system().lower() == 'windows': return "windows" elif platform.system().lower() == 'linux' or platform.system().lower( ) == 'linux2':
import sys import os.path from robot.libraries.String import String _here = os.path.dirname(__file__) string = String() _here = string.fetch_from_left(_here, "globals") sys.path.insert(0, os.path.abspath(os.path.join(_here))) from drivers.paths import Paths from selenium import webdriver class Config(object): def __init__(self): self.path = Paths() self.driver = None def get_browser(self, browser: str = 'chrome'): if browser.lower() == 'chrome': self.driver = webdriver.Chrome(_here + self.path.get_path_of(browser.lower())) elif browser.lower() == 'firefox': self.driver = webdriver.Firefox(executable_path=_here + self.path.get_path_of(browser.lower())) else: raise Exception('This browser is not yet supported in this platform') return self.driver if __name__ == '__main__': c = Config()
import sys import os.path from robot.libraries.String import String _here = os.path.dirname(__file__) string = String() _here = string.fetch_from_left(_here, "pagefactory") sys.path.insert(0, os.path.abspath(os.path.join(_here))) import random class Loginpage(object): user_name = "*****@*****.**" password = "******" lbl_login = "******" txt_user = "******" lnk_register = "//a[@href='/en/registration']" panel_language = "//div[@id='react-language-list-container']" lnk_privacy = "//a[contains(., 'Privacy Policy')]" lnk_service = "//a[contains(., 'Service agreements')]" lnk_safe_usage = "//a[contains(., 'Recommendations for the safe usage')]" btn_login = "******" lbl_user_name = "//div[@class='row user-identifier-row']/div/strong" img_avatar = "//img[@alt='avatar']"