public void Upload(string filePath)
 {
     Dialogs.FileUploadDialog fileUploadDialog =
         new Dialogs.FileUploadDialog(
             this.driver.ActiveBrowser,
             filePath,
             Dialogs.DialogButton.CANCEL);
     try
     {
         this.driver.DialogMonitor.AddDialog(fileUploadDialog);
         this.driver.DialogMonitor.Start();
         fileUploadDialog.WaitUntilHandled();
         fileUploadDialog.Handle();
     }
     finally
     {
         this.driver.DialogMonitor.RemoveDialog(fileUploadDialog);
         this.driver.DialogMonitor.Stop();
     }
 }
Exemple #2
0
        public void TestMethod_Video()
        {
            string navigateURL;

            ReadData();

            //Login to the system ---------------------
            myManager.ActiveBrowser.NavigateTo(_Url);
            CommonFunctions.HandleSpashScreen(myManager, myManager.ActiveBrowser);
            myManager.ActiveBrowser.WaitUntilReady();
            myManager.ActiveBrowser.RefreshDomTree();
            CommonFunctions.Login(myManager, myManager.ActiveBrowser, _Uname, _Password);
            Thread.Sleep(7000);
            //----------- End reagon

            //Navigate to Video Center-----------------------
            navigateURL = _Url + "/video-center/#/";
            myManager.ActiveBrowser.NavigateTo(navigateURL);
            Thread.Sleep(5000);
            myManager.ActiveBrowser.WaitUntilReady();
            myManager.ActiveBrowser.RefreshDomTree();
            //----------- End reagon

            //Add New Video
            ObjVideo objNewVideo = new ObjVideo(myManager);

            myManager.ActiveBrowser.Actions.Click(objNewVideo.UploadButton);
            Thread.Sleep(5000);
            myManager.ActiveBrowser.WaitUntilReady();
            myManager.ActiveBrowser.RefreshDomTree();


            //ClcikOn UploadVideoDialog
            //Add a Video
            var x = new ArtOfTest.WebAii.Win32.Dialogs.FileUploadDialog(myManager.ActiveBrowser, @"C:\Images\BMW.mp4", DialogButton.OPEN);

            myManager.DialogMonitor.Start();
            myManager.DialogMonitor.AddDialog(x);
            HtmlInputFile choose = myManager.ActiveBrowser.Find.ById <HtmlInputFile>("fuVideo");

            choose.Click();
            x.WaitUntilHandled(10000);
            //Sometimes the frame takes little time to show up
            Thread.Sleep(5000);
            //----------- End reagon

            //ClcikOn UploadImageDialog
            //Add a picture
            var xi = new ArtOfTest.WebAii.Win32.Dialogs.FileUploadDialog(myManager.ActiveBrowser, @"C:\Images\918.jpg", DialogButton.OPEN);

            myManager.DialogMonitor.Start();
            myManager.DialogMonitor.AddDialog(xi);
            HtmlInputFile chooseImage = myManager.ActiveBrowser.Find.ById <HtmlInputFile>("ctl00_plhFullWidthContentArea_ucNewVideo_puNewVideo_fuPreviewFrame");

            chooseImage.Click();
            xi.WaitUntilHandled(10000);
            //Sometimes the frame takes little time to show up
            Thread.Sleep(5000);
            //----------- End reagon

            //Addigng description
            ArtOfTest.WebAii.Core.Browser t1_frame = myManager.ActiveBrowser.Frames[0];
            Element TextEditor = t1_frame.Find.ByXPath("/html/body");

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


            myManager.ActiveBrowser.Actions.SetText(objNewVideo.VIdeoTitle, _VideoTitle);

            switch (_Club.ToUpper())
            {
            case "CUSTOMER":
                myManager.ActiveBrowser.Actions.Check(objNewVideo.CustomerCheckBox, true);
                break;

            case "DEVELOPER":
                myManager.ActiveBrowser.Actions.Check(objNewVideo.DeveloperCheckBox, true);
                break;

            case "TECHNICAL":
                myManager.ActiveBrowser.Actions.Check(objNewVideo.TechnicalCheckBox, true);
                break;

            case "PARLIAMENT":
                myManager.ActiveBrowser.Actions.Check(objNewVideo.ParliamentCheckBox, true);
                break;

            default:
                myManager.ActiveBrowser.Actions.Check(objNewVideo.CustomerCheckBox, true);
                break;
            }

            myManager.ActiveBrowser.Actions.SelectDropDown(objNewVideo.LanguageDropdown, _VideoLanguage);

            myManager.ActiveBrowser.Actions.SetText(objNewVideo.VideoTag, _VideoTag);

            myManager.ActiveBrowser.Actions.Click(objNewVideo.Save);

            Thread.Sleep(5000);

            //Validate Activity stream
            CommonFunctions.ValideActivityStream(myManager, myManager.ActiveBrowser, _Url, _VideoTitle, _Club);

            Assert.AreEqual(VerifcationPlayVideo(), true, "Video is not playable");

            PostComment(_VideoComment);

            //VideoOtherValidations(_VideoTitle);
        }
        public void TestMethod_BlogParliament()
        {
            string navigateURL;

            ReadData();

            //Login to the system ---------------------
            myManager.ActiveBrowser.NavigateTo(_Url);
            CommonFunctions.HandleSpashScreen(myManager, myManager.ActiveBrowser);
            myManager.ActiveBrowser.WaitUntilReady();
            myManager.ActiveBrowser.RefreshDomTree();
            CommonFunctions.Login(myManager, myManager.ActiveBrowser, _Uname, _Password);
            Thread.Sleep(7000);
            //----------- End reagon

            //Navigate to parliament blog -----------------------
            navigateURL = _Url + "/the-parliament/";
            myManager.ActiveBrowser.NavigateTo(navigateURL);
            Thread.Sleep(5000);
            myManager.ActiveBrowser.WaitUntilReady();
            myManager.ActiveBrowser.RefreshDomTree();
            //----------- End reagon

            //Add new Blog
            CreateBlog objNewblog = new CreateBlog(myManager);

            myManager.ActiveBrowser.Actions.Click(objNewblog.TPnewblog);
            Thread.Sleep(5000);
            myManager.ActiveBrowser.WaitUntilReady();
            myManager.ActiveBrowser.RefreshDomTree();

            myManager.ActiveBrowser.Actions.SetText(objNewblog.TPBlogTitle, _BlogTitle);

            //Add a picture
            var x = new ArtOfTest.WebAii.Win32.Dialogs.FileUploadDialog(myManager.ActiveBrowser, @"C:\Images\918.jpg", DialogButton.OPEN);

            myManager.DialogMonitor.Start();
            myManager.DialogMonitor.AddDialog(x);
            HtmlInputFile choose = myManager.ActiveBrowser.Find.ById <HtmlInputFile>("fuPreviewImage");

            choose.Click();
            x.WaitUntilHandled(10000);
            //Sometimes the frame takes little time to show up
            Thread.Sleep(5000);
            //----------- End reagon


            ArtOfTest.WebAii.Core.Browser t1_frame = myManager.ActiveBrowser.Frames[0];
            Element TextEditor = t1_frame.Find.ByXPath("/html/body");

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

            //This functionality is temporalyremoved will be implemented in the future
            //--------------------------------------------------------------------------
            //myManager.ActiveBrowser.Actions.Check(objNewblog.TPfrontpagenews, _FrontPageNews);
            //myManager.ActiveBrowser.Actions.Click(objNewblog.TPdisplayuntill);
            //myManager.ActiveBrowser.Actions.SetText(objNewblog.TPdisplayuntill, _displayUntill);
            //myManager.ActiveBrowser.Actions.Click(objNewblog.TPdisplayuntill);
            //--------------------------------------------------------------------------

            //Selecting the pulish Subsidiary
            if (_Subsidiary != "")
            {
                selectSubsidiary(_Subsidiary);
            }
            //----------- End reagon

            //Selecting the pulish Subsidiary
            if (_areas != "")
            {
                selectArea(_areas);
            }
            Thread.Sleep(5000);
            //----------- End reagon


            //Publish or Draft
            if (_publish == true)
            {
                myManager.ActiveBrowser.Actions.Click(objNewblog.saveandPublish);
            }
            else if (_draft == true)
            {
                myManager.ActiveBrowser.Actions.Click(objNewblog.saveDraft);
            }
            else
            {
                myManager.ActiveBrowser.Actions.Click(objNewblog.saveandPublish);
            }

            Thread.Sleep(5000);
            myManager.ActiveBrowser.WaitUntilReady();
            myManager.ActiveBrowser.RefreshDomTree();
            //----------- End reagon


            TPBlogArchiveValidation(_BlogTitle);
            TPBlogvalidationCarasoel(_BlogTitle);

            Thread.Sleep(5000);
            CommonFunctions.ValideActivityStream(myManager, myManager.ActiveBrowser, _Url, _BlogTitle, "PARLIAMENT");

            //after the activity stream validation the test screen will be on the added blog

            //Adding a Comment to the blog

            Thread.Sleep(5000);
            myManager.ActiveBrowser.WaitUntilReady();
            myManager.ActiveBrowser.RefreshDomTree();

            myManager.ActiveBrowser.Actions.SetText(objNewblog.TPBlogComment, _TPBlogComment);
            myManager.ActiveBrowser.Actions.Click(objNewblog.TPBlogCommentPostButton);

            CommonFunctions.ActivityStreamCommentsValidator(myManager, myManager.ActiveBrowser, _Url, _TPBlogComment, "PARLIAMENT");
        }
        public void CreateNewBlog(string navigateURL, Browser Br, Manager M, string BlogTitle, string BlogDescription, string Club, string BlogTag)
        {
            Br.NavigateTo(navigateURL);
            Thread.Sleep(7000);
            Br.WaitUntilReady();
            Br.RefreshDomTree();

            CreateBlog objNewblog = new CreateBlog(M);

            //objNewblog.createEntry.Wait.ForExists(5000);
            Br.Actions.Click(objNewblog.createEntry);

            Thread.Sleep(5000);
            Br.WaitUntilReady();
            Br.RefreshDomTree();

            //Adding title to blog
            Br.Actions.SetText(objNewblog.BlogTitle, BlogTitle);

            var x = new ArtOfTest.WebAii.Win32.Dialogs.FileUploadDialog(Br, @"C:\Images\918.jpg", DialogButton.OPEN);

            M.DialogMonitor.Start();
            M.DialogMonitor.AddDialog(x);

            HtmlInputFile choose = Br.Find.ById <HtmlInputFile>("fuPreviewImage");

            choose.Click();
            x.WaitUntilHandled(10000);


            Thread.Sleep(5000);
            Br.WaitUntilReady();
            Br.RefreshDomTree();

            ArtOfTest.WebAii.Core.Browser t1_frame = Br.Frames[0];

            Element TextEditor = t1_frame.Find.ByXPath("/html/body");

            Br.Actions.SetText(TextEditor, BlogDescription);

            switch (Club.ToUpper())
            {
            case "CUSTOMER":
                Br.Actions.Check(objNewblog.cbxBlogCustomer, true);
                break;

            case "DEVELOPER":
                Br.Actions.Check(objNewblog.cbxBlogDeveloper, true);
                break;

            case "TECHNICAL":
                Br.Actions.Check(objNewblog.cbxBlogTechnical, true);
                break;

            default:
                Br.Actions.Check(objNewblog.cbxBlogCustomer, true);
                break;
            }

            Br.Actions.SetText(objNewblog.blogTags, BlogTag);
            Br.Actions.Click(objNewblog.blogPostButton);
            Thread.Sleep(7000);
        }