Advertisement
zhytnytskyi

POC task

Apr 27th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.23 KB | None | 0 0
  1. package ua.com.azhytnytskyi.poctask;
  2.  
  3. import com.codeborne.selenide.Configuration;
  4. import org.junit.Test;
  5. import org.openqa.selenium.By;
  6.  
  7. import static com.codeborne.selenide.CollectionCondition.exactTexts;
  8. import static com.codeborne.selenide.Condition.cssClass;
  9. import static com.codeborne.selenide.Condition.exactText;
  10. import static com.codeborne.selenide.Selenide.$;
  11. import static com.codeborne.selenide.Selenide.$$;
  12. import static com.codeborne.selenide.Selenide.open;
  13.  
  14. public class TodoMvcTest {
  15.  
  16.     @Test
  17.     public void completeTask(){
  18.  
  19.         open("http://todomvc.com/examples/emberjs");
  20.  
  21.         //Add 3 new tasks
  22.         $("#new-todo").setValue("a").pressEnter();
  23.         $("#new-todo").setValue("b").pressEnter();
  24.         $("#new-todo").setValue("c").pressEnter();
  25.         $$("#todo-list li").shouldHaveSize(3);
  26.         $$("#todo-list li").shouldHave(exactTexts("a", "b", "c"));
  27.  
  28.         //Toggle task check
  29.         $("#todo-list li:nth-of-type(2) .toggle").click();
  30.         $$("#todo-list li.completed").shouldHave(exactTexts("b"));
  31.         $$("#todo-list li:not(.completed)").shouldHave(exactTexts("a","c"));
  32.  
  33.         //Check "Completed" tab
  34.         $$("#filters li").get(2).click();
  35.         $$("#todo-list li").shouldHave(exactTexts("b"));
  36.  
  37.         //Check "Active" tab
  38.         $$("#filters li").get(1).click();
  39.         $$("#todo-list li").shouldHave(exactTexts("a","c"));
  40.  
  41.         //Return back to all tasks tab
  42.         $$("#filters li").get(0).click();
  43.  
  44.         //Untoggle task check
  45.         $("#todo-list li:nth-of-type(2) .toggle").click();
  46.         $$("#todo-list li:not(.completed)").shouldHave(exactTexts("a", "b", "c"));
  47.  
  48.         //Editing check
  49.         $$("#todo-list li").findBy(exactText("a")).doubleClick();
  50.         $("#todo-list li").find(".edit").setValue("new a").pressEnter();
  51.  
  52.         //Delete task check
  53.         $$("#todo-list li").findBy(exactText("new a")).hover().find(".destroy").click();
  54.         $$("#todo-list li").shouldHave(exactTexts("b", "c"));
  55.  
  56.         //Check "Toggle "All"
  57.         $("#toggle-all").click();
  58.         $$("#todo-list li.completed").shouldHave(exactTexts("b","c"));
  59.  
  60.         //Check "Clear all" button
  61.         $("#footer #clear-completed").click();
  62.  
  63.     }
  64.  
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement