Exemplo n.º 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()
Exemplo n.º 2
0
class LoginPage():
    def __init__(self):
        self._cbb_repository = ComboBox("name=repository")
        self._txt_username = TextBox("id=username")
        self._txt_password = TextBox("id=password")
        self._btn_login = BaseElement("class=btn-login")

    def open(self):
        browser.open_url(os.getenv("url"))
        browser.wait_until(have.title(constant.DA_TITLE))

    def login(self,
              username=constant.DA_USER,
              password=constant.DA_PWD,
              success=True,
              repository=constant.DA_REPO):
        self._cbb_repository.select_by_visible_text(repository)
        self._txt_username.clear()
        self._txt_username.send_keys(username)
        self._txt_password.send_keys(password)
        self._btn_login.click()
        if success:
            self._btn_login.wait_for_invisible()

    def is_message_displayed(self, message):
        return browser_helper.get_alert_text() == message
Exemplo n.º 3
0
 def go_to_page(self, page_path):
     browser.wait_for_page_load_by_ajax()
     nodes = page_path.split("/")
     for node in nodes:
         page_button = BaseElement(
             "xpath = //div[@class = 'container']//a[text()='{}']".format(
                 node.replace(" ", "\u00a0")))
         page_button.move_to_element()
     page_button.click()
Exemplo n.º 4
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()
Exemplo n.º 5
0
class Menu(BaseElement):
    def __init__(self, locator):
        super().__init__(locator)
        self._mmu_item = BaseElement("//a[text()='%s']")

    def select_menu(self, *menu_path):
        self.move_to()
        for menu in menu_path:
            self._mmu_item.format(menu)
            if menu == menu_path[-1]:
                self._mmu_item.click()
            else:
                self._mmu_item.move_to()
Exemplo n.º 6
0
 def select_menu(self, item):
     element = BaseElement(self.dynamic_string.format(item))
     element.wait_until(be.visible)
     element.click()
Exemplo n.º 7
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()
Exemplo n.º 8
0
 def delete_data_profile(self, data):
     browser.wait_for_page_load_by_ajax()
     _txt_delete = BaseElement(self._dynamic_string.format(data, 'Delete'))
     _txt_delete.wait_for_clickable(constant.MEDIUM_TIME_OUT / 6)
     _txt_delete.click()
     browser.accept_alert()
Exemplo n.º 9
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()
Exemplo n.º 10
0
 def click_button(self, button_name):
     browser.wait_for_page_load_by_ajax()
     _btn_button_name = BaseElement(self.dynamic_string.format(button_name))
     _btn_button_name.wait_for_clickable(constant.MEDIUM_TIME_OUT / 6)
     _btn_button_name.click()