public ValidCandidateCase FillValidSkill(IWebDriver webDriver, EasyAction action, ViewModelMapper mapper) { mapper.Map(Skill(), action); var btnAddSkill = webDriver.FindElements(By.XPath("//select[contains(@id, 'Level')]/following-sibling::span//button"))[0]; btnAddSkill.Click(); return(this); }
public ValidCandidateCase FillValidPhone(IWebDriver webDriver, EasyAction action, ViewModelMapper mapper) { mapper.Map(Phone(), action); var btnAddPhone = webDriver.FindElement(By.CssSelector("button[ng-click='$ctrl.add();']")); btnAddPhone.Click(); return(this); }
public override void Map(EasyAction actions, IWebElement element, PropertyInfo property, object instance) { actions.TryClear(element); actions.MoveToElement(element).Click(element).AwaitAndPerform(10); var value = property.GetValue(instance)?.ToString() ?? string.Empty; actions.SendKeys(value); actions.Build().Perform(); }
public override void Map(EasyAction actions, IWebElement element, PropertyInfo property, object instance) { if (UseRandomValue) { SelectRandom(actions, element); return; } var value = property.GetValue(instance)?.ToString() ?? string.Empty; SelectByValue(actions, element, value); }
public void Map <T>(T viewModel, EasyAction action) { var type = typeof(T); var properties = type.GetProperties(); foreach (var property in properties) { var element = WebDriver.TryFindElement(By.Id(type.ViewPropertyName(property))); //WebDriver.SwitchTo().ActiveElement(); if (element != null) { var js = String.Format("window.scrollTo({0}, {1})", 0, element.Location.Y - 100); ((OpenQA.Selenium.IJavaScriptExecutor)WebDriver).ExecuteScript(js); action.Value(element, property, viewModel); } } }
public void When_run_a_valid_candidate_case_save_with_success() { IWebDriver webDriver = new ChromeDriver(@"C:\Users\a288461\Downloads\chromedriver_win32\"); webDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20); EasyAction commands = new EasyAction(webDriver); ViewModelMapper mapper = new ViewModelMapper(webDriver); Cases.ValidCandidateCase candidateCase = new Cases.ValidCandidateCase(); candidateCase .OpenSite(webDriver, "http://localhost:56484") .FillValidProfile(commands, mapper) .OpenContactTab(webDriver) .FillValidPhone(webDriver, commands, mapper) .OpenSkillTab(webDriver) .FillValidSkill(webDriver, commands, mapper) .SaveProfile(webDriver, commands); webDriver.Quit(); }
public ValidCandidateCase SaveProfile(IWebDriver webDriver, EasyAction action) { var btnSave = webDriver.FindElement(By.XPath("//button[contains(@ng-click, 'controller.saveProfile')]")); return(this); }
public ValidCandidateCase FillValidProfile(EasyAction action, ViewModelMapper mapper) { mapper.Map(Candidate(), action); mapper.Map(Address(), action); return(this); }
public abstract void Map(EasyAction actions, IWebElement element, PropertyInfo property, object instance);