Пример #1
0
class DAGeneralSettingsPage():
    def __init__(self):
        self.dynamic_button = BaseElement("//input[@value='%s']")
        self._txt_name = TextBox("id=txtProfileName")
        self._cbb_type = ComboBox("id=cbbEntityType")
        self._cbb_related_data = ComboBox("id=cbbSubReport")

    def fill_general_setting_info(self,
                                  name,
                                  item_type=None,
                                  related_data=None):
        self._txt_name.wait_for_visible()
        self._txt_name.clear()
        self._txt_name.send_keys(name)
        if item_type is not None:
            self._cbb_type.select_by_visible_text(item_type)
        if related_data is not None:
            self._cbb_related_data.select_by_visible_text(related_data)

    def click_next_button(self):
        self.dynamic_button.format("Next")
        self.dynamic_button.wait_for_visible()
        self.dynamic_button.click()

    def click_finish_button(self):
        self.dynamic_button.format("Finish")
        self.dynamic_button.wait_for_visible()
        self.dynamic_button.click()

    def get_item_type_options(self):
        return self._cbb_type.get_options()
Пример #2
0
class DataProfilesPage():

    def __init__(self):
        self._lbl_dynamic_link = BaseElement("//a[text()='%s']")
        
    def select_add_new_link(self):
        self._lbl_dynamic_link.format("Add New")
        self._lbl_dynamic_link.wait_for_visible()
        self._lbl_dynamic_link.click()
Пример #3
0
class DashboardPage():

    def __init__(self):
        self._lbl_login_title = BaseElement("//div[@class='ltext' and text()='Login']")
        self._lbl_welcome_user = BaseElement("//a[@href='#Welcome']")
        self._lbl_logout = BaseElement("//a[@href='logout.do']")
        self._ico_global_setting = BaseElement("//li[@class='mn-setting']/a")
        self._txt_page_name = TextBox("id=name")
        self._cbb_parent_name = ComboBox("id=parent")
        self._cbb_num_of_column = ComboBox("id=columnnumber")
        self._cbb_display_after = ComboBox("id=afterpage")
        self._cb_public = BaseElement("id=ispublic")
        self._btn_dynamic_on_add_edit_new_page = BaseElement("//input[@class='button page_button' and @id='%s']")
        self._lbl_test_module_execution = BaseElement("//div[@title='Test Module Execution']")
        self._lbl_dynamic_global_setting_item = BaseElement("//li[@class='mn-setting']//a[text()='%s']")
        self._lbl_dynamic_label = BaseElement("//a[text()='%s']")
        self._lbl_administer_user = BaseElement("//a[@href='#Administer']")

    def logout(self):
        self._lbl_welcome_user.wait_for_visible()
        self._lbl_welcome_user.move_to()
        self._lbl_logout.wait_for_visible()
        self._lbl_logout.click()
        self._lbl_welcome_user.wait_for_invisible()

    def add_page(self, page_name, parent_page = "Overview", success=True):
        self.select_global_selecting_item("Add Page")
        self.fill_page_info(page_name, parent_page)
        self.submit_modal()
        if success:
            self._txt_page_name.wait_for_invisible()
        
    def edit_page(self,page_name, parent_page = "Overview", success=True):
        self.select_global_selecting_item("Edit")
        self.fill_page_info(page_name, parent_page)
        self.submit_modal()
        if success:
            self._txt_page_name.wait_for_invisible()
        
    def submit_modal(self):
        self._btn_dynamic_on_add_edit_new_page.format("OK")
        self._btn_dynamic_on_add_edit_new_page.wait_for_visible()
        self._btn_dynamic_on_add_edit_new_page.click()
    
    def dismiss_modal(self):
        self._btn_dynamic_on_add_edit_new_page.format("Cancel")
        if self._btn_dynamic_on_add_edit_new_page.is_displayed(SHORT_TIME):
            self._btn_dynamic_on_add_edit_new_page.click()
        self._btn_dynamic_on_add_edit_new_page.wait_for_invisible()
        
    def fill_page_info(self,page_name, parent_page = "Overview"):
        self._txt_page_name.wait_for_visible()
        self._txt_page_name.clear()
        self._txt_page_name.send_keys(page_name)
        self._cbb_parent_name.wait_for_visible()
        self._cbb_parent_name.select_by_text_contains(parent_page)
           
    def select_global_selecting_item(self, item):
        self._ico_global_setting.wait_for_visible()
        self._ico_global_setting.click()
        self._lbl_dynamic_global_setting_item.format(item)
        self._lbl_dynamic_global_setting_item.wait_for_visible()
        self._lbl_dynamic_global_setting_item.click()
        
    def open_page(self,*page_name):
        for item in page_name:
            self._lbl_dynamic_label.format(item)
            self._lbl_dynamic_label.wait_for_visible()
            if item == page_name[-1]:
                self._lbl_dynamic_label.click()
            else:
                self._lbl_dynamic_label.move_to()
    
    def delete_page(self, page_name):
        self.open_page(*page_name)
        self.select_global_selecting_item("Delete")
        browser_helper.accept_alert()
        self._lbl_test_module_execution.wait_for_visible()

    def click_administer_item(self, item):
        self._lbl_administer_user.wait_for_visible()
        self._lbl_administer_user.move_to()
        self._lbl_dynamic_label.format(item)
        self._lbl_dynamic_label.wait_for_visible()
        self._lbl_dynamic_label.click()
Пример #4
0
class DashboardPage():
    def __init__(self):
        self._btn_global_setting = BaseElement("class=mn-setting")
        self._txt_page_name = TextBox("id=name")
        self._cbb_parent_name = ComboBox("id=parent")
        self._btn_ok = BaseElement("id=OK")
        self._lbl_test_module_execution = BaseElement(
            "//div[@title='Test Module Execution']")
        self._link_page_item = BaseElement(
            "//div[@id='main-menu']//a[text()='%s']")
        self._item_menu = BaseElement("//a[text()='%s']")

    def page_title(self, title):
        return constant.DA_TITLE + " - " + title

    def is_page_displayed(self, page_name):
        return browser_helper.get_title() == self.page_title(page_name)

    def select_menu_item(self, *menu_item):
        for item in menu_item:
            self._item_menu.format(item)
            self._item_menu.wait_for_visible()
            if item == menu_item[-1]:
                self._item_menu.click()
            else:
                self._item_menu.move_to()

    def log_out(self):
        self.select_menu_item(constant.DA_USER, MenuList.LOGOUT.value)

    def select_global_setting(self, name):
        self._btn_global_setting.wait_for_visible()
        self._btn_global_setting.move_to()
        self.select_menu_item(name)

    def fill_page_info(self, page_name, parent_name):
        self._txt_page_name.wait_for_visible()
        self._txt_page_name.clear()
        self._txt_page_name.send_keys(page_name)
        if parent_name is not None:
            self._cbb_parent_name.select_by_text_contains(parent_name)

    def create_new_page(self,
                        page_name,
                        parent_name=constant.ROOT_PAGE,
                        success=True):
        self.select_global_setting(SettingsList.ADD_PAGE.value)
        self.fill_page_info(page_name, parent_name)
        self._btn_ok.wait_for_visible()
        self._btn_ok.click()
        if success:
            self._txt_page_name.wait_for_invisible()

    def edit_page_info(self, page_name, parent_name=None, success=True):
        self.select_global_setting(SettingsList.EDIT.value)
        self.fill_page_info(page_name, parent_name)
        self._btn_ok.wait_for_visible()
        self._btn_ok.click()
        if success:
            self._txt_page_name.wait_for_invisible()

    def go_to_page(self, *page_name):
        self.select_menu_item(*page_name)

    def delete_page(self, *page_name):
        self.go_to_page(*page_name)
        self.select_global_setting(SettingsList.DELETE.value)
        browser_helper.accept_alert()
        self._lbl_test_module_execution.wait_for_visible()