public void ShouldValidateContactDetails()
        {
            _contactPage.NavigateTo();

            // Don't enter a name
            _contactPage.EnterFormValue(nameof(ContactViewModel.Email), "*****@*****.**");
            _contactPage.EnterFormValue(nameof(ContactViewModel.Website), "");
            _contactPage.EnterFormValue(nameof(ContactViewModel.Subject), "Enquiry");
            _contactPage.EnterFormValue(nameof(ContactViewModel.Message), "This is a test message");

            var responsePage = _contactPage.Submit("ContactSubmit");

            Assert.Equal("Contact Me | Digital Nomad Dave", _contactPage.Driver.Title);

            IWebElement firstErrorMessage =
                _contactPage.Driver.FindElement(By.Id(nameof(ContactViewModel.Name) + "-error"));

            Assert.Equal("The Name field is required.", firstErrorMessage.Text);
        }
示例#2
0
 public void GivenIEnterNameOf(string name)
 {
     _contactScreen.EnterFormValue(nameof(ContactViewModel.Name), name);
 }