Exemple #1
0
        public string[] GetTestClasses()
        {
            var model   = new SeleniumTestModel();
            var classes = model.EnumTestClass();

            return(classes.Select(c => c.Name).ToArray());
        }
        public override void Perform(SeleniumSideModel tests, SeleniumTestModel test, SeleniumCommandModel comand)
        {
            var element = SearchElement(comand);

            element
            .Should()
            .NotBeNull();
        }
Exemple #3
0
        public string Post(string baseUrl, DriverType driverType = DriverType.Chrome, string className = null, string methodName = null)
        {
            var model    = new SeleniumTestModel();
            var rootPath = HostingEnvironment.MapPath("~/");
            var basePath = model.GetPath(rootPath);
            var id       = model.TestStart(driverType, basePath, baseUrl, className, methodName);

            return(id);
        }
Exemple #4
0
        public override void Perform(SeleniumSideModel tests, SeleniumTestModel test, SeleniumCommandModel comand)
        {
            var size = comand.Target.Split('x');

            if (size.Length > 1)
            {
                Current.Driver.Manage().Window.Size = new Size(size[0].ToInt(), size[1].ToInt());
            }
        }
Exemple #5
0
        public string[] GetTestMethoedes(string className)
        {
            var model   = new SeleniumTestModel();
            var classes = model.EnumTestClass();

            var type    = classes.FirstOrDefault(c => c.Name == className);
            var methods = model.EnumTestMethods(type);

            return(methods.Select(c => c.Name).ToArray());
        }
        public override void Perform(SeleniumSideModel tests, SeleniumTestModel test, SeleniumCommandModel comand)
        {
            Current.LastAlert
            .Should()
            .NotBeNull();

            Current.LastAlert
            .Should()
            .Be(comand.Target);
        }
Exemple #7
0
        public TestResultInfo Get(string id)
        {
            var model    = new SeleniumTestModel();
            var rootPath = HostingEnvironment.MapPath("~/");
            var basePath = model.GetPath(rootPath);
            var r        = model.GetTestResult(basePath, id);

            var filesPath = HostingEnvironment.MapPath($"~/Content/Results/{id}/");

            r.Files = Directory.EnumerateFiles(filesPath, "*.png").Select(c => Path.GetFileName(c)).ToArray();
            return(r);
        }
Exemple #8
0
        public override void Perform(SeleniumSideModel tests, SeleniumTestModel test, SeleniumCommandModel comand)
        {
            var alert = Current.Driver.SwitchTo().Alert();

            alert
            .Should()
            .NotBeNull();

            Current.LastAlert = alert.Text;

            alert.Dismiss();
        }
Exemple #9
0
        public override void Perform(SeleniumSideModel tests, SeleniumTestModel test, SeleniumCommandModel comand)
        {
            Wait(1000 * 2);

            if (!comand.Target.ContainsText("="))
            {
                return;
            }

            var index = comand.Target.Split('=')[1].ToInt();

            Current.Driver.SwitchTo().Frame(frameIndex: index);
        }
Exemple #10
0
        private void PerformCommand(SeleniumSideModel tests, Context context, SeleniumTestModel test, SeleniumCommandModel command)
        {
            var current = CommandFactory.Create(context, command.Command);

            if (!(current is INextCommand))
            {
                current.Perform(tests, test, command);
            }
            if (context.LastCommand is INextCommand)
            {
                context.LastCommand.Perform(tests, test, command);
            }
            context.LastCommand = current;
        }
Exemple #11
0
        // GET: TestResult
        public ActionResult Index()
        {
            var model    = new SeleniumTestModel();
            var rootPath = HostingEnvironment.MapPath("~/");
            var basePath = model.GetPath(rootPath);
            var ids      = model.EnumResultIds(basePath);

            var results = ids
                          .OrderByDescending(c => c)
                          .Take(50)
                          .Select(c => model.GetTestResult(basePath, c))
                          .ToArray();

            return(View(results));
        }
Exemple #12
0
        public override void Perform(SeleniumSideModel tests, SeleniumTestModel test, SeleniumCommandModel comand)
        {
            var element = SearchElement(comand);

            element
            .Should()
            .NotBeNull();

            var preventDefault = false;

            var customEvent = GetCustomEvent <ClickCommandDelegate>();

            customEvent?.Invoke(tests, test, comand, element, ref preventDefault);

            if (!preventDefault)
            {
                element.Click();
            }
        }
Exemple #13
0
 public override void Perform(SeleniumSideModel tests, SeleniumTestModel test, SeleniumCommandModel comand)
 {
     Current.Driver.Close();
 }
Exemple #14
0
 public abstract void Perform(SeleniumSideModel tests, SeleniumTestModel test, SeleniumCommandModel comand);
 public override void Perform(SeleniumSideModel tests, SeleniumTestModel test, SeleniumCommandModel comand)
 {
 }
Exemple #16
0
 public override void Perform(SeleniumSideModel tests, SeleniumTestModel test, SeleniumCommandModel comand)
 {
     Current.Driver.Navigate().GoToUrl(tests.Url + comand.Target);
 }