package rocketboard;

import static org.junit.Assert.assertEquals;

import org.junit.Test;
import org.openqa.selenium.By;

public class AssigneTests extends AbstractRocketboardTests {
	
	@Test
	public void AssignMeCard() throws Exception{
		rocketboardPage.waitingLoading();
		rocketboardPage.createIssue(title, desc, getRandomProject().getName());
		rocketboardPage.waitCreatedIssue(title);
		String idCard = rocketboardPage.getInfo(title, "id");
		rocketboardPage.assignMe(idCard);
		assertEquals((driver.findElement(By.xpath("//*[@id='"+idCard+"']/div[1]/a[1]/img")).isDisplayed()), Boolean.TRUE);
	}
	
	@Test
	public void UnassignLabel() throws Exception {
		rocketboardPage.waitingLoading();
		rocketboardPage.createIssue(title, desc, getRandomProject().getName());
		String href = rocketboardPage.getInfo(title, "href");
		String idCard = rocketboardPage.getInfo(title, "id");
		rocketboardPage.restAssign(href, "{\"assignee\":\"nayaramoura\"}");
		rocketboardPage.visible(idCard);
		rocketboardPage.alreadyAssignee(idCard);
		String btn1 = driver.findElement(By.xpath("//*[@id='"+idCard+"']/div[1]/div/div[2]/div/button[1]")).getText();
		assertEquals(btn1.equals("Unassign"), Boolean.TRUE);
		String btn2 = driver.findElement(By.xpath("//*[@id='"+idCard+"']/div[1]/div/div[2]/div/button[2]")).getText();
		assertEquals(btn2.equals("Cancel"), Boolean.TRUE);
	}
	
	@Test
	public void CancelUnassignAction() throws Exception {
		String repoCreateIssue = getRandomProject().getName();
		rocketboardPage.waitingLoading();
		rocketboardPage.createIssue(title, desc, repoCreateIssue);
		String href = rocketboardPage.getInfo(title, "href");
		String idCard = rocketboardPage.getInfo(title, "id");
		rocketboardPage.restAssign(href, "{\"assignee\":\"nayaramoura\"}");
		rocketboardPage.visible(idCard);
		rocketboardPage.alreadyAssignee(idCard);
		rocketboardPage.unassignCancel(idCard);
		assertEquals((driver.findElement(By.xpath("//*[@id='"+idCard+"']/div[1]/a[1]/img")).isDisplayed()), Boolean.TRUE);
	}
	
	@Test
	public void ConfirmUnassignAction() throws Exception {
		String repoCreateIssue = getRandomProject().getName();
		rocketboardPage.waitingLoading();
		rocketboardPage.createIssue(title, desc, repoCreateIssue);
		String href = rocketboardPage.getInfo(title, "href");
		String idCard = rocketboardPage.getInfo(title, "id");
		rocketboardPage.restAssign(href, "{\"assignee\":\"nayaramoura\"}");
		rocketboardPage.visible(idCard);
		rocketboardPage.alreadyAssignee(idCard);
		rocketboardPage.unassignConfirm(idCard);
		assertEquals((driver.findElement(By.xpath("//*[@id='"+idCard+"']/div[1]/a[1]/img")).isDisplayed()), Boolean.FALSE);
	}
	
	@Test
	public void UnassignOwnUser() throws Exception{
		rocketboardPage.waitingLoading();
		rocketboardPage.createIssue(title, desc, getRandomProject().getName());
		rocketboardPage.waitCreatedIssue(title);
		String idCard = rocketboardPage.getInfo(title, "id");
		rocketboardPage.assignMe(idCard);
		rocketboardPage.unassignMe(idCard);
		assertEquals((driver.findElement(By.xpath("//*[@id='"+idCard+"']/div[1]/a[1]/img")).isDisplayed()), Boolean.FALSE);
	}
	
	
}
	
	
@@ -61,16 +61,41 @@
 quals;%0A%0A
+import org.junit.Ignore;%0A
 import o
@@ -623,32 +623,41 @@
 E);%0A%09%7D%0A%09%0A%09@Test%0A
+%09@Ignore%0A
 %09public void Una
@@ -1085,32 +1085,37 @@
 ver.findElement(
+%0A%09%09%09%09
 By.xpath(%22//*%5B@i
@@ -1114,32 +1114,36 @@
 (%22//*%5B@id='%22
-+
+ + 
 idCard
-+
+ + 
 %22'%5D/div%5B1%5D/d
@@ -1262,32 +1262,37 @@
 ver.findElement(
+%0A%09%09%09%09
 By.xpath(%22//*%5B@i
@@ -1291,32 +1291,36 @@
 (%22//*%5B@id='%22
-+
+ + 
 idCard
-+
+ + 
 %22'%5D/div%5B1%5D/d
@@ -1409,33 +1409,32 @@
 n.TRUE);%0A%09%7D%0A
-%09
 %0A%09@Test%0A
 %09public void
@@ -1413,32 +1413,41 @@
 UE);%0A%09%7D%0A%0A%09@Test%0A
+%09@Ignore%0A
 %09public void Can
@@ -1948,32 +1948,37 @@
 %0A%09%09assertEquals(
+%0A%09%09%09%09
 (driver.findElem
@@ -1997,32 +1997,36 @@
 (%22//*%5B@id='%22
-+
+ + 
 idCard
-+
+ + 
 %22'%5D/div%5B1%5D/a
@@ -2027,32 +2027,39 @@
 v%5B1%5D/a%5B1%5D/img%22))
+%0A%09%09%09%09%09%09
 .isDisplayed()),
@@ -2050,33 +2050,37 @@
 .isDisplayed()),
- 
+%0A%09%09%09%09
 Boolean.TRUE);%0A%09
@@ -2073,33 +2073,32 @@
 olean.TRUE);%0A%09%7D%0A
-%09
 %0A%09@Test%0A%09public 

Remove the test :(