package integration;

import org.junit.jupiter.api.Test;

import static com.codeborne.selenide.Condition.disabled;
import static com.codeborne.selenide.Condition.enabled;
import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Condition.value;

final class DoubleClickTest extends ITest {
  @Test
  void userCanDoubleClickOnElement() {
    openFile("page_with_double_clickable_button.html");

    withLongTimeout(() -> {
      $("#double-clickable-button")
        .shouldHave(value("double click me"))
        .shouldBe(enabled);

      $("#double-clickable-button")
        .doubleClick()
        .shouldHave(value("do not click me anymore"))
        .shouldBe(disabled);

      $("h2").shouldHave(text("Double click worked"));
    });
  }
}

@@ -15,16 +15,57 @@
 ation;%0A%0A
+import org.junit.jupiter.api.BeforeEach;%0A
 import o
@@ -357,16 +357,177 @@
 ITest %7B%0A
+  @BeforeEach%0A  final void hackForFlakyTestInChrome() throws InterruptedException %7B%0A    if (driver().browser().isChrome()) %7B%0A      Thread.sleep(500);%0A    %7D%0A  %7D%0A%0A
   @Test%0A

make a small pause before running double-click test