Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.junit.Test;
- import static com.codeborne.selenide.CollectionCondition.exactTexts;
- import static com.codeborne.selenide.Selenide.$;
- import static com.codeborne.selenide.Selenide.$$;
- import static com.codeborne.selenide.Selenide.open;
- import static com.codeborne.selenide.CollectionCondition.empty;
- public class TodoMVCTest {
- @Test
- public void testTasksCommonFlow(){
- open("https://todomvc4tasj.herokuapp.com/#/");
- $("#new-todo").setValue("task 1").pressEnter();
- $("#new-todo").setValue("task 2").pressEnter();
- $("#new-todo").setValue("task 3").pressEnter();
- $("#new-todo").setValue("task 4").pressEnter();
- $$("#todo-list li").shouldHave(exactTexts("task 1","task 2","task 3","task 4"));
- //Delete taksk2
- $("#todo-list li:nth-of-type(2)").hover();
- $("#todo-list li:nth-of-type(2) .destroy").hover().click();
- $$("#todo-list li").shouldHave(exactTexts("task 1", "task 3", "task 4"));
- //complete task4
- $("#todo-list li:nth-of-type(3) .toggle").click();
- $$("#todo-list li.completed").shouldHave(exactTexts("task 4"));
- $("#clear-completed").click();
- $$("#todo-list li").shouldHave(exactTexts("task 1", "task 3"));
- //complete all
- $("#toggle-all").click();
- $$("#todo-list li.completed").shouldHave(exactTexts("task 1", "task 3"));
- $("#clear-completed").click();
- $$("#todo-list li").shouldBe(empty);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment