public void GivenRegisterForm_WhenRegisterButtonPressed_UserIsNotRegistered()
 {
     TestSteps
     .GoTo <RegistrationPage>((p, a) => a
                              .Click(p.RegisterButton)
                              .Expect(that => that
                                      .PageUrl(Is.EqualTo(p.RelativeUrl))));
 }
Beispiel #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()));
        }
Beispiel #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)));
        }
Beispiel #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)));
        }
Beispiel #8
0
        public async Task Test1()
        {
            //Get test result
            //Exception Continutation

            var context = new Context(new Config(new Dictionary <string, string>()
            {
                { "param1", "value1" }, { "param2", "value2" }
            }),
                                      new Config(new Dictionary <string, string>()
            {
                { "param1", "my-value" }
            }));

            context.SetService <HttpClient>("httpClient", new HttpClient());
            await new TestCase()
            .AddStep(x => x.Log("FirstStep"))
            .AddStep(async(x) =>
            {
                var httpClient = x.GetService <HttpClient>("httpClient");
                x.Log("Hash code is " + httpClient.GetHashCode());
                x.Log(x.GetValue("param1"));
                x.Log(x.GetValue("param2"));
                await Task.Delay(1000);
                x.Log("Second test");
                return(StepResult.Fail);
            })
            .AddStep(async(x) => x.Log("Step 3"))
            .AddStep(x =>
            {
                x.Log("Step 4");
                Assert.AreEqual(4, 5);
            })
            .AddStep(x => TestSteps.Login1(x))
            .RunTest(context);

            Action <IContext>                   s1;
            Func <IContext, StepResult>         s2;
            Func <IContext, Task>               s3;
            Func <IContext, Task <StepResult> > s4;

            s2 = TestSteps.Login1;
        }
        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()));
        }
Beispiel #10
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)));
        }
Beispiel #12
0
 private void ClickSmokeTest(Func <LoginPage, IClickable> buttonSpecifier)
 {
     TestSteps.
     GoTo <LoginPage>((p, a) => a
                      .Click(buttonSpecifier(p)));
 }