public void ExcelgetFormulaTest()
 {
     scripter.Text = ($@"excel.open {SpecialChars.Variable}xlsPath sheet Add
                         excel.getformula row 1 colindex 3");
     scripter.Run();
     Assert.AreEqual(formula, scripter.Variables.GetVariableValue <string>("result"));
 }
        public void XlsxGetValueDifferentTypesTest()
        {
            scripter.Text = $@"
            xlsx.open {SpecialChars.Variable}xlsPath result {SpecialChars.Variable}id
            xlsx.getvalue row 1 colindex 1 result {SpecialChars.Variable}result1
            xlsx.getvalue row 1 colindex 2 result {SpecialChars.Variable}result2
            xlsx.getvalue row 1 colindex 4 result {SpecialChars.Variable}result3
            xlsx.getvalue row 2 colindex 7 result {SpecialChars.Variable}result4
            xlsx.getvalue row 5 colindex 27 result {SpecialChars.Variable}result6
            xlsx.getvalue row 5 colindex 52 result {SpecialChars.Variable}result7
            xlsx.getvalue row 5 colindex 53 result {SpecialChars.Variable}result8
            xlsx.getvalue row 5 colindex 728 result {SpecialChars.Variable}result9
            xlsx.getvalue row 5 colindex 731 result {SpecialChars.Variable}result10
            xlsx.getvalue row 5 colindex 26 result {SpecialChars.Variable}result11
            xlsx.getvalue row 22 colindex 38 result {SpecialChars.Variable}result12
";
            scripter.Run();
            Assert.AreEqual("1234", scripter.Variables.GetVariable("result1").GetValue().Object);
            Assert.AreEqual("abcd", scripter.Variables.GetVariable("result2").GetValue().Object);
            Assert.AreEqual("150", scripter.Variables.GetVariable("result3").GetValue().Object);

            Assert.AreEqual("AA", scripter.Variables.GetVariable("result6").GetValue().Object);
            Assert.AreEqual("AZ", scripter.Variables.GetVariable("result7").GetValue().Object);
            Assert.AreEqual("BA", scripter.Variables.GetVariable("result8").GetValue().Object);
            Assert.AreEqual("AAZ", scripter.Variables.GetVariable("result9").GetValue().Object);
            Assert.AreEqual("ABC", scripter.Variables.GetVariable("result10").GetValue().Object);
            Assert.AreEqual("Z", scripter.Variables.GetVariable("result11").GetValue().Object);

            Assert.IsTrue(string.IsNullOrEmpty(scripter.Variables.GetVariable("result12").GetValue().Object.ToString()));
        }
 public void ExcelActivateSheetTest()
 {
     scripter.Text = ($@"excel.open {SpecialChars.Variable}xlsPath
                       excel.activatesheet name {SpecialChars.Text}Macro{SpecialChars.Text}
                       excel.close");
     scripter.Run();
 }
 public void WaitForValueSuccessTest()
 {
     scripter.Text = $@"
                     ie.open url {SpecialChars.Text}https://secure.tibia.com/community/?subtopic=characters{SpecialChars.Text}
                     ie.waitforvalue script {SpecialChars.Text}document.querySelectorAll('input[name=""name""]').length > 0{SpecialChars.Text} timeout 15000 expectedvalue true
                     ie.close";
     scripter.Run();
 }
Exemplo n.º 5
0
        public void FindAllTest()
        {
            int    expectedRectanglesCount = 8;
            string imageWithRectanglesPath = Assembly.GetExecutingAssembly().UnpackResourceToFile("Resources." + nameof(Resources.Rectangles8), "png");

            scripter.Text = ($"image.findrectangles {SpecialChars.Text}{imageWithRectanglesPath}{SpecialChars.Text}");
            scripter.Run();
            Assert.AreEqual(expectedRectanglesCount, scripter.Variables.GetVariableValue <List <Object> >("result").Count);
        }
Exemplo n.º 6
0
 public void ExcelDuplicateRowTest()
 {
     scripter.Text = ($@"excel.open ♥xlsPath sheet Add
                         excel.duplicaterow source 1 destination 2
                         excel.getvalue row 2 colindex 1
                         excel.close");
     scripter.Run();
     Assert.AreEqual(3, int.Parse(scripter.Variables.GetVariableValue <string>("result")));
 }
 public void ExcelExportTest()
 {
     scripter.Text = ($@"excel.open {SpecialChars.Variable}xlsPath
                       excel.export {SpecialChars.Variable}pdfPath
                       excel.export {SpecialChars.Variable}xpsPath");
     scripter.Run();
     Assert.IsTrue(File.Exists(xpsPath));
     Assert.IsTrue(File.Exists(pdfPath));
 }
Exemplo n.º 8
0
 public void XlsxSetSheetDefault()
 {
     scripter.Text = $@"
     xlsx.open {SpecialChars.Variable}xlsPath result {SpecialChars.Variable}id
     xlsx.setsheet result {SpecialChars.Variable}res
     ";
     scripter.Run();
     Assert.IsTrue(scripter.Variables.GetVariableValue <bool>("res"));
 }
        public void ExcelInsertRowFailTest()
        {
            scripter.Text = "excel.insertcolumn colindex 1 where haha";
            Exception exception = Assert.Throws <ApplicationException>(delegate
            {
                scripter.Run();
            });

            Assert.IsInstanceOf <ArgumentException>(exception.GetBaseException());
        }
Exemplo n.º 10
0
 public void IEOpenTestSuccessTest()
 {
     scripter.Text = $@"
                     ie.open
                     ie.open
                     ie.open
                     ";
     scripter.Run();
     Assert.IsTrue(IETests.GetIeInstancesCount() == 3);
 }
Exemplo n.º 11
0
 public void ExcelGetValueTest()
 {
     scripter.Text = ($@"excel.open {SpecialChars.Variable}xlsPath sheet Add
                        excel.getvalue row 1 colindex 1 result {SpecialChars.Variable}result1
                        excel.getvalue row 1 colindex 3 result {SpecialChars.Variable}result3
                        excel.getvalue row 1 colindex 2 result {SpecialChars.Variable}result2");
     scripter.Run();
     Assert.AreEqual(3, int.Parse(scripter.Variables.GetVariable("result1").GetValue().Object.ToString()));
     Assert.AreEqual(4, int.Parse(scripter.Variables.GetVariable("result2").GetValue().Object.ToString()));
     Assert.AreEqual(7, int.Parse(scripter.Variables.GetVariable("result3").GetValue().Object.ToString()));
 }
        public void GoogleSheetDownloadFileXLSX()
        {
            scripter.Text = ($@"googlesheet.open {SpecialChars.Variable}fileid isshared false
                                {SpecialChars.Variable}savePath = {SpecialChars.Variable}temp{SpecialChars.Text}\\SheetsTest.xlsx{SpecialChars.Text}
                                googlesheet.download path {SpecialChars.Variable}savePath type {SpecialChars.Text}xls{SpecialChars.Text}
                                delay 3
googlesheet.close");
            scripter.Run();
            var result = scripter.Variables.GetVariable("result");

            Assert.AreEqual("Download complete.", result.GetValue().ToString());
        }
Exemplo n.º 13
0
        public void IERunScriptSuccessTest()
        {
            scripter.Text = $@"
                            ie.open
                            ie.seturl {SpecialChars.Text}google.pl{SpecialChars.Text}
                            ie.runscript script {SpecialChars.Text}2 + 5{SpecialChars.Text}
                            ";
            scripter.Run();
            string result = scripter.Variables.GetVariableValue <string>("result", string.Empty, true)?.ToLower();

            Assert.AreEqual(result, 7.ToString());
        }
Exemplo n.º 14
0
        public void CountRowsTest()
        {
            int rowCount;

            scripter.InitVariables.Clear();
            scripter.InitVariables.Add("xlsPath", new TextStructure(file));
            scripter.Text = $@"xlsx.open {SpecialChars.Variable}xlsPath result {SpecialChars.Variable}id
            xlsx.countrows result {SpecialChars.Variable}rowCunt";
            scripter.Run();
            rowCount = scripter.Variables.GetVariableValue <int>("rowCunt", -1, true);
            Assert.AreEqual(5, rowCount);
        }
Exemplo n.º 15
0
        public void ProcessFileTest()
        {
            scripter.Text = ($"ocrabbyy.processfile {SpecialChars.Variable}file language English");
            scripter.Run();
            int documentId = scripter.Variables.GetVariableValue <int>("result");

            FineReaderDocument document = AbbyyManager.Instance.GetDocument(documentId);

            Assert.IsNotNull(document);
            string plainText = document.GetAllText();

            Assert.AreEqual(Properties.Resources.documentText, plainText);
        }
Exemplo n.º 16
0
        public void IEWaitForCompleteSuccessGoogleTests()
        {
            scripter.Text = $@"
                            ie.open
                            ie.seturl google.pl nowait true
                            ie.waitforcomplete timeout 20000
                            ie.gettitle result {SpecialChars.Variable}title
                            ";
            scripter.Run();
            var title = scripter.Variables.GetVariableValue <string>("title").ToLower();

            Assert.IsTrue(title.Contains("google"));
        }
        public void CloseTest()
        {
            scripter.RunLine($@"ocrabbyy.processfile {SpecialChars.Variable}file result {SpecialChars.Variable}result1
                               ocrabbyy.processfile {SpecialChars.Variable}file
                               ocrabbyy.close");
            scripter.Run();
            int documentId = scripter.Variables.GetVariableValue <int>("result1");
            FineReaderDocument document = AbbyyManager.Instance.GetDocument(documentId);
            long engineLoadedMemory     = GetAllocatedMemory();
            long engineUnloadedMemory   = GetAllocatedMemory();

            Assert.IsTrue(engineLoadedMemory - engineUnloadedMemory > 0x10000, $"Closing engine relesed less than 1MB of memory, relesed bytes = {engineLoadedMemory - engineUnloadedMemory}");
        }
        public void IEGetTitleSuccessTest()
        {
            scripter.Text = $@"
                            ie.open
                            ie.seturl {SpecialChars.Text}google.pl{SpecialChars.Text}
                            ie.waitforvalue script {SpecialChars.Text}document.querySelectorAll('#lst-ib').length > 0{SpecialChars.Text} timeout 15000 expectedvalue true
                            ie.gettitle result {SpecialChars.Variable}title
                            ";
            scripter.Run();
            string title = scripter.Variables.GetVariableValue <string>("title", string.Empty, true)?.ToLower();

            Assert.IsTrue(title.Contains("google"));
        }
Exemplo n.º 19
0
        public void IEGetAttributeSuccessTest()
        {
            scripter.Text = $@"
                            ie.open timeout 20000
                            ie.seturl {SpecialChars.Text}google.pl{SpecialChars.Text} timeout 20000
                            ie.waitforvalue script {SpecialChars.Text}document.querySelectorAll('input[name=""q""]').length > 0{SpecialChars.Text} timeout 15000 expectedvalue true
                            ie.getattribute name {SpecialChars.Text}title{SpecialChars.Text} search {SpecialChars.Text}lst-ib{SpecialChars.Text} by id result {SpecialChars.Variable}title
                            ";
            scripter.Run();
            string title = scripter.Variables.GetVariableValue <string>("title", string.Empty, true)?.ToLower();

            Assert.IsTrue(title == "search" || title == "szukaj");
        }
        public void IEDetachSuccessTest()
        {
            scripter.Text = $@"
                            ie.open result {SpecialChars.Variable}result1
                            ie.open result {SpecialChars.Variable}result2
                            ie.switch {SpecialChars.Variable}result1
                            ie.detach
                            ie.switch {SpecialChars.Variable}result2
                            ie.detach";

            scripter.Run();
            Assert.IsTrue(IETests.GetIeInstancesCount() != 0);
        }
        public void IEClickTestsSuccessTest()
        {
            string titleVariable      = "title";
            string titleShouldContain = "gmail";

            scripter.Text = $@"
                            ie.open {pageAddress}
                            ie.click search {SpecialChars.Text}a.gb_P[href='https://mail.google.com/mail/?tab=wm']{SpecialChars.Text} by query timeout 30000
                            ie.gettitle result {SpecialChars.Variable}{titleVariable}";
            scripter.Run();
            string title = scripter.Variables.GetVariableValue <string>(titleVariable, string.Empty, true)?.ToLower();

            Assert.IsTrue(title.Contains(titleShouldContain));
        }
Exemplo n.º 22
0
        public void XlsxFindDifferentTypesTest()
        {
            scripter.Text = $@"xlsx.open {SpecialChars.Variable}xlsPath result {SpecialChars.Variable}id
            xlsx.find 1234 resultrow {SpecialChars.Variable}resrow resultcolumn {SpecialChars.Variable}resCol
            xlsx.find {SpecialChars.Text}abcd{SpecialChars.Text} resultrow {SpecialChars.Variable}resrow2 resultcolumn {SpecialChars.Variable}resCol2
            xlsx.find 150 resultrow {SpecialChars.Variable}resrow3 resultcolumn {SpecialChars.Variable}resCol3
            -xlsx.find {SpecialChars.Text}160%{SpecialChars.Text} resultrow {SpecialChars.Variable}resrow4 resultcolumn {SpecialChars.Variable}resCol4
            -xlsx.find {SpecialChars.Text}100%{SpecialChars.Text} resultrow {SpecialChars.Variable}resrow5 resultcolumn {SpecialChars.Variable}resCol5
            xlsx.find {SpecialChars.Text}AA{SpecialChars.Text} resultrow {SpecialChars.Variable}resrow6 resultcolumn {SpecialChars.Variable}resCol6
            xlsx.find {SpecialChars.Text}AZ{SpecialChars.Text} resultrow {SpecialChars.Variable}resrow7 resultcolumn {SpecialChars.Variable}resCol7
            xlsx.find {SpecialChars.Text}BA{SpecialChars.Text} resultrow {SpecialChars.Variable}resrow8 resultcolumn {SpecialChars.Variable}resCol8
            xlsx.find {SpecialChars.Text}AAZ{SpecialChars.Text} resultrow {SpecialChars.Variable}resrow9 resultcolumn {SpecialChars.Variable}resCol9
            xlsx.find {SpecialChars.Text}ABC{SpecialChars.Text} resultrow {SpecialChars.Variable}resrow10 resultcolumn {SpecialChars.Variable}resCol10
            xlsx.find {SpecialChars.Text}Z{SpecialChars.Text} resultrow {SpecialChars.Variable}resrow11 resultcolumn {SpecialChars.Variable}resCol11

";
            scripter.Run();
            Assert.AreEqual(1, scripter.Variables.GetVariable("resrow").GetValue().Object);
            Assert.AreEqual(1, scripter.Variables.GetVariable("resCol").GetValue().Object);

            Assert.AreEqual(1, scripter.Variables.GetVariable("resrow2").GetValue().Object);
            Assert.AreEqual(2, scripter.Variables.GetVariable("resCol2").GetValue().Object);

            Assert.AreEqual(1, scripter.Variables.GetVariable("resrow3").GetValue().Object);
            Assert.AreEqual(4, scripter.Variables.GetVariable("resCol3").GetValue().Object);

            //Assert.AreEqual(1, scripter.Variables.GetVariable("resrow4").GetValue().Object);
            //Assert.AreEqual(5, scripter.Variables.GetVariable("resCol4").GetValue().Object);

            //Assert.AreEqual(2, scripter.Variables.GetVariable("resrow5").GetValue().Object);
            //Assert.AreEqual(5, scripter.Variables.GetVariable("resCol5").GetValue().Object);

            Assert.AreEqual(5, scripter.Variables.GetVariable("resrow6").GetValue().Object);
            Assert.AreEqual(27, scripter.Variables.GetVariable("resCol6").GetValue().Object);

            Assert.AreEqual(5, scripter.Variables.GetVariable("resrow7").GetValue().Object);
            Assert.AreEqual(52, scripter.Variables.GetVariable("resCol7").GetValue().Object);

            Assert.AreEqual(5, scripter.Variables.GetVariable("resrow8").GetValue().Object);
            Assert.AreEqual(53, scripter.Variables.GetVariable("resCol8").GetValue().Object);

            Assert.AreEqual(5, scripter.Variables.GetVariable("resrow9").GetValue().Object);
            Assert.AreEqual(728, scripter.Variables.GetVariable("resCol9").GetValue().Object);

            Assert.AreEqual(5, scripter.Variables.GetVariable("resrow10").GetValue().Object);
            Assert.AreEqual(731, scripter.Variables.GetVariable("resCol10").GetValue().Object);

            Assert.AreEqual(5, scripter.Variables.GetVariable("resrow11").GetValue().Object);
            Assert.AreEqual(26, scripter.Variables.GetVariable("resCol11").GetValue().Object);
        }
Exemplo n.º 23
0
        public void IEFireEventTestsSuccessTest()
        {
            scripter.Text = $@"
                            ie.open
                            ie.seturl {SpecialChars.Text}google.pl{SpecialChars.Text}
                            ie.waitforvalue script {SpecialChars.Text}document.querySelectorAll('input[name=""q""]').length > 0{SpecialChars.Text} timeout 15000 expectedvalue true
                            ie.fireevent eventname {SpecialChars.Text}onclick{SpecialChars.Text} search {SpecialChars.Text}a.gb_P[href='https://mail.google.com/mail/?tab=wm']{SpecialChars.Text} by query timeout 15000
                            ie.gettitle result {SpecialChars.Variable}title
                            ie.close";
            scripter.Run();
            string title = scripter.Variables.GetVariableValue <string>("title", string.Empty, true)?.ToLower();

            Assert.IsTrue(title.Contains("gmail"));
        }
        public void ReadTabletest()
        {
            Scripter scripter = new Scripter();

            scripter.InitVariables.Clear();

            scripter.Text = ($@"ocrabbyy.processfile {SpecialChars.Text}{path}{SpecialChars.Text}
                                ocrabbyy.readtables");
            scripter.Run();
            List <GStruct.Structure> cells = scripter.Variables.GetVariableValue <List <GStruct.Structure> >("result");

            List <string> values = new List <string>()
            {
                "Egypt", "Nigeria"
            };

            for (int i = 0; i < cells.Count; i++)
            {
                for (int j = 0; j < values.Count; j++)
                {
                    if (values[j] == ((GStruct.TextStructure)cells[i]).Value.Trim())
                    {
                        values.Remove(values[j]);
                    }
                }
            }

            Assert.AreEqual(0, values.Count, $"Havent found values {values}");
        }
        public void WaitForExistingImageTest()
        {
            testerApp = SDK.Tester.RunFormTester("Title TestApp");

            Color  color     = Color.Gainsboro;
            string colorCode = "FFDCDCDC";

            RobotWin32.ShowWindow(testerApp.MainWindowHandle, RobotWin32.ShowWindowEnum.ShowNormal);

            Scripter scripter = new Scripter();

            scripter.InitVariables.Clear();
            scripter.RunLine("window TestApp");
            scripter.InitVariables.Add(nameof(colorCode), new TextStructure(colorCode));
            scripter.Text = $@"keyboard {TextChar}FocusOnControl tbColorRGB{TextChar}
				            keyboard {SpecialChars.KeyBegin}enter{SpecialChars.KeyEnd}
                            keyboard {TextChar}{SpecialChars.Variable}{nameof(colorCode)}{TextChar} 
                            keyboard {SpecialChars.KeyBegin}enter{SpecialChars.KeyEnd}";

            scripter.Run();

            string path1 = Assembly.GetExecutingAssembly().UnpackResourceToFile("Resources." + nameof(Resources.littleGrayRectangle), "bmp");

            scripter.RunLine($"waitfor.image image {SpecialChars.Text}{path1}{SpecialChars.Text}");
        }
Exemplo n.º 26
0
        public void FilterTest()
        {
            List <string> boldedTexts = new List <string>()
            {
                "In 1929", "In 1949", "In 1950,", "In 1955,"
            };
            string path = Assembly.GetExecutingAssembly().UnpackResourceToFile("Resources." + nameof(Resources.document2), "jpg");

            Scripter scripter = new Scripter();

            scripter.InitVariables.Clear();
            scripter.Text = ($@"ocrabbyy.processfile {SpecialChars.Text}{path}{SpecialChars.Text}
                                ocrabbyy.filter filter bold");
            scripter.Run();
            List <GStruct.Structure> res = scripter.Variables.GetVariableValue <List <GStruct.Structure> >("result");

            foreach (GStruct.Structure value in res)
            {
                string text = ((GStruct.TextStructure)value).Value.Trim();
                if (boldedTexts.Contains(text))
                {
                    boldedTexts.Remove(text);
                }
            }

            System.Text.StringBuilder notRecognizedBold = new System.Text.StringBuilder();
            foreach (string s in boldedTexts)
            {
                notRecognizedBold.Append($" '{s}'");
            }

            Assert.AreEqual(0, boldedTexts.Count, $"Text not recognized as boold {notRecognizedBold}");
        }
        public void WordSaveTest()
        {
            string savePath = Environment.CurrentDirectory + @"\test.docx";

            scripter.Text =
                $@"word.open
                window {SpecialChars.Text}{SpecialChars.Search}word{SpecialChars.Search}{SpecialChars.Text}
                keyboard {SpecialChars.Text}{wordToBeTested}{SpecialChars.Text}
                word.save {SpecialChars.Variable}savePath
                word.close
                delay 4
                word.open {SpecialChars.Variable}savePath
                window {SpecialChars.Text}{SpecialChars.Search}word{SpecialChars.Search}{SpecialChars.Text}
                word.gettext
                word.close";

            scripter.InitVariables.Add("savePath", new TextStructure(savePath));
            scripter.Run();
            Assert.AreEqual(wordToBeTested, scripter.Variables.GetVariableValue <string>("result").Trim());

            FileInfo f = new FileInfo(savePath);

            Assert.IsTrue(f.Exists);
            f.Delete();
        }
Exemplo n.º 28
0
 public void ExcelRemovecolindexumnTest()
 {
     scripter.Text = ($@"excel.open
                         excel.setvalue aaa row 1 colindex 1
                         excel.setvalue bbb row 1 colindex 2
                         excel.insertcolumn colindex 1 where after
                         excel.removecolumn colindex 2
                         excel.getvalue row 1 colindex 2 result {SpecialChars.Variable}result1
                         excel.insertcolumn colindex 2 where before
                         excel.removecolumn colname b
                         excel.getvalue row 1 colindex 2
                         excel.close");
     scripter.Run();
     Assert.AreEqual("bbb", scripter.Variables.GetVariableValue <string>("result1"));
     Assert.AreEqual("bbb", scripter.Variables.GetVariableValue <string>("result"));
 }
Exemplo n.º 29
0
        public void ExpectImageOnScreenTest()
        {
            string colorCode = "FFF0F8FF";

            testerApp = SDK.Tester.RunFormTester("Title TestApp");

            Scripter scripter = new Scripter();

            scripter.InitVariables.Clear();
            string image1 = Assembly.GetExecutingAssembly().UnpackResourceToFile("Resources." + nameof(Resources.FFF0F8FF), "bmp");

            scripter.InitVariables.Add(nameof(colorCode), new TextStructure(colorCode));
            scripter.Text = $@"image.expected image1 {SpecialChars.Text}{image1}{SpecialChars.Text}
                            window TestApp
                            keyboard {TextChar}FocusOnControl tbColorRGB{TextChar}
				            keyboard {SpecialChars.KeyBegin}enter{SpecialChars.KeyEnd}
                            keyboard {TextChar}{SpecialChars.Variable}{nameof(colorCode)}{TextChar} 
                            keyboard {SpecialChars.KeyBegin}enter{SpecialChars.KeyEnd}";
            scripter.Run();


            var result = scripter.Variables.GetVariableValue <bool>("result");

            Assert.IsTrue(result);
        }
Exemplo n.º 30
0
        public void WordExportTest()
        {
            string pdfPath = Environment.CurrentDirectory + @"\test.pdf";
            string xpsPath = Environment.CurrentDirectory + @"\test.xps";


            scripter.InitVariables.Add("pdfPath", new TextStructure(pdfPath));
            scripter.InitVariables.Add("xpsPath", new TextStructure(xpsPath));

            scripter.Text =
                $@"word.open
                    word.export {SpecialChars.Variable}pdfPath
                    word.export {SpecialChars.Variable}xpsPath type xps
                    word.close";
            scripter.Run();

            FileInfo pdfFile = new FileInfo(pdfPath);
            FileInfo xpsFile = new FileInfo(xpsPath);

            Assert.IsTrue(pdfFile.Exists);
            Assert.IsTrue(xpsFile.Exists);

            pdfFile.Delete();
            xpsFile.Delete();
        }