refactored javascript in the test for FACES-1427-portlet