def campWithTrackImagelesson(self,campaignTitle,campDescription,trackName,actualSuccessMessage): 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 Track" #Add Track elements.addTrackButton() #Searching track and adding elements.searchTracksAndSelect(trackName) #Adding to Campaign elements.addToCampaignTrack() #Verifying Added Track is displayed in Grid print "\nVerifying Added Track is displayed in Grid" if trackName in elements.firstTrackInGrid(): print "Track displayed in grid" else: print "Track 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 campWithAllcardsTwotime(self, campaignTitle, campDescription, trackName, actualSuccessMessage, minPassingScore, numberOfAttempts, ownDuration): 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 Track" #Add Track elements.addTrackButton() #Searching track and adding elements.searchTracksAndSelect(trackName) #Adding to Campaign elements.addToCampaignTrack() #Verifying Added Track is displayed in Grid print "\nVerifying Added Track is displayed in Grid" if trackName in elements.firstTrackInGrid(): print "Track displayed in grid" else: print "Track not displayed in grid" print "Setting Own duration" elements.setOwnDuration(ownDuration) #Making as Graded campaign print "Making this as a graded campaign" elements.makeThisAsAGradedCampaign() print "setting minimum passing score" elements.setMinimumPassingScore(minPassingScore) print "Setting max no 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"