Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
                }
            }
        }
Ejemplo n.º 6
0
        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();
        }
Ejemplo n.º 7
0
        public ValidCandidateCase SaveProfile(IWebDriver webDriver, EasyAction action)
        {
            var btnSave = webDriver.FindElement(By.XPath("//button[contains(@ng-click, 'controller.saveProfile')]"));

            return(this);
        }
Ejemplo n.º 8
0
 public ValidCandidateCase FillValidProfile(EasyAction action, ViewModelMapper mapper)
 {
     mapper.Map(Candidate(), action);
     mapper.Map(Address(), action);
     return(this);
 }
Ejemplo n.º 9
0
 public abstract void Map(EasyAction actions, IWebElement element, PropertyInfo property, object instance);