def __init__(self): ''' Constructor ''' Login.__init__(self) ControlPanel.__init__(self) CommonActions.__init__(self) NewArticle.__init__(self) ManagerArticle.__init__(self)
def checkArticleInformation(self, driver, title, expTitle, expCategory, expText, expAccess): titleCorrect = categoryCorrect = textCorrect = accessCorrect = False ManagerArticle().selectCheckboxArticle(driver, title) ManagerArticle().clickToolbarButton(driver, "Edit") #Check created title currentTitle = driver.find_element_by_xpath( self.txtTitle).get_attribute('value') if currentTitle == expTitle: titleCorrect = True else: self.logInfo("Current TITLE does not match with expected one") #Check selected option of Category currentCaSelection = Select( driver.find_element_by_xpath(self.ddlCategory)) currentCategory = currentCaSelection.first_selected_option.text if expCategory in currentCategory: categoryCorrect = True else: self.logInfo("Current CATEGORY does not match with expected one") #Check selected option of Access currentAcSelection = Select( driver.find_element_by_xpath(self.ddlAccess)) currentAccess = currentAcSelection.first_selected_option.text if expAccess == currentAccess: accessCorrect = True else: self.logInfo("Current ACCESS does not match with expected one") #Check value on 'Article Text' text are self.switchToFrame(driver, "jform_articletext_ifr") currentText = driver.find_element_by_xpath( self.txtText).get_attribute('textContent') driver.switch_to.default_content() if expText == currentText: textCorrect = True else: self.logInfo("Current TEXT doesn't not match with expected one") correctInfomation = titleCorrect and categoryCorrect and accessCorrect and textCorrect self.verifyTrue( correctInfomation == True, "\tPASSED : Created %s's information is displayed correctly " % title, "\tFAILED: Created %s's information is NOT displayed correctly " % title) #Redirect to Manager Article option = self.btnToolbarBox.replace("$TOOLBAR BUTTON NAME$", "Close") driver.find_element_by_xpath(option).click()
def editArticle(self, driver, title, newtitle, newcategory, newtext, newoption): #Search a article before editing ManagerArticle().searchArticle(driver, title) #select Article ManagerArticle().selectCheckboxArticle(driver, title) ManagerArticle().clickToolbarButton(driver, "Edit") #Enter values to edit self.enterValue(driver, newtitle, newcategory, newtext) #Click option icon to save of the top right toolbar option = self.btnToolbarBox.replace("$TOOLBAR BUTTON NAME$", newoption) driver.find_element_by_xpath(option).click()
def createNewArticleByButton(self, driver, title, category, text, option, status=None, insert=None, access=None, alias=None, permission=None, featureed=None, language=None): #Click on 'New' icon of the top right toolbar ManagerArticle().clickToolbarButton(driver, "New") #Enter value for the new article NewArticle().enterValue(driver, title, category, text, status, insert, access) #Click option icon to save of the top right toolbar try: option = self.btnToolbarBox.replace("$TOOLBAR BUTTON NAME$", option) driver.find_element_by_xpath(option).click() except Exception, e: print str(e)
def checkArticleFeature(self, driver, title, sttFeature): #Search a article before editing ManagerArticle().searchArticle(driver, title) #select Article ManagerArticle().selectCheckboxArticle(driver, title) ManagerArticle().clickToolbarButton(driver, "Edit") currentSelection = Select(driver.find_element_by_xpath( self.ddlFeature)) currentOption = currentSelection.first_selected_option.text if sttFeature == "Featured": expectedOption = "Yes" else: expectedOption = "No" self.verifyTrue( currentOption == expectedOption, "\tPASSED : The article is %s successfully " % sttFeature, "\tFAILED: The article is NOT %s successfully " % sttFeature) #Click option icon to save of the top right toolbar option = self.btnToolbarBox.replace("$TOOLBAR BUTTON NAME$", "Close") driver.find_element_by_xpath(option).click()
def getManagerArticle(): return ManagerArticle()