public void RegistrationButtonEnabledOnlyWhenFormValid()
        {
            var registerControl = new RegistrationControlPageObject(this.window);

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

            // demo: remember these?
            // Assert.IsTrue(registerControl.RegisterButton.TryFind());
            // Assert.IsFalse(registerControl.RegisterButton.Enabled);
            #region Spoiler
            // demo:
            // 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);
            #endregion
            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);
        }
        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);
        }
        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/Change2");

            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();
        }