0

I have such a big problem and I really need your help. Basically, I'm working on a project whose core technology is GWT and I have to make functional tests and the tests of UIs. In fact, I have also to use Cucumber the framework which is BDD-based framework.
Now I come to the main problem : Indeed, at every Maven build, GWT generates automatically the ids of the widgets. Then, Selenium could not find these widgets because of the recent updates/changes of their Ids. Moreover, I can't find some widgets with the methods (findByName/xPath/cssSelector etc.). I'm working now on the FluentLenium which is an overlay of Selenium.. I don't know how to fix this problem because I have no control of how GWT generates the Ids behind .. Does anynone met the same problem before ?

Thank you a lot.

AmineP90X
  • 33
  • 5
  • Set the Id to the Widget.. – moh Apr 28 '15 at 12:55
  • The app is really big. The project started 1.5 year ago and not all the widgets have Ids. Gwt behind generates at every maven build the IDs and it's hard to deal with this problem. Do you have please a solution to manage this issue with a structured method? Thank you. – AmineP90X Apr 28 '15 at 12:59
  • I dont no other solution...One think while developing the application need to take care of setting Id .. – moh Apr 28 '15 at 13:04
  • This question in way too broad! The answer is: you need to use the **correct** XPath or CSS locators, whichever you feel more comfortable with. – SiKing Apr 28 '15 at 15:03
  • I tried to use XPath and CssSelector on websites like Google, but Selenium was not able to figure out the widgets I selected in my test using XPath or CssSelectors. What really works is when i make a search with id, otherwise, Locators like Xpath or css or name are not reliable (from my little experience). Is there any tool which helps to give me the path of a widget just by clicking on the widget for example (eg firebug) ? Thank you – AmineP90X Apr 28 '15 at 15:22

1 Answers1

0

I've worked with GWT/Selenium/Cucumber. We had a single class file with public static String fields for each ID used in the whole application. These id's were set with ensureDebugId. This same class file is then used in Selenium/Cubumber tests to find the widgets by id. I don't know if this works for you. But in our case the tester was in control of the id's.

Hilbrand Bouwkamp
  • 13,509
  • 1
  • 45
  • 52
  • Thank you for your response. I would like to know if you added the line ** to your project.gwt.xml file** or you used **Maven** to say that you use the mode Debug without referencing it in your **project.gwt.xml**. In my case, I'd like to use the mode debug only in deployment (so Maven) in the continuous integration and not in the project.gwt.xml file. – AmineP90X May 11 '15 at 07:19
  • I don't understand why you used a class which encapsulates all the ids. Do this class contains some methods ? – AmineP90X May 11 '15 at 07:33
  • Yes we added the `Debug`. But in a separate `project.gwt.xml` that inherited the main `project.gwt.xml`. Via a maven profile the debug `project.gwt.xml` is enabled for the test build. The class doesn't contain methods, just the id's. It's just to get them in one place. – Hilbrand Bouwkamp May 11 '15 at 07:45
  • Can you show me please how you enabled the debug **project.gwt.xml** in maven profile ? Thank you – AmineP90X May 11 '15 at 08:02
  • It's the normal gwt maven configuration with the module set. Setting the debug project , means setting the `projectDebug` instead of the normal profile. With profile activation you can enable the profile under conditions you want. For example by passing a specific argument. See for GWT module: http://mojo.codehaus.org/gwt-maven-plugin/user-guide/compile.html and maven activation: http://books.sonatype.com/mvnref-book/reference/profiles-sect-activation.html. hope this helps. – Hilbrand Bouwkamp May 11 '15 at 19:36