julia_v_iluhina

Untitled

Jul 31st, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.47 KB | None | 0 0
  1. import org.junit.Test;
  2.  
  3. import static com.codeborne.selenide.CollectionCondition.exactTexts;
  4. import static com.codeborne.selenide.Selenide.$;
  5. import static com.codeborne.selenide.Selenide.$$;
  6. import static com.codeborne.selenide.Selenide.open;
  7. import static com.codeborne.selenide.CollectionCondition.empty;
  8.  
  9.  
  10. public class TodoMVCTest {
  11.  
  12.    @Test
  13.    public void testTasksCommonFlow(){
  14.  
  15.        open("https://todomvc4tasj.herokuapp.com/#/");
  16.  
  17.        $("#new-todo").setValue("task 1").pressEnter();
  18.        $("#new-todo").setValue("task 2").pressEnter();
  19.        $("#new-todo").setValue("task 3").pressEnter();
  20.        $("#new-todo").setValue("task 4").pressEnter();
  21.        $$("#todo-list li").shouldHave(exactTexts("task 1","task 2","task 3","task 4"));
  22.  
  23.        //Delete taksk2
  24.        $("#todo-list li:nth-of-type(2)").hover();
  25.        $("#todo-list li:nth-of-type(2) .destroy").hover().click();
  26.        $$("#todo-list li").shouldHave(exactTexts("task 1", "task 3", "task 4"));
  27.  
  28.        //complete task4
  29.        $("#todo-list li:nth-of-type(3) .toggle").click();
  30.        $$("#todo-list li.completed").shouldHave(exactTexts("task 4"));
  31.      
  32.        $("#clear-completed").click();
  33.        $$("#todo-list li").shouldHave(exactTexts("task 1", "task 3"));
  34.  
  35.        //complete all
  36.        $("#toggle-all").click();
  37.        $$("#todo-list li.completed").shouldHave(exactTexts("task 1", "task 3"));
  38.  
  39.        $("#clear-completed").click();
  40.        $$("#todo-list li").shouldBe(empty);
  41.    }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment