Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Selenium - TreeNodeClick

    Hi all

    We have a few SectionStackItems each containing a TreeGrid. If a node gets clicked (event onNodeClick) some actions are called. If a user just hits the "+"-icon, then the subnodes are loaded.

    We are trying to test this construct now with Selenium. The Problem is, that if we select the node with the Selenium IDE and do a "click", just the subbranch opens but the onNodeClick Event doesn't fire. If you click manual (without selenium) on this node, everything works as expected.

    Code:
    scLocator=//ListGrid[ID="isc_TreeGrid_1"]/body/row[UniqueId=160.ID_GEBAEUDE.537||Display=Gesamtbetrieb%20||2]/col[fieldName=Display||0]
    We also have a similar problem with the SectionStackItems. Is there a possibility to fire the onSectionHeaderClick event?

    We use FF 3.6 and SmartGWT 2.2.

    Thank you very much...

    p.s: Just realised that I posted this question in the wrong forum.. Could you please move it to SmartGWT. Sorry about that
    Last edited by krigu; 8 Jul 2010, 01:11.

    #2
    Hi, can you tell me, please, how to select the tree node with selenium? Click on it doesn't help.
    Thank's.

    Comment


      #3
      I also interested how to select tree item with selenium.

      Thank you

      Comment


        #4
        If you find a solution how to select tree node, please, let us know.

        Comment


          #5
          I am experiencing this same problem, and would also be interested in a solution to this.

          Comment


            #6
            I'll look into it.

            Comment


              #7
              Any progress?

              I'm facing the same issue :(

              Comment


                #8
                Hi,

                we've got the same issue.
                This is our generated scLocator:

                Code:
                scLocator=//TreeGrid[ID="isc_TreeGrid_5"]/body/row[0]/col[fieldName=nodeTitle||0]

                Comment


                  #9
                  Hi Levi, All,
                  We're not reproducing this problem with a simple test case. Selection, folder open and close and folderClick events all seem to be firing as expected.

                  Can you
                  - Ensure you're testing against the lastest SmartGWT build and using the Selenium extensions from that build (see http://smartclient.com/builds - the Selenium Extension files are present in the LGPL package)
                  (Note that when adding extensions under the "Options">"Options..." menu in Selenium you may need to first remove the path to earlier versions of the user-extensions js files, before adding the newly downloaded version)

                  - If you still see the problem, can you post a simple test case (Entry point class with treeGrid definition, plus steps to reproduce the problem) so we can test on our end?

                  Comment


                    #10
                    Hi,
                    this is done with the 2010-09-01 build of SmartGWT LGPL with the GWT sample project.
                    I didn't see differences in the user-extensions js files against the version we were using already.

                    Code:
                     public void onModuleLoad() {
                      RootPanel.get().add(getViewPanel());
                     }
                    
                     public Canvas getViewPanel() {
                      HTMLFlow htmlFlow = new HTMLFlow();
                      htmlFlow.setOverflow(Overflow.AUTO);
                      htmlFlow.setPadding(10);
                      String contents = "<b>Severity 1</b> - Critical problem<br>System is unavailable in production or "
                        + "is corrupting data, and the error severely impacts the user's operations."
                        + "<br><br><b>Severity 2</b> - Major problem<br>An important function of the system "
                        + "is not available in production, and the user's operations are restricted."
                        + "<br><br><b>Severity 3</b> - Minor problem<br>Inability to use a function of the "
                        + "system occurs, but it does not seriously affect the user's operations.";
                      htmlFlow.setContents(contents);
                    
                      TreeGrid moduleTree = new TreeGrid();
                      moduleTree.setWidth100();
                      moduleTree.setHeight100();
                      moduleTree.setShowConnectors(false);
                      moduleTree.setShowOpenIcons(true);
                      moduleTree.setShowDropIcons(false);
                      moduleTree.setShowHeader(false);
                      moduleTree.setAnimateFolders(true);
                      moduleTree.setAnimateFolderSpeed(500);
                    
                      moduleTree.addLeafClickHandler(new LeafClickHandler() {
                       public void onLeafClick(LeafClickEvent event) {
                        SC.say("Hello World from SmartGWT");
                       }
                      });
                    
                      Tree tree = new Tree();
                      tree.setModelType(TreeModelType.PARENT);
                      tree.setNameProperty("title");
                      tree.setTitleProperty("title");
                      tree.setShowRoot(false);
                    
                      TreeNode subMenu = null;
                      TreeNode parent = new TreeNode();
                      parent.setAttribute("title", "parent");
                      tree.setRoot(parent);
                    
                      TreeNode node = new TreeNode();
                      node.setAttribute("title", "the_title");
                    
                      subMenu = new TreeNode();
                      subMenu.setAttribute("title", "LeafOfMenu");
                      tree.add(subMenu, "parent");
                      tree.openFolder(subMenu);
                      tree.add(node, "test");
                    
                      moduleTree.setData(tree);
                    
                      IButton button = new IButton("Hello World");
                      button.addClickHandler(new ClickHandler() {
                       public void onClick(ClickEvent event) {
                        SC.say("Hello World from SmartGWT");
                       }
                      });
                    
                      SectionStack menu = new SectionStack();
                      // only one visible at a time
                      menu.setVisibilityMode(VisibilityMode.MUTEX);
                      menu.setWidth(300);
                      menu.setHeight(600);
                      menu.setBorder("2px solid #458B00");
                      menu.setAnimateSections(true);
                    
                      SectionStackSection section = new SectionStackSection("HTML Flow 1");
                      section.setCanCollapse(true);
                      section.addItem(htmlFlow);
                      menu.addSection(section);
                    
                      SectionStackSection section2 = new SectionStackSection("TreeGrid");
                      section2.setExpanded(true);
                      section2.setCanCollapse(true);
                      section2.addItem(moduleTree);
                      menu.addSection(section2);
                    
                      HLayout layout = new HLayout();
                      layout.setMembersMargin(20);
                      layout.addMember(menu);
                    
                      VLayout right = new VLayout();
                      right.setMembersMargin(10);
                      right.addMember(button);
                    
                      layout.addMember(right);
                      return layout;
                    
                     }

                    As attachment the steps in Selenium.
                    FireFox 3.6.8
                    Java 1.5
                    Selenium IDE 1.0.7
                    Attached Files

                    Comment


                      #11
                      Thanks for the test-case -very helpful
                      We've found the culprit and fixed it in our mainline code. The fix should will be present in the next nightly build - let us know if you continue to see the problem

                      Comment


                        #12
                        Hi,
                        we'll check that fix with next build.
                        if you can also check this case for the doubleClick:


                        Code:
                        public Canvas getViewPanel() {
                        	final ListGrid listGrid = new ListGrid();
                        	listGrid.setWidth(130);
                        	listGrid.setFields(new ListGridField("project", "Project"));
                        	listGrid.setData(new ProjectRecord[] {
                        			new ProjectRecord("AJAX Interface"),
                        			new ProjectRecord("Simplify Backend"),
                        			new ProjectRecord("Broaden Reach") });
                        
                        	listGrid.addDoubleClickHandler(new DoubleClickHandler() {
                        		public void onDoubleClick(DoubleClickEvent event) {
                        			SC.say("Hello World from SmartGWT");
                        		}
                        
                        	});
                        
                        	HLayout layout = new HLayout();
                        	layout.setMembersMargin(20);
                        	layout.addMember(listGrid);
                        
                        	return layout;
                        
                        }
                        
                        public class ProjectRecord extends ListGridRecord {
                        	ProjectRecord(String project) {
                        		setAttribute("project", project);
                        	}
                        }


                        thanks
                        Attached Files

                        Comment


                          #13
                          Hi Levi
                          Just a quick update to note that I ran the following test case (Identical to the one you attached except for directly 'draw()'ing the layout)
                          Code:
                              public void onModuleLoad() {
                              	
                              		final ListGrid listGrid = new ListGrid();
                              		listGrid.setWidth(130);
                              		listGrid.setFields(new ListGridField("project", "Project"));
                              		listGrid.setData(new ProjectRecord[] {
                              				new ProjectRecord("AJAX Interface"),
                              				new ProjectRecord("Simplify Backend"),
                              				new ProjectRecord("Broaden Reach") });
                          
                              		listGrid.addDoubleClickHandler(new DoubleClickHandler() {
                              			public void onDoubleClick(DoubleClickEvent event) {
                              				SC.say("Hello World from SmartGWT");
                              			}
                          
                              		});
                          
                              		HLayout layout = new HLayout();
                              		layout.setMembersMargin(20);
                              		layout.addMember(listGrid);
                          
                              		layout.draw();
                              }
                          	public class ProjectRecord extends ListGridRecord {
                          		ProjectRecord(String project) {
                          			setAttribute("project", project);
                          		}
                          	}
                          I modified your test HTML file to point at my bootstrap file rather than /SmartTestcase.html, and the test case ran for me, simulating a double click and showing the SC.say dialog.
                          Please give it a try with the latest code and let us know if you continue to see issues.
                          Thanks

                          Comment


                            #14
                            Hi, thanks for looking into it,

                            Can't seem to get it working though: doubleClick is still not working (also with draw()).
                            What exactly do you mean with "your bootstrap" file?

                            Here's a step-by-step test document of the setup. When running, Selenium thinks it doubleClicked OK on the row, but no dialog is shown with an OK button, so it fails then.

                            Oops, can't upload PDFs. Here's a link to the document.

                            Comment


                              #15
                              This was verified as a platform specific bug.
                              We've now resolved this issue - please try the latest nightly build (and note that you'll need to update the user-extensions.js file used by Selenium as well as picking up fresh SmartClient code)

                              Comment

                              Working...
                              X