Example #1
0
        /// <summary>
        /// No default constructor, as configuration should be passed in
        /// </summary>
        /// <param name="config"></param>
        protected BaseExpectRuntime(IScriptExpectConfig config)
        {
            ScriptExpectID = config.ScriptExpectID;
            Message        = config.Message;

            if (config is IHasTarget targetConfig)
            {
                Target = targetConfig.Target;
            }
        }
Example #2
0
        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
                }
            });
        }