Beispiel #1
0
        internal AgentsPOM GotoAgents()
        {
            Agents = null;
            Execute(() => {
                ClickConfigurationsRibbon();
                Frame f = (Frame)mMainWindow.FindName("MainFrame");
                TwoLevelMenuPage configurationsPage = (TwoLevelMenuPage)f.Content;

                ListView lv = (ListView)configurationsPage.FindName("xMainNavigationListView");
                foreach (ListViewItem lvi in lv.Items)
                {
                    string AID = AutomationProperties.GetAutomationId(lvi);
                    if (AID == "Agents AID")
                    {
                        lv.SelectedItem = lvi;
                        SleepWithDoEvents(100);
                        Frame f1 = (Frame)FindElementByName(configurationsPage, "xSelectedItemFrame");
                        SingleItemTreeViewExplorerPage itemExplorerPage = (SingleItemTreeViewExplorerPage)f1.Content;
                        while (!itemExplorerPage.IsVisible)
                        {
                            SleepWithDoEvents(100);
                        }
                        Agents = new AgentsPOM(itemExplorerPage);
                    }
                }
            });

            if (Agents == null)
            {
                throw new Exception("Cannot goto Agents");
            }

            return(Agents);
        }
Beispiel #2
0
        public void CutPasteAgentFromSubFolderToroot()
        {
            //Arrange
            string    name       = "Move Me Up";
            string    folderName = "MySubFolder 2";
            AgentsPOM AgentsPOM  = mGingerAutomator.MainWindowPOM.GotoAgents();

            AgentsPOM.AgentsTree.SelectRootItem();
            AgentsPOM.AddSubFolder(folderName);
            Agent MyAgent = AgentsPOM.CreateAgent(folderName, name, ePlatformType.Web, Agent.eDriverType.SeleniumChrome);

            //Act
            AgentsPOM.AgentsTree.SelectItem(name);
            AgentsPOM.AgentsTree.Cut();
            AgentsPOM.AgentsTree.SelectRootItem();
            AgentsPOM.AgentsTree.Paste();

            bool agentExist = AgentsPOM.AgentsTree.IsItemExist(name);

            RepositoryFolder <Agent> AgentsFolder = WorkSpace.Instance.SolutionRepository.GetRepositoryItemRootFolder <Agent>();
            RepositoryFolder <Agent> subFolder    = AgentsFolder.GetSubFolder(folderName);
            Agent ACopyTag = (from x in subFolder.GetFolderItems() where x.Name == name select x).SingleOrDefault();

            // assert
            Assert.IsTrue(agentExist, "Agent exist");
            Assert.IsTrue(ACopyTag != null);
            Assert.AreEqual(@"~\Agents\" + folderName, ACopyTag.ContainingFolder);
            Assert.AreEqual(MyAgent, ACopyTag, "Same agent object in memeory");
        }
Beispiel #3
0
        public void AddAgentsFolderinFilesystemShowinTree()
        {
            //Arrange
            string    folderName = "Agents sub folder 1";
            string    subFolder  = Path.Combine(SolutionFolder, "Agents", folderName);
            AgentsPOM AgentsPOM  = mGingerAutomator.MainWindowPOM.GotoAgents();

            //Act
            Directory.CreateDirectory(subFolder);
            bool agentExist = AgentsPOM.AgentsTree.IsItemExist(folderName);

            // assert
            Assert.IsTrue(agentExist, "Agent exist in tree");
        }
Beispiel #4
0
        public void AddAgentUsingWizard()
        {
            //Arrange
            string    name      = "bondi";
            AgentsPOM AgentsPOM = mGingerAutomator.MainWindowPOM.GotoAgents();

            //Act
            AgentsPOM.CreateAgent(name, ePlatformType.Web, Agent.eDriverType.SeleniumFireFox);
            AgentsPOM.SelectAgent(name);
            Agent agent = (from x in WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Agent>() where x.Name == name select x).SingleOrDefault();

            //Assert
            Assert.AreEqual(name, agent.Name, "Agent.Name is same");
        }
Beispiel #5
0
        public void CreateAgentsbyTestData(string agentName, string platfromType, string driverType)
        {
            // arrange
            // We get the data from the params

            //Act
            AgentsPOM     AgentsPOM = mGingerAutomator.MainWindowPOM.GotoAgents();
            ePlatformType platform1 = (ePlatformType)Enum.Parse(typeof(ePlatformType), platfromType);

            Agent.eDriverType driver1 = (Agent.eDriverType)Enum.Parse(typeof(Agent.eDriverType), driverType);

            AgentsPOM.CreateAgent(agentName, platform1, driver1);
            bool agentCreated = AgentsPOM.AgentsTree.IsItemExist(agentName);

            //Assert
            Assert.IsTrue(agentCreated, "Agent created: " + agentName + ", " + platfromType + ", " + driverType);
        }
Beispiel #6
0
        public void AddAgentsFolderUsingMenu()
        {
            //Arrange
            string folderName = "sub folder 1";

            AgentsPOM AgentsPOM = mGingerAutomator.MainWindowPOM.GotoAgents();

            AgentsPOM.AgentsTree.SelectRootItem();

            //Act
            AgentsPOM.AddSubFolder(folderName);
            bool   folderCreatedOnTree = AgentsPOM.AgentsTree.IsItemExist(folderName);
            string subFolder           = Path.Combine(SolutionFolder, "Agents", folderName);

            // assert
            Assert.IsTrue(folderCreatedOnTree, "Folder create on tree");
            Assert.IsTrue(Directory.Exists(subFolder), "sub folder exist");
        }
Beispiel #7
0
        public void CreateAgentsFromCSV()
        {
            // arrange
            string agentName    = mTC.DataRow["Name"].ToString();
            string platfromType = mTC.DataRow["PlatfromType"].ToString();
            string driverType   = mTC.DataRow["DriverType"].ToString();

            //Act
            AgentsPOM     AgentsPOM = mGingerAutomator.MainWindowPOM.GotoAgents();
            ePlatformType platform  = (ePlatformType)Enum.Parse(typeof(ePlatformType), platfromType);

            Agent.eDriverType driver = (Agent.eDriverType)Enum.Parse(typeof(Agent.eDriverType), driverType);

            AgentsPOM.CreateAgent(agentName, platform, driver);
            bool agentCreated = AgentsPOM.AgentsTree.IsItemExist(agentName);

            //Assert
            Assert.IsTrue(agentCreated, "Agent created: " + agentName + ", " + platfromType + ", " + driverType);
        }
Beispiel #8
0
        public void RenameAgent()
        {
            //Arrange
            string OldName = "Bond 007";
            string NewName = "James Bond";

            AgentsPOM AgentsPOM = mGingerAutomator.MainWindowPOM.GotoAgents();

            //Act
            AgentsPOM.CreateAgent(OldName, ePlatformType.Web, Agent.eDriverType.SeleniumFireFox);
            AgentsPOM.RenameAgent(OldName, NewName);
            Agent treeNodeAgent = AgentsPOM.SelectAgent(NewName);

            Agent SRAgent = (from x in WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Agent>() where x.Name == NewName select x).SingleOrDefault();

            // assert
            Assert.AreEqual(treeNodeAgent, SRAgent, "TreeNode Agent = SR.Agent");
            Assert.AreEqual(NewName, SRAgent.Name, "SR.Agent NewName");
        }
Beispiel #9
0
        public void AddAgentsFolderUsingMenuAndAddAgent()
        {
            //Arrange
            string folderName = "sub folder 2";
            string name       = "IE 1";

            AgentsPOM AgentsPOM = mGingerAutomator.MainWindowPOM.GotoAgents();

            AgentsPOM.AgentsTree.SelectRootItem();
            AgentsPOM.AddSubFolder(folderName);

            //Act
            AgentsPOM.CreateAgent(folderName, name, ePlatformType.Web, Agent.eDriverType.SeleniumIE);
            bool folderExist = AgentsPOM.AgentsTree.IsItemExist(folderName);
            bool agentExist  = AgentsPOM.AgentsTree.IsItemExist(name);

            // assert
            Assert.IsTrue(folderExist, "Folder exist");
            Assert.IsTrue(agentExist, "Agent exist");
        }
        internal POMsPOM GotoPOMs()
        {
            Agents = null;
            Execute(() =>
            {
                ClickResourcesRibbon();
                Frame f = (Frame)mMainWindow.FindName("xMainWindowFrame");

                TwoLevelMenuPage resourcesPage = (TwoLevelMenuPage)f.Content;

                ListView lv = (ListView)resourcesPage.FindName("xMainNavigationListView");

                foreach (TopMenuItem topMenuItem in lv.Items)
                {
                    if (topMenuItem.AutomationID == "Application Models AID")
                    {
                        lv.SelectedItem = topMenuItem;
                        ListView lvi    = (ListView)resourcesPage.FindName("xSubNavigationListView");
                        foreach (SubMenuItem subMenuItem in lvi.Items)
                        {
                            if (subMenuItem.AutomationID == "POM Menu AID")
                            {
                                lvi.SelectedItem = subMenuItem;
                            }
                        }
                        SleepWithDoEvents(100);
                        Frame f1 = (Frame)FindElementByName(resourcesPage, "xSelectedItemFrame");
                        SingleItemTreeViewExplorerPage itemExplorerPage = (SingleItemTreeViewExplorerPage)f1.Content;
                        while (!itemExplorerPage.IsVisible)
                        {
                            SleepWithDoEvents(100);
                        }
                        POMs = new POMsPOM(itemExplorerPage);
                        break;
                    }
                }
            });

            return(POMs);
        }
Beispiel #11
0
        public void VisualCompareAgentConfig()
        {
            //Arrange
            string name = "Visual Compare";
            Agent  a    = new Agent()
            {
                Name = name, DriverType = Agent.eDriverType.SeleniumFireFox
            };

            WorkSpace.Instance.SolutionRepository.AddRepositoryItem(a);

            //Act
            AgentsPOM AgentsPOM = mGingerAutomator.MainWindowPOM.GotoAgents();

            AgentsPOM.SelectAgent(name);
            mGingerAutomator.MainWindowPOM.ChangeSize(1280, 800);
            //Act
            bool IsEquel = AgentsPOM.IsWindowBitmapEquel(AgentsPOM.GetSelectedAgentEditPage(), "AgentEditPage");

            //Assert
            Assert.IsTrue(IsEquel, "Agent edit page equel to baseline");
        }
Beispiel #12
0
        public void CopyPasteAgentinAgentRoot()
        {
            //Arrange
            string    name      = "C1";
            string    copy      = "C1_Copy";
            AgentsPOM AgentsPOM = mGingerAutomator.MainWindowPOM.GotoAgents();

            AgentsPOM.CreateAgent(name, ePlatformType.Web, Agent.eDriverType.SeleniumIE);

            //Act
            AgentsPOM.AgentsTree.Copy();
            AgentsPOM.AgentsTree.SelectRootItem();
            AgentsPOM.AgentsTree.Paste(copy);
            bool agentExist = AgentsPOM.AgentsTree.IsItemExist(copy);

            Agent Acopy = (from x in WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Agent>() where x.Name == copy select x).SingleOrDefault();
            RepositoryFolder <Agent> AgentsFolder = WorkSpace.Instance.SolutionRepository.GetRepositoryItemRootFolder <Agent>();
            Agent ACopyTag = (from x in AgentsFolder.GetFolderItems() where x.Name == copy select x).SingleOrDefault();

            // assert
            Assert.IsTrue(agentExist, "Agent exist");
            Assert.IsTrue(Acopy != null);
            Assert.AreEqual(Acopy, ACopyTag);
        }
Beispiel #13
0
        public void DuplicateAgentinSubFolder()
        {
            //Arrange
            string folderName   = "sub folder dup";
            string agentName    = "agent 1";
            string agentDupName = "agent 1 dup";

            AgentsPOM AgentsPOM = mGingerAutomator.MainWindowPOM.GotoAgents();

            AgentsPOM.AgentsTree.SelectRootItem();
            AgentsPOM.AddSubFolder(folderName);
            AgentsPOM.CreateAgent(folderName, agentName, ePlatformType.Web, Agent.eDriverType.SeleniumChrome);
            mGingerAutomator.ReloadSolution();

            //Act
            AgentsPOM = mGingerAutomator.MainWindowPOM.GotoAgents();
            AgentsPOM.AgentsTree.SelectItem(folderName);
            AgentsPOM.AgentsTree.SelectItem(agentName);
            AgentsPOM.AgentsTree.Duplicate(agentDupName);
            bool b = AgentsPOM.AgentsTree.IsItemExist(agentDupName);

            // Assert
            Assert.IsTrue(b, "Dup agent exist in tree");
        }