Skip to content

Commit 726da7c

Browse files
committed
Design decision: move .get('input') to our class methods?
1 parent 4b99406 commit 726da7c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/test_todo.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ def goto(self) -> 'TodoPage':
1212
return self
1313

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

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

2020

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

2525

2626
def test_check_first_item(page: TodoPage):
27-
checkbox = page.get_todo_by_name('First Item').get('input')
27+
checkbox = page.get_todo_by_name('First Item')
2828
checkbox.click()
2929
assert checkbox.should().be_checked()
3030

3131

3232
def test_check_many_items(py: Pylenium, page: TodoPage):
3333
todos = page.get_all_todos()
3434
todo2, todo4 = todos[1], todos[3]
35-
todo2.get('input').click()
36-
todo4.get('input').click()
35+
todo2.click()
36+
todo4.click()
3737
assert py.contains('3 of 5 remaining')
3838

3939

4040
def test_check_all_items(py: Pylenium, page: TodoPage):
4141
for todo in page.get_all_todos():
42-
todo.get('input').click()
42+
todo.click()
4343

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

0 commit comments

Comments
 (0)