<commit_before>package com.example.fw;

import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.support.ui.Select;
import com.example.tests.ContactData;
import com.example.tests.GroupData;
import com.example.tests.TestBase;

public class ApplicationManager {

	//GroupCreationTests
	public void returnToGroupsPage() {
	    TestBase.driver.findElement(By.linkText("group page")).click();
	}

	public void submitGroupCreation() {
		    TestBase.driver.findElement(By.name("submit")).click();
		}

	public void fillGroupForm(TestBase testBase, GroupData group) {
		    TestBase.driver.findElement(By.name("group_name")).clear();
		    TestBase.driver.findElement(By.name("group_name")).sendKeys(group.name);
		    TestBase.driver.findElement(By.name("group_header")).clear();
		    TestBase.driver.findElement(By.name("group_header")).sendKeys(group.header);
		    TestBase.driver.findElement(By.name("group_footer")).clear();
		    TestBase.driver.findElement(By.name("group_footer")).sendKeys(group.footer);
		}

	public void initNewGroupCreation() {
		    TestBase.driver.findElement(By.name("new")).click();
		}

	public void goToGroupsPage() {
		    TestBase.driver.findElement(By.linkText("groups")).click();
		}

	public void openMainPage() {
		    TestBase.driver.get(TestBase.baseUrl + "/addressbookv4.1.4/");
		}

	public boolean isElementPresent(By by) {
		    try {
		      TestBase.driver.findElement(by);
		      return true;
		    } catch (NoSuchElementException e) {
		      return false;
		    }
		  }

	public boolean isAlertPresent() {
		    try {
		      TestBase.driver.switchTo().alert();
		      return true;
		    } catch (NoAlertPresentException e) {
		      return false;
		    }
		  }

	public String closeAlertAndGetItsText() {
		    try {
		      Alert alert = TestBase.driver.switchTo().alert();
		      String alertText = alert.getText();
		      if (TestBase.acceptNextAlert) {
		        alert.accept();
		      } else {
		        alert.dismiss();
		      }
		      return alertText;
		    } finally {
		      TestBase.acceptNextAlert = true;
		    }
		  }

	//New Contact
	public void returnToHP() {
		TestBase.driver.findElement(By.linkText("home page")).click();
	}

	public void submit() {
			TestBase.driver.findElement(By.name("submit")).click();
		}

	public void fillGroupForm(TestBase testBase, ContactData parameterObject) {
			TestBase.driver.findElement(By.name("firstname")).clear();
		    TestBase.driver.findElement(By.name("firstname")).sendKeys(parameterObject.firstname);
		    TestBase.driver.findElement(By.name("lastname")).clear();
		    TestBase.driver.findElement(By.name("lastname")).sendKeys(parameterObject.lastName);
		    TestBase.driver.findElement(By.name("address")).clear();
		    TestBase.driver.findElement(By.name("address")).sendKeys(parameterObject.address);
		    TestBase.driver.findElement(By.name("home")).clear();
		    TestBase.driver.findElement(By.name("home")).sendKeys(parameterObject.homePhone);
		    TestBase.driver.findElement(By.name("mobile")).clear();
		    TestBase.driver.findElement(By.name("mobile")).sendKeys(parameterObject.mobilePhone);
		    TestBase.driver.findElement(By.name("work")).clear();
		    TestBase.driver.findElement(By.name("work")).sendKeys(parameterObject.workPhone);
		    TestBase.driver.findElement(By.name("email")).clear();
		    TestBase.driver.findElement(By.name("email")).sendKeys(parameterObject.email1);
		    TestBase.driver.findElement(By.name("email2")).clear();
		    TestBase.driver.findElement(By.name("email2")).sendKeys(parameterObject.email2);
		    new Select(TestBase.driver.findElement(By.name("bday"))).selectByVisibleText(parameterObject.bday);
		    new Select(TestBase.driver.findElement(By.name("bmonth"))).selectByVisibleText(parameterObject.bmonth);
		    TestBase.driver.findElement(By.name("byear")).clear();
		    TestBase.driver.findElement(By.name("byear")).sendKeys(parameterObject.yearBD);
		    new Select(TestBase.driver.findElement(By.name("new_group"))).selectByVisibleText("Eddie_would_go");
		    TestBase.driver.findElement(By.name("address2")).clear();
		    TestBase.driver.findElement(By.name("address2")).sendKeys(parameterObject.address2);
		    TestBase.driver.findElement(By.name("phone2")).clear();
		    TestBase.driver.findElement(By.name("phone2")).sendKeys(parameterObject.phone2);
		}

	public void initNewContactCreation() {
			TestBase.driver.findElement(By.linkText("add new")).click();
		}

}<commit_msg>22/07<commit_after>package com.example.fw;

import static org.junit.Assert.fail;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;

import com.example.tests.ContactData;
import com.example.tests.GroupData;
import com.example.tests.TestBase;

public class ApplicationManager {
	
	public static WebDriver driver;
	public static String baseUrl;
	public static boolean acceptNextAlert = true;
	private static StringBuffer verificationErrors = new StringBuffer();

	public ApplicationManager() {
	    driver = new FirefoxDriver();
	    baseUrl = "http://localhost/";
	    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

		
	}
	
	public void stop() {
	    driver.quit();
	    String verificationErrorString = verificationErrors.toString();
	    if (!"".equals(verificationErrorString)) {
	      fail(verificationErrorString);
	    }
	}

	
	//GroupCreationTests
	public void returnToGroupsPage() {
	    driver.findElement(By.linkText("group page")).click();
	}

	public void submitGroupCreation() {
		    driver.findElement(By.name("submit")).click();
		}

	public void fillGroupForm(TestBase testBase, GroupData group) {
		    driver.findElement(By.name("group_name")).clear();
		    driver.findElement(By.name("group_name")).sendKeys(group.name);
		    driver.findElement(By.name("group_header")).clear();
		    driver.findElement(By.name("group_header")).sendKeys(group.header);
		    driver.findElement(By.name("group_footer")).clear();
		    driver.findElement(By.name("group_footer")).sendKeys(group.footer);
		}

	public void initNewGroupCreation() {
		    driver.findElement(By.name("new")).click();
		}

	public void goToGroupsPage() {
		    driver.findElement(By.linkText("groups")).click();
		}

	public void openMainPage() {
		    driver.get(baseUrl + "/addressbookv4.1.4/");
		}

	public boolean isElementPresent(By by) {
		    try {
		      driver.findElement(by);
		      return true;
		    } catch (NoSuchElementException e) {
		      return false;
		    }
		  }

	public boolean isAlertPresent() {
		    try {
		      driver.switchTo().alert();
		      return true;
		    } catch (NoAlertPresentException e) {
		      return false;
		    }
		  }

	public String closeAlertAndGetItsText() {
		    try {
		      Alert alert = driver.switchTo().alert();
		      String alertText = alert.getText();
		      if (acceptNextAlert) {
		        alert.accept();
		      } else {
		        alert.dismiss();
		      }
		      return alertText;
		    } finally {
		      acceptNextAlert = true;
		    }
		  }

	//New Contact
	public void returnToHP() {
		driver.findElement(By.linkText("home page")).click();
	}

	public void submit() {
			driver.findElement(By.name("submit")).click();
		}

	public void fillGroupForm(TestBase testBase, ContactData parameterObject) {
			driver.findElement(By.name("firstname")).clear();
		    driver.findElement(By.name("firstname")).sendKeys(parameterObject.firstname);
		    driver.findElement(By.name("lastname")).clear();
		    driver.findElement(By.name("lastname")).sendKeys(parameterObject.lastName);
		    driver.findElement(By.name("address")).clear();
		    driver.findElement(By.name("address")).sendKeys(parameterObject.address);
		    driver.findElement(By.name("home")).clear();
		    driver.findElement(By.name("home")).sendKeys(parameterObject.homePhone);
		    driver.findElement(By.name("mobile")).clear();
		    driver.findElement(By.name("mobile")).sendKeys(parameterObject.mobilePhone);
		    driver.findElement(By.name("work")).clear();
		    driver.findElement(By.name("work")).sendKeys(parameterObject.workPhone);
		    driver.findElement(By.name("email")).clear();
		    driver.findElement(By.name("email")).sendKeys(parameterObject.email1);
		    driver.findElement(By.name("email2")).clear();
		    driver.findElement(By.name("email2")).sendKeys(parameterObject.email2);
		    new Select(driver.findElement(By.name("bday"))).selectByVisibleText(parameterObject.bday);
		    new Select(driver.findElement(By.name("bmonth"))).selectByVisibleText(parameterObject.bmonth);
		    driver.findElement(By.name("byear")).clear();
		    driver.findElement(By.name("byear")).sendKeys(parameterObject.yearBD);
		    new Select(driver.findElement(By.name("new_group"))).selectByVisibleText("Eddie_would_go");
		    driver.findElement(By.name("address2")).clear();
		    driver.findElement(By.name("address2")).sendKeys(parameterObject.address2);
		    driver.findElement(By.name("phone2")).clear();
		    driver.findElement(By.name("phone2")).sendKeys(parameterObject.phone2);
		}

	public void initNewContactCreation() {
			driver.findElement(By.linkText("add new")).click();
		}

}
{'fraction_non_alphanumeric': 0.14961784106376297, 'fraction_numerical': 0.0033504345094754477, 'mean_word_length': 4.146551724137931, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1891249', 'n_tokens_mistral': 3222, 'n_tokens_neox': 2875, 'n_words': 349}