package guitests;

import javafx.scene.input.KeyCode;
import org.junit.Test;
import ui.listpanel.ListPanelCell;

import static org.junit.Assert.assertEquals;
import static org.loadui.testfx.Assertions.assertNodeExists;
import static org.loadui.testfx.controls.Commons.hasText;

public class LabelPickerTests extends UITest {

    public static final int EVENT_DELAY = 500;

    @Test
    public void showLabelPickerTest() {
        click("#dummy/dummy_col0_9");
        push(KeyCode.L);
        sleep(EVENT_DELAY);
        assertNodeExists(hasText("Issue #9: Issue 9"));
        push(KeyCode.ENTER);
    }

    @Test
    public void addAndRemoveLabelTest() {
        ListPanelCell listPanelCell = find("#dummy/dummy_col0_9");
        click(listPanelCell);
        assertEquals(1, listPanelCell.getIssueLabels().size());
        sleep(EVENT_DELAY);
        push(KeyCode.L);
        sleep(EVENT_DELAY);
        type("3 ");
        sleep(EVENT_DELAY);
        push(KeyCode.ENTER);
        sleep(EVENT_DELAY);
        assertEquals(2, listPanelCell.getIssueLabels().size());
        sleep(EVENT_DELAY);
        push(KeyCode.L);
        sleep(EVENT_DELAY);
        type("3 ");
        sleep(EVENT_DELAY);
        push(KeyCode.ENTER);
        sleep(EVENT_DELAY);
        assertEquals(1, listPanelCell.getIssueLabels().size());
    }

}

@@ -817,36 +817,8 @@
 ));%0A
-        sleep(EVENT_DELAY);%0A
     
@@ -830,32 +830,32 @@
 ush(KeyCode.L);%0A
+
         sleep(EV
@@ -890,36 +890,8 @@
 %22);%0A
-        sleep(EVENT_DELAY);%0A
     
@@ -907,32 +907,85 @@
 KeyCode.ENTER);%0A
+        listPanelCell = find(%22#dummy/dummy_col0_9%22);%0A
         sleep(EV
@@ -1064,36 +1064,8 @@
 ));%0A
-        sleep(EVENT_DELAY);%0A
     
@@ -1145,54 +1145,79 @@
     
-sleep(EVENT_DELAY);%0A        push(KeyCode.ENTER
+push(KeyCode.ENTER);%0A        listPanelCell = find(%22#dummy/dummy_col0_9%22
 );%0A 

Revert "Added more event delays"