示例#1
0
        public void RegistrationButtonEnabledOnlyWhenFormValid()
        {
            var registerControl = new RegistrationControlPageObject(this.window);

            registerControl.SetFormValues("a", "b", String.Empty);
            registerControl.SetFormValues(String.Empty, String.Empty, null);

            // try find will still succeed because it is in the markup
            // regarless of whether it is visible!
            // Assert.IsTrue(registerControl.RegisterButton.TryFind());
            // Assert.IsFalse(registerControl.RegisterButton.Enabled);
            Assert.IsFalse(registerControl.IsRegisterButtonVisible);

            registerControl.SetFormValues("mike", null, null);
            Assert.IsFalse(registerControl.IsRegisterButtonVisible);

            registerControl.SetFormValues(null, "password", null);
            Assert.IsTrue(registerControl.IsRegisterButtonVisible);
            Assert.IsFalse(registerControl.IsRegisterButtonEnabled);

            registerControl.SetFormValues(null, null, "nomatch");
            Assert.IsTrue(registerControl.IsRegisterButtonVisible);
            Assert.IsFalse(registerControl.IsRegisterButtonEnabled);

            registerControl.SetFormValues(null, null, "password");
            Assert.IsTrue(registerControl.IsRegisterButtonVisible);
            Assert.IsTrue(registerControl.IsRegisterButtonEnabled);
        }
示例#2
0
        public void GivenNewUser()
        {
            window = BrowserWindow.Launch($"{TestConfig.UrlBase}/DecomposingPageObjects/Change3");

            HtmlCustom nav = new HtmlCustom(window);

            nav.SearchProperties.Add(HtmlControl.PropertyNames.TagName, "nav");

            HtmlButton registerButton = new HtmlButton(nav);

            registerButton.SearchProperties.Add(HtmlButton.PropertyNames.DisplayText, "Register");

            Mouse.Click(registerButton);

            RegistrationControlPageObject registrationControl = new RegistrationControlPageObject(window);

            // allow the tests to use this information
            this.newUsername = Guid.NewGuid().ToString("N");
            this.newPassword = "******";

            // demo: what happens is registration process changes?
            registrationControl.SetFormValues(this.newUsername, this.newPassword, this.newPassword);
            registrationControl.ClickRegister();

            HtmlButton ordersButton = new HtmlButton(nav);

            ordersButton.SearchProperties.Add(HtmlButton.PropertyNames.DisplayText, "Orders");

            Mouse.Click(ordersButton);

            this.ordersPageObject = new OrdersPageObject(window);
        }
示例#3
0
        public void AfterRegisteringNewUser_AccountSettingsIsShown()
        {
            var registerControl = new RegistrationControlPageObject(this.window);

            registerControl.SetFormValues(Guid.NewGuid().ToString("N"), "pass", "pass");

            HtmlDiv accountSettingsDiv = new HtmlDiv(window);

            accountSettingsDiv.SearchProperties.Add(HtmlDiv.PropertyNames.Id, "accountSettingsControl");

            Assert.IsTrue(accountSettingsDiv.Width == 0 && accountSettingsDiv.Height == 0);

            registerControl.ClickRegister();

            Assert.IsFalse(accountSettingsDiv.Width == 0 && accountSettingsDiv.Height == 0);
        }
示例#4
0
        public void ConfirmPasswordNotVisibleWhenCredentialsNotSet()
        {
            var registerControl = new RegistrationControlPageObject(this.window);

            registerControl.SetFormValues("a", "b", String.Empty);
            registerControl.SetFormValues(String.Empty, String.Empty, null);

            Assert.IsFalse(registerControl.IsConfirmPasswordVisible);

            registerControl.SetFormValues("mike", null, null);
            Assert.IsFalse(registerControl.IsConfirmPasswordVisible);

            registerControl.SetFormValues(null, "pass", null);
            Assert.IsTrue(registerControl.IsConfirmPasswordVisible);

            registerControl.SetFormValues(String.Empty, null, null);
            Assert.IsFalse(registerControl.IsConfirmPasswordVisible);
        }
        public void GivenNewUser()
        {
            window = BrowserWindow.Launch($"{TestConfig.UrlBase}/DecomposingPageObjects/Change3");

            HtmlCustom nav = new HtmlCustom(window);

            nav.SearchProperties.Add(HtmlControl.PropertyNames.TagName, "nav");

            HtmlButton registerButton = new HtmlButton(nav);

            registerButton.SearchProperties.Add(HtmlButton.PropertyNames.DisplayText, "Register");

            Mouse.Click(registerButton);

            RegistrationControlPageObject registrationControl = new RegistrationControlPageObject(window);

            this.newUsername = Guid.NewGuid().ToString("N");
            this.newPassword = "******";
            registrationControl.SetFormValues(this.newUsername, this.newPassword, this.newPassword);

            this.accountSettingsPageObject = registrationControl.ClickRegister();
        }