Beispiel #1
0
class LoginPage():
    def __init__(self, edriver):
        self.driver = edriver

    __username_text_box = (By.NAME, "j_username")
    __password_text_box = (By.NAME, "j_password")
    __login_button = (By.XPATH, "//input[@value='Login']")
    __logout_button = (By.XPATH, "//a[contains(text(),'Logout')]")

    url = config.get_default("url")
    username = config.get_default("username")
    password = config.get_default("password")

    def login(self):
        driver = self.driver
        driver.get(self.url)
        driver.find_element(*LoginPage.__username_text_box).send_keys(
            self.username)
        driver.find_element(*LoginPage.__password_text_box).send_keys(
            self.password)
        driver.find_element(*LoginPage.__login_button).click()

    def assert_title(self):
        assert self.driver.title == "TVGCM: Catalog Player Status"
        log.info("Login is Successful !!")

    def logout(self):
        driver = self.driver
        driver.find_element(*LoginPage.__logout_button).click()
        log.info("Successfully Logged Out!!")
    def test_primary_on_standby_off(self, test_setup):
        standby_ip_with_port = CPS.Test_CP_Status.test_get_standby_ip(self, test_setup)
        standby_ip=standby_ip_with_port[:-5:1]
        print("standby_ip: ", standby_ip)
        ip = config.get_default("ssh_ip")
        username = config.get_default("ssh_username")
        password = config.get_default("ssh_password")
        sshutils.ssh_connect(ip,username,password)
        sshutils.ssh_stop_service(standby_ip)

        primary_status, standby_status = CPS.Test_CP_Status.test_get_cp_status(self, test_setup)
        assert primary_status=='Up'
        assert standby_status=='Down'
        sshutils.ssh_start_service()
        sshutils.ssh_close(ip,standby_ip)
 def test_get_standby_ip(self, test_setup):
     codebase.driver.find_element_by_xpath(
         "//td[@id='tvgcmHomeMainMenu']").click()
     standby_ip_port = config.get_default("standby")
     standby = flib.get_text(
         "//span[contains(text(),'Duluth_Standby_Service')]//following::td[2]"
     )
     print("standby: ", standby)
     assert standby == standby_ip_port, "Standby IP mismatch !!"
     return standby
 def test_get_primary_ip(self, test_setup):
     codebase.driver.find_element_by_xpath(
         "//td[@id='tvgcmHomeMainMenu']").click()
     primary_ip_port = config.get_default("primary")
     primary = flib.get_text(
         "//span[contains(text(),'Duluth_Primary_Service')]//following::td[2]"
     )
     print("primary: ", primary)
     assert primary == primary_ip_port, "Primary IP mismatch !!"
     return primary
Beispiel #5
0
 def verify_add_db_broadcast_offering_(self):
     DBSERVER = config.get_default("DBSERVER")
     db = connect_to_db(DBSERVER,
                        dbuser='******',
                        dbpassword='******',
                        dbname='ADAPTERDB')
     read_query = {"oid": self.Broadcast_Offering_Name}
     query_resp = findone(db, "barker_broadcast_offering", read_query)
     assert query_resp['oid'] == self.Broadcast_Offering_Name
     log.info("Broadcast Offering " + self.Broadcast_Offering_Name +
              " added to database")
Beispiel #6
0
 def verify_delete_db_broadcast_offering_(self):
     DBSERVER = config.get_default("DBSERVER")
     db = connect_to_db(DBSERVER,
                        dbuser='******',
                        dbpassword='******',
                        dbname='ADAPTERDB')
     read_query = {"oid": self.Broadcast_Offering_Name}
     query_resp = findone(db, "barker_broadcast_offering", read_query)
     # assert query_resp['oid'] != self.Broadcast_Offering_Name #TypeError: 'NoneType' object is not subscriptable
     if not query_resp:
         log.info("Broadcast Offering " + self.Broadcast_Offering_Name +
                  " deleted from database")
Beispiel #7
0
class CatalogPageData:

    hotLaunchSourceId = config.get_default("hotLaunchSourceId")
    hotLaunchSourceIds = config.get_default("hotLaunchSourceIds")
    test_catalogPage_data=[{"hlsId":hotLaunchSourceId}, {"hlsId":hotLaunchSourceIds}]
    test_catalogPage_data_1 = [{"hlsId": hotLaunchSourceId}]
class CatalogPage:
    def __init__(self, edriver):
        self.driver = edriver

    navigationId = config.get_default("navigationId")
    __categoryId = (By.XPATH, "//input[@id='category']")
    __navigationId = (By.XPATH, "//input[@id='navigation']")
    __hotLaunchSourceId = (By.XPATH, "//input[@id='hotlaunchsourceId']")
    __save_button = (By.XPATH, "//input[@value='Save']")
    __category_success_msg = (
        By.XPATH, "//p[contains(text(),'Category added successfully.')]")
    __publish_button = (By.XPATH, "//div[@class='publish']//input")
    __publish_successful_msg = (
        By.XPATH, "//p[contains(text(),'Categories published successfully.')]")
    __duplicate_hotLaunchSourceId_error_msg = (
        By.XPATH,
        "//li[contains(text(),'The HotLauchSourceID you are trying to add already')]"
    )
    __delete_button = (By.XPATH, "//input[@class='delete']")
    __delete_successful_msg = (By.XPATH,
                               "//div/p[1][@class='message success']")

    __table = (By.XPATH, "//table[@class='list']")

    def add_and_publish_category(self, hlsId):
        driver = self.driver
        date = datetime.datetime.now()
        dt = date.strftime("%Y%m%d%H%M%S")
        categoryId = "Category" + dt
        log.info("Adding categoryId {} and hotLaunchSourceIds {}".format(
            categoryId, hlsId))
        driver.find_element(*CatalogPage.__categoryId).send_keys(categoryId)
        driver.find_element(*CatalogPage.__navigationId).send_keys(
            self.navigationId)
        driver.find_element(*CatalogPage.__hotLaunchSourceId).send_keys(hlsId)
        driver.find_element(*CatalogPage.__save_button).click()
        try:
            category_success_msg = driver.find_element(
                *CatalogPage.__category_success_msg)
            category_success_msg.is_displayed()
            log.info(
                driver.find_element(*CatalogPage.__category_success_msg).text)
            __checkbox = "//td[contains(text(),'" + hlsId + "')]//preceding::input[1]"
            driver.find_element_by_xpath(__checkbox).click()
            driver.find_element(*CatalogPage.__publish_button).click()
            BaseClass.alert_accept(self)
            driver.find_element(
                *CatalogPage.__publish_successful_msg).is_displayed()
            log.error(
                driver.find_element(
                    *CatalogPage.__publish_successful_msg).text)
        except NoSuchElementException:
            duplicate_hotLaunchSourceId_error_msg = driver.find_element(
                *CatalogPage.__duplicate_hotLaunchSourceId_error_msg)
            duplicate_hotLaunchSourceId_error_msg.is_displayed()
            log.info(
                driver.find_element(
                    *CatalogPage.__duplicate_hotLaunchSourceId_error_msg).text)
            log.info("Category Not added !!")

    def delete_category(self, hlsId):
        driver = self.driver
        __delete_hotLaunchSource = "//td[contains(text(),'" + hlsId + "')]//preceding::input[1]"
        driver.find_element_by_xpath(__delete_hotLaunchSource).click()
        driver.find_element(*CatalogPage.__delete_button).click()
        BaseClass.alert_accept(self)
        driver.find_element(
            *CatalogPage.__delete_successful_msg).is_displayed()
        log.info(
            driver.find_element(*CatalogPage.__delete_successful_msg).text)

    def list_hotLaunchSource_Ids(self):
        ''' Fetch the list of available categories '''
        driver = self.driver
        table = driver.find_element(*CatalogPage.__table)
        rowCount = BaseClass.getWebTableRowCount(self, table)
        hl_list = []
        for i in range(2, rowCount + 1):
            hl_xpath = "//table[1]/tbody[1]/tr[" + str(i) + "]/td[4]"
            hl_list.append(driver.find_element_by_xpath(hl_xpath).text)
        str1 = ','.join(hl_list)
        hls = list(str1.split(","))
        log.info("List of available hotLaunchSourceIds :", hls)
Beispiel #9
0
class BroadcastOfferingPage(BaseClass):
    def __init__(self, edriver):
        self.driver = edriver

    __table_rows = (By.XPATH, "//table[@class='list customTable']//tbody/tr")
    __broadcast_offering_name = (By.ID, "oid")
    __iphostname = (By.ID, "iphostname")
    __ipport = (By.ID, "ipport")
    __save_and_publish = (By.XPATH, "//input[@value='Save and Publish']")

    STB_Config = config.get_default("stbConfigName")
    Broadcast_Offering_Name = config.get_default("Broadcast Offering Name")
    QAM_Host = config.get_default("QAM Host")
    QAM_Port = config.get_default("QAM Port")
    __delete_broadcast_offering = (
        By.XPATH, "//a[contains(text(),'ch_008_barker')]//preceding::input[1]")
    __delete_button = (By.XPATH, "//input[@value='Delete']")

    # def get_table_rows(self):
    #rows = driver.find_elements_by_xpath("//table[@class='list customTable']//tbody/tr")
    # self.driver.find_element(*BroadcastOfferingPage.__table_rows)

    def get_broadcast_offerings_list(self):
        bo_list = []
        qam_port_list = []
        rows = self.driver.find_elements(*BroadcastOfferingPage.__table_rows)
        for i in range(2, len(rows) + 1):
            bo_name = self.driver.find_element_by_xpath(
                "//table[@class='list customTable']//tbody/tr[" + str(i) +
                "]/td[2]").text
            qam_port = self.driver.find_element_by_xpath(
                "//table[@class='list customTable']//tbody/tr[" + str(i) +
                "]/td[8]").text
            bo_list.append(bo_name)
            qam_port_list.append(qam_port)

        str_bo_list = ', '.join(bo_list)
        str_qam_port_list = ', '.join(qam_port_list)
        log.info("List of available broadcast offerings: " + str_bo_list)
        log.info("List of available qam ports: " + str_qam_port_list)

    def add_broadcast_offering(self):
        driver = self.driver
        driver.find_element(
            *BroadcastOfferingPage.__broadcast_offering_name).send_keys(
                self.Broadcast_Offering_Name)
        driver.find_element(*BroadcastOfferingPage.__iphostname).clear()
        driver.find_element(*BroadcastOfferingPage.__iphostname).send_keys(
            self.QAM_Host)
        driver.find_element(*BroadcastOfferingPage.__ipport).send_keys(
            self.QAM_Port)
        drop = BaseClass.getAllDropDownOptions(self, "stb_sel")
        BaseClass.selectDropDownListByValue(self, "stb_sel", self.STB_Config)
        BaseClass.selectDropDownListByIndex(self, "catalogPlayer", 1)
        BaseClass.srollToBottomOfPage(self)
        driver.find_element(*BroadcastOfferingPage.__save_and_publish).click()
        assert driver.title == "TVGCM: Broadcast Offerings"
        log.info("New broadcast offering " + self.Broadcast_Offering_Name +
                 " added !!")

    def delete_broadcast_offering(self):
        self.driver.find_element(
            *BroadcastOfferingPage.__delete_broadcast_offering).click()
        self.driver.find_element(
            *BroadcastOfferingPage.__delete_button).click()
        BaseClass.alert_accept(self)
        log.info("Broadcast Offering " + self.Broadcast_Offering_Name +
                 " deleted successfully!!")

    def verify_add_db_broadcast_offering_(self):
        DBSERVER = config.get_default("DBSERVER")
        db = connect_to_db(DBSERVER,
                           dbuser='******',
                           dbpassword='******',
                           dbname='ADAPTERDB')
        read_query = {"oid": self.Broadcast_Offering_Name}
        query_resp = findone(db, "barker_broadcast_offering", read_query)
        assert query_resp['oid'] == self.Broadcast_Offering_Name
        log.info("Broadcast Offering " + self.Broadcast_Offering_Name +
                 " added to database")

    def verify_delete_db_broadcast_offering_(self):
        DBSERVER = config.get_default("DBSERVER")
        db = connect_to_db(DBSERVER,
                           dbuser='******',
                           dbpassword='******',
                           dbname='ADAPTERDB')
        read_query = {"oid": self.Broadcast_Offering_Name}
        query_resp = findone(db, "barker_broadcast_offering", read_query)
        # assert query_resp['oid'] != self.Broadcast_Offering_Name #TypeError: 'NoneType' object is not subscriptable
        if not query_resp:
            log.info("Broadcast Offering " + self.Broadcast_Offering_Name +
                     " deleted from database")