Program: 69962
Project: 69962
Buggy source:
@Test @RunAsClient public void checkSettings() throws IOException, URISyntaxException, InterruptedException {
  List<UserVO> userVO=functionalVOUtil.createTestUsers(deploymentUrl,1);
  Assert.assertTrue(functionalUtil.login(browser));
  Assert.assertTrue(functionalHomeSiteUtil.resetSettings(browser));
  functionalHomeSiteUtil.selectLanguage(browser,FunctionalHomeSiteUtil.GERMAN_LANGUAGE_VALUE);
  functionalHomeSiteUtil.disableResume(browser);
  Assert.assertTrue(functionalUtil.logout(browser));
  Assert.assertTrue(functionalUtil.login(browser));
  functionalHomeSiteUtil.beginEditingPortal(browser);
  if (functionalHomeSiteUtil.deactivatePortlet(browser,functionalHomeSiteUtil.getPortletEffCss())) {
    Assert.assertFalse(functionalHomeSiteUtil.checkPortletActive(browser,functionalHomeSiteUtil.getPortletEffCss()));
  }
  if (functionalHomeSiteUtil.activatePortlet(browser,functionalHomeSiteUtil.getPortletNotesCss())) {
    Assert.assertTrue(functionalHomeSiteUtil.checkPortletActive(browser,functionalHomeSiteUtil.getPortletNotesCss()));
  }
  int oldPositionDyk[]=functionalHomeSiteUtil.findPortletPosition(browser,functionalHomeSiteUtil.getPortletDykCss(),portalColumnCount);
  if (functionalHomeSiteUtil.movePortlet(browser,functionalHomeSiteUtil.getPortletDykCss(),FunctionalHomeSiteUtil.Direction.UP)) {
    browser.refresh();
    int newPosition[]=functionalHomeSiteUtil.findPortletPosition(browser,functionalHomeSiteUtil.getPortletDykCss(),portalColumnCount);
    Assert.assertEquals(oldPositionDyk[1],newPosition[1] + 1);
  }
  int oldPositionNoti[]=functionalHomeSiteUtil.findPortletPosition(browser,functionalHomeSiteUtil.getPortletNotiCss(),portalColumnCount);
  if (functionalHomeSiteUtil.movePortlet(browser,functionalHomeSiteUtil.getPortletNotiCss(),FunctionalHomeSiteUtil.Direction.LEFT)) {
    int newPosition[]=functionalHomeSiteUtil.findPortletPosition(browser,functionalHomeSiteUtil.getPortletNotiCss(),portalColumnCount);
    Assert.assertEquals(oldPositionNoti[0] - 1,newPosition[0]);
  }
  functionalHomeSiteUtil.endEditingPortal(browser);
  functionalHomeSiteUtil.openActionByMenuTree(browser,FunctionalHomeSiteUtil.HomeSiteAction.SETTINGS);
  functionalUtil.openContentTab(browser,SettingsTab.SYSTEM.ordinal());
  functionalHomeSiteUtil.selectLanguage(browser,FunctionalHomeSiteUtil.ENGLISH_LANGUAGE_VALUE);
  functionalHomeSiteUtil.enableBack(browser);
  Assert.assertTrue(functionalUtil.logout(browser));
  Assert.assertTrue(functionalUtil.login(browser));
  HashMap<String,String> pages=new HashMap<String,String>();
  Iterator iter=pages.keySet().iterator();
  while (iter.hasNext()) {
    Map.Entry pairs=(Map.Entry)iter.next();
    browser.click((String)pairs.getKey());
  }
  String[] keys=(String[])pages.entrySet().toArray();
  for (int i=pages.size() - 1; i >= 0; i--) {
    browser.goBack();
    Assert.assertTrue(browser.isElementPresent(pages.get(keys[i])));
  }
  UserVO current=userVO.get(0);
  Assert.assertTrue(functionalUtil.logout(browser));
  Assert.assertTrue(functionalUtil.login(browser,current.getLogin(),current.getPassword(),true));
  functionalUtil.openSite(browser,FunctionalUtil.OlatSite.HOME);
  functionalHomeSiteUtil.openActionByMenuTree(browser,FunctionalHomeSiteUtil.HomeSiteAction.SETTINGS);
  String newPassword="String_Node_Str" + 0 + "String_Node_Str"+ UUID.randomUUID().toString();
  functionalUtil.openContentTab(browser,SettingsTab.PASSWORD.ordinal());
  functionalUtil.typePassword(browser,functionalHomeSiteUtil.getOldPasswordCss(),functionalUtil.getPassword());
  functionalUtil.typePassword(browser,functionalHomeSiteUtil.getNewPasswordCss(),newPassword);
  functionalUtil.typePassword(browser,functionalHomeSiteUtil.getConfirmPasswordCss(),newPassword);
  functionalUtil.saveForm(browser,0);
  Assert.assertTrue(functionalUtil.logout(browser));
  Assert.assertTrue(functionalUtil.login(browser,current.getLogin(),newPassword,true));
  functionalHomeSiteUtil.endEditingPortal(browser);
}

Fixed version (ground truth):
@Test @RunAsClient public void checkSettings() throws IOException, URISyntaxException, InterruptedException {
  List<UserVO> userVO=functionalVOUtil.createTestUsers(deploymentUrl,1);
  Assert.assertTrue(functionalUtil.login(browser));
  Assert.assertTrue(functionalHomeSiteUtil.resetSettings(browser));
  Assert.assertTrue(functionalUtil.login(browser));
  functionalHomeSiteUtil.selectLanguage(browser,FunctionalHomeSiteUtil.GERMAN_LANGUAGE_VALUE);
  functionalHomeSiteUtil.disableResume(browser);
  Assert.assertTrue(functionalUtil.logout(browser));
  Assert.assertTrue(functionalUtil.login(browser));
  functionalHomeSiteUtil.beginEditingPortal(browser);
  if (functionalHomeSiteUtil.deactivatePortlet(browser,functionalHomeSiteUtil.getPortletEffCss())) {
    Assert.assertFalse(functionalHomeSiteUtil.checkPortletActive(browser,functionalHomeSiteUtil.getPortletEffCss()));
  }
  if (functionalHomeSiteUtil.activatePortlet(browser,functionalHomeSiteUtil.getPortletNotesCss())) {
    Assert.assertTrue(functionalHomeSiteUtil.checkPortletActive(browser,functionalHomeSiteUtil.getPortletNotesCss()));
  }
  int oldPositionDyk[]=functionalHomeSiteUtil.findPortletPosition(browser,functionalHomeSiteUtil.getPortletDykCss(),portalColumnCount);
  if (functionalHomeSiteUtil.movePortlet(browser,functionalHomeSiteUtil.getPortletDykCss(),FunctionalHomeSiteUtil.Direction.UP)) {
    browser.refresh();
    int newPosition[]=functionalHomeSiteUtil.findPortletPosition(browser,functionalHomeSiteUtil.getPortletDykCss(),portalColumnCount);
    Assert.assertEquals(oldPositionDyk[1],newPosition[1] + 1);
  }
  int oldPositionNoti[]=functionalHomeSiteUtil.findPortletPosition(browser,functionalHomeSiteUtil.getPortletNotiCss(),portalColumnCount);
  if (functionalHomeSiteUtil.movePortlet(browser,functionalHomeSiteUtil.getPortletNotiCss(),FunctionalHomeSiteUtil.Direction.LEFT)) {
    int newPosition[]=functionalHomeSiteUtil.findPortletPosition(browser,functionalHomeSiteUtil.getPortletNotiCss(),portalColumnCount);
    Assert.assertEquals(oldPositionNoti[0] - 1,newPosition[0]);
  }
  functionalHomeSiteUtil.endEditingPortal(browser);
  functionalHomeSiteUtil.openActionByMenuTree(browser,FunctionalHomeSiteUtil.HomeSiteAction.SETTINGS);
  functionalUtil.openContentTab(browser,SettingsTab.SYSTEM.ordinal());
  functionalHomeSiteUtil.selectLanguage(browser,FunctionalHomeSiteUtil.ENGLISH_LANGUAGE_VALUE);
  functionalHomeSiteUtil.enableBack(browser);
  Assert.assertTrue(functionalUtil.logout(browser));
  Assert.assertTrue(functionalUtil.login(browser));
  LinkedHashMap<String,String> pages=new LinkedHashMap<String,String>();
  FunctionalLocatorPairsFactory pairsFactory=new FunctionalLocatorPairsFactory(functionalUtil);
  pages.put(pairsFactory.getLocatorOfSite(functionalUtil.getOlatSiteHomeCss()),pairsFactory.getApprovalOfSite(functionalUtil.getOlatSiteHomeCss()));
  pages.put(pairsFactory.getLocatorOfSite(functionalUtil.getOlatSiteAdministrationCss()),pairsFactory.getApprovalOfSite(functionalUtil.getOlatSiteAdministrationCss()));
  pages.put(pairsFactory.getLocatorOfSite(functionalUtil.getOlatSiteGroupAdministrationCss()),pairsFactory.getApprovalOfSite(functionalUtil.getOlatSiteGroupAdministrationCss()));
  pages.put(pairsFactory.getLocatorOfSite(functionalUtil.getOlatSiteGroupsCss()),pairsFactory.getApprovalOfSite(functionalUtil.getOlatSiteGroupsCss()));
  pages.put(pairsFactory.getLocatorOfSite(functionalUtil.getOlatSiteLearningResourcesCss()),pairsFactory.getApprovalOfSite(functionalUtil.getOlatSiteLearningResourcesCss()));
  pages.put(pairsFactory.getLocatorOfSite(functionalUtil.getOlatSiteUserManagementCss()),pairsFactory.getApprovalOfSite(functionalUtil.getOlatSiteUserManagementCss()));
  String[] keys=pages.keySet().toArray(new String[0]);
  String[] values=(String[])pages.values().toArray(new String[0]);
  int i;
  for (i=0; i < pages.size(); i++) {
    browser.click(keys[i]);
    browser.waitForPageToLoad(functionalUtil.getWaitLimit());
    functionalUtil.waitForPageToLoadElement(browser,values[i]);
  }
  i=pages.size() - 1;
  Assert.assertTrue(browser.isElementPresent(values[i]));
  i--;
  for (; i >= 0; i--) {
    browser.goBack();
    browser.waitForPageToLoad(functionalUtil.getWaitLimit());
    functionalUtil.waitForPageToLoadElement(browser,values[i]);
    Assert.assertTrue(browser.isElementPresent(values[i]));
  }
  UserVO current=userVO.get(0);
  Assert.assertTrue(functionalUtil.logout(browser));
  Assert.assertTrue(functionalUtil.login(browser,current.getLogin(),current.getPassword(),true));
  functionalUtil.openSite(browser,FunctionalUtil.OlatSite.HOME);
  functionalHomeSiteUtil.openActionByMenuTree(browser,FunctionalHomeSiteUtil.HomeSiteAction.SETTINGS);
  String newPassword=("String_Node_Str" + 0 + "String_Node_Str"+ UUID.randomUUID().toString()).substring(0,24);
  functionalUtil.openContentTab(browser,SettingsTab.PASSWORD.ordinal());
  functionalUtil.typePassword(browser,functionalHomeSiteUtil.getOldPasswordCss(),functionalUtil.getPassword());
  functionalUtil.typePassword(browser,functionalHomeSiteUtil.getNewPasswordCss(),newPassword);
  functionalUtil.typePassword(browser,functionalHomeSiteUtil.getConfirmPasswordCss(),newPassword);
  functionalUtil.saveForm(browser,0);
  Assert.assertTrue(functionalUtil.logout(browser));
  Assert.assertTrue(functionalUtil.login(browser,current.getLogin(),newPassword,true));
}