def step_impl(context):
    homepage = HomePage(utilizer.active_driver_instance())
    utilizer.click_on_element(homepage.login_button, "homepage.login_button")
    utilizer.time_elapsed(6)
    login_url = utilizer.get_current_url()
    assert "login" in login_url, utilizer.log_it(
        "login screen is not opened . Try again : Current url :{}".format(
            login_url))
def step_impl(context, username, password):
    homepage = HomePage(utilizer.active_driver_instance())
    logging.info(" * - Entering username password")
    utilizer.type_on_element(
        homepage.login_username,
        utilizer.ini_reader(context,
                            username.split(".")[1]))
    utilizer.type_on_element(
        homepage.login_password,
        utilizer.ini_reader(context,
                            password.split(".")[1]))
    utilizer.scroll_to_bottom()
    utilizer.click_on_element(homepage.subscriber_login,
                              "homepage.subscriber_login")
    utilizer.time_elapsed(5)
def step_impl(context):
    homepage = HomePage(utilizer.active_driver_instance())
    utilizer.scroll_to_bottom()
    Before_clicking_gototop = utilizer.active_driver_instance().execute_script(
        'return window.pageYOffset;')
    utilizer.visibility_of_ele_located(homepage.go_to_top_button,
                                       "homepage.go_to_top_button")
    utilizer.click_on_element(homepage.go_to_top_button,
                              "homepage.go_to_top_button")
    utilizer.time_elapsed(6)
    After_clicking_gototop = utilizer.active_driver_instance().execute_script(
        'return window.pageYOffset;')
    logging.info("Before_gototop :{}, After_gototop: {}".format(
        Before_clicking_gototop, After_clicking_gototop))
    assert After_clicking_gototop == 0, utilizer.log_it(
        "GO TO TOP might not be worked as expected. "
        "Before_gototop:{} After_gototop:{}".format(Before_clicking_gototop,
                                                    After_clicking_gototop))
def step_impl(context):
    homepage = HomePage(utilizer.active_driver_instance())
    before_total_articlesection_articlelink = homepage.subject_article_section_articlelink
    logging.info(
        " * - Total article count before load more operation - {}".format(
            len(before_total_articlesection_articlelink)))
    utilizer.scroll_to_bottom()
    utilizer.time_elapsed(2)
    logging.info(" * - Clicking on load more button")
    utilizer.click_on_element(homepage.load_more, "homepage.load_more")
    utilizer.time_elapsed(5)
    after_total_articlesection_articlelink = homepage.subject_article_section_articlelink
    logging.info(
        " * - Total article count after load more operation - {}".format(
            len(after_total_articlesection_articlelink)))
    assert len(after_total_articlesection_articlelink) >= len(
        before_total_articlesection_articlelink), utilizer.log_it(
            "Load more feature is not working effectively")
def step_impl(context):
    homepage = HomePage(utilizer.active_driver_instance())
    utilizer.click_on_element(homepage.latest_edition,
                              "homepage.latest_edition")
    utilizer.time_elapsed(5)
    utilizer.verify_text_present(homepage.subscriber_exclusive,
                                 "Subscriber Exclusive")
    utilizer.scroll_to_height(800)
    utilizer.time_elapsed(10)
    utilizer.navigate_to("https://www.the-tls.co.uk/article-section/letters/")
    utilizer.time_elapsed(8)
    current_url = utilizer.get_current_url()
    logging.info(current_url)
    assert "letters" in current_url, utilizer.log_it(
        " Current url is not opened properly it's should be letter's ")
    logging.info(" * - Opening the private article")
    for each in homepage.list_of_article_under_section:
        utilizer.move_to_element_click(each)
        break
    utilizer.time_elapsed(8)
def step_impl(context):
    homepage = HomePage(utilizer.active_driver_instance())
    logging.info(" * - Checking subject category")
    utilizer.click_on_element(homepage.subject_link, "homepage.subject_link")
    utilizer.time_elapsed(6)
def step_impl(context):
    homepage = HomePage(utilizer.active_driver_instance())
    utilizer.click_on_element(homepage.subject_link, "homepage.subject_link")
    utilizer.time_elapsed(8)
def step_impl(context):
    homepage = HomePage(utilizer.active_driver_instance())
    utilizer.click_on_element(homepage.latest_edition,
                              "homepage.latest_edition")
    utilizer.time_elapsed(4)
def step_impl(context):
    homepage = HomePage(utilizer.active_driver_instance())
    utilizer.click_on_element(homepage.search_button, "homepage.search_button")
def step_impl(context):
    homepage = HomePage(utilizer.active_driver_instance())
    utilizer.click_on_element(homepage.logout_button, "homepage.logout_button")
    utilizer.page_element_validator(homepage.login_button,
                                    "homepage.login_button")
def step_impl(context):
    homepage = HomePage(utilizer.active_driver_instance())
    utilizer.click_on_element(homepage.subscribe_button,
                              "homepage.subscribe_button")
    utilizer.time_elapsed(5)