Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save angelovstanton/dd1e8d5b4fbc39230dbc55d851fd75b4 to your computer and use it in GitHub Desktop.
Save angelovstanton/dd1e8d5b4fbc39230dbc55d851fd75b4 to your computer and use it in GitHub Desktop.
[TestClass]
public class HealthyDietMenuGeneratorTestsEdge
{
private IWebDriver _driver;
[TestInitialize]
public void SetupTest()
{
var options = new EdgeOptions()
{
PageLoadStrategy = EdgePageLoadStrategy.Eager
};
_driver = new EdgeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), options);
_driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(5);
}
[TestCleanup]
public void TeardownTest()
{
_driver.Quit();
}
[TestMethod]
public void FillAwsomeDietTest()
{
_driver.Navigate().GoToUrl(@"http://automatetheplanet.com/healthy-diet-menu-generator/");
var addAdditionalSugarCheckbox = _driver.FindElement(By.Id("ninja_forms_field_18"));
addAdditionalSugarCheckbox.Click();
var ventiCoffeeRadioButton = _driver.FindElement(By.Id("ninja_forms_field_19_1"));
ventiCoffeeRadioButton.Click();
var selectElement = new SelectElement(_driver.FindElement(By.Id("ninja_forms_field_21")));
selectElement.SelectByText("7 x BBQ Ranch Burgers");
var smotheredChocolateCakeCheckbox = _driver.FindElement(By.Id("ninja_forms_field_27_2"));
smotheredChocolateCakeCheckbox.Click();
var addSomethingToDietTextArea = _driver.FindElement(By.Id("ninja_forms_field_22"));
addSomethingToDietTextArea.SendKeys(@"Goi cuon- This snack made from pork, shrimp, herbs, rice vermicelli and other ingredients wrapped in rice paper is served at room temperature. It’s “meat light,” with the flavors of refreshing herbs erupting in your mouth.");
var rockStarRating = _driver.FindElement(By.XPath("//*[@id='ninja_forms_field_20_div_wrap']/span/div[11]/a"));
rockStarRating.Click();
var firstNameTextBox = _driver.FindElement(By.Id("ninja_forms_field_23"));
firstNameTextBox.SendKeys("Anton");
var lastNameTextBox = _driver.FindElement(By.Id("ninja_forms_field_24"));
lastNameTextBox.SendKeys("Angelov");
var emailTextBox = _driver.FindElement(By.Id("ninja_forms_field_25"));
emailTextBox.SendKeys("aangelov@yahoo.com");
var awsomeDietSubmitButton = _driver.FindElement(By.Id("ninja_forms_field_28"));
awsomeDietSubmitButton.Click();
}
[TestMethod]
public void FillAwsomeDietTest_ThroughPageObjects()
{
var healthyDietGeneratorPage = new HealthyDietGeneratorPage(_driver);
_driver.Navigate().GoToUrl(healthyDietGeneratorPage.Url);
healthyDietGeneratorPage.AddAdditionalSugarCheckbox.Click();
healthyDietGeneratorPage.VentiCoffeeRadioButton.Click();
var selectElement = new SelectElement(healthyDietGeneratorPage.BurgersDropDown);
selectElement.SelectByText("7 x BBQ Ranch Burgers");
healthyDietGeneratorPage.SmotheredChocolateCakeCheckbox.Click();
healthyDietGeneratorPage.AddSomethingToDietTextArea.SendKeys(@"Goi cuon- This snack made from pork, shrimp, herbs, rice vermicelli and other ingredients wrapped in rice paper is served at room temperature. It’s “meat light,” with the flavors of refreshing herbs erupting in your mouth.");
healthyDietGeneratorPage.RockStarRating.Click();
healthyDietGeneratorPage.FirstNameTextBox.SendKeys("Anton");
healthyDietGeneratorPage.LastNameTextBox.SendKeys("Angelov");
healthyDietGeneratorPage.EmailTextBox.SendKeys("aangelov@yahoo.com");
healthyDietGeneratorPage.AwsomeDietSubmitButton.Click();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment