def __init__(self): super().__init__() self._mnu_administer = Menu("css=[href='#Administer']") self._mmu_global_setting = Menu("css=.mn-setting") self._mnu_overview = Menu("//div[@id='main-menu']//a[text()='Overview']") self._lbl_new_page_title = Label("css=#div_popup h2") self._txt_name = TextBox("css=#div_popup #name") self._cbb_parent = ComboBox("css=#div_popup #parent") self._cbb_number_of_column = ComboBox("css=#div_popup #columnnumber") self._cbb_display_after = ComboBox("css=#div_popup #afterpage") self._chk_is_public = CheckBox("css=#div_popup #ispublic") self._btn_ok = Button("css=#div_popup #OK") self._btn_cancel = Button("css=#div_popup #Cancel")
class DataProfilesPage(GeneralPage): general_settings_page = GeneralSettingPage() def __init__(self): self._btn_add_new = Button("//a[text()='Add New']") self._btn_delete = Button("//a[text()='Delete']") def open_add_new_profile(self): self._btn_add_new.wait_for_visible() self._btn_add_new.click() self.wait_for_page_loaded() def add_new_profile(self, name, item_type=None, related_data=None): self.open_add_new_profile() self.general_settings_page.add_new_profile(name, item_type, related_data)
class LoginPage(): data = DataReader() def __init__(self): self._txt_user_name = TextBox("id=username") self._txt_password = TextBox("id=password") self._btn_login = Button("css=.btn-login") def go_to(self): browser.open_url(self.data.get_url()) self._txt_user_name.wait_for_visible() def login(self, user=data.get_username(), pwd=data.get_password()): self._txt_user_name.send_keys(user) self._txt_password.send_keys(pwd) self._btn_login.click() browser_helper.wait_for_ajax()
def __init__(self): self._btn_next = Button("css=input[value='Next']") self._btn_finish = Button("css=input[value='Finish']") self._btn_cancel = Button("css=input[value='Cancel']") self._txt_name = TextBox("id=txtProfileName") self._cbb_item_type = ComboBox("id=cbbEntityType") self._cbb_related_data = ComboBox("id=cbbSubReport")
def __init__(self): self._txt_user_name = TextBox("id=username") self._txt_password = TextBox("id=password") self._btn_login = Button("css=.btn-login")
def __init__(self): self._btn_add_new = Button("//a[text()='Add New']") self._btn_delete = Button("//a[text()='Delete']")
class GeneralSettingPage(GeneralPage): def __init__(self): self._btn_next = Button("css=input[value='Next']") self._btn_finish = Button("css=input[value='Finish']") self._btn_cancel = Button("css=input[value='Cancel']") self._txt_name = TextBox("id=txtProfileName") self._cbb_item_type = ComboBox("id=cbbEntityType") self._cbb_related_data = ComboBox("id=cbbSubReport") def next(self): self._btn_next.wait_for_visible() self._btn_next.click() def finish(self): self._btn_finish.wait_for_visible() self._btn_finish.click() def cancel(self): self._btn_cancel.wait_for_visible() self._btn_cancel.click() def enter_profile_information(self, name, item_type = None, related_data = None): self._txt_name.wait_for_visible() self._txt_name.send_keys(name) if item_type is not None: self._cbb_item_type.select_by_text_contains(item_type) if related_data is not None: self._cbb_related_data.select_by_text_contains(related_data) def add_new_profile(self, name, item_type = None, related_data = None): self.enter_profile_information(name, item_type, related_data) self.finish()
class DashboardPage(GeneralPage): def __init__(self): super().__init__() self._mnu_administer = Menu("css=[href='#Administer']") self._mmu_global_setting = Menu("css=.mn-setting") self._mnu_overview = Menu("//div[@id='main-menu']//a[text()='Overview']") self._lbl_new_page_title = Label("css=#div_popup h2") self._txt_name = TextBox("css=#div_popup #name") self._cbb_parent = ComboBox("css=#div_popup #parent") self._cbb_number_of_column = ComboBox("css=#div_popup #columnnumber") self._cbb_display_after = ComboBox("css=#div_popup #afterpage") self._chk_is_public = CheckBox("css=#div_popup #ispublic") self._btn_ok = Button("css=#div_popup #OK") self._btn_cancel = Button("css=#div_popup #Cancel") def select_global_setting_option(self, option): self._mmu_global_setting.wait_for_visible() self._mmu_global_setting.select_menu(option) def select_page(self, *link): self._mnu_overview.wait_for_visible() self._mnu_overview.select_menu(*link) def delete_page(self, *page_link): self.select_page(*page_link) self.select_global_setting_option(MenuList.DELETE.value) browser_helper.accept_alert() self._mmu_global_setting.wait_for_visible() def add_new_page(self, name, parent = None, succeed = True): self.select_global_setting_option(MenuList.ADD_PAGE.value) self.enter_new_page_information(name, parent) self.submit_modal() if succeed: self._lbl_new_page_title.wait_for_invisible() def edit_page(self, name, parent = None, succeed = True): self.select_global_setting_option(MenuList.EDIT.value) self.enter_new_page_information(name, parent) self.submit_modal() if succeed: self._lbl_new_page_title.wait_for_invisible() def enter_new_page_information(self, name, parent): self._lbl_new_page_title.wait_for_visible() self._txt_name.clear() self._txt_name.send_keys(name) if parent is not None: self._cbb_parent.select_by_text_contains(parent) def submit_modal(self): self._btn_ok.wait_for_visible() self._btn_ok.click() def cancel_modal(self): self._btn_cancel.wait_for_visible() self._btn_cancel.click() def select_administer_option(self, option): self._mnu_administer.wait_for_visible() self._mnu_administer.select_menu(option)