package org.se.lab.pages;

import org.openqa.selenium.*;

public class CommunityOverviewPage extends PageObject {

	public CommunityOverviewPage(WebDriver driver) {
		super(driver);
	}

	public void createCommunity(String name, String description) {
		driver.findElement(By.cssSelector("button.btn.btn-success")).click();
		driver.findElement(By.id("input_j_idt24:j_idt26")).clear();
		driver.findElement(By.id("input_j_idt24:j_idt26")).sendKeys(name);
		driver.findElement(By.id("input_j_idt24:j_idt28")).clear();
		driver.findElement(By.id("input_j_idt24:j_idt28")).sendKeys(description);
		driver.findElement(By.id("j_idt24:j_idt31")).click();
	}

	public String getCommunityName() {
		return driver.findElement(By.cssSelector("h2")).getText();
	}

	public String getCommunityDescription() {
		return driver.findElement(By.cssSelector("td")).getText().split("\n")[1];
	}

	public String getAvailableCommunities() {
		return driver.findElement(By.id("j_idt34:j_idt35")).getText();
	}
}

@@ -359,25 +359,25 @@
 idt24:j_idt2
-6
+7
 %22)).clear();
@@ -429,9 +429,9 @@
 idt2
-6
+7
 %22)).
@@ -490,25 +490,25 @@
 idt24:j_idt2
-8
+9
 %22)).clear();
@@ -560,9 +560,9 @@
 idt2
-8
+9
 %22)).
@@ -624,15 +624,18 @@
 t24:
-j_idt31
+sendbutton
 %22)).

fix broken test