Skip to content

Commit 4b99406

Browse files
committed
Write a new test and cleanup our existing tests
Use our newly created Page class and fixture
1 parent 5521c6d commit 4b99406

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

tests/test_todo.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,22 @@ def page(py: Pylenium):
2323
return TodoPage(py).goto()
2424

2525

26-
def test_check_first_item(py: Pylenium):
27-
py.visit('https://lambdatest.github.io/sample-todo-app/')
28-
checkbox = py.getx("//*[text()='First Item']").parent().get('input')
26+
def test_check_first_item(page: TodoPage):
27+
checkbox = page.get_todo_by_name('First Item').get('input')
2928
checkbox.click()
3029
assert checkbox.should().be_checked()
3130

3231

33-
def test_check_many_items(py: Pylenium):
34-
py.visit('https://lambdatest.github.io/sample-todo-app/')
35-
todos = py.find("li[ng-repeat*='todo']")
32+
def test_check_many_items(py: Pylenium, page: TodoPage):
33+
todos = page.get_all_todos()
3634
todo2, todo4 = todos[1], todos[3]
3735
todo2.get('input').click()
3836
todo4.get('input').click()
3937
assert py.contains('3 of 5 remaining')
38+
39+
40+
def test_check_all_items(py: Pylenium, page: TodoPage):
41+
for todo in page.get_all_todos():
42+
todo.get('input').click()
43+
44+
assert py.contains('0 of 5 remaining')

0 commit comments

Comments
 (0)