Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ua.com.azhytnytskyi;
- import com.codeborne.selenide.*;
- import org.junit.Test;
- import org.openqa.selenium.By;
- import static com.codeborne.selenide.Selenide.*;
- import static com.codeborne.selenide.Selectors.*;
- import static com.codeborne.selenide.Condition.*;
- import static com.codeborne.selenide.CollectionCondition.*;
- public class TodoMvcTest {
- {
- System.setProperty("webdriver.chrome.driver", "C:/work/web drivers/chromedriver.exe");
- Configuration.browser = "chrome";
- }
- @Test
- public void todoMvcTestCss() {
- open("http://todomvc.com/examples/emberjs");
- $("#new-todo").setValue("a").pressEnter();
- $("#new-todo").setValue("b").pressEnter();
- $("#new-todo").setValue("c").pressEnter();
- $$("#todo-list li").shouldHave(exactTexts("a", "b", "c"));
- $("#todo-list>li:nth-of-type(2)").$(".toggle").click();
- $$("#todo-list>li.completed").shouldHave(exactTexts("b"));
- $$("#todo-list>li:not(.completed)").shouldHave(exactTexts("a","c"));
- }
- @Test
- public void todoMvcTestXPath(){
- open("http://todomvc.com/examples/emberjs");
- $x("//input[@id='new-todo']").setValue("a").pressEnter();
- $x("//input[@id='new-todo']").setValue("b").pressEnter();
- $x("//input[@id='new-todo']").setValue("c").pressEnter();
- $$x("//ul[@id='todo-list']/li").shouldHave(exactTexts("a","b","c"));
- $x("//ul[@id='todo-list']/li[position()=2]/div/input").click();
- $$x("//ul[@id='todo-list']/li[contains(@class,'completed ember-view')]").shouldHave(exactTexts("b"));
- $$x("//ul[@id='todo-list']/li[not(contains(@class,'completed'))]").shouldHave(exactTexts("a","c"));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement