/// <summary> /// No default constructor by design -- an runtime action is built from configuration /// </summary> /// <param name="config">Configuration object ; it can also impliment IHasTarget</param> protected BaseActionRuntime(IScriptActionConfig config) { ScriptActionID = config.ScriptActionID; // if config has Target path, then apply here as well if (config is IHasTarget targetConfig) { Target = targetConfig.Target; } }
private StepConfig processElement(XElement el) { var action = el.Element("command").Value; var target = el.Element("target").Value; var value = el.Element("value").Value; IScriptActionConfig scriptAction = null; IPath path = getPath(target); switch (action) { case "logMessage": scriptAction = new LogMessageActionConfig() { Message = value }; break; case "submit": scriptAction = new FormSubmitActionConfig() { Target = path }; break; case "click": scriptAction = new ClickActionConfig() { Target = path }; break; case "type": scriptAction = new EnterTextActionConfig() { Text = value, Target = path }; break; case "special": scriptAction = new EnterTextActionConfig() { Text = value, Target = path }; break; } IScriptExpectConfig scriptExpects = null; switch (action.ToLower()) { case "doubleclick": scriptExpects = parseExpects(target, value); break; case "verifytext": case "elementtext": scriptExpects = new ElementTextExpectConfig() { MatchType = StringMatchTypes.ContainsCaseInsensative, Target = path, Text = value }; break; } return(new StepConfig() { Expectations = new List <IScriptExpectConfig>() { scriptExpects }, Actions = new List <IScriptActionConfig>() { scriptAction } }); }