You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by sb...@apache.org on 2015/04/07 06:21:23 UTC

svn commit: r1671740 - in /sling/trunk/contrib/explorers/resourceeditor: ./ frontend/ src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/ src/main/resources/SLING-INF/libs/sling/resource-editor/ src/test/javascript/e2e/spec/

Author: sboehme
Date: Tue Apr  7 04:21:22 2015
New Revision: 1671740

URL: http://svn.apache.org/r1671740
Log:
reverting "SLING-4555 Resource Editor: fixed e2e tests, node name handling in the add node dialog and added an initial version of the add node e2e test" as it has been breaking the build.

Modified:
    sling/trunk/contrib/explorers/resourceeditor/README
    sling/trunk/contrib/explorers/resourceeditor/frontend/Gruntfile.js
    sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/AddNodeController.js
    sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp
    sling/trunk/contrib/explorers/resourceeditor/src/test/javascript/e2e/spec/e2e_spec.js

Modified: sling/trunk/contrib/explorers/resourceeditor/README
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/README?rev=1671740&r1=1671739&r2=1671740&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/README (original)
+++ sling/trunk/contrib/explorers/resourceeditor/README Tue Apr  7 04:21:22 2015
@@ -12,13 +12,8 @@ o Use `mvn install sling:install` to dep
 o To have frontend changes automatically deployed call `mvn install -P autoInstallBundle -Dsling.mountByFS=true`
 o To run the build on your local machine call './grunt desktop_build' within the frontend directory. It includes end to end tests with firefox and chrome.
 o To have the less sources automatically compiled on change call `./grunt watch:less` in the frontend directory. Press Ctrl-Z to stop watching.
-o To have the 'desktop_build' target triggered on changes in the frontend tests, less sources, JavaScript files and JSP sources use `./grunt watch:all` in the frontend directory and also press Ctrl-Z to stop watching.
-o To get the end to end tests triggered by changes use './grunt watch:e2e' in the frontend directory and also press Ctrl-Z to stop watching.
+o To have the 'desktop_build' target triggered on changes in the frontend tests, less sources, JavaScript files and JSP sources use call `./grunt watch:all` in the frontend directory and also press Ctrl-Z to stop watching. 
 
-++ Debugging the the end to end tests ++
-o You can still use 'console.log()' and JSON.stringify(display) to inspect JSON values of a test spec.
-o You can use 'client.pause([milliseconds]);' in you test spec to pause and also inspect the browser status.
-o To set breakpoints in a test spec you can use a JavaScript IDE like 'Webstorm'
 
 
 Enjoy!
\ No newline at end of file

Modified: sling/trunk/contrib/explorers/resourceeditor/frontend/Gruntfile.js
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/frontend/Gruntfile.js?rev=1671740&r1=1671739&r2=1671740&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/frontend/Gruntfile.js (original)
+++ sling/trunk/contrib/explorers/resourceeditor/frontend/Gruntfile.js Tue Apr  7 04:21:22 2015
@@ -57,7 +57,6 @@ module.exports = function(grunt) {
 		                  'bootstrap/dist/js/bootstrap.min.js',
 		                  'select2/select2.min.js',
 		                  'jquery/dist/jquery.min.js',
-		                  'jquery/dist/jquery.min.map',
 		                  'bootbox/bootbox.min.js',
 		                  'jstree/dist/jstree.min.js'
 		                 ], // Actual pattern(s) to match.
@@ -74,7 +73,6 @@ module.exports = function(grunt) {
 	            src: [
 	                  'select2/select2.css',
 	                  'select2/select2.png',
-	                  'select2/select2-spinner.gif',
 	                  'animate.css/animate.min.css',
 	                  'jstree/dist/themes/default/style.min.css',
 	                  'jstree/dist/themes/default/32px.png',
@@ -117,6 +115,8 @@ module.exports = function(grunt) {
 	    },
         webdriver: {
             options: {
+            	host: 'localhost',
+            	port: 8080
             },
             chrome: {
                 tests: [e2eTestSpecFolder],

Modified: sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/AddNodeController.js
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/AddNodeController.js?rev=1671740&r1=1671739&r2=1671740&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/AddNodeController.js (original)
+++ sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/AddNodeController.js Tue Apr  7 04:21:22 2015
@@ -73,12 +73,12 @@ org.apache.sling.reseditor.AddNodeContro
 			})
 		});
 	};
-	
+
 	AddNodeController.prototype.addNode = function() {
 		var thatAddNodeController = this;
-		var nodeName = this.latestEnteredNodeName;
-		var nodeType = $("#nodeType").select2("val");
-		var resourceType = this.latestEnteredResType;
+		var nodeName = this.latestEnteredNodeName.trim();
+		var nodeType = $("#nodeType").val();
+		var resourceType = (this.latestEnteredResType != null && this.latestEnteredResType != "") ? this.latestEnteredResType.trim() : "";
 		
 		var data = {"_charset_": "utf-8"};
 		if ("" != nodeType){
@@ -205,13 +205,19 @@ org.apache.sling.reseditor.AddNodeContro
 		$("#nodeName").select2({
 			placeholder: "Enter or select a node name",
 			allowClear: true, 
-			dropdownCssClass: "node_name_dd_container",
+			selectOnBlur: true,
 			data: nodeNameObjects,
 			createSearchChoice: function(searchTerm){
-				thatAddNodeController.latestEnteredNodeName = searchTerm;
 				return {id:searchTerm, text:searchTerm};
 			}
 		});
+		$("#nodeName").on("select2-highlight", function(e) { 
+			/* In Select2 there is currently no way of getting
+			 * the highlighted (newly entered but not yet selected) text.
+			 * But there is this event. Thats why I use this one. 
+			 */ 
+			thatAddNodeController.latestEnteredNodeName=e.val;
+		})
 		
 		var nodeNameList = Object.keys(appliCnTypesByNodeName);
 		nodeNameList.sort();
@@ -264,13 +270,16 @@ org.apache.sling.reseditor.AddNodeContro
 				selectOnBlur: true,
 				data: data,
 				createSearchChoice: function(searchTerm){
-					thatAddNodeController.latestEnteredResType = searchTerm;
 					return {id:searchTerm, text:searchTerm};
 				}
 			}).data("select2");
-			$("#resourceType").on("select2-loaded", function() {
-				$('#addNodeDialog').append('<div class="add-node-finished"></div>');
-			});
+			$("#resourceType").on("select2-highlight", function(e) {
+				/* In Select2 there is currently no way of getting
+				 * the highlighted (newly entered but not yet selected) text.
+				 * But there is this event. Thats why I use this one. 
+				 */ 
+				thatAddNodeController.latestEnteredResType=e.val;
+			})
 		});
 	}
 	

Modified: sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp?rev=1671740&r1=1671739&r2=1671740&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp (original)
+++ sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp Tue Apr  7 04:21:22 2015
@@ -324,6 +324,5 @@ new org.apache.sling.reseditor.JSTreeAda
 	    </div>
 	  </div>
 	</div>
-	<div id="last-element"></div>
 </body>
 </html>

Modified: sling/trunk/contrib/explorers/resourceeditor/src/test/javascript/e2e/spec/e2e_spec.js
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/src/test/javascript/e2e/spec/e2e_spec.js?rev=1671740&r1=1671739&r2=1671740&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/src/test/javascript/e2e/spec/e2e_spec.js (original)
+++ sling/trunk/contrib/explorers/resourceeditor/src/test/javascript/e2e/spec/e2e_spec.js Tue Apr  7 04:21:22 2015
@@ -2,62 +2,16 @@
 
 var assert = require('assert');
 
-describe('A user of the Apache Sling Resource Editor', function() {
-	var homeURL = 'http://localhost:8080/reseditor/.html';
-	var client = browser.url(homeURL);
-	// TODO: Find a way to specify the host and the port via grunt. See 
+describe('The Apache Sling Resource Editor', function() {
+	browser = browser.url('http://localhost:8080/reseditor/.html');
+	// Find a way to specify the host and the port via grunt. See 
 	// http://stackoverflow.com/questions/29370075/how-to-pass-parameters-from-the-gruntfile-js-to-the-webdriverio-spec
-	client.timeouts("script", 500);
-
-	describe('can open the add node dialog with', function() {
-		  it('the icon', function(done) {
-			  client = client.url(homeURL);
-			  client.waitForExist('#last-element', function(err) {
-				  client.click('#root_anchor i.add-icon', function(err, res) {
-					  client.waitForVisible('#addNodeDialog', function(err) {
-			    		  client.getCssProperty('#addNodeDialog', 'display', function(err, display) {
-				    		  assert(typeof err === "undefined" || err === null);
-				    		  assert(display.value === "block");
-				    	  });
-			    	  });
-			      })
-		      })
-		      .call(done);
-		  });
-
-		  it('the shortcut', function(done) {
-			  client = client.url(homeURL);
-			  client.waitForExist('#last-element', function(err) {
-				  client.click('#root_anchor i.add-icon', function(err, res) {
-					  client.keys("a", function(err) {
-						  client.waitForVisible('#addNodeDialog', function(err) {
-				    		  client.getCssProperty('#addNodeDialog', 'display', function(err, display) {
-					    		  assert(typeof err === "undefined" || err === null);
-					    		  assert(display.value === "block");
-					    	  });
-				    	  });
-					  });
-			      })
-		      })
-		      .call(done);
-		  });
-	});
-
-	  it('can add an unstructured node to the root node', function(done) {
-		  client = client.url(homeURL);
-		  client.waitForExist('#last-element', function(err) {
-			  client.click('#root_anchor i.add-icon', function(err, res) {
-				  client.waitForVisible('#addNodeDialog .add-node-finished', function(err) {
-					  client.setValue('.node_name_dd_container input', 'testnode');
-					  client.addValue('.node_name_dd_container input', 'Return'); // presses the 'return' key
-					  client.click('#addNodeDialog .btn.btn-primary.submit', function(err, res) {
-						  client.pause(3000); 
-					  });
-		    	  });
-				  
-		      })  
+	
+	  it('should have a title', function(done) {
+		  browser
+	      .getTitle(function(err,title) {
+	          assert(title.indexOf('Apache Sling Resource Editor') !== -1);
 	      })
 	      .call(done);
 	  });
-	
 });
\ No newline at end of file