def createCampaignTxtAndImageLessons(self,campaignTitle,campDescription,actualSuccessMessage,lessonNameForTextLesson,lessonNameforImageLesson): elements=CampPage() wait=WebDriverWait(driver, 60) print "\n\nCreating Campaign" wait.until(EC.visibility_of_element_located((By.XPATH,elements.campaignButtonFromSideMenuXpath()))) elements.campaignButtonFromSideMenu() wait.until(EC.visibility_of_element_located((By.XPATH,elements.createCampaignButtonXpath()))) if elements.campaignsPageHeaderText()=="Campaigns": print "Campaigns page displayed" else: print "Campaigns page is not displayed" raise Exception print "Clicking on Create Campaign button" wait.until(EC.visibility_of_element_located((By.XPATH,elements.createCampaignButtonXpath()))) elements.createCampaignButton() wait.until(EC.visibility_of_element_located((By.XPATH,elements.Camp_titleXpath()))) print "Create Campaign page is displayed" elements.titleTextField(campaignTitle) print "Title entered ::campTitle" elements.descriptionField(campDescription) print "Description entered ::campDescription" print "Adding Lesson" #Add lesson button elements.addlessonButton() #Waiting until first lesson in pop is displayed wait.until(EC.visibility_of_element_located((By.XPATH,elements.FirstLessonWaitXpath()))) #Searching lesson by its name print "Searching first lesson" elements.searchLesson(lessonNameForTextLesson) elements.waitUntilSearchedLessonDisplayed(lessonNameForTextLesson) elements.selectSearchedLesson(lessonNameForTextLesson) print "First lesson selected" print "Searching second lesson" elements.searchLesson(lessonNameforImageLesson) elements.waitUntilSearchedLessonDisplayed(lessonNameforImageLesson) elements.selectSearchedLesson(lessonNameforImageLesson) print "Second lesson selected" #waiting until add to campaign button is click able wait.until(EC.element_to_be_clickable((By.XPATH,elements.AddToCampaign_ButtonXpath()))) #Clicking on Add to Campaign button elements.addToCampaignButton() #Verifying Added lesson is displayed in Grid print "\nVerifying Added first lesson is displayed in Grid" if elements.firstLessonInGrid()==lessonNameForTextLesson: print "Lesson displayed in grid ::"+lessonNameForTextLesson else: print "Lesson not displayed in grid" print "\nVerifying Added second lesson is displayed in Grid" if elements.secondLessonInGrid()==lessonNameforImageLesson: print "Lesson displayed in grid ::"+lessonNameforImageLesson else: print "Lesson not displayed in grid" wait.until(EC.element_to_be_clickable((By.XPATH,elements.SaveAndExit_ButtonXpath()))) #Clicking on save & exit button print "Clicking on save & exit button" elements.saveAndExitButton() '''#verifying success message print "\nVerifying success message" if elements.successMessage()==actualSuccessMessage: print "Message '"+actualSuccessMessage+"' is displayed" else: print "Success message is not displayed properly" raise Exception''' #Verifying campaign detail page is displayed print "\nVerifying campaign detail page is displayed" if elements.campaignDetailPageHeaderText()==campaignTitle: print "Campaign detail page is displayed" else: print "Campaign detail page is not displayed" raise Exception #verifying in Campaigns displayed in Campaigns grid elements.searchingForlesson(campaignTitle) if elements.actualCampTitleINGrid()==campaignTitle: print "Campaign '"+campaignTitle+"' displayed in Grid" else: print "Campaign is not displayed in Grid" raise Exception print "\n----Text Execution Completed----\n"
def createCampaignForLessonTextVideoQuestion(self, campaignTitle, campDescription, lessonName, actualSuccessMessage, minPassingScore, numberOfAttempts): elements = CampPage() wait = WebDriverWait(driver, 60) print "\n\nCreating Campaign" wait.until( EC.visibility_of_element_located( (By.XPATH, elements.campaignButtonFromSideMenuXpath()))) elements.campaignButtonFromSideMenu() wait.until( EC.visibility_of_element_located( (By.XPATH, elements.createCampaignButtonXpath()))) if elements.campaignsPageHeaderText() == "Campaigns": print "Campaigns page displayed" else: print "Campaigns page is not displayed" raise Exception print "Clicking on Create Campaign button" wait.until( EC.visibility_of_element_located( (By.XPATH, elements.createCampaignButtonXpath()))) elements.createCampaignButton() wait.until( EC.visibility_of_element_located( (By.XPATH, elements.Camp_titleXpath()))) print "Create Campaign page is displayed" elements.titleTextField(campaignTitle) print "Title entered ::campTitle" elements.descriptionField(campDescription) print "Description entered ::campDescription" print "Adding Lesson" #Add lesson button elements.addlessonButton() #Waiting until first lesson in pop is displayed wait.until( EC.visibility_of_element_located( (By.XPATH, elements.FirstLessonWaitXpath()))) #Searching lesson by its name elements.searchLesson(lessonName) #Waiting until lesson displayed elements.waitUntilSearchedLessonDisplayed(lessonName) #selecting searched lesson elements.selectSearchedLesson(lessonName) #waiting until add to campaign button is click able wait.until( EC.element_to_be_clickable( (By.XPATH, elements.AddToCampaign_ButtonXpath()))) #Clicking on Add to Campaign button elements.addToCampaignButton() #Verifying Added lesson is displayed in Grid print "\nVerifying Added lesson is displayed in Grid" if elements.firstLessonInGrid() == lessonName: print "Lesson displayed in grid" else: print "Lesson not displayed in grid" print "Making This campaign as Graded campaign" elements.makeThisAsAGradedCampaign() elements.setMinimumPassingScore(minPassingScore) print "Setting maximum number of attempts" elements.setAMaxNoOfAttempts(numberOfAttempts) wait.until( EC.element_to_be_clickable( (By.XPATH, elements.SaveAndExit_ButtonXpath()))) #Clicking on save & exit button print "Clicking on save & exit button" elements.saveAndExitButton() '''#verifying success message print "\nVerifying success message" if elements.successMessage()==actualSuccessMessage: print "Message '"+actualSuccessMessage+"' is displayed" else: print "Success message is not displayed properly" raise Exception''' #Verifying campaign detail page is displayed print "\nVerifying campaign detail page is displayed" if elements.campaignDetailPageHeaderText() == campaignTitle: print "Campaign detail page is displayed" else: print "Campaign detail page is not displayed" raise Exception #verifying in Campaigns displayed in Campaigns grid elements.searchingForlesson(campaignTitle) if elements.actualCampTitleINGrid() == campaignTitle: print "Campaign '" + campaignTitle + "' displayed in Grid" else: print "Campaign is not displayed in Grid" raise Exception print "\n----Text Execution Completed----\n"
def createCampaignFourLessonsCombiOne(self, campaignTitle, campDescription, actualSuccessMessage, lessonName1, lessonName2, lessonName3, lessonName4, minPassingScore, numberOfAttempts): elements = CampPage() wait = WebDriverWait(driver, 60) print "\n\n----This Test case creates campaigns with Four Lesson----\n1. All Cards\n2. Five Text, Image and Question\n3. Five Video, Document and Question\4. Ten Text, Video and Question" print "\n\nCreating Campaign" wait.until( EC.visibility_of_element_located( (By.XPATH, elements.campaignButtonFromSideMenuXpath()))) elements.campaignButtonFromSideMenu() wait.until( EC.visibility_of_element_located( (By.XPATH, elements.createCampaignButtonXpath()))) if elements.campaignsPageHeaderText() == "Campaigns": print "Campaigns page displayed" else: print "Campaigns page is not displayed" raise Exception print "Clicking on Create Campaign button" wait.until( EC.visibility_of_element_located( (By.XPATH, elements.createCampaignButtonXpath()))) elements.createCampaignButton() wait.until( EC.visibility_of_element_located( (By.XPATH, elements.Camp_titleXpath()))) print "Create Campaign page is displayed" elements.titleTextField(campaignTitle) print "Title entered ::campTitle" elements.descriptionField(campDescription) print "Description entered ::campDescription" print "Adding Lesson" #Add lesson button elements.addlessonButton() #Waiting until first lesson in pop is displayed wait.until( EC.visibility_of_element_located( (By.XPATH, elements.FirstLessonWaitXpath()))) #Searching lesson by its name print "Searching first lesson" elements.searchLesson(lessonName1) elements.waitUntilSearchedLessonDisplayed(lessonName1) elements.selectSearchedLesson(lessonName1) print "First lesson selected" print "Searching second lesson" elements.searchLesson(lessonName2) elements.waitUntilSearchedLessonDisplayed(lessonName2) elements.selectSearchedLesson(lessonName2) print "Second lesson selected" print "Searching Third lesson" elements.searchLesson(lessonName3) elements.waitUntilSearchedLessonDisplayed(lessonName3) elements.selectSearchedLesson(lessonName3) print "Second Third selected" print "Searching Fourth lesson" elements.searchLesson(lessonName4) elements.waitUntilSearchedLessonDisplayed(lessonName4) elements.selectSearchedLesson(lessonName4) print "Second Fourth selected" #waiting until add to campaign button is click able wait.until( EC.element_to_be_clickable( (By.XPATH, elements.AddToCampaign_ButtonXpath()))) #Clicking on Add to Campaign button elements.addToCampaignButton() #Verifying Added lesson is displayed in Grid print "\nVerifying Added first lesson is displayed in Grid" if elements.firstLessonInGrid() == lessonName1: print "Lesson displayed in grid ::" + lessonName1 else: print "Lesson not displayed in grid" raise Exception print "\nVerifying Added second lesson is displayed in Grid" if elements.secondLessonInGrid() == lessonName2: print "Lesson displayed in grid ::" + lessonName2 else: print "Lesson not displayed in grid" raise Exception print "\nVerifying Added Third lesson is displayed in Grid" if elements.thirdLessonInGrid() == lessonName3: print "Lesson displayed in grid ::" + lessonName3 else: print "Lesson not displayed in grid" raise Exception print "\nVerifying Added Fourth lesson is displayed in Grid" if elements.fourthLessonInGrid() == lessonName4: print "Lesson displayed in grid ::" + lessonName4 else: print "Lesson not displayed in grid" raise Exception print "Making This as a Graded campaign" elements.makeThisAsAGradedCampaign() elements.setMinimumPassingScore(minPassingScore) print "Setting maximum no of attempts" elements.setAMaxNoOfAttempts(numberOfAttempts) print "Minimum Passing score set" wait.until( EC.element_to_be_clickable( (By.XPATH, elements.SaveAndExit_ButtonXpath()))) #Clicking on save & exit button print "Clicking on save & exit button" elements.saveAndExitButton() '''#verifying success message print "\nVerifying success message" if elements.successMessage()==actualSuccessMessage: print "Message '"+actualSuccessMessage+"' is displayed" else: print "Success message is not displayed properly" raise Exception''' #Verifying campaign detail page is displayed print "\nVerifying campaign detail page is displayed" if elements.campaignDetailPageHeaderText() == campaignTitle: print "Campaign detail page is displayed" else: print "Campaign detail page is not displayed" raise Exception #verifying in Campaigns displayed in Campaigns grid elements.searchingForlesson(campaignTitle) if elements.actualCampTitleINGrid() == campaignTitle: print "Campaign '" + campaignTitle + "' displayed in Grid" else: print "Campaign is not displayed in Grid" raise Exception print "\n----Text Execution Completed----\n"