def before_scenario(context, scenario): print("==============================> In before scenario") device_name = None '''from tags get the tag name which contains device name''' for eachTag in scenario.tags: if eachTag.startswith('device'): device_name = eachTag.split("-")[1] break '''Here desired capabilities are set into current_config of ConfigSetup class''' Config.current_config = Utils.read_yaml_get_data_for( r'./core/deviceInfo.yaml', device_name) Config.current_config['scenario_name'] = scenario.name Session.session_name_config[scenario.name] = Config.current_config AppiumWrapper()
def choose_login_method(context): AppiumWrapper().click('id', 'com.fastaccess.github:id/basicAuth')
def validate_login_activity(context): assert AppiumWrapper().get_current_activity() == "com.fastaccess.ui.modules.login.chooser.LoginChooserActivity"
def click_on_search_icon(context): AppiumWrapper().click('id', 'com.fastaccess.github:id/search')
def click_on_add_option(context): AppiumWrapper().click('id', 'com.fastaccess.github:id/add')
def confirm_logout(context): AppiumWrapper().click('id', 'com.fastaccess.github:id/ok') assert AppiumWrapper().get_current_activity( sleep_time=1) == "com.fastaccess.ui.modules.login.chooser.LoginChooserActivity"
def click_on_profile_tab(context): AppiumWrapper().click('xpath', '//androidx.appcompat.app.ActionBar.Tab[@content-desc="Profile"]')
def validate_main_activity(context): assert AppiumWrapper().get_current_activity(sleep_time=5) == 'com.fastaccess.ui.modules.main.MainActivity'
def click_on_issue_icon(context): AppiumWrapper().click('id', 'com.fastaccess.github:id/issues')
def click_on_issue_title(context, recent_issue_title): AppiumWrapper().click('xpath', "//*[@text='" + recent_issue_title + "']")
def validation_issue_title(context, issue_title): time.sleep(5) assert AppiumWrapper().get_element_text('xpath', "//*[@text='" + issue_title + "']") == issue_title
def add_new_issue(context, issue_title, issue_description): AppiumWrapper().insert_data('xpath', "//*[@text='Title']", issue_title) AppiumWrapper().click('xpath', "//*[@text='Description']") AppiumWrapper().insert_data('id', "com.fastaccess.github:id/editText", issue_description) AppiumWrapper().click('id', "com.fastaccess.github:id/submit")
def update_issue_title_and_description(context, issue_title, issue_description): AppiumWrapper().clear_text_box('class name', "android.widget.EditText") AppiumWrapper().insert_data('class name', "android.widget.EditText", issue_title) AppiumWrapper().click('id', "com.fastaccess.github:id/description") AppiumWrapper().insert_data('id', "com.fastaccess.github:id/editText", issue_description) AppiumWrapper().click('id', "com.fastaccess.github:id/submit")
def click_on_edit_btn(context): AppiumWrapper().click('id', 'com.fastaccess.github:id/editMenu') AppiumWrapper().click('xpath', "//*[@text='Edit']")
def click_on_submit_btn(context): AppiumWrapper().click('id', 'com.fastaccess.github:id/submit')
def fill_user_account_info(context, Username, Password): AppiumWrapper().insert_data('id', 'com.fastaccess.github:id/usernameEditText', Username) AppiumWrapper().insert_data('id', 'com.fastaccess.github:id/passwordEditText', Password) AppiumWrapper().hide_keyboard()
def click_on_login_btn(context): AppiumWrapper().click('id', 'com.fastaccess.github:id/login')
def enter_repo_name(context, repository_name): AppiumWrapper().insert_data('id', 'com.fastaccess.github:id/searchEditText', repository_name) AppiumWrapper().click('id', 'com.fastaccess.github:id/search')
def click_on_navigation_drawer(context): AppiumWrapper().click('xpath', '//android.widget.ImageButton[@content-desc="Navigate up"]')
def click_on_result(context, repository_name): AppiumWrapper().click('id', 'com.fastaccess.github:id/title')
def click_on_logout_option(context): AppiumWrapper().click('id', 'com.fastaccess.github:id/logout')
def validation_repo_page(context, repository_name): time.sleep(5) assert AppiumWrapper().get_element_text( 'id', 'com.fastaccess.github:id/headerTitle') == repository_name
def close_change_log(context): """lunch application in environment - step before scenario run""" if AppiumWrapper().is_exist_element('id', 'com.fastaccess.github:id/title', time_out=2): AppiumWrapper().back_button()
def click_on_fab_btn(context): AppiumWrapper().click('id', 'com.fastaccess.github:id/fab')