Skip to content

Commit

Permalink
Design decision: move .get('input') to our class methods?
Browse files Browse the repository at this point in the history
  • Loading branch information
ElSnoMan committed Mar 1, 2021
1 parent 4b99406 commit 726da7c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/test_todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ def goto(self) -> 'TodoPage':
return self

def get_todo_by_name(self, name: str) -> Element:
return self.py.getx(f"//*[text()='{name}']").parent()
return self.py.getx(f"//*[text()='{name}']").parent().get('input')

def get_all_todos(self) -> Elements:
return self.py.find("li[ng-repeat*='todo']")
return self.py.find("li[ng-repeat*='todo'] > input")


@pytest.fixture
Expand All @@ -24,21 +24,21 @@ def page(py: Pylenium):


def test_check_first_item(page: TodoPage):
checkbox = page.get_todo_by_name('First Item').get('input')
checkbox = page.get_todo_by_name('First Item')
checkbox.click()
assert checkbox.should().be_checked()


def test_check_many_items(py: Pylenium, page: TodoPage):
todos = page.get_all_todos()
todo2, todo4 = todos[1], todos[3]
todo2.get('input').click()
todo4.get('input').click()
todo2.click()
todo4.click()
assert py.contains('3 of 5 remaining')


def test_check_all_items(py: Pylenium, page: TodoPage):
for todo in page.get_all_todos():
todo.get('input').click()
todo.click()

assert py.contains('0 of 5 remaining')

0 comments on commit 726da7c

Please sign in to comment.