/// <summary> /// initialize elements /// </summary> public override void InitElements() { SubjectElement subject = new SubjectElement(PageNames.CreatePassage); SubjectSelect = subject.SelectElement; GradeLevelElement gradeLevel = new GradeLevelElement(PageNames.CreatePassage); GradeFromSelect = gradeLevel.FromSelectElement; GradeToSelect = gradeLevel.ToSelectElement; TeacherInstructionEditor = new TeacherInstructionEditor(PageNames.CreatePassage); Title_textbox = new WebElementWrapper(ByTitle_textbox); OptionalProperties_link = new WebElementWrapper(ByOptionalProperties_link); OptionalProperties_icon = new WebElementWrapper(ByOptionalProperties_icon); AdditionalPassageID_textbox = new WebElementWrapper(ByAdditionalPassageID_textbox); AssetType_textbox = new WebElementWrapper(ByAssetType_textbox); Author_textbox = new WebElementWrapper(ByAuthor_textbox); CourseID_textbox = new WebElementWrapper(ByCourseID_textbox); FleschKincaid_textbox = new WebElementWrapper(ByFleschKincaid_textbox); Genre_textbox = new WebElementWrapper(ByGenre_textbox); QuestionLanguage_dropdown = new SelectElementWrapper(new WebElementWrapper(ByQuestionLanguage_dropdown)); LexileCode_dropdown = new SelectElementWrapper(new WebElementWrapper(ByLexileCode_dropdown)); Lexile_textbox = new WebElementWrapper(ByLexile_textbox); BeginningReader_chkbox = new WebElementWrapper(ByBeginningReader_chkbox); Publisher_textbox = new WebElementWrapper(ByPublisher_textbox); ReadingMaturityMetric_textbox = new WebElementWrapper(ByReadingMaturityMetric_textbox); Topic_textbox = new WebElementWrapper(ByTopic_textbox); Type_dropdown = new SelectElementWrapper(new WebElementWrapper(ByType_dropdown)); Year_textbox = new WebElementWrapper(ByYear_textbox); Batch_textbox = new WebElementWrapper(ByBatch_textbox); TeacherInstruction = new TeacherInstruction(PageNames.CreatePassage); Editor = new Editor(PageNames.CreatePassage, this.ControlPrefix); PortraitLayout = new WebElementWrapper(ByPortraitLayout); LandscapeLayout = new WebElementWrapper(ByLandscapeLayout); }
/// <summary> /// Uploads the required file inside the Editor /// </summary> /// <param name="editor">Instance of SeleniumUITests.Main.Library.Assess.Components.TeacherInstructionEditor</param> /// <param name="autoItData">Instance of the AutoIt Data Object</param> /// <param name="fileUploadTree">Dictionary containing the File Upload Details for the Scenario. Inner Dictionary Uses Question Content, Answer Content, Teacher or Student Explanation as Key. /// Inner Dictionary uses Image File Name to be uploaded as the Value. Outer Dictionary Uses True or False (boolean) as Key to indicate WithFileUpload or WithoutFileUpload.</param> /// <param name="fieldToUploadTheFileTo">string value of the Field on the form concerned to which the file needs to be uploaded</param> public void DoFileUpload(TeacherInstructionEditor editor, AutoItData autoItData, Dictionary <bool, Dictionary <string, string> > fileUploadTree, string fieldToUploadTheFileTo) { if (fileUploadTree != null && fileUploadTree.ContainsKey(true)) { var fileNameDictionary = new Dictionary <string, string>(); fileUploadTree.TryGetValue(true, out fileNameDictionary); if (fileNameDictionary != null && fileNameDictionary.ContainsKey(fieldToUploadTheFileTo)) { editor.Form.DoFileUpload = true; autoItData.FileNameToBeUploaded = fileNameDictionary[fieldToUploadTheFileTo]; editor.Data = autoItData; } else { editor.Form.DoFileUpload = false; } } else { editor.Form.DoFileUpload = false; } }