Ejemplo n.º 1
0
        private void SetUniqueControlIdentifiers()
        {
            AnswerChoiceTabs = new Dictionary <string, ItemTypeTabForm>();
            InteractionTabs.WaitUntilVisible();
            //get the tabs
            ReadOnlyCollection <IWebElement> webElementTabs = Driver.FindElements(ByInteractionTabs);

            Report.Write("Found the elements by: '" + ByInteractionTabs.ToString() + "'.");
            if (Driver.WrappedDriver.GetType() == typeof(DummyDriver))
            {
                DummyWebElement dummy1 = new DummyWebElement();
                dummy1.FakeAttributeId    = "tabfc5d6a01-9539-46d2-966a-15ab568698e8";
                dummy1.FakeAttributeClass = "active";
                DummyWebElement dummy2 = new DummyWebElement();
                dummy2.FakeAttributeId    = "tabe2e3dda0-5708-40b5-8354-198a1232176a";
                dummy2.FakeAttributeClass = "";
                DummyWebElement dummy3 = new DummyWebElement();
                dummy3.FakeAttributeId    = "tab76962807-988c-4d06-b977-9f9a4c35d87f";
                dummy3.FakeAttributeClass = "";
                List <IWebElement> list = new List <IWebElement> {
                    dummy1, dummy2, dummy3
                };
                webElementTabs = new ReadOnlyCollection <IWebElement>(list);
            }

            int dummyindex = 1;
            int index      = 0;

            foreach (var webElement in webElementTabs)
            {
                string tempTabId = webElement.GetAttribute("id");
                Report.Write("Got the attribute: 'id' = '" + tempTabId + "' of this element by: '" + ByInteractionTabs.ToString() + "'.");

                //parse the tab ids to get the root id
                int    from  = tempTabId.IndexOf("tab") + "tab".Length;
                string tabId = tempTabId.Substring(from);

                string tabClass = webElement.GetAttribute("class");
                Report.Write("Got the attribute: 'class' = '" + tabClass + "' of this element by: '" + ByInteractionTabs.ToString() + "'.");
                InteractionTab = new WebElementWrapper(By.CssSelector("#tab" + tabId + " > a"));
                InteractionTab.Wait(3).Text = "" + dummyindex;
                dummyindex++;
                string tabName = InteractionTab.Text.Trim();
                //string tabName, string tabId, string tabClass
                Report.Write("Tab control identifier by tabName: " + tabName + "; tabId: " + tabId + "; tabClass: " + tabClass);
                //click the tab to make it visible, then create the item type tab object
                InteractionTab.Click();
                //create an item type tab object
                var itemTypeFormTab = new ItemTypeTabForm(ItemType.InlineResponse, tabName, tabId, tabClass,
                                                          index, ControlPrefix);
                //add the item type tab object to the collection (1, 2, 3)
                AnswerChoiceTabs.Add(tabName, itemTypeFormTab);
                index = index + 1000;
            }
        }
Ejemplo n.º 2
0
        //implemented methods
        public override void InputFormFields()
        {
            WebElementWrapper questionContentElement = SelectQuestionContent();

            //QuestionAnswerData
            if (_questionAnswerDataObject != null)
            {
                this.Utilities.DoFileUpload(Editor, _autoItDataObject, _questionAnswerDataObject.FileUploadTree, _questionAnswerDataObject.QuestionEndingAfterLastGap);
                Editor.ContentData    = _questionAnswerDataObject.QuestionEndingAfterLastGap;
                Editor.GapContentData = _questionAnswerDataObject.QuestionList;
            }
            else //ItemTypeData
            {
                this.Utilities.DoFileUpload(Editor, _autoItDataObject, Data.FileUploadTree, Data.EndOfQuestionGaps);
                Editor.ContentData    = Data.EndOfQuestionGaps;
                Editor.GapContentData = Data.QuestionGapsList;
            }

            Editor.InputAndSubmitForm(questionContentElement);

            SetUniqueControlIdentifiers();

            //for each element in the hash
            foreach (var tab in AnswerChoiceTabs.Keys)
            {
                //get the tab
                ItemTypeTabForm answerChoiceTab = AnswerChoiceTabs[tab];
                //QuestionAnswerData
                if (_questionAnswerDataObject != null)
                {
                    answerChoiceTab.QuestionAnswerDataObject = _questionAnswerDataObject;
                }
                else //ItemTypeData
                {
                    answerChoiceTab.Data = Data;
                }
                answerChoiceTab.SelectTab();
                answerChoiceTab.InputFormFields();
            }
            //this is only applicable on https://qa-153mt.sndev.net
            //SelectEnableManipulativesNo();
            //TODO: work on enable manipulatives for version 15.4
        }