/// <summary> /// search for a rubric and attach the rubric /// </summary> /// <param name="instructions">the instructions</param> public void SearchAndAttachRubric() { AttachRubricDialog.Data = Data.RubricSearchData; AttachRubricDialog.Form.InputAndSubmitForm(); System.Threading.Thread.Sleep(2000); AttachRubricDialog = new AttachRubricDialog(); AttachRubricDialog.Detail.GetItemFromResultsList(0).SelectAttach(); }
/// <summary> /// EditQuestion page - create new item, attaching rubric /// Attaching rubric applied to Open Response question only /// </summary> /// <remarks>requires the EditQuestionCreateNewItemPage to be initialized in this class</remarks> /// <returns>Workflows</returns> public CreateItemWorkflows EditQuestionCreateNewItemPageAttachRubric(string rubricKeyword) { if (AssessWorkflows.EditQuestionCreateNewItemPage == null) { throw new Exception("The EditQuestionCreateNewItemPage is null, please initialize it before trying to use it in a workflow."); } ItemTypeOpenResponseForm ORForm1 = ((ItemTypeOpenResponseForm)AssessWorkflows.EditQuestionCreateNewItemPage.Form.ItemTypeForm); ItemTypeData formData = (ItemTypeData)ORForm1.Data; //the user click on rubric button ORForm1.SelectRubric(); AttachRubricDialog beforePostbackDialog = ORForm1.AttachRubricDialog; //post back, need to reinitialize page setItemTypeForm(AssessWorkflows.EditQuestionCreateNewItemPage.Form.ItemTypeForm); AssessWorkflows.EditQuestionCreateNewItemPage = new EditQuestionCreateNewItemPage(ItemTypeForm); ORForm1 = ((ItemTypeOpenResponseForm)AssessWorkflows.EditQuestionCreateNewItemPage.Form.ItemTypeForm); formData.RubricSearchData = new AttachRubricDialogData() { FilterKeyword = rubricKeyword }; ORForm1.Data = formData; ORForm1.AttachRubricDialog = beforePostbackDialog; //the user search for the rubric using keyword and attach it. //((ItemTypeData)ORForm1.Data).RubricSearchData = new AttachRubricDialogData() { FilterKeyword = rubricKeyword }; ORForm1.SearchAndAttachRubric(); //post back, need to reinitialize page Thread.Sleep(1000); //wait 1 sec. If post back is slow, the page instance is create, get stale element exception as it read old page setItemTypeForm(AssessWorkflows.EditQuestionCreateNewItemPage.Form.ItemTypeForm); AssessWorkflows.EditQuestionCreateNewItemPage = new EditQuestionCreateNewItemPage(ItemTypeForm); ORForm1 = ((ItemTypeOpenResponseForm)AssessWorkflows.EditQuestionCreateNewItemPage.Form.ItemTypeForm); //verified rubric is attached by checking rubric weight table ORForm1.VerifyFieldsExist(new List <ItemTypeOpenResponseFields>() { ItemTypeOpenResponseFields.RubricWeightTable }); return(this); }
/// <summary> /// select the rubric button /// </summary> /// <param name="response">the rubric</param> public void SelectRubric() { RubricButton.Click(); System.Threading.Thread.Sleep(2000); AttachRubricDialog = new AttachRubricDialog(); }