示例#1
0
        /// <summary>
        /// Adds an action to global test (inside global page)
        /// </summary>
        /// <param name="element"></param>
        internal void AddAction(HtmlElement element)
        {
            wxAction action = WxFactory.GetWxAction(element);

            if (action != null)
            {
                currentTest.AddAction(action);
            }
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="document"></param>
        /// <param name="tv"></param>
        internal void CapturePage(HtmlDocument document, TreeView tv)
        {
            if (!initialized)
            {
                Initialize(document);
            }
            wxPage page = new wxPage();

            page.Name = document.Title;
            wxTsSimple test     = new wxTsSimple();
            wxTsSimple linkTest = new wxTsSimple();

            linkTest.Name = "Captured Links";
            test.Name     = "Captured Html Elements";
            TreeNode tnPage = new TreeNode(page.ToString());

            tnPage.Tag = page;
            TreeNode tnTest = new TreeNode(test.ToString());

            tnTest.Tag = test;
            TreeNode tnTestLnk = new TreeNode(linkTest.ToString());

            tnTestLnk.Tag = linkTest;
            foreach (HtmlElement element in document.All)
            {
                wxAction action = WxFactory.GetWxAction(element);
                if (action != null)
                {
                    TreeNode tnAction = new TreeNode(action.ToString());
                    tnAction.Tag = action;
                    if (action is wxActLink)
                    {
                        linkTest.AddAction(action);
                        tnTestLnk.Nodes.Add(tnAction);
                    }
                    else
                    {
                        test.AddAction(action);
                        tnTest.Nodes.Add(tnAction);
                    }
                }
            }
            // Add tests
            tnPage.Nodes.Add(tnTest);
            page.AddTest(test);
            // Add link tests
            tnPage.Nodes.Add(tnTestLnk);
            page.AddTest(linkTest);
            // Add page
            tv.Nodes.Add(tnPage);
            scenario.Pages.Add(page);
        }