Пример #1
0
        //We do visual compare using ImageMagick
        public bool IsVisualEquel(Visual visual, string VisualID)
        {
            string tempScreenFolder = TestResources.getGingerUnitTesterTempFolder("VisualCompareScreens");

            if (!System.IO.Directory.Exists(tempScreenFolder))
            {
                System.IO.Directory.CreateDirectory(tempScreenFolder);
            }
            string FileName = Path.Combine(tempScreenFolder, VisualID + ".png");

            if (File.Exists(FileName))
            {
                File.Delete(FileName);
            }
            TakeVisualScreenShot(visual, FileName);
            string BaselineFileName = TestResources.GetTestResourcesFile(@"VisualCompareScreens\" + VisualID + ".png");
            string ResultFileName   = Path.Combine(tempScreenFolder, VisualID + "_Diff.png");

            if (File.Exists(ResultFileName))
            {
                File.Delete(ResultFileName);
            }
            // Copy also baseline to output temp folder
            if (System.IO.File.Exists(BaselineFileName))
            {
                string baseLinefileName = Path.Combine(tempScreenFolder, VisualID + ".Baseline.png");
                File.Copy(BaselineFileName, baseLinefileName, true);
                bool Diff = IsBitmapEquel(BaselineFileName, FileName, ResultFileName);
                return(Diff);
            }
            else
            {
                throw new Exception("No baseline file for comapre, missing: " + BaselineFileName);
            }
        }
Пример #2
0
        public static void ClassInitialize(TestContext TC)
        {
            TempRepositoryFolder = TestResources.getGingerUnitTesterTempFolder("Solutions", "SRTestTemp");
            Console.WriteLine("SolutionRepositoryTest folder: " + TempRepositoryFolder);

            Console.WriteLine("===> Creating test solution");
            CreateTestSolution();
            Console.WriteLine("===> test solution created");

            mRepositorySerializer = new NewRepositorySerializer();
            // Init SR
            mSolutionRepository = new SolutionRepository();
            mSolutionRepository.AddItemInfo <MyRepositoryItem>(pattern: "*.Ginger.MyRepositoryItem.xml",   // Need to use for file name
                                                               rootFolder: SolutionRepository.cSolutionRootFolderSign + "MyRepositoryItems",
                                                               containRepositoryItems: true,
                                                               displayName: "My Repository Item",
                                                               addToRootFolders: true,
                                                               PropertyNameForFileName: nameof(MyRepositoryItem.Name)
                                                               );

            NewRepositorySerializer RS = new NewRepositorySerializer();

            NewRepositorySerializer.AddClassesFromAssembly(typeof(MyRepositoryItem).Assembly);
            mSolutionRepository.Open(TempRepositoryFolder);
        }
        public static void ClassInitialize(TestContext TestContext)
        {
            DummyWorkSpace ws = new DummyWorkSpace();

            WorkSpace.Init(ws);

            string folder = TestResources.getGingerUnitTesterTempFolder("Solutions", "PluginTest");

            if (Directory.Exists(folder))
            {
                Directory.Delete(folder, true);
            }

            SR = new SolutionRepository();
            SR.AddItemInfo <PluginPackage>("*.Ginger.PluginPackage.xml", @"~\Plugins", true, "Plugins", addToRootFolders: true, PropertyNameForFileName: nameof(PluginPackage.PluginID));
            SR.CreateRepository(folder);
            SR.Open(folder);
            WorkSpace.Instance.SolutionRepository = SR;
            string pluginFolder = TestResources.GetTestResourcesFolder(@"PluginPackages\GingerOfficePlugin");


            //string txt = WorkSpace.Instance.PlugInsManager.CreatePluginPackageInfo("GingerOfficePlugin", "1.0.0");
            //System.IO.File.WriteAllText(pluginFolder + @"\Ginger.PluginPackage.json", txt);


            WorkSpace.Instance.PlugInsManager.AddPluginPackage(pluginFolder);
        }
Пример #4
0
        public static void ClassInit(TestContext context)
        {
            AutoLogProxy.Init("Unit Tests");

            // Create new solution
            mBusinessFlow            = new BusinessFlow();
            mBusinessFlow.Activities = new ObservableList <Activity>();
            mBusinessFlow.Name       = "MyDriver BF";
            mBusinessFlow.Active     = true;
            Platform p = new Platform();

            p.PlatformType          = ePlatformType.NA;
            mBusinessFlow.Platforms = new ObservableList <Platform>();
            mBusinessFlow.Platforms.Add(p);
            mBusinessFlow.TargetApplications.Add(new TargetApplication()
            {
                AppName = mAppName
            });

            mGingerRunner = new GingerRunner();
            mGingerRunner.CurrentSolution = new Ginger.SolutionGeneral.Solution();

            Agent agent = new Agent();

            agent.AgentType = Agent.eAgentType.Service;

            mGingerRunner.SolutionAgents = new ObservableList <Agent>();
            mGingerRunner.SolutionAgents.Add(agent);

            mGingerRunner.ApplicationAgents.Add(new ApplicationAgent()
            {
                AppName = mAppName, Agent = agent
            });
            mGingerRunner.SolutionApplications = new ObservableList <ApplicationPlatform>();
            mGingerRunner.SolutionApplications.Add(new ApplicationPlatform()
            {
                AppName = mAppName, Platform = ePlatformType.NA
            });
            mGingerRunner.BusinessFlows.Add(mBusinessFlow);


            // Add the plugin to solution
            WorkSpace.Init(new WorkSpaceEventHandler());
            WorkSpace.Instance.SolutionRepository = Ginger.App.CreateGingerSolutionRepository();

            string solutionfolder = TestResources.getGingerUnitTesterTempFolder("sol1");

            if (Directory.Exists(solutionfolder))
            {
                Directory.Delete(solutionfolder, true);
            }
            WorkSpace.Instance.SolutionRepository.CreateRepository(solutionfolder);
            WorkSpace.Instance.SolutionRepository.Open(solutionfolder);

            string pluginFolder = TestResources.GetTestResourcesFolder(@"Plugins\PluginDriverExample4");

            WorkSpace.Instance.PlugInsManager.AddPluginPackage(pluginFolder);
        }
        public static void ClassInitialize(TestContext TC)
        {
            CreateTestSolution();

            // Init SR
            mSolutionRepository = Ginger.App.CreateGingerSolutionRepository();
            Ginger.App.InitClassTypesDictionary();
            string TempRepositoryFolder = TestResources.getGingerUnitTesterTempFolder(@"Solutions\SRTestTemp");

            mSolutionRepository.Open(TempRepositoryFolder);
        }
Пример #6
0
        public void TestInitialize()
        {
            string TempSolutionFolder = TestResources.getGingerUnitTesterTempFolder(@"Solutions\WSDL");

            if (Directory.Exists(TempSolutionFolder))
            {
                Directory.Delete(TempSolutionFolder, true);
            }
            //Solution.CreateNewSolution("WSDL", TempSolutionFolder);
            //SR = new SolutionRepository();
            //SR.Open(TempSolutionFolder);
        }
        public void DirService_CheckDirExists()
        {
            //Arrange
            string       tempFolder = TestResources.getGingerUnitTesterTempFolder(testFolderName);
            DirService   dirService = new DirService();
            GingerAction gingerAct  = new GingerAction();

            //Act
            dirService.DirExists(gingerAct, tempFolder);

            //Assert
            Assert.AreEqual("True", gingerAct.Output["DirExists"], "DirExists=True");
        }
Пример #8
0
        public static void ClassInit(TestContext TC)
        {
            mTC = TC;
            string sampleSolutionFolder = TestResources.GetTestResourcesFolder(@"Solutions\EnvsTest");

            SolutionFolder = TestResources.getGingerUnitTesterTempFolder(@"Solutions\EnvsTest");
            if (Directory.Exists(SolutionFolder))
            {
                Directory.Delete(SolutionFolder, true);
            }
            CopyDir.Copy(sampleSolutionFolder, SolutionFolder);

            mGingerAutomator = GingerAutomator.StartSession();
            mGingerAutomator.OpenSolution(SolutionFolder);
        }
        private static void CreateTestSolution()
        {
            // First we create a basic solution with some sample items
            SolutionRepository SR = new SolutionRepository();
            string             TempRepositoryFolder = TestResources.getGingerUnitTesterTempFolder(@"Solutions\SRTestTemp");

            if (Directory.Exists(TempRepositoryFolder))
            {
                Directory.Delete(TempRepositoryFolder, true);
            }


            SR = Ginger.App.CreateGingerSolutionRepository();
            SR.Open(TempRepositoryFolder);

            ProjEnvironment E1 = new ProjEnvironment()
            {
                Name = "E1"
            };

            SR.AddRepositoryItem(E1);



            //RepositoryFolder<MyRepositoryItem> BFRF = SR.GetRepositoryItemRootFolder<MyRepositoryItem>();
            //RepositoryFolder<MyRepositoryItem> SubFolder1 = (RepositoryFolder<MyRepositoryItem>)BFRF.AddSubFolder("SubFolder1");

            //BFRF.AddSubFolder("EmptySubFolder");

            //MyRepositoryItem BF4 = new MyRepositoryItem("A4");
            //SubFolder1.AddRepositoryItem(BF4);

            //// Folder to delete later
            //BFRF.AddSubFolder("SubFolderForDelete");

            //// Create folders tree
            //RepositoryFolder<MyRepositoryItem> SF1 = (RepositoryFolder<MyRepositoryItem>)BFRF.AddSubFolder("SF1");
            //RepositoryFolder<MyRepositoryItem> SF2 = (RepositoryFolder<MyRepositoryItem>)SF1.AddSubFolder("SF1_SF2");
            //RepositoryFolder<MyRepositoryItem> SF3 = (RepositoryFolder<MyRepositoryItem>)SF2.AddSubFolder("SF1_SF2_SF3");
            //MyRepositoryItem BF5 = new MyRepositoryItem("A5");
            //SubFolder1.AddRepositoryItem(BF5);

            //MyRepositoryItem BF6 = new MyRepositoryItem("A6");
            //SF3.AddRepositoryItem(BF6);

            //TODO: add more sample items for testing
            SR.Close();
        }
Пример #10
0
        public static void ClassInitialize(TestContext TC)
        {
            solutionName = "SRVarSync";
            CreateTestSolution();

            // Creating workspace
            WorkSpace.Init(new WorkSpaceEventHandler());
            WorkSpace.Instance.SolutionRepository = Ginger.App.CreateGingerSolutionRepository();

            // Init SR
            mSolutionRepository = WorkSpace.Instance.SolutionRepository;
            Ginger.App.InitClassTypesDictionary();
            string TempRepositoryFolder = TestResources.getGingerUnitTesterTempFolder(@"Solutions\" + solutionName);

            mSolutionRepository.Open(TempRepositoryFolder);
        }
Пример #11
0
        public void WizardWithWindowWidth()
        {
            //Arrange

            double width  = 1200;
            string folder = TestResources.getGingerUnitTesterTempFolder("MyWizardItemsFolder3");

            //Act
            WizardPOM mWizard = ShowMyWizard(folder, width);
            double    w       = mWizard.WindowPOM.Width;

            mWizard.CancelButton.Click();

            //Assert
            Assert.AreEqual(width, w, "Wizard width");
        }
Пример #12
0
        private static void CreateTestSolution()
        {
            // First we create a basic solution with some sample items
            SolutionRepository SR = new SolutionRepository();
            string             TempRepositoryFolder = TestResources.getGingerUnitTesterTempFolder(@"Solutions\" + solutionName);

            if (Directory.Exists(TempRepositoryFolder))
            {
                Directory.Delete(TempRepositoryFolder, true);
            }

            SR = Ginger.App.CreateGingerSolutionRepository();
            SR.Open(TempRepositoryFolder);

            SR.Close();
        }
        public void DirService_DirListFileCount()
        {
            //Arrange
            string       tempFolder = TestResources.getGingerUnitTesterTempFolder(testFolderName);
            DirService   dirService = new DirService();
            GingerAction gingerAct  = new GingerAction();

            string tempFile1 = Path.Combine(tempFolder, "test1.txt");
            string tempFile2 = Path.Combine(tempFolder, "test2.txt");

            //Act
            CreateTempFileContents(tempFile1);
            CreateTempFileContents(tempFile2);
            dirService.DirList(gingerAct, tempFolder);

            //Assert
            Assert.AreEqual("2", gingerAct.Output["FileCount"], "FileCount=2");
        }
Пример #14
0
        private static void CreateTestSolution()
        {
            string sourceFolder = TestResources.GetTestResourcesFolder(@"Solutions\ReportSR");

            solutionFolder = TestResources.getGingerUnitTesterTempFolder(@"Solutions\ReportSR");
            if (Directory.Exists(solutionFolder))
            {
                Directory.Delete(solutionFolder, true);
            }
            CopyDir.Copy(sourceFolder, solutionFolder);

            SolutionRepository SR = new SolutionRepository();

            SR = Ginger.App.CreateGingerSolutionRepository();
            SR.Open(solutionFolder);

            SR.Close();
        }
Пример #15
0
        public static void ClassInit(TestContext TC)
        {
            mTC = TC;
            mGingerAutomator.StartGinger();

            string sampleSolutionFolder = TestResources.GetTestResourcesFolder(@"Solutions\EnvsTest");

            SolutionFolder = TestResources.getGingerUnitTesterTempFolder(@"Solutions\EnvsTest");
            if (Directory.Exists(SolutionFolder))
            {
                Directory.Delete(SolutionFolder, true);
            }

            CopyDir.Copy(sampleSolutionFolder, SolutionFolder);

            mGingerAutomator.OpenSolution(SolutionFolder);

            LogFile = mTC.TestLogsDir + @"\GingerWPF_BasicsTest.txt";
        }
Пример #16
0
        public void CreateMyWizardItem()
        {
            //Arrange
            string folder = TestResources.getGingerUnitTesterTempFolder("MyWizardItemsFolder2");

            //Act
            WizardPOM mWizard = ShowMyWizard(folder);

            mWizard.NextButton.Click();
            mWizard.CurrentPage["Name AID"].SetText("My Wizard Item 1");
            mWizard.NextButton.Click();
            mWizard.FinishButton.Click();

            bool WizardOpen = WizardPOM.IsWizardOpen;

            //Assert

            Assert.IsFalse(WizardOpen, "Wizard was closed");
        }
Пример #17
0
        public static void ClassInitialize(TestContext TC)
        {
            string TempSolutionFolder = TestResources.getGingerUnitTesterTempFolder(@"Solutions\APIModelsTest");

            if (Directory.Exists(TempSolutionFolder))
            {
                Directory.Delete(TempSolutionFolder, true);
            }
            SR = new SolutionRepository();

            SR.AddItemInfo <ApplicationAPIModel>("*.Ginger.ApplicationAPIModel.xml", @"~\Applications Models\API Models", true, "API Models", PropertyNameForFileName: nameof(ApplicationAPIModel.Name));
            // SR.AddItemInfo<GlobalAppModelParameter>("*.Ginger.GlobalAppModelParameter.xml", @"~\Applications Models\Global Models Parameters", true, "Global Model Parameters", addToRootFolders: true, PropertyNameForFileName: nameof(GlobalAppModelParameter.PlaceHolder));

            SR.CreateRepository(TempSolutionFolder);

            NewRepositorySerializer RS = new NewRepositorySerializer();

            NewRepositorySerializer.AddClassesFromAssembly(typeof(ApplicationAPIModel).Assembly);
            SR.Open(TempSolutionFolder);
        }
Пример #18
0
        public void VerifyButtonsOnStartThenCancel()
        {
            //Arrange
            string folder = TestResources.getGingerUnitTesterTempFolder("MyWizardItemsFolder1");

            //Act
            WizardPOM mWizard             = ShowMyWizard(folder);
            bool      nextButtonEnabled   = mWizard.NextButton.IsEnabled;
            bool      prevButtonEnabled   = mWizard.PrevButton.IsEnabled;
            bool      finishButtonEnabled = mWizard.FinishButton.IsEnabled;

            mWizard.CancelButton.Click();
            bool WizardOpen = WizardPOM.IsWizardOpen;

            //Assert
            Assert.IsTrue(nextButtonEnabled, "Next button is enabled");
            Assert.IsFalse(prevButtonEnabled, "Prev button is disabled");
            Assert.IsFalse(finishButtonEnabled, "Finish button is disabled");
            Assert.IsFalse(WizardOpen, "Wizard was closed");
        }
Пример #19
0
        public static void ClassInit(TestContext TC)
        {
            TC.WriteLine("@@@@@@@@@@@@@@@@@@@@@@ ClassInit @@@@@@@@@@@@@@@@@@@@@@@@@@@@");
            mTC = TC;
            Console.WriteLine("===> Starting Ginger");
            mGingerAutomator = new GingerAutomator();
            mGingerAutomator.StartGinger();
            string sampleSolutionFolder = TestResources.GetTestResourcesFolder(@"Solutions\EnvsTest");

            SolutionFolder = TestResources.getGingerUnitTesterTempFolder(@"Solutions\EnvsTest");
            if (Directory.Exists(SolutionFolder))
            {
                Directory.Delete(SolutionFolder, true);
            }

            CopyDir.Copy(sampleSolutionFolder, SolutionFolder);

            Console.WriteLine("===> Open solution");
            TC.WriteLine("@@@@@@@@@@@@@@@@@@@@@@ Open solution @@@@@@@@@@@@@@@@@@@@@@@@@@@@");
            mGingerAutomator.OpenSolution(SolutionFolder);

            LogFile = mTC.TestLogsDir + @"\Ginger_BasicsTest.txt";
        }
Пример #20
0
        public void InstalledPluginPackageFromOnline()
        {
            //Arrange

            // TODO: create a simple plugin for unit test which will download faster.

            string PluginId      = "PACT";
            string PluginVersion = "1.6";
            string path          = TestResources.getGingerUnitTesterTempFolder(@"Solutions\PluginsManagerSR1");

            if (Directory.Exists(path))
            {
                Directory.Delete(path, true);
            }

            SolutionRepository solutionRepository = new SolutionRepository();

            solutionRepository.AddItemInfo <PluginPackage>("*.Ginger.PluginPackage.xml", @"~\Plugins", true, "Plugins", PropertyNameForFileName: nameof(PluginPackage.PluginId));
            solutionRepository.CreateRepository(path);
            solutionRepository.Open(path);

            PluginsManager pluginsManager = new PluginsManager(solutionRepository);
            ObservableList <PluginPackage> pluginPackages = solutionRepository.GetAllRepositoryItems <PluginPackage>();

            // Act
            var p = pluginsManager.GetOnlinePluginsIndex();
            OnlinePluginPackage onlinePluginPackage = (from x in p where x.Id == PluginId select x).SingleOrDefault();

            //OnlinePluginPackageRelease onlinePluginPackageRelease
            pluginsManager.InstallPluginPackage(onlinePluginPackage, onlinePluginPackage.Releases[0]);
            //string folder = Path.Combine(Common.GetTestResourcesFolder(), @"PluginPackages\SeleniumPluginPackage.1.0.0");


            //Assert
            Assert.AreEqual(1, pluginPackages.Count);
            Assert.AreEqual("PACT", pluginPackages[0].PluginId);
        }
Пример #21
0
        public void TestInitialize()
        {
            mBF            = new BusinessFlow();
            mBF.Activities = new ObservableList <Activity>();
            mBF.Name       = "BF Visual Testing";
            mBF.Active     = true;
            Platform p = new Platform();

            p.PlatformType = ePlatformType.Web;
            mBF.Platforms  = new ObservableList <Platform>();
            mBF.Platforms.Add(p);
            mBF.TargetApplications.Add(new TargetApplication()
            {
                AppName = "VM"
            });

            mGR = new GingerRunner();
            mGR.SolutionFolder = TestResources.getGingerUnitTesterTempFolder("");

            Agent a = new Agent();

            a.DriverType = Agent.eDriverType.SeleniumChrome;

            mGR.SolutionAgents = new ObservableList <Agent>();
            mGR.SolutionAgents.Add(a);

            mGR.ApplicationAgents.Add(new ApplicationAgent()
            {
                AppName = "VM", Agent = a
            });
            mGR.SolutionApplications = new ObservableList <ApplicationPlatform>();
            mGR.SolutionApplications.Add(new ApplicationPlatform()
            {
                AppName = "VM", Platform = ePlatformType.Web, Description = "VM application"
            });
            mGR.BusinessFlows.Add(mBF);
        }