Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium gui tests for Liferay + Vaadin

We try to test our portlets for Liferay 6.0.6 via Selenium. We have few liferay mvc portlets and vaadin portlets. In first approach we create test which do steps below:

  1. Restore database dump with basic structure and portlet placement
  2. Delete "data" folder and copy initial data to it
  3. Delete appropriate folders of portlets from "webapps" folder
  4. Copy our portlets (*.war) to "deploy" folder
  5. Start liferay
  6. Wait while portlets will have installed
  7. Go to Control panel -> Server Administration and click on "Clear content cached by this VM", "Clear the database cache.", "Reindex all search indexes."

After We start selenium tests (test portlets behavior, upload files via vaadin portlets, approving workflow (kaleo) tasks via vaadin portlets etc). And tests failed in different places:

  1. Some times DuplicateFileException occurs during uploading file via our portlet (but in document manager there are no files)
  2. Some times Selenium can not find elements on page
  3. Sometimes kaleo workflow can not approve all files without errors

More unstable behavior we get when start test on Jenkins node on VM.

How do you test your portlets? Is there a way to stable behavior of test? What is a best practice?

like image 850
dimafeng Avatar asked Jan 01 '26 21:01

dimafeng


1 Answers

Some times DuplicateFileException occurs during uploading file via our portlet (but in document manager there are no files)

it would be very useful to see the full stacktrace

Some times Selenium can not find elements on page.

I see 2 possible reasons/solutions:

  1. If a portlet is using ajax to load the content then your test should wait until the content has been loaded, try:

    waitForElementPresent(locator)

  2. If you do not use Vaadin TestBench then make sure you set debugId for vaadin elements:

    setDebugID("aButton");

How do you test your portlets?

We used selenium and cucumber, see: https://projects.savoirfairelinux.com/projects/ctr-liferay/wiki/Portal_-_Testing

like image 94
Dmitri Carpov Avatar answered Jan 03 '26 09:01

Dmitri Carpov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!