[mapguide-commits] r8759 - trunk/MgDev/UnitTest/Acceptance/tests/ajax

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Sep 10 10:10:59 PDT 2015


Author: jng
Date: 2015-09-10 10:10:59 -0700 (Thu, 10 Sep 2015)
New Revision: 8759

Added:
   trunk/MgDev/UnitTest/Acceptance/tests/ajax/ui.js
Modified:
   trunk/MgDev/UnitTest/Acceptance/tests/ajax/navigation.js
   trunk/MgDev/UnitTest/Acceptance/tests/ajax/tools.js
Log:
#2573: Add AJAX viewer tests for:
 - Radius select
 - Testing UI elements
   - Context Menu (moved from navigation suite)
   - Task Pane toggling
   - Property/Layer palette toggling and collapsing

Modified: trunk/MgDev/UnitTest/Acceptance/tests/ajax/navigation.js
===================================================================
--- trunk/MgDev/UnitTest/Acceptance/tests/ajax/navigation.js	2015-09-10 15:39:29 UTC (rev 8758)
+++ trunk/MgDev/UnitTest/Acceptance/tests/ajax/navigation.js	2015-09-10 17:10:59 UTC (rev 8759)
@@ -129,25 +129,5 @@
                 //Snapshot and baseline compare
                 .saveScreenshot(helper.screenshotName(client, "Ajax - NAV004 - 002 - Pan result"))
             .end();
-    },
-    'NAV005 - Context Menu': function (client) {
-        client.url(settings.getAjaxViewerUrl())
-            .waitForElementPresent("#taskFrame", 5000, true)
-            //NOTE: For nested frames, you have to navigate down each frame individually. This is a selenium problem
-            .frame("taskFrame")
-                .waitForElementPresent("frame[name='taskPaneFrame']", 5000, true)
-                .frame("taskPaneFrame")
-                    .waitForElementVisible("table.RegText", 5000, true)
-                    .assert.containsText("table.RegText td.Title", "Overview")
-                .frame(null)
-            .frame(null)
-            .waitForElementPresent("#mapFrame", 5000, true)
-            .frame("mapFrame")
-                .moveToElement("#map", 250, 250)
-                .mouseButtonClick(2)
-                .waitForElementVisible("#CtxMenu", 1000, true)
-                //Snapshot and baseline compare
-                .saveScreenshot(helper.screenshotName(client, "Ajax - NAV005 - 001 - Context Menu"))
-            .end();
     }
 }
\ No newline at end of file

Modified: trunk/MgDev/UnitTest/Acceptance/tests/ajax/tools.js
===================================================================
--- trunk/MgDev/UnitTest/Acceptance/tests/ajax/tools.js	2015-09-10 15:39:29 UTC (rev 8758)
+++ trunk/MgDev/UnitTest/Acceptance/tests/ajax/tools.js	2015-09-10 17:10:59 UTC (rev 8759)
@@ -1,6 +1,8 @@
 var settings = require("../settings");
 var helper = require("../helper");
 var wl = require("./weblayout");
+var cmds = require("../ajaxcmds");
+var util = require("util");
 
 module.exports = {
     tags: ["ajax", "tools"],
@@ -263,5 +265,129 @@
                 .frame(null)
             .frame(null)
             .end();
+    },
+    'TOOLS004 - Radius Select': function(client) {
+        client.url(settings.getAjaxViewerUrl())
+            .waitForElementPresent("#taskFrame", 5000, true)
+            //NOTE: For nested frames, you have to navigate down each frame individually. This is a selenium problem
+            .frame("taskFrame")
+                .waitForElementPresent("frame[name='taskPaneFrame']", 5000, true)
+                .frame("taskPaneFrame")
+                    .waitForElementVisible("table.RegText", 5000, true)
+                    .assert.containsText("table.RegText td.Title", "Overview")
+                .frame(null)
+            .frame(null)
+            .waitForElementPresent("#tbFrame", 5000, true)
+            .frame("tbFrame")
+                .useXpath()
+                    .waitForElementVisible(wl.getToolbarCommand(wl.toolbar.ZOOM_RECT), 1000, true)
+                    .moveToElement(wl.getToolbarCommand(wl.toolbar.ZOOM_RECT), 10, 10)
+                    .click(wl.getToolbarCommand(wl.toolbar.ZOOM_RECT))
+                    //Snapshot and baseline compare
+                    .saveScreenshot(helper.screenshotName(client, "Ajax - TOOLS004 - 001 - Zoom Rectangle clicked"))
+                .useCss()
+            .frame(null)
+            .waitForElementPresent("#mapFrame", 5000, true)
+            .frame("mapFrame")
+                .moveToElement("#map", 350, 350)
+                .mouseButtonDown(0)
+                .moveToElement("#map", 400, 400)
+                //Snapshot and baseline compare
+                .saveScreenshot(helper.screenshotName(client, "Ajax - TOOLS004 - 002 - Zoom Rectangle drag box"))
+                .mouseButtonUp(0)
+                .pause(3000) //Breathe for rendering
+                //Snapshot and baseline compare
+                .saveScreenshot(helper.screenshotName(client, "Ajax - TOOLS004 - 003 - Zoom Rectangle result"))
+                //Flyout context menu
+                .moveToElement("#map", 250, 250)
+                .mouseButtonClick(2)
+                .waitForElementVisible("#CtxMenu", 1000, true)
+                    .waitForElementVisible("tr[name='Sub:1']", 1000, true)
+                        .moveToElement("tr[name='Sub:1']", 10, 10)
+                        .moveToElement("#FlyoutDiv31", 10, 10) //This is the select radius context menu command. Assuming deterministic DOM element generation here.
+                            .assert.containsText("#FlyoutDiv3T1", "Select Radius") //But check just in case
+                            .click("#FlyoutDiv3T1", function() { console.log("Clicked 'Select Radius' context menu item"); })
+                .moveToElement("#map", 350, 350)
+                .mouseButtonDown(0)
+                .moveToElement("#map", 400, 400)
+                //Snapshot and baseline compare
+                .saveScreenshot(helper.screenshotName(client, "Ajax - TOOLS004 - 004 - Select Radius circle"))
+                .mouseButtonUp(0)
+                .pause(3000) //Breathe for rendering
+                //Snapshot and baseline compare
+                .saveScreenshot(helper.screenshotName(client, "Ajax - TOOLS004 - 005 - Select Radius result"))
+                .waitForElementVisible("#PropertyPaneToolbar", 1000, true)
+                    .assert.containsText("#selLayers option:nth-child(1)", "Parcels", "Expected selected layer dropdown present with entry 'Parcels'")
+                    .assert.containsText("#selFeature option:nth-child(1)", "1", "Expected selected feature dropdown present with entry '1'")
+                .frame("PropertyCtrl")
+                    .waitForElementVisible("#Grid", 1000, true)
+                    .assert.elementPresent("#Grid tbody tr.GridCell", "Expected property palette to have attributes of selected feature")
+                .frame(null)
+            .frame(null)
+            .end();
     }
+    //Can't test polygon select yet as nightwatch.js doesn't appear to allow us to perform [ctrl + click]
+    //needed to finish polygon digitization
+    /*
+    'TOOLS005 - Polygon Select': function(client) {
+        client.url(settings.getAjaxViewerUrl())
+            .waitForElementPresent("#taskFrame", 5000, true)
+            //NOTE: For nested frames, you have to navigate down each frame individually. This is a selenium problem
+            .frame("taskFrame")
+                .waitForElementPresent("frame[name='taskPaneFrame']", 5000, true)
+                .frame("taskPaneFrame")
+                    .waitForElementVisible("table.RegText", 5000, true)
+                    .assert.containsText("table.RegText td.Title", "Overview")
+                .frame(null)
+            .frame(null)
+            .waitForElementPresent("#tbFrame", 5000, true)
+            .frame("tbFrame")
+                .useXpath()
+                    .waitForElementVisible(wl.getToolbarCommand(wl.toolbar.ZOOM_RECT), 1000, true)
+                    .moveToElement(wl.getToolbarCommand(wl.toolbar.ZOOM_RECT), 10, 10)
+                    .click(wl.getToolbarCommand(wl.toolbar.ZOOM_RECT))
+                    //Snapshot and baseline compare
+                    .saveScreenshot(helper.screenshotName(client, "Ajax - TOOLS004 - 001 - Zoom Rectangle clicked"))
+                .useCss()
+            .frame(null)
+            .waitForElementPresent("#mapFrame", 5000, true)
+            .frame("mapFrame")
+                .moveToElement("#map", 350, 350)
+                .mouseButtonDown(0)
+                .moveToElement("#map", 400, 400)
+                //Snapshot and baseline compare
+                .saveScreenshot(helper.screenshotName(client, "Ajax - TOOLS004 - 002 - Zoom Rectangle drag box"))
+                .mouseButtonUp(0)
+                .pause(3000) //Breathe for rendering
+                //Snapshot and baseline compare
+                .saveScreenshot(helper.screenshotName(client, "Ajax - TOOLS004 - 003 - Zoom Rectangle result"))
+                //Flyout context menu
+                .moveToElement("#map", 250, 250)
+                .mouseButtonClick(2)
+                .waitForElementVisible("#CtxMenu", 1000, true)
+                    .waitForElementVisible("tr[name='Sub:1']", 1000, true)
+                        .moveToElement("tr[name='Sub:1']", 10, 10)
+                        .moveToElement("#FlyoutDiv32", 10, 10) //This is the select radius context menu command. Assuming deterministic DOM element generation here.
+                            .assert.containsText("#FlyoutDiv3T2", "Select Polygon") //But check just in case
+                            .click("#FlyoutDiv3T2", function() { console.log("Clicked 'Select Polygon' context menu item"); })
+                .moveToElement("#map", 350, 350)
+                .mouseButtonDown(0)
+                .moveToElement("#map", 400, 400)
+                //Snapshot and baseline compare
+                .saveScreenshot(helper.screenshotName(client, "Ajax - TOOLS004 - 004 - Select Radius circle"))
+                .mouseButtonUp(0)
+                .pause(3000) //Breathe for rendering
+                //Snapshot and baseline compare
+                .saveScreenshot(helper.screenshotName(client, "Ajax - TOOLS004 - 005 - Select Radius result"))
+                .waitForElementVisible("#PropertyPaneToolbar", 1000, true)
+                    .assert.containsText("#selLayers option:nth-child(1)", "Parcels", "Expected selected layer dropdown present with entry 'Parcels'")
+                    .assert.containsText("#selFeature option:nth-child(1)", "1", "Expected selected feature dropdown present with entry '1'")
+                .frame("PropertyCtrl")
+                    .waitForElementVisible("#Grid", 1000, true)
+                    .assert.elementPresent("#Grid tbody tr.GridCell", "Expected property palette to have attributes of selected feature")
+                .frame(null)
+            .frame(null)
+            .end();
+    }
+    */
 };
\ No newline at end of file

Added: trunk/MgDev/UnitTest/Acceptance/tests/ajax/ui.js
===================================================================
--- trunk/MgDev/UnitTest/Acceptance/tests/ajax/ui.js	                        (rev 0)
+++ trunk/MgDev/UnitTest/Acceptance/tests/ajax/ui.js	2015-09-10 17:10:59 UTC (rev 8759)
@@ -0,0 +1,118 @@
+var settings = require("../settings");
+var helper = require("../helper");
+var wl = require("./weblayout");
+
+module.exports = {
+    tags: ["ajax", "ui"],
+    beforeEach: function(browser) {
+        helper.setDefaultBrowserSize(browser);
+    },
+    'UI001 - Context Menu': function (client) {
+        client.url(settings.getAjaxViewerUrl())
+            .waitForElementPresent("#taskFrame", 5000, true)
+            //NOTE: For nested frames, you have to navigate down each frame individually. This is a selenium problem
+            .frame("taskFrame")
+                .waitForElementPresent("frame[name='taskPaneFrame']", 5000, true)
+                .frame("taskPaneFrame")
+                    .waitForElementVisible("table.RegText", 5000, true)
+                    .assert.containsText("table.RegText td.Title", "Overview")
+                .frame(null)
+            .frame(null)
+            .waitForElementPresent("#mapFrame", 5000, true)
+            .frame("mapFrame")
+                .moveToElement("#map", 250, 250)
+                .mouseButtonClick(2)
+                .waitForElementVisible("#CtxMenu", 1000, true)
+                //Snapshot and baseline compare
+                .saveScreenshot(helper.screenshotName(client, "Ajax - UI001 - 001 - Context Menu"))
+            .end();
+    },
+    'UI002 - Task Pane Toggle': function (client) {
+        client.url(settings.getAjaxViewerUrl())
+            .waitForElementPresent("#taskFrame", 5000, true)
+            //NOTE: For nested frames, you have to navigate down each frame individually. This is a selenium problem
+            .frame("taskFrame")
+                .waitForElementPresent("frame[name='taskPaneFrame']", 5000, true)
+                .frame("taskPaneFrame")
+                    .waitForElementVisible("table.RegText", 5000, true)
+                    .assert.containsText("table.RegText td.Title", "Overview")
+                .frame(null)
+            .frame(null)
+            .waitForElementPresent("#taskBar", 5000, true)
+            .frame("taskBar")
+                .waitForElementVisible("#btnClose", 1000, true)
+                .moveToElement("#btnClose", 10, 10)
+                .mouseButtonClick(0)
+                .pause(1500) //Breathe, let the toggle and re-render take effect
+                //Snapshot and baseline compare
+                .saveScreenshot(helper.screenshotName(client, "Ajax - UI002 - 001 - Task Pane hidden"))
+            .frame(null)
+            .frame("tbFrame")
+                .waitForElementVisible("#divOpenTaskbarBtn", 1000, true)
+                    .moveToElement("#divOpenTaskbarBtn", 10, 10)
+                    .mouseButtonClick(0)
+                .pause(1500) //Breathe, let the toggle and re-render take effect
+                //Snapshot and baseline compare
+                .saveScreenshot(helper.screenshotName(client, "Ajax - UI002 - 002 - Task Pane shown"))
+            .frame(null)
+            .end();
+    },
+    'UI003 - Pane Collapsing': function (client) {
+        client.url(settings.getAjaxViewerUrl())
+            .waitForElementPresent("#taskFrame", 5000, true)
+            //NOTE: For nested frames, you have to navigate down each frame individually. This is a selenium problem
+            .frame("taskFrame")
+                .waitForElementPresent("frame[name='taskPaneFrame']", 5000, true)
+                .frame("taskPaneFrame")
+                    .waitForElementVisible("table.RegText", 5000, true)
+                    .assert.containsText("table.RegText td.Title", "Overview")
+                .frame(null)
+            .frame(null)
+            .waitForElementPresent("#mapFrame", 5000, true)
+            .frame("mapFrame")
+                .waitForElementVisible("#legendIcon", 1000, true)
+                .waitForElementVisible("#propIcon", 1000, true)
+                    .click("#legendIcon")
+                    .pause(500) //breathe to let the toggle happen
+                    //Snapshot and baseline compare
+                    .saveScreenshot(helper.screenshotName(client, "Ajax - UI003 - 001 - Legend Collapsed"))
+                    .click("#propIcon")
+                    .pause(500) //breathe to let the toggle happen
+                    //Snapshot and baseline compare
+                    .saveScreenshot(helper.screenshotName(client, "Ajax - UI003 - 002 - Legend and Properties Collapsed"))
+            .frame(null)
+            .end();
+    },
+    'UI004 - Pane Toggling': function (client) {
+        client.url(settings.getAjaxViewerUrl())
+            .waitForElementPresent("#taskFrame", 5000, true)
+            //NOTE: For nested frames, you have to navigate down each frame individually. This is a selenium problem
+            .frame("taskFrame")
+                .waitForElementPresent("frame[name='taskPaneFrame']", 5000, true)
+                .frame("taskPaneFrame")
+                    .waitForElementVisible("table.RegText", 5000, true)
+                    .assert.containsText("table.RegText td.Title", "Overview")
+                .frame(null)
+            .frame(null)
+            .waitForElementPresent("#mapFrame", 5000, true)
+            .frame("mapFrame")
+                .waitForElementVisible("#LayerCaption", 1000, true)
+                .waitForElementVisible("#PropertyCaption", 1000, true)
+                    .moveToElement("#LayerCaption", 10, 10)
+                        .mouseButtonClick(2)
+                        .waitForElementVisible("#InfoMenu1", 1000, true)
+                        .moveToElement("#InfoMenu1", 10, 10) //Layers
+                            .mouseButtonClick(0)
+                            .pause(250) //Breathe and let the toggle happen
+                            .saveScreenshot(helper.screenshotName(client, "Ajax - UI004 - 001 - Legend hidden"))
+                    .moveToElement("#PropertyCaption", 10, 10)
+                        .mouseButtonClick(2)
+                        .waitForElementVisible("#InfoMenu2", 1000, true)
+                        .moveToElement("#InfoMenu2", 10, 10) //Layers
+                            .mouseButtonClick(0)
+                            .pause(250) //Breathe and let the toggle happen
+                            .saveScreenshot(helper.screenshotName(client, "Ajax - UI004 - 002 - Properties hidden"))
+            .frame(null)
+            .end();
+    }
+};
\ No newline at end of file



More information about the mapguide-commits mailing list