示例#1
0
        public void CloseWelcomeWizard()
        {
            var buttons   = this.Browser.FindElements(By.XPath("//*[text()='Cancel']"));
            var cancelBtn = new HtmlButton(this, buttons.First(b => b.TagName == "img"));

            cancelBtn.Click();
        }
示例#2
0
        public void CreateUserFromNewButton(TenantData data, string planName)
        {
            Log.Information("---Click New button---");
            Browser.WaitForAjax();
            OpenDrawer();
            Log.Information("---Select User Account---");

            Browser.WaitForAjax();

            this.drawer.SelectItem("USER ACCOUNT");

            Browser.WaitForAjax();
            this.drawer.SelectItem("QUICK CREATE");

            var emailTextBox = new HtmlTextBox(this, this.Browser.FindElement(By.Id("accountEmail")));

            emailTextBox.SetText(data.emailAddress);
            var passwordTextBox = new HtmlTextBox(this, this.Browser.FindElement(By.Id("accountPassword")));

            passwordTextBox.SetText(data.password);
            var repeatPswTextBox = new HtmlTextBox(this, this.Browser.FindElement(By.Id("confirmPassword")));

            repeatPswTextBox.SetText(data.password);
            Thread.Sleep(1000 * 2);
            IWebElement   ee = this.SearchContext.FindElement(By.Id("accountPlanDropDown"));
            SelectElement e  = new SelectElement(ee);

            e.WrappedElement.Click();
            e.SelectByText(planName + " (public)");
            Thread.Sleep(1000 * 2);
            var createButton = new HtmlButton(this, this.Browser.FindElement(By.XPath("//*[text()='Create']")));

            createButton.Click();
        }
        /// <summary>
        /// Click the login button.
        /// </summary>
        public void PressLoginButton()
        {
            HtmlButton loginBtn = this.EM.Identity.LoginFormFrontend.LoginButton.AssertIsPresent("Login button");

            loginBtn.Click();
            ActiveBrowser.WaitForAsyncJQueryRequests();
        }
示例#4
0
        public void VerifyDialogText_CodedStep()
        {
            ActiveBrowser.NavigateTo("http://www.w3schools.com/JS/tryit.asp?filename=tryjs_alert");



            // Click the button to fire the Alert Dialog inside the browser
            FrameInfo  myFrame     = new FrameInfo("iframeResult", "", "", 0);
            Browser    frame       = ActiveBrowser.Frames[myFrame];
            HtmlButton tryItButton = frame.Find.ByTagIndex <HtmlButton>("button", 0);

            //Console.WriteLine(tryItButton);

            Assert.IsNotNull(tryItButton);


            // Initialize custom 'Alert' dialog handler
            AlertDialog alertDialog = AlertDialog.CreateAlertDialog(ActiveBrowser, DialogButton.OK);

            Manager.DialogMonitor.Start();
            alertDialog.HandlerDelegate = MyCustomAlertHandler;
            Manager.DialogMonitor.AddDialog(alertDialog);
            tryItButton.Click();

            // Wait Until Dialog is Handled.
            alertDialog.WaitUntilHandled(20000);

            // Validate the text that was captured by the custom dialog handler
            Assert.AreEqual <string>("I am an alert box!", dialogText);
        }
示例#5
0
        /// <summary>
        /// Provide access to unshare button
        /// </summary>
        public void UnshareButton()
        {
            HtmlButton shareButton = EM.GenericContent.ContentBlockWidget.UnshareButton
                                     .AssertIsPresent("Unshare button");

            shareButton.Click();
        }
示例#6
0
        /// <summary>
        /// click add button
        /// </summary>
        public void ClickAddButton()
        {
            HtmlButton addButton = EM.Card.CardEditScreen.AddButton.AssertIsPresent("Add button");

            addButton.Click();
            ActiveBrowser.WaitUntilReady();
        }
        /// <summary>
        /// Changes the media file.
        /// </summary>
        public void ChangeMediaFile()
        {
            HtmlButton changeBtn = this.EM.Media.MediaPropertiesBaseScreen.ChangeButton.AssertIsPresent("Change button");

            changeBtn.Click();
            ActiveBrowser.WaitForAsyncRequests();
        }
        /// <summary>
        /// Clicks to remove first choice link.
        /// </summary>
        public void ClickToRemoveFirstChoiceLink()
        {
            HtmlDiv    firstChoice       = ActiveBrowser.Find.AllByExpression <HtmlDiv>("class=col-md-1 text-right").FirstOrDefault();
            HtmlButton removeFirstChoice = firstChoice.Find.ByExpression <HtmlButton>("class=~close");

            removeFirstChoice.Click();
        }
        /// <summary>
        /// Opens the toggle navigation menu
        /// </summary>
        public void OpenNavigationToggleMenu()
        {
            HtmlButton toggleButton = this.EM.Navigation.NavigationWidgetFrontend.ToggleButton
                                      .AssertIsPresent <HtmlButton>("Toggle Button");

            toggleButton.Click();
        }
示例#10
0
        /// <summary>
        /// Performs logout action.
        /// </summary>
        public void Logout()
        {
            HtmlButton logoutBtn = this.EM.Identity.LoginStatusFrontend.LogoutButton.AssertIsPresent("Logout button");

            logoutBtn.Click();
            ActiveBrowser.WaitForAsyncJQueryRequests();
        }
示例#11
0
        /// <summary>
        /// Save navigation widget
        /// </summary>
        public void SaveChanges()
        {
            HtmlButton saveButton = EM.Navigation.NavigationWidgetEditScreen.SaveChangesButton
                                    .AssertIsPresent("Save button");

            saveButton.Click();
        }
示例#12
0
        /// <summary>
        /// Selects the content.
        /// </summary>
        /// <param name="isNewsSelector">True or false depending on the selector.</param>
        public void SelectContent(bool isNewsSelector = true)
        {
            if (isNewsSelector)
            {
                var contentSelector = this.GetContentSelectorByType("Telerik.Sitefinity.News.Model.NewsItem").As <HtmlControl>()
                                      .AssertIsPresent("selector directive");

                HtmlButton selectButton = contentSelector.Find.ById <HtmlButton>("openSelectorBtn").AssertIsPresent("select button");

                selectButton.Click();
                ActiveBrowser.WaitForAsyncRequests();
                ActiveBrowser.RefreshDomTree();
            }
            else
            {
                var contentSelector = this.GetContentSelectorByType("Telerik.Sitefinity.GenericContent.Model.ContentItem").As <HtmlControl>()
                                      .AssertIsPresent("selector directive");

                HtmlButton selectButton = contentSelector.Find.ById <HtmlButton>("openSelectorBtn").AssertIsPresent("select button");

                selectButton.Click();
                ActiveBrowser.WaitForAsyncRequests();
                ActiveBrowser.RefreshDomTree();
            }
        }
        public void TestMethod_SingleActivate()
        {
            readData();

            CommonFunctions.Login(myManager, _username, _password, _Url);

            myManager.ActiveBrowser.Window.Maximize();

            // -- End of Login ---
            ObjMenus menus = new ObjMenus(myManager);

            HtmlListItem system = menus.systemlink.As <HtmlListItem>();

            system.MouseHover();

            myManager.ActiveBrowser.RefreshDomTree();

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            HtmlAnchor users = menus.userslink.As <HtmlAnchor>();

            users.MouseClick();

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            // Search user to Active

            ObjActiveDeactive objactive = new ObjActiveDeactive(myManager);

            ObjEditUser objedit = new ObjEditUser(myManager);

            HtmlInputText usern = objedit.searchUsername.As <HtmlInputText>();

            usern.Text = _editusername;

            myManager.Desktop.Mouse.Click(MouseClickType.LeftClick, usern.GetRectangle());
            myManager.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Enter);

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            // Select one user to activate

            HtmlTable usertable = objedit.usertable.As <HtmlTable>();

            HtmlInputCheckBox firstrowcheck = objactive.row1.As <HtmlInputCheckBox>();

            firstrowcheck.Check(true);

            // click on Edit user button
            HtmlButton editbtn = objedit.editbutton.As <HtmlButton>();

            editbtn.Click();

            activateUser();
            verifyActivation();
        }
示例#14
0
        public void TestMethod_deleteArticlePopup()

        {
            readData();

            CommonFunctions.Login(myManager, _username, _password, _Url);

            myManager.ActiveBrowser.Window.Maximize();

            // -- End of Login ---

            ObjMenus menus = new ObjMenus(myManager);

            HtmlAnchor data = menus.Datalink.As <HtmlAnchor>();

            data.MouseHover();

            myManager.ActiveBrowser.RefreshDomTree();

            Thread.Sleep(1000);
            myManager.ActiveBrowser.RefreshDomTree();

            HtmlAnchor articles = menus.Articlelink.As <HtmlAnchor>();

            articles.MouseClick();

            Thread.Sleep(1000);
            myManager.ActiveBrowser.RefreshDomTree();


            ObjDeleteArticle objdeletearticle = new ObjDeleteArticle(myManager);

            HtmlInputCheckBox rowcheck1 = objdeletearticle.deleterowcheck1.As <HtmlInputCheckBox>();

            rowcheck1.Check(true);

            HtmlButton deletebutton = objdeletearticle.deletebtn.As <HtmlButton>();

            deletebutton.Click();

            // Verify Confirmation popup

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            Element verifypopuptitle = objdeletearticle.deletepopuptitle;

            Assert.IsTrue(verifypopuptitle.InnerText.Contains("Delete Articles"));

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            Element verifyconfirmation = objdeletearticle.confirmation1;

            Assert.IsTrue(verifyconfirmation.InnerText.Contains("Are you sure you want to delete the selected article(s)?"));

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();
        }
示例#15
0
        /// <summary>
        /// Cancels the upload.
        /// </summary>
        public void CancelUpload()
        {
            HtmlButton cancelBtn = this.EM.Media.MediaUploadPropertiesScreen.CancelButton.AssertIsPresent("Cancel button");

            cancelBtn.Click();
            ActiveBrowser.WaitForAsyncRequests();
            ActiveBrowser.RefreshDomTree();
        }
示例#16
0
        /// <summary>
        /// Dones the selecting in select library dialog.
        /// </summary>
        public void DoneSelecting()
        {
            HtmlButton shareButton = this.EM.Media.MediaUploadPropertiesScreen.DoneSelecting.AssertIsPresent("Done selecting button");

            shareButton.Click();
            ActiveBrowser.WaitUntilReady();
            ActiveBrowser.WaitForAsyncRequests();
        }
        /// <summary>
        /// Clicks Done button on media properties dialog.
        /// </summary>
        public void ConfirmMediaProperties()
        {
            HtmlButton doneBtn = this.EM.Media.MediaPropertiesBaseScreen.DoneButton.AssertIsPresent("Done button");

            doneBtn.Click();
            ActiveBrowser.WaitForAsyncOperations();
            ActiveBrowser.RefreshDomTree();
        }
示例#18
0
        /// <summary>
        /// Uploads the file.
        /// </summary>
        public void UploadMediaFile()
        {
            HtmlButton uploadBtn = this.EM.Media.MediaUploadPropertiesScreen.UploadButton.AssertIsPresent("Upload button");

            uploadBtn.Click();
            ActiveBrowser.WaitForAsyncRequests();
            ActiveBrowser.RefreshDomTree();
        }
        /// <summary>
        /// Dones the resizing.
        /// </summary>
        public void DoneResizing()
        {
            HtmlButton doneBtn = this.EM.Media.ImagePropertiesScreen.DoneResizingButton.AssertIsPresent("Done button");

            doneBtn.Click();
            ActiveBrowser.WaitForAsyncOperations();
            ActiveBrowser.RefreshDomTree();
        }
        /// <summary>
        /// Edits all properties.
        /// </summary>
        public void EditAllProperties()
        {
            HtmlButton editBtn = this.EM.Media.MediaPropertiesBaseScreen.EditAllPropertiesButton.AssertIsPresent("Edit all properties button");

            editBtn.Click();
            ActiveBrowser.WaitForAsyncOperations();
            ActiveBrowser.RefreshDomTree();
        }
示例#21
0
        /// <summary>
        /// Provide access to done button
        /// </summary>
        public void DoneSelectingButton()
        {
            HtmlButton shareButton = EM.GenericContent.ContentBlockWidget.DoneSelectingButton
                                     .AssertIsPresent("Done selecting button");

            shareButton.Click();
            ActiveBrowser.WaitUntilReady();
            ActiveBrowser.WaitForAsyncRequests();
        }
示例#22
0
        /// <summary>
        /// Clicks the next step button
        /// </summary>
        public void ClickNextButton()
        {
            ActiveBrowser.RefreshDomTree();
            HtmlButton nextButton = EM.Forms.FormsFrontend.NextStepVisible;

            nextButton.ScrollToVisible();
            nextButton.Focus();
            nextButton.Click();
        }
        /// <summary>
        /// Opens the model tab.
        /// </summary>
        public void ClickModelButton()
        {
            HtmlButton modelButton = EM.ModuleBuilder.DynamicWidgetAdvancedSettings.ModelButton
                                     .AssertIsPresent("Model button");

            modelButton.Click();
            ActiveBrowser.WaitUntilReady();
            ActiveBrowser.WaitForAsyncRequests();
        }
        /// <summary>
        /// Press Register button
        /// </summary>
        public void RegisterButton()
        {
            HtmlButton registerButton = EM.Identity.RegistrationFrontend.RegisterButton
                                        .AssertIsPresent("register button");

            registerButton.Click();
            ActiveBrowser.WaitUntilReady();
            ActiveBrowser.WaitForAsyncJQueryRequests();
        }
示例#25
0
        /// <summary>
        /// Clicks the save button.
        /// </summary>
        public void ClickSaveButton()
        {
            HtmlButton saveButton = this.EM.Widgets.FeatherWidget.SaveButton
                                    .AssertIsPresent("save button");

            saveButton.Click();
            ActiveBrowser.WaitForAsyncRequests();
            ActiveBrowser.RefreshDomTree();
        }
示例#26
0
        /// <summary>
        /// Confirms the selecting.
        /// </summary>
        public void DoneSelectingOfDocument()
        {
            HtmlButton doneButton = this.EM.Widgets.FeatherWidget.DoneSelectingButton
                                    .AssertIsPresent("done button");

            doneButton.Click();
            ActiveBrowser.WaitForAsyncRequests();
            ActiveBrowser.RefreshDomTree();
        }
示例#27
0
        /// <summary>
        /// Changes the document button.
        /// </summary>
        public void ChangeDocumentButton()
        {
            HtmlButton changeButton = this.EM.Widgets.FeatherWidget.ChangeDocumentButton
                                      .AssertIsPresent("Change document button");

            changeButton.Click();
            ActiveBrowser.WaitForAsyncRequests();
            ActiveBrowser.RefreshDomTree();
        }
示例#28
0
        /// <summary>
        /// Clicks the submit button in the frontend of the form
        /// </summary>
        public void ClickSubmit()
        {
            HtmlButton submitButton = EM.Forms.FormsFrontend.SubmitButton;

            submitButton.Click();
            ActiveBrowser.WaitForAsyncJQueryRequests();
            ActiveBrowser.WaitUntilReady();
            ActiveBrowser.RefreshDomTree();
        }
示例#29
0
        //[Test]
        public void TestMethod1()
        {
            Manager  manager;
            Settings mySettings = new Settings();

            //
            //mySettings.Web.DefaultBrowser = BrowserType.FireFox;
            //mySettings.Web.DefaultBrowser = BrowserType.InternetExplorer;
            mySettings.Web.DefaultBrowser = BrowserType.Chrome;
            manager = new Manager(mySettings);
            //manager.Settings.Web.BaseUrl = "https://www.google.com.ua";
            manager.Start();
            manager.LaunchNewBrowser();
            //manager.Settings.Web.RecycleBrowser = true;
            //manager.Settings.Web.KillBrowserProcessOnClose = true;
            manager.ActiveBrowser.NavigateTo("http://java.training.local:8080/registrator/login");
            //
            HtmlInputText login = manager.ActiveBrowser.Find.ById <HtmlInputText>("login");

            login.Text = "admin11111";
            Thread.Sleep(2000);
            //
            //manager.ActiveBrowser.Refresh();
            //Thread.Sleep(2000);
            //login.Refresh();
            //
            login.Text = "admin";
            //HtmlInputPassword password = manager.ActiveBrowser.Find.ById<HtmlInputPassword>("password");
            //password.Text = "admin";
            //
            //IList<HtmlInputPassword> passwords = manager.ActiveBrowser.Find.AllByAttributes<HtmlInputPassword>("name=password");
            //Console.WriteLine("passwords size = " + passwords.Count);
            //
            // Do not use local variables
            manager.ActiveBrowser.Find.ById <HtmlInputPassword>("password").Text = "admin";
            //
            HtmlButton signin = manager.ActiveBrowser.Find.ByAttributes <HtmlButton>("class=btn btn-primary");

            signin.Click();
            //
            HtmlButton account = manager.ActiveBrowser.Find.ByAttributes <HtmlButton>("class=btn btn-primary btn-sm");

            Assert.AreEqual("admin", account.TextContent, "Error found");
            Thread.Sleep(2000);
            //
            manager.ActiveBrowser.Find.ByAttributes <HtmlButton>("class=btn btn-primary btn-sm dropdown-toggle").Click();
            manager.ActiveBrowser.Find.ByXPath <HtmlAnchor>("//a[contains(@href,'/logout')]").Click();
            //
            HtmlImage image = manager.ActiveBrowser.Find.ByTagIndex <HtmlImage>("img", 0);

            Assert.IsTrue(image.Src.ToLower().Contains("ukraine_logo2.gif"));
            Thread.Sleep(2000);
            //
            manager.Dispose();
            Console.WriteLine("done");
        }
示例#30
0
        public void HandleWelcomeWizard()
        {
            var button  = this.Browser.FindElement(By.XPath("//a[@title='Next']"));
            var nextBtn = new HtmlButton(this, button);

            nextBtn.Click();
            Thread.Sleep(1000 * 3);
            nextBtn.Click();
            Thread.Sleep(1000 * 3);
            nextBtn.Click();
            Thread.Sleep(1000 * 3);
            nextBtn.Click();
            Thread.Sleep(1000 * 3);
            nextBtn.Click();
            var btn      = this.Browser.FindElement(By.XPath("//div[@title='Close']"));
            var closeBtn = new HtmlButton(this, btn);

            closeBtn.Click();
        }