def test_adding_and_completing_tasks(): s('#new-todo').type('a').press_enter() s('#new-todo').type('b').press_enter() s('#new-todo').type('c').press_enter() ss('#todo-list>li').should(have.exact_texts('a', 'b', 'c')) s('#todo-list>li:nth-child(2) .toggle').click() s('#todo-list>li:nth-child(2)').should(have.css_class('completed')) s('#todo-list>li:nth-child(1)').should(have.no.css_class('completed')) s('#todo-list>li:nth-child(3)').should(have.no.css_class('completed'))
def test_counts_invisible_tasks(): GIVEN_PAGE.opened_empty() elements = driver.all('li').filtered_by(have.css_class('will-appear')) WHEN.load_body(''' <ul>Hello to: <li>Anonymous</li> <li class='will-appear'>Bob</li> <li class='will-appear' style='display:none'>Kate</li> </ul>''') assert len(elements) == 2
def test_complete(): browser.open('http://todomvc.com/examples/emberjs/') browser.element('#new-todo').type('a').press_enter() browser.element('#new-todo').type('b').press_enter() browser.element('#new-todo').type('c').press_enter() browser.all('#todo-list > li').filtered_by(have.no.css_class('completed')) browser.all('#todo-list > li').filtered_by( have.no.css_class('completed')).element('.toggle').click() browser.all('#todo-list > li').filtered_by(have.css_class('completed')) browser.all('#todo-list > li').filtered_by(have.no.css_class('completed'))
def test_condition_have_css_class(): assert have.css_class(".css").expected == ".css"
def __init__(self): self.todos = browser.all('#todo-list>li') self.be_completed = have.css_class('completed') self.be_active = self.be_completed.not_
def _start_editing(self, name: str, edited_text): self.todos.element_by(have.exact_text(name)).double_click() return self.todos.element_by(have.css_class('editing')) \ .element('.edit').with_(set_value_by_js=True).set_value(edited_text)
def should_have_completed(self, *names): self._todos.filtered_by(have.css_class('completed'))\ .should(have.texts(*names)) return self
def should_have_active(self, *names): self._todos.filtered_by(have.css_class('active'))\ .should(have.texts(*names)) return self
def check_choice_selected(num=1): element(by_xpath(__choice_checkbox_pattern.format(num))).should_have(have.css_class("user-selected"))