Пример #1
0
        public static void ValidateArticle(Manager M, Browser Br, string Heading)
        {
            string atriclePageHeading;

            objAricle article = new objAricle(M);

            Br.Window.SetFocus();
            Br.RefreshDomTree();

            atriclePageHeading = article.ArticlePageHeading.InnerText;
            Assert.AreEqual(atriclePageHeading, Heading, "Article Validation Failed from the page");
        }
Пример #2
0
        public void CreateArticle(string Heading, string Name, IList <string> ClubsList, string Introduction, string Description)
        {
            //name on the page
            myManager.ActiveBrowser.RefreshDomTree();
            HtmlInputText NameOnPage = myManager.ActiveBrowser.Find.ById("dijit_form_ValidationTextBox_3").As <HtmlInputText>();

            //NameOnPage.ScrollToVisible();
            NameOnPage.MouseHover();
            NameOnPage.MouseClick();
            NameOnPage.Text = Name;


            //Select PreviewImage
            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();
            HtmlSpan PreviewImageButton = myManager.ActiveBrowser.Find.ByExpression("id=#dijit_form_Button_.._label").As <HtmlSpan>();

            PreviewImageButton.MouseClick();

            //TreeExpand
            Thread.Sleep(7000);
            myManager.ActiveBrowser.RefreshDomTree();
            HtmlSpan TreeExpand = myManager.ActiveBrowser.Find.ByXPath("/html/body/div[58]/div[2]/div[3]/div/div/div[2]/div/div/div/div[2]/a/span/span[1]").As <HtmlSpan>();

            TreeExpand.MouseClick();


            Thread.Sleep(5000);
            myManager.ActiveBrowser.RefreshDomTree();
            HtmlSpan firstpng = myManager.ActiveBrowser.Find.ByXPath("/html/body/div[58]/div[2]/div[3]/div/div/div[2]/div/div/div/div[2]/div/div[10]/a/span/span[6]").As <HtmlSpan>();

            firstpng.MouseClick();

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();
            HtmlSpan okbuttonPicture = myManager.ActiveBrowser.Find.ByExpression("id=#dijit_form_Button_.._label", "innertext=OK").As <HtmlSpan>();

            okbuttonPicture.MouseClick();

            //Add Heading
            myManager.ActiveBrowser.RefreshDomTree();
            HtmlInputText HeadingtextBox = myManager.ActiveBrowser.Find.ById("dijit_form_ValidationTextBox_4").As <HtmlInputText>();

            HeadingtextBox.Text = Heading;

            //SelectClub
            objAricle article = new objAricle(myManager);

            HtmlInputCheckBox CustomerCheckbox  = article.ArticleCustomerCheckbox.As <HtmlInputCheckBox>();
            HtmlInputCheckBox DeveloperCheckbox = article.ArticleDeveloperCheckbox.As <HtmlInputCheckBox>();
            HtmlInputCheckBox TechnicalCheckbox = article.ArticleTechnicalCheckbox.As <HtmlInputCheckBox>();
            HtmlInputCheckBox ParlimentCheckbox = article.ArticleCustomerCheckbox.As <HtmlInputCheckBox>();

            foreach (string listItem in ClubsList)
            {
                switch (listItem)
                {
                case "Customer":
                    CustomerCheckbox.MouseClick();
                    break;

                case "Developer":
                    DeveloperCheckbox.MouseClick();
                    break;

                case "Technical":
                    TechnicalCheckbox.MouseClick();
                    break;

                case "Parliment":
                    ParlimentCheckbox.MouseClick();
                    break;

                default:
                    CustomerCheckbox.MouseClick();
                    break;
                }
            }

            //CLick On Create Button
            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();
            HtmlSpan CreateButton = myManager.ActiveBrowser.Find.ByExpression("id=#dijit_form_Button_._label", "innertext=Create").As <HtmlSpan>();

            CreateButton.MouseClick();
            Thread.Sleep(5000);


            //Click On the Edit Button
            Thread.Sleep(20000);
            myManager.ActiveBrowser.RefreshDomTree();
            HtmlSpan EditButton     = myManager.ActiveBrowser.Find.ByExpression("id=#dijit_form_ToggleButton_.", "title=All Properties").As <HtmlSpan>();
            HtmlSpan EditButtonSpan = EditButton.Find.AllByTagName("span")[0].As <HtmlSpan>();

            EditButtonSpan.ScrollToVisible();
            EditButtonSpan.MouseHover();
            EditButtonSpan.MouseClick();
            Thread.Sleep(7000);

            //Adding Introduction
            //Add Heading
            myManager.ActiveBrowser.RefreshDomTree();
            HtmlTextArea IntroductionField = myManager.ActiveBrowser.Find.ByExpression("id=#uniqName_..._.", "name=introduction").As <HtmlTextArea>();

            IntroductionField.MouseClick();
            IntroductionField.Text = Introduction;


            Thread.Sleep(5000); //Till the editor loads
            //Add Discription
            ArtOfTest.WebAii.Core.Browser t1_frame = myManager.ActiveBrowser.Frames[0];
            Element TextEditor = t1_frame.Find.ByXPath("/html/body");

            myManager.ActiveBrowser.Actions.SetText(TextEditor, Description);


            //Publish
            //Click on publish
            ObjEditMode editmode      = new ObjEditMode(myManager);
            HtmlSpan    PublishButton = editmode.PublishDropdown.As <HtmlSpan>();

            PublishButton.ScrollToVisible();
            PublishButton.MouseHover();
            PublishButton.MouseClick();
            Thread.Sleep(2000);

            myManager.ActiveBrowser.RefreshDomTree();
            HtmlSpan Publish = editmode.PublishButton.As <HtmlSpan>();

            Publish.MouseClick();
        }