/// <summary>
 /// EditQuestion page, return new instance of the form type.
 /// Ie ItemTypeOpenResponseForm, ItemTypeFormMultipleChoice, ItemTypeFormTrueFalse ...
 /// </summary>
 /// <remarks>requires the EditQuestionCreateNewItemPage to be initialized in this class</remarks>
 /// <param name="itemTypeForm">ItemTypeForm</param>
 private void setItemTypeForm(ItemTypeForm itemTypeForm)
 {
     if (itemTypeForm.GetType() == typeof(ItemTypeMultipleChoiceForm))
     {
         ItemTypeForm = new ItemTypeMultipleChoiceForm();
     }
     else if (itemTypeForm.GetType() == typeof(ItemTypeTrueFalseForm))
     {
         ItemTypeForm = new ItemTypeTrueFalseForm();
     }
     else if (itemTypeForm.GetType() == typeof(ItemTypeGriddedForm))
     {
         ItemTypeForm = new ItemTypeGriddedForm();
     }
     else if (itemTypeForm.GetType() == typeof(ItemTypeOpenResponseForm))
     {
         ItemTypeForm = new ItemTypeOpenResponseForm();
     }
     else if (itemTypeForm.GetType() == typeof(ItemTypeInlineResponseForm))
     {
         ItemTypeForm = new ItemTypeInlineResponseForm();
     }
     else if (itemTypeForm.GetType() == typeof(ItemTypeMatchingForm))
     {
         ItemTypeForm = new ItemTypeMatchingForm();
     }
     else if (itemTypeForm.GetType() == typeof(ItemTypeDragDropForm))
     {
         ItemTypeForm = new ItemTypeDragDropForm();
     }
 }
示例#2
0
 public override void InputFormFields()
 {
     ItemPropertiesForm.InputFormFields();
     //if not a task item
     if (ItemTypeForm.GetType() != typeof(ItemTypeTaskForm))
     {
         //then select a standard
         StandardPopupDialog      = ItemPropertiesForm.StandardLookup();
         StandardPopupDialog.Data = Data.StandardPickerData;
         StandardPopupDialog.Form.InputAndSubmitForm();
         this.DriverCommands.WaitAndMeasurePageLoadTime();
         InitElements();
         ItemPropertiesForm.Data             = Data.ItemTypeData;
         ItemPropertiesForm.AutoItDataObject = Data.AutoItData;
     }
     ItemTypeForm.Data = Data.ItemTypeData;
     ItemTypeForm.QuestionAnswerDataObject = Data.QuestionAnswerData;
     ItemTypeForm.AutoItDataObject         = Data.AutoItData;
     ItemTypeForm.InputFormFields();
 }
示例#3
0
        /// <summary>
        /// Change the item type
        /// </summary>
        /// <param name="itemType">the item type</param>
        public void ChangeItemType(ItemType itemType) // added by Oleg Feb 20, 2014
        {
            string option = null;

            switch (itemType)
            {
            case ItemType.DragAndDrop:
                option = "Drag and Drop";
                break;

            case ItemType.ClickStickClickDrop:
                option = "Click Stick Click Drop";
                break;

            case ItemType.Gridded:
                option = "Gridded";
                break;

            case ItemType.HotSpotMultipleSelection:
                option = "Hot Spot - Multiple Selection";
                break;

            case ItemType.HotSpotSingleSelection:
                option = "Hot Spot - Single Selection";
                break;

            case ItemType.InlineResponse:
                option = "Inline Response";
                break;

            case ItemType.Matching:
                option = "Matching";
                break;

            case ItemType.MultipleChoice:
                option = "Multiple Choice";
                break;

            case ItemType.OpenResponse:
                option = "Open Response";
                break;

            case ItemType.Task:
                option = "Task";
                break;

            case ItemType.TrueFalse:
                option = "True/False";
                break;

            default:
                option = "Select Item Type";
                break;
            }
            if (option != null)
            {
                this.Parent.CurrentWindowHandle = Driver.CurrentWindowHandle;
                Report.Write("The current window is: '" + this.Parent.CurrentWindowHandle + "'.");

                ChangeType_link.Click();
                ChangeItemType_dropdown.Wait(3).SelectByText(option);

                //TODO: this is inconsistent behavior, and I pointed the issue out to Boris
                //  so Boris talked to Product Owners, but won't it be fixed anytime soon
                //  there could be test failures as a side affect
                //if item type is not multiple choice, then handle the pop-up
                if (ItemTypeForm.GetType() != typeof(ItemTypeMultipleChoiceForm))
                {
                    IAlert alert     = Driver.SwitchTo().Alert();
                    string expected1 = "Some content cannot be carried over.";
                    if (Driver.WrappedDriver.GetType() == typeof(DummyDriver))
                    {
                        ((DummyIAlert)alert).Text = expected1;
                    }
                    string actual = alert.Text;
                    Report.Write("The alert text: '" + actual + "'.");
                    Assert.IsTrue(actual.Contains(expected1), "The delete confirmation pop-up does not contain the expected text: '" + expected1 + "'; actual text: '" + actual + "'.");
                    alert.Accept();

                    //switch to window
                    DriverCommands.WaitToSwitchWindow(this.Parent.CurrentWindowHandle, 5);
                }

                this.DriverCommands.WaitForPageToLoad(60);
            }
            switch (itemType)
            {
            case ItemType.DragAndDrop:
                ItemTypeForm = new ItemTypeDragDropForm();
                break;

            case ItemType.ClickStickClickDrop:
                ItemTypeForm = new ItemTypeDragDropForm();
                break;

            case ItemType.Gridded:
                ItemTypeForm = new ItemTypeGriddedForm();
                break;

            case ItemType.HotSpotMultipleSelection:
                //TODO: add later
                //ItemTypeForm = null;
                break;

            case ItemType.HotSpotSingleSelection:
                //TODO: add later
                //ItemTypeForm = null;
                break;

            case ItemType.InlineResponse:
                ItemTypeForm = new ItemTypeInlineResponseForm();
                break;

            case ItemType.Matching:
                ItemTypeForm = new ItemTypeMatchingForm();
                break;

            case ItemType.MultipleChoice:
                ItemTypeForm = new ItemTypeMultipleChoiceForm();
                break;

            case ItemType.OpenResponse:
                ItemTypeForm = new ItemTypeOpenResponseForm();
                break;

            case ItemType.Task:
                ItemTypeForm = new ItemTypeTaskForm();
                break;

            case ItemType.TrueFalse:
                ItemTypeForm = new ItemTypeTrueFalseForm();
                break;
            }
            //may need to call initElements() if there are problems
            ItemTypeForm.Data = Data.ItemTypeData;
        }