예제 #1
0
        private void MainTreeView_ItemSelected(object sender, SelectionTreeEventArgs e)
        {
            GridLength POMItemsSelected      = new GridLength(1, GridUnitType.Auto);
            GridLength POMDetailsPanelLoaded = new GridLength(100, GridUnitType.Star);

            if (e.SelectedItems != null && e.SelectedItems.Count == 1)
            {
                mPOM = e.SelectedItems[0] as ApplicationPOMModel;
                if (mPOM != null)
                {
                    foreach (ElementInfo elem in mPOM.MappedUIElements)
                    {
                        elem.ParentGuid = mPOM.Guid;
                    }
                    xMainElementsGrid.DataSourceList = mPOM.MappedUIElements;
                    xMainElementsGrid.Visibility     = Visibility.Visible;
                    xPOMSplitter.Visibility          = Visibility.Visible;

                    if (xPOMDetails.Height != POMDetailsPanelLoaded)
                    {
                        xPOMItems.Height   = POMItemsSelected;
                        xPOMDetails.Height = POMDetailsPanelLoaded;
                    }
                }
            }
            else
            {
                CollapseDetailsGrid();
            }
        }
예제 #2
0
        public POMEditPage(ApplicationPOMModel POM)
        {
            InitializeComponent();
            mPOM = POM;
            ControlsBinding.ObjFieldBinding(xNameTextBox, TextBox.TextProperty, mPOM, nameof(mPOM.Name));
            ControlsBinding.ObjFieldBinding(xDescriptionTextBox, TextBox.TextProperty, mPOM, nameof(mPOM.Description));
            ControlsBinding.ObjFieldBinding(xPageURLTextBox, TextBox.TextProperty, mPOM, nameof(mPOM.PageURL));

            xTargetApplicationComboBox.ComboBox.Style = this.FindResource("$FlatInputComboBoxStyle") as Style;
            FillTargetAppsComboBox();
            xTargetApplicationComboBox.Init(mPOM, nameof(ApplicationPOMModel.TargetApplicationKey));
            xTagsViewer.Init(mPOM.TagsKeys);

            ePlatformType          mAppPlatform       = App.UserProfile.Solution.GetTargetApplicationPlatform(POM.TargetApplicationKey);
            ObservableList <Agent> optionalAgentsList = GingerCore.General.ConvertListToObservableList((from x in WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Agent>() where x.Platform == mAppPlatform select x).ToList());

            xAgentControlUC.Init(optionalAgentsList);
            App.ObjFieldBinding(xAgentControlUC, ucAgentControl.SelectedAgentProperty, this, nameof(Agent));

            BitmapSource source = null;

            if (mPOM.ScreenShotImage != null)
            {
                source = Ginger.General.GetImageStream(Ginger.General.Base64StringToImage(mPOM.ScreenShotImage.ToString()));
            }

            mScreenShotViewPage      = new ScreenShotViewPage(mPOM.Name, source);
            xScreenShotFrame.Content = mScreenShotViewPage;

            mPomAllElementsPage      = new PomAllElementsPage(mPOM);
            xUIElementsFrame.Content = mPomAllElementsPage;

            UIElementTabTextBlockUpdate();
        }
예제 #3
0
        public ApplicationPOMModel SelectPOM(string name)
        {
            mTreeView.SelectItem(name);
            ApplicationPOMModel pom = (ApplicationPOMModel)mTreeView.GetSelectedItemNodeObject();

            return(pom);
        }
예제 #4
0
        public PomDeltaWizard(ApplicationPOMModel pom, Agent agent)
        {
            mPomDeltaUtils = new PomDeltaUtils(pom, agent);

            AddPage(Name: "Elements Update Settings", Title: "Elements Update Settings", SubTitle: "Elements Update Settings", Page: new PomDeltaSettingsWizardPage());
            AddPage(Name: "Elements Compare", Title: "Elements Compare", SubTitle: "Elements Comparison with Latest Status", Page: new PomDeltaElementCompareWizardPage());
        }
예제 #5
0
        public PomElementsPage(ApplicationPOMModel pom, eElementsContext context)
        {
            InitializeComponent();
            mPOM     = pom;
            mContext = context;
            if (mContext == eElementsContext.Mapped)
            {
                mElements = mPOM.MappedUIElements;
            }
            else if (mContext == eElementsContext.Unmapped)
            {
                mElements = mPOM.UnMappedUIElements;
            }

            SetElementsGridView();
            SetLocatorsGridView();
            SetControlPropertiesGridView();

            xMainElementsGrid.DataSourceList = mElements;

            if (mElements.Count > 0)
            {
                xMainElementsGrid.Grid.SelectedItem = mElements[0];
            }
            else
            {
                DisableDetailsExpander();
            }
        }
예제 #6
0
        private ApplicationPOMModel CreatePOMOnWizard(string POMName, string POMDescription, string targetApp, Agent agent, string URL, List <eElementType> elementTypeCheckBoxToClickList, List <ElementLocator> prioritizedLocatorsList)
        {
            WizardPOM wizard = WizardPOM.CurrentWizard;

            wizard.NextButton.Click();
            ucAgentControl    ucAgentControl    = (ucAgentControl)wizard.CurrentPage["ucAgentControl AID"].dependencyObject;
            ucAgentControlPOM ucAgentControlPOM = new ucAgentControlPOM(ucAgentControl);

            ucAgentControlPOM.SelectValueUCAgentControl(agent);
            ucAgentControlPOM.UCAgentControlStatusButtonClick();
            SleepWithDoEvents(10000);

            //Process AutoMap Element Locators Grid
            ucGrid    ucElementLocatorsGrid    = (ucGrid)wizard.CurrentPage["AutoMapElementLocatorsGrid AID"].dependencyObject;
            ucGridPOM ucElementLocatorsGridPOM = new ucGridPOM(ucElementLocatorsGrid);
            int       locatorIndex             = 0;

            foreach (ElementLocator elemLocator in prioritizedLocatorsList)
            {
                if (!elemLocator.Active)
                {
                    ucElementLocatorsGridPOM.ClickOnCheckBox(nameof(ElementLocator.Active), nameof(ElementLocator.LocateBy), elemLocator.LocateBy.ToString());
                }

                ucElementLocatorsGridPOM.ReOrderGridRows(nameof(ElementLocator.LocateBy), elemLocator.LocateBy.ToString(), locatorIndex);

                locatorIndex++;
            }

            //Process AutoMap Element Types Grid
            ucGrid    ucElementTypesGrid    = (ucGrid)wizard.CurrentPage["AutoMapElementTypesGrid AID"].dependencyObject;
            ucGridPOM ucElementTypesGridPOM = new ucGridPOM(ucElementTypesGrid);

            foreach (eElementType elementType in elementTypeCheckBoxToClickList)
            {
                ucElementTypesGridPOM.ClickOnCheckBox(nameof(UIElementFilter.Selected), nameof(UIElementFilter.ElementType), elementType.ToString());
            }
            string html = TestResources.GetTestResourcesFile(URL);

            agent.Driver.RunAction(new ActBrowserElement()
            {
                ControlAction = ActBrowserElement.eControlAction.GotoURL, ValueForDriver = html
            });
            SleepWithDoEvents(2000);
            wizard.NextButton.Click();
            while (agent.Driver.IsDriverBusy)
            {
                SleepWithDoEvents(20000);
            }
            wizard.NextButton.Click();
            SleepWithDoEvents(2000);
            wizard.CurrentPage["Name POMID"].SetText(POMName);
            wizard.CurrentPage["Description POMID"].SetText(POMDescription);
            wizard.FinishButton.Click();
            SleepWithDoEvents(2000);

            ApplicationPOMModel POM = (from x in WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ApplicationPOMModel>() where x.Name == POMName select x).SingleOrDefault();

            return(POM);
        }
예제 #7
0
 public UnmappedElementsPage(ApplicationPOMModel POM)
 {
     InitializeComponent();
     mPOM = POM;
     SetControlsGridView();
     xUnmappedElementsGrid.DataSourceList = mPOM.UnMappedUIElements;
 }
예제 #8
0
 public PomDeltaUtils(ApplicationPOMModel pom, Agent agent)
 {
     POM           = pom;
     Agent         = agent;
     PomLearnUtils = new PomLearnUtils(pom, agent);
     POMLatestElements.CollectionChanged += ElementsListCollectionChanged;
 }
예제 #9
0
        public void DoRecordingWithMultiplePageHandledTest()
        {
            List <ApplicationPOMModel> lstPOM     = new List <ApplicationPOMModel>();
            ApplicationPOMModel        currentPOM = new ApplicationPOMModel();

            lstPOM.Add(currentPOM);
            RecordingManager mngr = new RecordingManager(lstPOM, mBF, Context, mDriver, PlatformInfo);

            if (mngr != null)
            {
                mngr.StartRecording();
                Thread.Sleep(3000);
                mngr.StopRecording();
            }
            if (mngr.ListPOMObjectHelper != null && mngr.ListPOMObjectHelper.Count > 0)
            {
                ApplicationPOMModel cPOM = mngr.ListPOMObjectHelper[1].ApplicationPOM;
                Assert.IsTrue(cPOM.PageURL == "www.google.com");
                Assert.IsTrue(mngr.ListPOMObjectHelper.Count == 2);
            }
            else
            {
                Assert.IsTrue(false);
            }
        }
        private void SelectPOM_Click(object sender, RoutedEventArgs e)
        {
            if (mApplicationPOMSelectionPage == null)
            {
                ApplicationPOMsTreeItem pOMsRoot = new ApplicationPOMsTreeItem(mPOMModelFolder);
                mApplicationPOMSelectionPage = new SingleItemTreeViewSelectionPage("Page Objects Model Element", eImageType.ApplicationPOMModel, pOMsRoot,
                                                                                   SingleItemTreeViewSelectionPage.eItemSelectionType.Single, true,
                                                                                   new Tuple <string, string>(nameof(ApplicationPOMModel.TargetApplicationKey) + "." +
                                                                                                              nameof(ApplicationPOMModel.TargetApplicationKey.ItemName),
                                                                                                              App.BusinessFlow.CurrentActivity.TargetApplication));
            }

            List <object> selectedPOMs = mApplicationPOMSelectionPage.ShowAsWindow();

            if (selectedPOMs != null && selectedPOMs.Count > 0)
            {
                mSelectedPOM = (ApplicationPOMModel)selectedPOMs[0];
                SetPOMPathToShow();
                xPOMElementsGrid.DataSourceList = GenerateElementsDataSourseList();
                xPOMElementTextBox.Text         = string.Empty;
                if (mAction is ActUIElement)
                {
                    ((ActUIElement)mAction).ElementType        = eElementType.Unknown;
                    ((ActUIElement)mAction).ElementLocateValue = string.Empty;
                }
                else
                {
                    mAction.LocateValue = string.Empty;
                }
                SelectElement();
            }
        }
예제 #11
0
        public void DoRecordingWithPOMTest()
        {
            List <ApplicationPOMModel> lstPOM     = new List <ApplicationPOMModel>();
            ApplicationPOMModel        currentPOM = new ApplicationPOMModel();

            lstPOM.Add(currentPOM);
            RecordingManager mngr = new RecordingManager(lstPOM, mBF, Context, mDriver, PlatformInfo);

            if (mngr != null)
            {
                mngr.StartRecording();
                Thread.Sleep(3000);
                mngr.StopRecording();
            }
            if (mBF.Activities[0].Acts.Count > 0)
            {
                ApplicationPOMModel cPOM  = mngr.ListPOMObjectHelper[1].ApplicationPOM;
                TestAction          actUI = (TestAction)mBF.Activities[0].Acts[0];
                Assert.IsTrue(actUI.ElementLocateBy == eLocateBy.POMElement);
                Assert.IsTrue(actUI.ElementAction == "Click");
                Assert.IsTrue(actUI.ElementType == "Button");
                Assert.IsTrue(cPOM.MappedUIElements[0].ElementTypeEnum.ToString() == eElementType.Button.ToString());
                Assert.IsTrue(cPOM.MappedUIElements.Count == mBF.Activities[0].Acts.Count);
            }
            else
            {
                Assert.IsTrue(false);
            }
        }
예제 #12
0
        private POMObjectRecordingHelper GetNewPOM(string pageTitle, string pageURL, string screenShot)
        {
            POMObjectRecordingHelper recordingHelper = new POMObjectRecordingHelper();

            try
            {
                ApplicationPOMModel newPOM = new ApplicationPOMModel();
                newPOM.FileName         = pageTitle;
                newPOM.FilePath         = pageTitle;
                newPOM.Name             = pageTitle;
                newPOM.Guid             = new Guid();
                newPOM.ItemName         = pageTitle;
                newPOM.PageURL          = pageURL;
                newPOM.ScreenShotImage  = screenShot;
                newPOM.MappedUIElements = new ObservableList <ElementInfo>();

                recordingHelper.PageTitle      = pageTitle;
                recordingHelper.PageURL        = pageURL;
                recordingHelper.ApplicationPOM = newPOM;
            }
            catch (Exception ex)
            {
                Reporter.ToLog(eLogLevel.ERROR, "Error in creating Recording object", ex);
            }
            return(recordingHelper);
        }
예제 #13
0
 private void MainTreeView_ItemSelected(object sender, SelectionTreeEventArgs e)
 {
     if (e.SelectedItems != null && e.SelectedItems.Count == 1)
     {
         mPOM = e.SelectedItems[0] as ApplicationPOMModel;
         if (mPOM != null)
         {
             foreach (ElementInfo elem in mPOM.MappedUIElements)
             {
                 elem.ParentGuid = mPOM.Guid;
             }
             mPOM.StartDirtyTracking();
             xPOMDetails.Height = xPOMItems.Height;
             xPomElementsListView.DataSourceList = mPOM.MappedUIElements;
             xPomElementsListView.Visibility     = Visibility.Visible;
             xPOMSplitter.IsEnabled = true;
         }
     }
     else
     {
         xPOMDetails.Height = new GridLength(0, GridUnitType.Star);
         xPomElementsListView.DataSourceList = null;
         xPomElementsListView.Visibility     = Visibility.Hidden;
         xPOMSplitter.IsEnabled = false;
     }
 }
예제 #14
0
        private void SelectPOM_Click(object sender, RoutedEventArgs e)
        {
            if (mApplicationPOMSelectionPage == null)
            {
                ApplicationPOMsTreeItem pOMsRoot = new ApplicationPOMsTreeItem(mPOMModelFolder);
                mApplicationPOMSelectionPage = new SingleItemTreeViewSelectionPage("Page Objects Model Element", eImageType.ApplicationPOMModel, pOMsRoot,
                                                                                   SingleItemTreeViewSelectionPage.eItemSelectionType.Single, true,
                                                                                   new Tuple <string, string>(nameof(ApplicationPOMModel.TargetApplicationKey) + "." +
                                                                                                              nameof(ApplicationPOMModel.TargetApplicationKey.ItemName),
                                                                                                              App.BusinessFlow.CurrentActivity.TargetApplication));
            }

            List <object> selectedPOMs = mApplicationPOMSelectionPage.ShowAsWindow();

            if (selectedPOMs != null && selectedPOMs.Count > 0)
            {
                mSelectedPOM = (ApplicationPOMModel)selectedPOMs[0];
                SetPOMPathToShow();

                if (mOnlyPOMRequest)
                {
                    mObjectLocateValue.GetType().GetProperty(mLocateValueFieldName).SetValue(mObjectLocateValue, mSelectedPOM.Guid.ToString());
                }
                else
                {
                    xPOMElementsGrid.DataSourceList = GenerateElementsDataSourseList();
                    xPOMElementTextBox.Text         = string.Empty;
                    mObjectLocateValue.GetType().GetProperty(mLocateValueFieldName).SetValue(mObjectLocateValue, string.Empty);
                    SetElementTypeProperty(eElementType.Unknown);
                }
                AllowElementSelection();
            }
        }
예제 #15
0
        public AddPOMWizard()
        {
            //this.WinExplorer = WinExplorer;
            //this.POMFolder = POMFolder;

            //string filename = mPOMFolder

            //if (POM == null)
            //{
            //we are in Add mode
            this.POM = new ApplicationPOMModel();

            //Show Add page intro only for add mode
            AddPage(Name: "Intro", Title: "Intro", SubTitle: "Add new POM page for application", Page: new AddPOMIntroWizardPage());
            //}
            //else
            //{
            //    this.POM = POM;
            //}

            // We can set specific page and text per mode of Add or Edit

            AddPage(Name: "Select App and folder", Title: "Select App and Folder", SubTitle: "Choose Target Application and Agent", Page: new SelectAppFolderWizardPage());

            //AddPage(Name: "Scan Page", Title: "Scan Page", SubTitle: "Scan or import from Mockup", Page: new ScanPageWizardPage());

            AddPage(Name: "Scan Config", Title: "Scan Config", SubTitle: "Scan Config", Page: new LearnConfigWizardPage());

            AddPage(Name: "Learn", Title: "Learn", SubTitle: "Learn Page Object Model", Page: new LearnWizardPage(this.POM));

            AddPage(Name: "Map", Title: "Map", SubTitle: "Map each UI element", Page: new MapUIElementsWizardPage(this.POM));

            AddPage(Name: "Save", Title: "Save", SubTitle: "Save POM to file", Page: new SavePOMWizardPage());
        }
예제 #16
0
        public NavigationsPage(ApplicationPOMModel ApplicationPOM)
        {
            InitializeComponent();

            mApplicationPOM = ApplicationPOM;

            ShowNavs();
        }
예제 #17
0
        public PomLearnUtils(ApplicationPOMModel pom, Agent agent = null, RepositoryFolder <ApplicationPOMModel> pomModelsFolder = null)
        {
            POM              = pom;
            mAgent           = agent;
            mPomModelsFolder = pomModelsFolder;

            mElementsList.CollectionChanged += ElementsListCollectionChanged;
        }
예제 #18
0
        public void ValidatePOMWasAddedToPOMsTree()
        {
            //Act
            mPOMsPOM.SelectPOM(mLearnedPOM.Name);
            ApplicationPOMModel treePOM = (from x in WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ApplicationPOMModel>() where x.Name == mLearnedPOM.Name select x).SingleOrDefault();

            //Assert
            Assert.AreEqual(mLearnedPOM.Name, treePOM.Name, "POM.Name is same");
        }
예제 #19
0
        public LearnWizardPage(ApplicationPOMModel POM)
        {
            InitializeComponent();

            //mPOM = POM;
            //SetControlsGridView();
            //ElementsGrid.DataSourceList = mPOM.UIElements;
            //ElementsGrid.btnRefresh.Click += RefreshClick;
            //ElementsGrid.btnAdd.Click += BtnAdd_Click;
        }
예제 #20
0
        public MapUIElementsWizardPage(ApplicationPOMModel POM)
        {
            InitializeComponent();

            mPOM = POM;
            SetControlsGridView();
            InitLocatorsGrid();

            ShowPOMInfo();
        }
예제 #21
0
        //mWinExplorer = winExplorer;

        public LocateByPOMElement(ActUIElement Action)
        {
            InitializeComponent();
            DataContext = this;
            mAction     = Action;
            SetControlsGridView();

            if (Action.ElementLocateBy == eLocateBy.POMElement)
            {
                if ((mAction.ElementLocateValue != null) && (mAction.ElementLocateValue != string.Empty))
                {
                    try
                    {
                        string[] pOMandElementGUIDs = mAction.ElementLocateValue.ToString().Split('_');
                        Guid     selectedPOMGUID    = new Guid(pOMandElementGUIDs[0]);
                        mSelectedPOM = WorkSpace.Instance.SolutionRepository.GetRepositoryItemByGuid <ApplicationPOMModel>(selectedPOMGUID);
                        if (mSelectedPOM == null)
                        {
                            Reporter.ToUser(eUserMsgKeys.POMSearchByGUIDFailed);
                            mAction.ElementLocateValue = string.Empty;
                            SelectPOM_Click(null, null);
                        }
                        else
                        {
                            SetPOMPathToShow();
                            Guid        selectedPOMElementGUID = new Guid(pOMandElementGUIDs[1]);
                            ElementInfo selectedPOMElement     = (ElementInfo)mSelectedPOM.MappedUIElements.Where(z => z.Guid == selectedPOMElementGUID).FirstOrDefault();
                            if (selectedPOMElement == null)
                            {
                                Reporter.ToUser(eUserMsgKeys.POMElementSearchByGUIDFailed);
                            }
                            else
                            {
                                xPOMElementsGrid.DataSourceList    = mSelectedPOM.MappedUIElements;
                                xPOMElementsGrid.Grid.SelectedItem = selectedPOMElement;
                                mAction.ElementType             = selectedPOMElement.ElementTypeEnum;
                                POMElementComboBox.IsEnabled    = true;
                                HeaderTextBlock.Text            = selectedPOMElement.ElementName;
                                HeaderTextBlock.Visibility      = Visibility.Visible;
                                POMElementComboBox.SelectedItem = HeaderTextBlock;
                                HighlightButton.IsEnabled       = true;
                            }
                        }
                    }
                    catch
                    {
                        Reporter.ToUser(eUserMsgKeys.POMSearchByGUIDFailed);
                        mAction.ElementLocateValue = string.Empty;
                        SelectPOM_Click(null, null);
                    }
                }
            }
        }
        public ApplicationPOMModel GetCurrentPOM()
        {
            Guid selectedPOMGUID           = new Guid(PomElementGUID[0]);
            ApplicationPOMModel currentPOM = WorkSpace.Instance.SolutionRepository.GetRepositoryItemByGuid <ApplicationPOMModel>(selectedPOMGUID);

            if (currentPOM == null)
            {
                mAct.ExInfo = string.Format("Failed to find the mapped element Page Objects Model with GUID '{0}'", selectedPOMGUID.ToString());
                return(null);
            }
            return(currentPOM);
        }
        /// <summary>
        /// This method is used to find the relative element from POM for the existing action
        /// </summary>
        /// <param name="newActUIElement"></param>
        /// <param name="pomModelObject"></param>
        /// <param name="elementMatchedInPOM"></param>
        /// <returns></returns>
        public Act GetMappedElementFromPOMForAction(Act newActUIElement, Guid pomModelObject, ref bool elementMatchedInPOM)
        {
            try
            {
                elementMatchedInPOM = false;
                if (pomModelObject != default(Guid))
                {
                    ObservableList <ApplicationPOMModel> pomLst = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ApplicationPOMModel>();
                    ApplicationPOMModel selectedPOM             = pomLst.Where(x => x.Guid == pomModelObject).SingleOrDefault();

                    ElementInfo elementInfo     = null;
                    string      locateValue     = Convert.ToString(newActUIElement.GetType().GetProperty(ActUIElementLocateValueField).GetValue(newActUIElement, null));
                    eLocateBy   elementLocateBy = GeteLocateByEnumItem(Convert.ToString(newActUIElement.GetType().GetProperty(ActUIElementElementLocateByField).GetValue(newActUIElement, null)));

                    var matchingExistingLocator = selectedPOM.MappedUIElements.Where(x => x.Locators.Any(y => y.LocateBy == elementLocateBy && y.LocateValue.ToLower().Trim().Equals(locateValue.ToLower().Trim())));
                    if (matchingExistingLocator != null)
                    {
                        elementInfo = matchingExistingLocator.FirstOrDefault();
                        if (elementInfo != null)
                        {
                            elementMatchedInPOM = true;
                            PropertyInfo pLocateBy = newActUIElement.GetType().GetProperty(ActUIElementElementLocateByField);
                            if (pLocateBy != null)
                            {
                                if (pLocateBy.PropertyType.IsEnum)
                                {
                                    pLocateBy.SetValue(newActUIElement, Enum.Parse(pLocateBy.PropertyType, "POMElement"));
                                }
                            }

                            PropertyInfo pLocateVal = newActUIElement.GetType().GetProperty(ActUIElementElementLocateValueField);
                            if (pLocateVal != null)
                            {
                                pLocateVal.SetValue(newActUIElement, string.Format("{0}_{1}", selectedPOM.Guid.ToString(), elementInfo.Guid.ToString()));
                            }

                            PropertyInfo pElementType = newActUIElement.GetType().GetProperty(ActUIElementElementTypeField);
                            if (pElementType != null && pElementType.PropertyType.IsEnum)
                            {
                                pElementType.SetValue(newActUIElement, Enum.Parse(pElementType.PropertyType, Convert.ToString(elementInfo.ElementTypeEnum)));
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Reporter.ToLog(eLogLevel.ERROR, "Error occurred while trying to Get Mapped Element From POM", ex);
            }
            return(newActUIElement);
        }
예제 #24
0
        public AddPOMWizard(RepositoryFolder <ApplicationPOMModel> pomModelsFolder = null)
        {
            mPomModelsFolder = pomModelsFolder;

            POM = new ApplicationPOMModel();

            AddPage(Name: "Introduction", Title: "Introduction", SubTitle: "Page Objects Model Introduction", Page: new WizardIntroPage("/ApplicationModelsLib/POMModels/POMWizardLib/AddPOMIntro.md"));

            AddPage(Name: "Learning Configurations", Title: "Learning Configurations", SubTitle: "Page Objects Learning Configurations", Page: new POMLearnConfigWizardPage());

            AddPage(Name: "Learned Objects Mapping", Title: "Learned Objects Mapping", SubTitle: "Map Learned Page Objects", Page: new POMObjectsMappingWizardPage());

            AddPage(Name: "General Details", Title: "General Details", SubTitle: "New Page Objects Model General Details", Page: new POMGeneralDetailsWizardPage());
        }
예제 #25
0
        public LearnWizardPage(ApplicationPOMModel POM)
        {
            InitializeComponent();

            mPOM = POM;

            mElementsList.CollectionChanged += ElementsListCollectionChanged;

            //SetControlsGridView();
            //xFoundElementsGrid.SetTitleLightStyle = true;
            //xFoundElementsGrid.DataSourceList = mPOM.UIElements;
            //xFoundElementsGrid.btnRefresh.Click += RefreshClick;
            //ElementsGrid.btnAdd.Click += BtnAdd_Click;
        }
예제 #26
0
        public POMEditPage(ApplicationPOMModel POM)
        {
            InitializeComponent();
            mPOM = POM;

            ScreenShotViewPage p = new ScreenShotViewPage(mPOM.Name, mPOM.ScreenShot);

            xScreenShotFrame.Content = p;

            MappedUIElementsPage mappedUIElementsPage = new MappedUIElementsPage(mPOM);

            xUIElementsFrame.Content = mappedUIElementsPage;

            //PageNameTextBox.BindControl(mApplicationPOM, nameof(ApplicationPOM.Name));

            //ObservableList<ApplicationPlatform> Apps = App.UserProfile.Solution.ApplicationPlatforms;
            //ApplicationPlatform AP = (from x in Apps where x.Guid == mApplicationPOM.TargetApplicationKey.Guid select x).FirstOrDefault();
            //mApplicationPOM.TargetApplicationKey = AP.Key;  // Create new binding and get updates if exist as key app name might changed

            //Yuval Uncomment
            //TargetApplicationComboBox.BindControl<ApplicationPlatform>(mApplicationPOM, nameof(mApplicationPOM.TargetAppplicationKey), Apps, nameof(ApplicationPlatform.AppName), nameof(ApplicationPlatform.Key));

            //TODO: lazy load based on tabs with cache
            //if (mPOM.ScreenShot == null)
            //{
            //    string filename = mPOM.FileName.Replace("xml", "Screenshot.bmp");  // TODO: use same const
            //    //mPom.ScreenShot = General.LoadBitmapFromFile(filename);
            //}


            //POMSimulatorFrame.Content = new POMSimulatorPage(mPom);


            //LearnWizardPage p2 = new LearnWizardPage(mPom);
            //UIElementsFrame.Content = p2;

            //MappingFrame.Content = new MapUIElementsWizardPage(mPom);

            //NaviagtionsFrame.Content = new NavigationsPage(mPom);

            ////TODO: create a page and move code to design page
            //pd = new ScreenShotViewPage(mPom.Name, mPom.ScreenShot);
            //pd.MouseClickOnScreenshot += MouseClickOnScreenshot;
            //pd.MouseUpOnScreenshot += MouseUpOnScreenshot;
            //pd.MouseMoveOnScreenshot += MouseMoveOnScreenshot;
            //DesignFrame.Content = pd;

            //InitControlPropertiesGrid();
        }
예제 #27
0
        public static void ClassInit(TestContext testContext)
        {
            //Arrange
            string name        = "MyNewPOM";
            string description = "MyDescription";

            string sampleSolutionFolder = TestResources.GetTestResourcesFolder(@"Solutions\POMsTest");
            string SolutionFolder       = TestResources.GetTestTempFolder(@"Solutions\POMsTest");

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

            CopyDir.Copy(sampleSolutionFolder, SolutionFolder);
            GingerAutomator mGingerAutomator = GingerAutomator.StartSession();

            mGingerAutomator.OpenSolution(SolutionFolder);

            mPOMsPOM = mGingerAutomator.MainWindowPOM.GotoPOMs();

            Agent mChromeAgent = (from x in WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Agent>() where x.Name == "ChromeAgent" select x).SingleOrDefault();

            //Act
            prioritizedLocatorsList = new List <ElementLocator>()
            {
                new ElementLocator()
                {
                    Active = false, LocateBy = eLocateBy.ByName
                },
                new ElementLocator()
                {
                    Active = true, LocateBy = eLocateBy.ByID
                },
                new ElementLocator()
                {
                    Active = false, LocateBy = eLocateBy.ByXPath
                },
                new ElementLocator()
                {
                    Active = true, LocateBy = eLocateBy.ByRelXPath
                }
            };
            mLearnedPOM = mPOMsPOM.CreatePOM(name, description, "MyWebApp", mChromeAgent, @"HTML\HTMLControls.html", new List <eElementType>()
            {
                eElementType.HyperLink, eElementType.Table, eElementType.ListItem
            }, prioritizedLocatorsList);
        }
예제 #28
0
        /// <summary>
        /// This method is used to get the current selected POM
        /// </summary>
        /// <returns></returns>
        private ElementInfo GetElementInfoFromCurerentPOMSelected()
        {
            ElementInfo selectedPOMElement = null;

            mExistingPOMAndElementGuidString = mAction.ElementLocateValue;
            string[]            pOMandElementGUIDs = mAction.ElementLocateValue.Split('_');
            Guid                selectedPOMGUID    = new Guid(pOMandElementGUIDs[0]);
            ApplicationPOMModel currentPOM         = WorkSpace.Instance.SolutionRepository.GetRepositoryItemByGuid <ApplicationPOMModel>(selectedPOMGUID);

            if (currentPOM != null)
            {
                Guid selectedPOMElementGUID = new Guid(pOMandElementGUIDs[1]);
                selectedPOMElement = (ElementInfo)currentPOM.MappedUIElements.Where(z => z.Guid == selectedPOMElementGUID).FirstOrDefault();
            }
            return(selectedPOMElement);
        }
예제 #29
0
        public PomAllElementsPage(ApplicationPOMModel POM)
        {
            InitializeComponent();
            mPOM = POM;
            mPOM.MappedUIElements.CollectionChanged   += MappedUIElements_CollectionChanged;
            mPOM.UnMappedUIElements.CollectionChanged += UnMappedUIElements_CollectionChanged;

            mappedUIElementsPage         = new PomElementsPage(mPOM, eElementsContext.Mapped);
            xMappedElementsFrame.Content = mappedUIElementsPage;

            unmappedUIElementsPage         = new PomElementsPage(mPOM, eElementsContext.Unmapped);
            xUnMappedElementsFrame.Content = unmappedUIElementsPage;

            UnMappedUIElementsUpdate();
            MappedUIElementsUpdate();
        }
예제 #30
0
        public AddPOMWizard()
        {
            POM = new ApplicationPOMModel();

            AddPage(Name: "Intro", Title: "Intro", SubTitle: "Add new POM page for application", Page: new AddPOMIntroWizardPage());

            AddPage(Name: "Select App and folder", Title: "Select App and Folder", SubTitle: "Choose Target Application and Agent", Page: new SelectAppFolderWizardPage());

            AddPage(Name: "Scan Config", Title: "Scan Config", SubTitle: "Scan Config", Page: new LearnConfigWizardPage());

            AddPage(Name: "Learn", Title: "Learn", SubTitle: "Learn Page Object Model", Page: new LearnWizardPage(this.POM));

            AddPage(Name: "Map", Title: "Map", SubTitle: "Map each UI element", Page: new MapUIElementsWizardPage(this.POM));

            AddPage(Name: "Save", Title: "Save", SubTitle: "Save POM to file", Page: new SavePOMWizardPage());
        }