/// <summary> /// initialize elements /// </summary> public override void InitElements() { switch (ItemType) { case ItemType.ClickStickClickDrop: ItemTypeForm = new ItemTypeDragDropForm(); break; case ItemType.DragAndDrop: ItemTypeForm = new ItemTypeDragDropForm(); break; case ItemType.Gridded: ItemTypeForm = new ItemTypeGriddedForm(); break; case ItemType.HotSpotMultipleSelection: //TODO not implemented break; case ItemType.HotSpotSingleSelection: //TODO not implemented 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; } /* DO NOT DELETE THIS SECTION - MARTIN * if (ItemTypeForm.GetType() == typeof(ItemTypeFormMultipleChoice)) * { * ItemTypeForm = new ItemTypeFormMultipleChoice(); * } * else if (ItemTypeForm.GetType() == typeof(ItemTypeFormTrueFalse)) * { * ItemTypeForm = new ItemTypeFormTrueFalse(); * } * else if (ItemTypeForm.GetType() == typeof(ItemTypeGriddedForm)) * { * ItemTypeForm = new ItemTypeGriddedForm(); * } * else if (ItemTypeForm.GetType() == typeof(ItemTypeOpenResponseForm)) * { * ItemTypeForm = new ItemTypeOpenResponseForm(); * } * else if (ItemTypeForm.GetType() == typeof(ItemTypeFormInlineResponse)) * { * ItemTypeForm = new ItemTypeFormInlineResponse(); * } * else if (ItemTypeForm.GetType() == typeof(ItemTypeFormMatching)) * { * ItemTypeForm = new ItemTypeFormMatching(); * } * else if (ItemTypeForm.GetType() == typeof(ItemTypeDragDropForm)) * { * ItemTypeForm = new ItemTypeDragDropForm(); * } */ ItemPropertiesForm = new ItemPropertiesForm(PageNames, ControlPrefix); //StandardPickerForm = new StandardPickerForm(PageNames, ControlPrefix); ChangeType_link = new WebElementWrapper(ByChangeType_link); // added by Oleg Feb 20, 2014 ChangeItemType_dropdown = new SelectElementWrapper(new WebElementWrapper(ByChangeItemType_dropdown)); // added by Oleg Feb 20, 2014 AddLink = new WebElementWrapper(ByAddLink); NewPassageLink = new WebElementWrapper(ByNewPassageLink); SearchForPassageLink = new WebElementWrapper(BySearchForPassageLink); EnterPassageTitleText = new WebElementWrapper(ByEnterPassageTitleText); DeletePassageButton = new WebElementWrapper(ByDeletePassageButton); EditPassageButton = new WebElementWrapper(ByEditPassageButton); PassageTitleLink = new WebElementWrapper(ByPassageTitleLink); CancelPassageTitleLink = new WebElementWrapper(ByCancelPassageTitleLink); SaveAndPreviewLink = new WebElementWrapper(BySaveAndPreviewLink); WithManipulativesLink = new WebElementWrapper(ByWithManipulativesLink); WithoutManipulativesLink = new WebElementWrapper(ByWithoutManipulativesLink); StepsToCompleteLabels = new WebElementWrapper(ByStepsToCompleteLabels); StepsCompletedLabel = new WebElementWrapper(ByStepsCompletedLabel); DeleteItemButton = new WebElementWrapper(ByDeleteItemButton); }
/// <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; }