<commit_before>package SpecmatePageClasses;

import java.util.ArrayList;
import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

//Page Class
public class CEGEditorElements {
	
	WebDriver driver;
	Actions builder;
	
	//Editor Elements and their locators
	By toolbarMove = By.id("toolbar-tools.move-button");
	By toolbarNode = By.id("toolbar-tools.addCegNode-button");
	By toolbarConnection = By.id("toolbar-tools.addCegConnection-button");
	By toolbarDelete = By.id("toolbar-tools.delete-button");
	By toolbarClear = By.id("toolbar-clear-button");
	By editor = By.id("editor-field");
	
	//Property Editor Elements and their locators
	By propertiesVariable = By.id("properties-variable-textfield");
	By propertiesCondition = By.id("properties-condition-textfield");
	By propertiesName = By.id("properties-name-textfield");
	By propertiesDescription = By.id("properties-description-textfield");
	By propertiesType = By.id("properties-type-dropdown");
	By TypeAND = By.id("type-AND");
	By TypeOR = By.id("type-OR");
	
	// Links & Actions
	By generateTestSpec = By.id("generatetestspec-button");
	
	//Pop-Up Elements and their locators
	By accept = By.id("popup-accept-button");
	By cancel = By.id("popup-dismiss-button");
	
	// Generates a test specification within the CEG Editor
	public void generateTestSpecification () {
		driver.findElement(generateTestSpec).click();
	}
	
	
	public CEGEditorElements(WebDriver driver, Actions builder) { //constructor
		
		this.driver = driver;
		this.builder = builder;
	}
	
	public void setModelName(String name) {
		driver.findElement(toolbarMove).click();
		driver.findElement(editor).click();
		WebElement modelName = driver.findElement(propertiesName);
		modelName.clear();
		modelName.sendKeys(name);
	}
	
	public void setModelDescription(String description) {
		driver.findElement(editor).click();
		WebElement modelDescription = driver.findElement(propertiesDescription);
		modelDescription.clear();
		modelDescription.sendKeys(description);
	}
	
	/**creates a new node with corresponding variable and condition
	 *at position x,y
	 *and returns the newly created node
	 */<commit_msg>Add: Explicit wait for generating test specification<commit_after>package SpecmatePageClasses;

import java.util.ArrayList;
import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

//Page Class
public class CEGEditorElements {
	
	WebDriver driver;
	Actions builder;
	
	//Editor Elements and their locators
	By toolbarMove = By.id("toolbar-tools.move-button");
	By toolbarNode = By.id("toolbar-tools.addCegNode-button");
	By toolbarConnection = By.id("toolbar-tools.addCegConnection-button");
	By toolbarDelete = By.id("toolbar-tools.delete-button");
	By toolbarClear = By.id("toolbar-clear-button");
	By editor = By.id("editor-field");
	
	//Property Editor Elements and their locators
	By propertiesVariable = By.id("properties-variable-textfield");
	By propertiesCondition = By.id("properties-condition-textfield");
	By propertiesName = By.id("properties-name-textfield");
	By propertiesDescription = By.id("properties-description-textfield");
	By propertiesType = By.id("properties-type-dropdown");
	By TypeAND = By.id("type-AND");
	By TypeOR = By.id("type-OR");
	
	// Links & Actions
	By generateTestSpec = By.id("generatetestspec-button");
	
	//Pop-Up Elements and their locators
	By accept = By.id("popup-accept-button");
	By cancel = By.id("popup-dismiss-button");
	
	// Generates a test specification within the CEG Editor
	public void generateTestSpecification () {
		WebDriverWait wait = new WebDriverWait(driver, 20);
		wait.until(ExpectedConditions.visibilityOfElementLocated(generateTestSpec));
		driver.findElement(generateTestSpec).click();
	}
	
	
	public CEGEditorElements(WebDriver driver, Actions builder) { //constructor
		
		this.driver = driver;
		this.builder = builder;
	}
	
	public void setModelName(String name) {
		driver.findElement(toolbarMove).click();
		driver.findElement(editor).click();
		WebElement modelName = driver.findElement(propertiesName);
		modelName.clear();
		modelName.sendKeys(name);
	}
	
	public void setModelDescription(String description) {
		driver.findElement(editor).click();
		WebElement modelDescription = driver.findElement(propertiesDescription);
		modelDescription.clear();
		modelDescription.sendKeys(description);
	}
	
	/**creates a new node with corresponding variable and condition
	 *at position x,y
	 *and returns the newly created node
	 */
{'fraction_non_alphanumeric': 0.11964940888707705, 'fraction_numerical': 0.00040766408479412964, 'mean_word_length': 5.211392405063291, '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': '3109297', 'n_tokens_mistral': 1535, 'n_tokens_neox': 1412, 'n_words': 320}