ContextMenuTest.cs :  » Web-Testing » IeUnit-web-testing-framework » QuickFocus » QA » Gui » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Web Testing » IeUnit web testing framework 
IeUnit web testing framework » QuickFocus » QA » Gui » ContextMenuTest.cs
#if QA_TEST
using System;
using VisuMap.AppTest;
using System.Windows.Forms;
using System.Diagnostics;


namespace QuickFocus.QA.Gui{
  /// <summary>
  /// Test the context menu of the transparent screen panel.
  /// </summary>
  [TestCase]
    public class ContextMenuTest : QaTestCase
  {
        ContextMenu screenMenu;

        public override void SetUpCase() {
            screenMenu = (FindControl("screenPanel") as Panel).ContextMenu;
        }

        public override void SetUp() {
            AttachSampleFile("TextTable.html");
            Root.appConfig.focusLevel = 0;
        }

        [Test]
        public void ChangeFocusScope() {
            AssertNotNull( screenMenu );
            MenuItem miEnlarge = FormChecker.FindMenuItem(screenMenu, "Enlarge Focus Scope");
            MenuItem miShrink  = FormChecker.FindMenuItem(screenMenu, "Shrink Focus Scope");
            MenuItem miReset   = FormChecker.FindMenuItem(screenMenu, "Reset Focus Scope");

            AssertNotNull( miEnlarge );

            ClickElementById("TheContent");
            AssertStatusHas("<TD id=TheContent>The Content </TD>");
            AssertEquals(0, Root.appConfig.focusLevel);

            Invoke( delegate() {
                miEnlarge.PerformClick();
                WaitMin();
                AssertEquals(1, Root.appConfig.focusLevel);

                miEnlarge.PerformClick();
                miEnlarge.PerformClick();
                miEnlarge.PerformClick();
                WaitMin();
                AssertEquals(4, Root.appConfig.focusLevel);

                miShrink.PerformClick();
                WaitMin();
                // move the mouse to trigger update of the status text.
                AssertEquals(3, Root.appConfig.focusLevel);
                MoveMouseToElement( FindElementById("TheContent") );
                AssertStatusHas("3: \r\n<TABLE id=Table25 border=0>");

                miReset.PerformClick();
                WaitMin();
                AssertEquals(0, Root.appConfig.focusLevel);
            });
        }

        [Test]
        public void DetachPageMenu() {
            MenuItem miDetach  = FormChecker.FindMenuItem(screenMenu, "Detach Page");
            Invoke( delegate() {
                miDetach.PerformClick();
            });
            AssertEquals(AppState.StOpen, Root.mainForm.TheState);
        }

        // Validate the context menu of the snippet window.
        [Test]
        public void SnippetCtxMenu() {
            ContextMenu ctxMenu = FindControl("rtbSnipWin").ContextMenu;
            AssertNotNull(ctxMenu);

            Invoke(delegate() {
                AssertNotNull(FormChecker.FindMenuItem(ctxMenu, "Cu&t"));
                AssertNotNull(FormChecker.FindMenuItem(ctxMenu, "&Copy"));
                AssertNotNull(FormChecker.FindMenuItem(ctxMenu, "&Paste"));
                AssertNotNull(FormChecker.FindMenuItem(ctxMenu, "&Run Snippet"));
                AssertNotNull(FormChecker.FindMenuItem(ctxMenu, "&Debug Snippet..."));
                AssertNotNull(FormChecker.FindMenuItem(ctxMenu, "Clear Snippet"));


                FormChecker.FindMenuItem(ctxMenu, "Cu&t").PerformClick();
                FormChecker.FindMenuItem(ctxMenu, "&Copy").PerformClick();
                FormChecker.FindMenuItem(ctxMenu, "&Paste").PerformClick();
                //FormChecker.FindMenuItem(ctxMenu, "&Run Snippet").PerformClick();
                //FormChecker.FindMenuItem(ctxMenu, "&Debug Snippet...").PerformClick();
                FormChecker.FindMenuItem(ctxMenu, "Clear Snippet").PerformClick();
            });
        }

        [Test]
        public void ElementProperty() {
            MenuItem prop = FormChecker.FindMenuItem(screenMenu, "Element Properties...");
            ClickElementById("TheContent");
            Invoke(delegate() {
                prop.PerformClick();
            });
            ElementProperties propForm = Root.mainForm.TheScreen.PropertyForm;
            AssertNotNull( propForm );
            FormChecker u = new FormChecker(propForm);
            u.Invoke(delegate() {
                TextBox tbox = u.FindControl("tboxElementHtml") as TextBox;
                AssertNotNull(tbox);
                AssertTrue(tbox.Text.IndexOf("The Content") > 0);
                propForm.Close();
            });
        }
  }
}

#endif
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.