Пример #1
0
        public void UseCommandListGetAndJumpToTest()
        {
            bool didPass = false;

            try
            {
                Ca.TestName = "UseCommandListGetAndJumpToTest";

                List <BatchCommandList> cmd = new List <BatchCommandList>();
                cmd.Add(new BatchCommandList()
                {
                    Actions     = GeneralActions.MyAction.Click,
                    UseCommand  = GeneralActions.UseCommand.WaitFound,
                    ElementName = "//li[4]/a",
                    FindBy      = GeneralActions.FindBy.XPath,
                    TestName    = @"Click On iOS App Menu"
                });
                cmd.Add(new BatchCommandList()
                {
                    UseCommand  = GeneralActions.UseCommand.GetUrlAndGoTo,
                    ElementName = "My Essential Oil Remedies",
                    FindBy      = GeneralActions.FindBy.LinkText,
                    TestName    = "Get Link Text and GOto url"
                });

                List <BatchCommandList> value = Ca.RunBatchCommands(cmd, out var errOut);

                int testNumber = 1;
                foreach (BatchCommandList v in value)
                {
                    string passfailed = v.PassedFailed ? "PASSED" : "FAILED";
                    TestContext.WriteLine($"{testNumber}.) {passfailed} - {v.TestName}");
                    TestContext.WriteLine(v.ReturnedValue);
                    testNumber++;
                }

                didPass = true;
            }
            catch (Exception e)
            {
                TestContext.WriteLine(e.Message);
            }
            Assert.IsTrue(didPass);
        }
Пример #2
0
        public void UseCommandListGetAndJumpToTest()
        {
            bool didPass = false;

            try
            {
                Ca.TestName = "UseCommandListGetAndJumpToTest";

                List <BatchCommandList> cmd = new List <BatchCommandList>();
                cmd.AddRange(BatchCmdHelper.Sleep500());
                cmd.AddRange(BatchCmdHelper.ClickOnElement("//ul[@id='jetmenu']/li[3]/a", "software app menu"));
                cmd.AddRange(BatchCmdHelper.Sleep500());
                cmd.AddRange(BatchCmdHelper.ClickOnElement("//ul[@id='jetmenu']/li[4]/a", "iOS App Menu"));
                cmd.AddRange(BatchCmdHelper.Sleep500());
                cmd.Add(new BatchCommandList()
                {
                    UseCommand  = GeneralActions.UseCommand.GetUrlAndGoTo,
                    ElementName = "//a[contains(.,'My Essential Oil Remedies')]",
                    TestName    = "Get Link Text and GOto url"
                });

                List <BatchCommandList> value = Ca.RunBatchCommands(cmd, out var errOut);

                int testNumber = 1;
                foreach (BatchCommandList v in value)
                {
                    string passfailed = v.PassedFailed ? "PASSED" : "FAILED";
                    TestContext.WriteLine($"{testNumber}.) {passfailed} - {v.TestName}");
                    TestContext.WriteLine(v.ReturnedValue);
                    testNumber++;
                }

                didPass = Ca.AllTestsPassed(value);
            }
            catch (Exception e)
            {
                TestContext.WriteLine(e.Message);
            }
            Assert.IsTrue(didPass);
        }
Пример #3
0
        public void PublicSideBatch()
        {
            Ca.TestName = "PublicUIBatch";
            string softwareMenu         = "//ul[@id='jetmenu']/li[3]/a";
            List <BatchCommandList> cmd = new List <BatchCommandList>();

            cmd.Add(new BatchCommandList()
            {
                Actions     = GeneralActions.MyAction.Click, UseCommand = GeneralActions.UseCommand.WaitFound,
                ElementName = softwareMenu, FindBy = GeneralActions.FindBy.XPath, TestName = @"Click On Windows App Menu"
            });
            cmd.Add(new BatchCommandList()
            {
                Actions     = GeneralActions.MyAction.Click,
                UseCommand  = GeneralActions.UseCommand.WaitFound,
                ElementName = "My Gun Collection",
                FindBy      = GeneralActions.FindBy.LinkText,
                TestName    = "Click on the My Gun Collection link"
            });


            cmd.Add(new BatchCommandList()
            {
                Actions     = GeneralActions.MyAction.Click,
                UseCommand  = GeneralActions.UseCommand.WaitFound,
                ElementName = softwareMenu,
                FindBy      = GeneralActions.FindBy.XPath,
                TestName    = @"Click On Windows App Menu"
            });
            cmd.Add(new BatchCommandList()
            {
                Actions     = GeneralActions.MyAction.Click,
                UseCommand  = GeneralActions.UseCommand.WaitFound,
                ElementName = "My Gun Collection",
                FindBy      = GeneralActions.FindBy.LinkText,
                TestName    = "Click on the My Gun Collection link"
            });

            cmd.Add(new BatchCommandList()
            {
                Actions     = GeneralActions.MyAction.Nothing,
                UseCommand  = GeneralActions.UseCommand.GetTextValue,
                ElementName = "//h3/span",
                FindBy      = GeneralActions.FindBy.XPath,
                TestName    = "Get Price of My Gun Collector Software"
            });

            cmd.Add(new BatchCommandList()
            {
                Actions               = GeneralActions.MyAction.Nothing,
                UseCommand            = GeneralActions.UseCommand.GetTextValueAndCompare,
                ElementName           = "//h3/span",
                FindBy                = GeneralActions.FindBy.XPath,
                TestName              = "Get Price of My Gun Collector Software and Compare to exptected Version",
                ExpectedReturnedValue = "FREE!"
            });

            List <BatchCommandList> value = Ca.RunBatchCommands(cmd, out var errOut);

            int testNumber = 1;

            foreach (BatchCommandList v in value)
            {
                string passfailed = v.PassedFailed ? "PASSED" : "FAILED";
                TestContext.WriteLine($"{testNumber}.) {passfailed} - {v.TestName}");
                TestContext.WriteLine(v.ReturnedValue);
                testNumber++;
            }
        }