0

I'm writing Arquillian+Graphene functional tests for a Java EE web client with Primefaces 6.1 components and would like to write them in the most portable way from the beginning.

I noticed that there's no possibility to perform operations like WebElement.click on any PrimeFaces component which is clickable (e.g. not on p:selectBooleanCheckbox since the WebElement is a div containing another div containing an input), so that I have to

  • figure out how a clickable component is structured for every component and access it via XPath
  • figure the above out for every component after I change the PrimeFaces version

A similar problem is the case for access by id: the clickable element seems to be suffixed with _input, but that's probably as non-portable as the element hierarchy described above.

How to avoid as many problems listed above as possible? Or more abstract: How do people test PrimeFaces components?

The only answer to PrimeFaces fileUpload testing with Selenium WebDriver is proposing my problem as a solution.

Kalle Richter
  • 8,008
  • 26
  • 77
  • 177
  • 1
    There are no problems with JSF h:xxx input components in Graphene at all. They all render plain HTML input elements which Graphene already natively supports. I have therefore adjusted the wrong focus in your question. PrimeFaces components may indeed render some more markup around the actual HTML input element and put the client ID over there, making it a bit more difficult for Graphene. – BalusC Oct 16 '17 at 08:05
  • The JSF h:xxx components are indeed painless to test with web drivers. Maybe I'm having trouble with understanding CSS selectors, however I didn't yet find any way to figure out how to test a Primefaces component reliably (neither intuitively nor in the documentation), so I need to create a SSCCE for every use case and eventually ask a question on SO. Therefore I suggested a Selenium or Graphene extension at https://github.com/primefaces/primefaces/issues/3544 in order to minimize the overhead for users. – Kalle Richter Apr 02 '18 at 10:17
  • 1
    I've an in-house project for that. I'll look if it can be open sourced else I'll perhaps create one anew. – BalusC Apr 02 '18 at 13:26
  • @BalusC That'd be awesome. Maybe it's just me, but it seems odd that there're no way more questions on SO and the internet (accessed via google) about that. I'm sure that if someone with your reputation promotes this as Primefaces extension or an even more flexible approach it will be incorporated soon and once equipped with tests it should be relatively easy to maintain if Primefaces components change the structure of generated HTML elements. – Kalle Richter Apr 02 '18 at 13:32
  • Using the Selenium IDE also helps a lot, but is a way larger technical dept than a Selenium/Graphene extension provided by Primefaces themselves. – Kalle Richter Apr 02 '18 at 13:47
  • 1
    https://github.com/omnifaces/arquillian-primefaces – BalusC Apr 04 '18 at 19:34

0 Answers0