public void GivenRegisterForm_WhenRegisterButtonPressed_UserIsNotRegistered()
 {
     TestSteps
     .GoTo <RegistrationPage>((p, a) => a
                              .Click(p.RegisterButton)
                              .Expect(that => that
                                      .PageUrl(Is.EqualTo(p.RelativeUrl))));
 }
Example #2
0
 private void SetTextFieldSmokeTest(Func <LoginPage, TextField> textFieldSpecifier, string value)
 {
     TestSteps.
     GoTo <LoginPage>((p, a) =>
     {
         var textField = textFieldSpecifier.Invoke(p);
         a.Set(textFieldSpecifier.Invoke(p), value)
         .Expect(that => that
                 .Field(textFieldSpecifier.Invoke(p), Is.EqualTo(value)));
     });
 }
        public void GivenRegisterFormWithOnlyUsernameFilled_WhenRegisterButtonPressed_UserIsNotRegistered()
        {
            var testData = new
            {
                Username = CreateRandomUserName(),
            };

            TestSteps
            .GoTo <RegistrationPage>((p, a) => a
                                     .Set(p.UserName, CreateRandomUserName())
                                     .Click(p.RegisterButton)
                                     .Expect(that => that
                                             .PageUrl(Is.EqualTo(p.RelativeUrl))));
        }
        public void GivenRegisterFormFilledCorrectly_ShouldNotDisplayErrorMessage()
        {
            var testData = new
            {
                Username        = CreateRandomUserName(),
                Password        = "******",
                ConfirmPassword = "******",
            };

            TestSteps
            .GoTo <RegistrationPage>((p, a) => a
                                     .Set(p.UserName, testData.Username)
                                     .Set(p.Password, testData.Password)
                                     .Set(p.ConfirmPassword, testData.ConfirmPassword)
                                     .Expect(that => that
                                             .PageUrl(Is.EqualTo(p.RelativeUrl))
                                             .HasNoErrors()));
        }
Example #5
0
        public void GivenLoginForm_WhenUserNameIsWrong_DisplayErrorMessage()
        {
            var testData = new {
                invalidUsername = "******",
                invalidPassword = "******"
            };

            TestSteps
            .GoTo <LoginPage>((p, a) => a
                              .Set(p.UserName, testData.invalidUsername)
                              .Set(p.Password, testData.invalidPassword)
                              .Click(p.LoginButton))
            .AwaitPageLoad <LoginPage>((p, a) => a
                                       .Expect(that => that
                                               .PageUrl(Is.EqualTo(p.RelativeUrl))
                                               .HasErrors()
                                               .Field(p.UserName, Is.Empty)));
        }
Example #6
0
        public void GivenLoginForm_WhenUserLogsWithCorrectCredentials_UserIsLoggedIn()
        {
            var testData = new
            {
                validUsername = "******",
                validPassword = "******"
            };

            TestSteps
            .GoTo <LoginPage>((p, a) => a
                              .Set(p.UserName, testData.validUsername)
                              .Set(p.Password, testData.validPassword)
                              .Click(p.LoginButton))
            .AwaitPageLoad <MainPage>((p, a) => a
                                      .Expect(that => that
                                              .PageUrl(Is.EqualTo(p.RelativeUrl))
                                              .LabelDisplayedText(p.SignedInUser.DisplayedText, Is.EqualTo(testData.validUsername))));
        }
        public void GivenRegisterFormWithConfirmPasswordEmpty_WhenRegisterButtonPressed_ErrorMessageIsDisplayed()
        {
            var testData = new
            {
                Username             = CreateRandomUserName(),
                Password             = "******",
                ExpectedErrorMassage = "Passwords don't match"
            };

            TestSteps
            .GoTo <RegistrationPage>((p, a) => a
                                     .Set(p.UserName, testData.Username)
                                     .Set(p.Password, testData.Password)
                                     .Click(p.RegisterButton)
                                     .Expect(that => that
                                             .PageUrl(Is.EqualTo(p.RelativeUrl))
                                             .HasErrors()
                                             .ErrorsContains(testData.ExpectedErrorMassage)));
        }
        public void GivenRegisterFormFilledCorrectly_WhenRegisterButtonIsClicked_ShouldDisplayLoginPage()
        {
            var testData = new
            {
                Username        = CreateRandomUserName(),
                Password        = "******",
                ConfirmPassword = "******",
            };

            TestSteps
            .GoTo <RegistrationPage>((p, a) => a
                                     .Set(p.UserName, testData.Username)
                                     .Set(p.Password, testData.Password)
                                     .Set(p.ConfirmPassword, testData.ConfirmPassword)
                                     .Click(p.RegisterButton))
            .AwaitPageLoad <LoginPage>((p, a) => a
                                       .Expect(that => that
                                               .PageUrl(Is.EqualTo(p.RelativeUrl))
                                               .HasNoErrors()));
        }
Example #9
0
        public void GivenMainPage_FirstNoteIsFirst()
        {
            var testData = new
            {
                validUsername = "******",
                validPassword = "******",
                firstRowTitle = "First",
            };

            TestSteps
            .GoTo <LoginPage>((p, a) => a
                              .Set(p.UserName, testData.validUsername)
                              .Set(p.Password, testData.validPassword)
                              .Click(p.LoginButton))
            .AwaitPageLoad <MainPage>((p, a) => a
                                      .InTable(p.NotesTable, (t) => t
                                               .InRow(p.NotesTable.GetFirstRow(), (r) => r
                                                      .Expect(that => that
                                                              .ValueInColumn(2, Is.EqualTo(testData.firstRowTitle))))));
        }
        public void GivenRegisterFormFilledCorrectly_WhenPasswordChanged_ShouldDisplayErrorMessage()
        {
            var testData = new
            {
                Username             = CreateRandomUserName(),
                Password             = "******",
                NewPassword          = "******",
                ConfirmPassword      = "******",
                ExpectedErrorMassage = "Passwords don't match"
            };

            TestSteps
            .GoTo <RegistrationPage>((p, a) => a
                                     .Set(p.UserName, testData.Username)
                                     .Set(p.Password, testData.Password)
                                     .Set(p.ConfirmPassword, testData.ConfirmPassword)
                                     .Set(p.Password, testData.NewPassword)
                                     .Click(p.RegisterButton)
                                     .Expect(that => that
                                             .PageUrl(Is.EqualTo(p.RelativeUrl))
                                             .HasErrors()
                                             .ErrorsContains(testData.ExpectedErrorMassage)));
        }
Example #11
0
 private void ClickSmokeTest(Func <LoginPage, IClickable> buttonSpecifier)
 {
     TestSteps.
     GoTo <LoginPage>((p, a) => a
                      .Click(buttonSpecifier(p)));
 }