public void CheckValidationForEmail() { productsPage = new ProductsPage(CmdDriver.Driver); yourOrderPage = new YourOrderPage(CmdDriver.Driver); contactInfoPage = new ContactInfoPage(CmdDriver.Driver); orderSummaryPage = new OrderSummaryPage(CmdDriver.Driver); extentReportUtils.createATestCase("Check validation for email"); extentReportUtils.addTestLog(Status.Info, "CheckValidationForEmail"); productsPage.ClickAcceptAllCookies(); // Click on Buy Now button per Product name productsPage.ClickBuyNowButtonByProductName(ProductsEnum.DEVCRAFT_UI); yourOrderPage.ClickAcceptAllCookies(); // Assert there is at least one product at the page Assert.AreEqual(1, yourOrderPage.GetProductsCountFromPage()); // Navigate user to the next page - Contact Info Page yourOrderPage.ClickContinueButton(); contactInfoPage.ClickAcceptAllCookies(); ContactInfo contactInfo = new ContactInfo(); contactInfo.Email = "32543543512@"; // Fill Billing Information contactInfoPage.SetFirstName(contactInfo.FirstName); contactInfoPage.SetLastName(contactInfo.LastName); contactInfoPage.SetCompany(contactInfo.CompanyName); contactInfoPage.SetPhone(contactInfo.PhoneNumber); contactInfoPage.SetAddress(contactInfo.Address.Street); contactInfoPage.SetCountry(contactInfo.Address.Country); contactInfoPage.SetCity(contactInfo.Address.City); contactInfoPage.SetZipCode(contactInfo.Address.ZipCode); contactInfoPage.ClickContinueButton(); // Assert email error message about required field Assert.AreEqual("Email is required", contactInfoPage.GetErrorMessageForEmail()); // Set email with more than max lenght (150) string tooLongEmail = StringUtils.CreateString(151); contactInfoPage.SetEmail(tooLongEmail); // Assert error message about lenght Assert.AreEqual("Invalid email", contactInfoPage.GetErrorMessageForEmail()); }