Example #1
0
def module_set_up_level_to_test_a_class(request, browser): # this is One time setup
    print('Module setup')
    webdriver_factory = WebDriverFactory(browser)
    driver = webdriver_factory.get_webdriver_instance_letskodit()
    login_page = LoginPage(driver)
    login_page.go_to_login_page()
    result = login_page.verify_redirected_to_login_page()
    #TODO add logging to this if-else: now when hitting else - printing to console
    if result:
        login_page.login("*****@*****.**", "abcabc")
    else:
        print('Result:{}: Not redirected to login page'.format(result))
    # base_url = "https://letskodeit.teachable.com"
    # if browser == 'Firefox':
    #     driver = webdriver.Firefox()
    #     driver.maximize_window()
    #     driver.implicitly_wait(3)
    #     driver.get(base_url)
    #     print('Running test on FF')
    # else:
    #     driver = webdriver.Chrome()
    #     driver.maximize_window()
    #     driver.implicitly_wait(3)
    #     driver.get(base_url)
    #     print('Running test on Chrome')

    # to pass value to the TestClassDemo2 if class requests it!! while initializing instance
    if request.cls:  #.cls - means class context (level)
        request.cls.driver = driver
    yield driver
    driver.quit()
    print('Module teardown')
Example #2
0
def driver_setup(request, browser, online, setuipath, setffpath, seturl):
    wdf = WebDriverFactory(browser, online, setuipath, setffpath, seturl)
    driver = wdf.get_webdriver_instance()

    yield driver
    wdf.clean_webdriver_instance()
    driver.quit()
Example #3
0
def module_set_up_level_to_test_a_class_orangehrm(request, browser): # this is One time setup
    print('Module setup')
    webdriver_factory = WebDriverFactory(browser)
    driver = webdriver_factory.get_webdriver_instance_hrm()
    login_page = LoginPage(driver)
    login_page.login_hrm("admin", "Bitnami.12345")
    # base_url = "http://localhost"
    # if browser == 'Firefox':
    #     driver = webdriver.Firefox()
    #     driver.maximize_window()
    #     driver.implicitly_wait(3)
    #     driver.get(base_url)
    #     print('Running test on FF')
    # else:
    #     driver = webdriver.Chrome()
    #     driver.maximize_window()
    #     driver.implicitly_wait(3)
    #     driver.get(base_url)
    #     print('Running test on Chrome')
    # to pass value to the TestClassDemo2 if class requests it!! while initializing instance
    if request.cls:  #.cls - means class context (level)
        request.cls.driver = driver
    yield driver
    driver.quit()
    print('Module teardown')
Example #4
0
def module_setup_to_test_class(request):
    print("Module setup")
    webdriver_factory = WebDriverFactory()
    driver = webdriver_factory.get_webdriver_instance()
    if request:
         request.cls.driver = driver
    yield driver
    driver.quit()
    print('Module teardown')
Example #5
0
def driver(request):
    web_driver_factory = WebDriverFactory(
        request.config.getoption("--browser"))
    driver = web_driver_factory.get_webdriver_instance()

    def finalizer():
        driver.quit()

    request.addfinalizer(finalizer)
    return driver
Example #6
0
def setup(request, browser):
    wdf = WebDriverFactory(browser)
    driver = wdf.get_webdriver()
    lp = LoginPage(driver)
    lp.click_login_link()
    lp.login("*****@*****.**", "********")

    if request.cls is not None:
        request.cls.driver = driver
    yield driver
    driver.quit()
Example #7
0
def classSetUp(request, browser):
    print("Running class level setup.")
    wf = WebDriverFactory(browser)
    driver = wf.getWebDriverInstance()

    if request.cls is not None:
        request.cls.driver = driver

    yield driver
    driver.quit()
    print("Running class level teardown.")
Example #8
0
def oneTimeSetUp(request, browser):
    print("Running one time setUp")
    wdf = WebDriverFactory(browser)
    driver = wdf.getWebDriverInstance()

    if request.cls is not None:
        request.cls.driver = driver

    yield driver
    driver.quit()
    print("Running one time tearDown")
Example #9
0
def browser(request):
    web_driver_factory = WebDriverFactory(
        request.config.getoption("--browser"))
    browser = web_driver_factory.get_webdriver_instance()
    browser.maximize_window()
    browser.implicitly_wait(10)

    def finalizer():
        browser.quit()

    request.addfinalizer(finalizer)
    return browser
def oneTimeSetUp(request, browser):
    print("Running one time setUp")
    wb = WebDriverFactory(browser)
    driver = wb.getWebDriverInstance()
    lp = LoginPage(driver)
    lp.click_login_link()
    lp.login("*****@*****.**", "abcabc")
    if request.cls is not None:
        request.cls.driver = driver
    yield driver
    #lp.logout()
    #driver.quit()
    print("Running one time tearDown")
def oneTimeSetUp(request, browser):
    print("Running one time setUp")
    wdf = WebDriverFactory(browser)
    driver = wdf.getWebDriverInstance()
    lp = LoginPage(driver)
    lp.login("*****@*****.**", "letskodeit")

    if request.cls is not None:
        request.cls.driver = driver

    yield driver
    driver.quit()
    print("Running one time tearDown")
def oneTimeSetUp(request, browser):
    print("Running one time setUp")
    wdf = WebDriverFactory(browser)
    driver = wdf.get_webdriver_instance()
    lp = LoginPage(driver)
    lp.login("*****@*****.**", "abcabc")

    if request.cls is not None:
        request.cls.driver = driver

    yield driver
    driver.quit()
    print("Running one time tearDown")
Example #13
0
def module_set_up_level_to_test_a_class(request, browser):
    print('One time setup.')

    wdf = WebDriverFactory(browser)
    driver = wdf.get_web_driver_instance()
    lp = LoginPage(driver)
    lp.login('*****@*****.**', 'abcabc')

    #to pass value to the TestClassDemo2 if class.requests it!! while initializing instance
    if request.cls is not None:
        request.cls.driver = driver
    yield driver
    driver.quit()
    print('One time teardown.')
Example #14
0
def one_time_setUp(browser, request):
    print('Running One time Set Up')
    wdf = WebDriverFactory(browser)
    driver = wdf.get_webdriver_instance()

    lp = LoginPage(driver)
    lp.login(user_name="*****@*****.**", password="******")

    if request.cls is not None:
        request.cls.driver = driver

    yield driver
    driver.quit()
    print('Running One time Teardown')
Example #15
0
def one_time_setup(request, browser):
    print('Running one time setup')

    wdf = WebDriverFactory(browser)
    driver = wdf.get_webdriver_instance()
    home = HomePage(driver)
    home.log_in()

    if request.cls is not None:
        request.cls.driver = driver

    yield driver

    driver.quit()
    print('Running One time Teardown')
Example #16
0
def cSetup(request, browser):
    print("Execute before each class")
    wdf = WebDriverFactory(browser)
    driver = wdf.getWebDriverInstance()

    base_url = "https://letskodeit.teachable.com/"
    driver.get(base_url)

    lp = LoginPage(driver)
    lp.login('*****@*****.**', "abcabc")

    if request.cls is not None:
        request.cls.driver = driver
    yield
    driver.quit()
    print("Execute after each module")
Example #17
0
def onetime_setup(request, browser, url, username, password):
    print("Creating browser driver instance")
    wdf = WebDriverFactory(browser)
    if url is None:
        url = "http://fantasy.premierleague.com/"
    driver = wdf.get_web_driver_instance(url)
    if username is None:
        username = "******"
    if password is None:
        password = "******"
    if request.cls is not None:
        request.cls.driver = driver
        request.cls.username = username
        request.cls.password = password
    yield driver, url, username, password
    driver.quit()
    print("Browser driver instance is destroyed")
Example #18
0
def oneTimeSetUp(request, browser):
    print("Running one time setUp")
    wdf = WebDriverFactory(browser)
    driver = wdf.getWebDriverInstance()
    lp = login(driver)

    # Give the location of the file
    loc = ("C:\\Users\Sagar\\PycharmProjects\\furnish\\testcases\\login.xls")

    # To open Workbook
    wb = xlrd.open_workbook(loc)
    sheet = wb.sheet_by_index(0)

    # For row 0 and column 0
    username = (sheet.cell_value(1, 0))
    password = (sheet.cell_value(1, 1))
    lp.validloginForm(username, password)

    if request.cls is not None:
        request.cls.driver = driver
    yield driver
    driver.quit()
    print("Running one time tearDown")