Skip to content

Commit 86bf5d9

Browse files
committed
Update example tests
1 parent 3e0b46b commit 86bf5d9

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

examples/boilerplates/classic_obj_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
""" Classic Page Object Model with BaseCase inheritance """
12
from seleniumbase import BaseCase
23

34

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
""" Classic Page Object Model with the "sb" fixture """
2+
3+
4+
class DataPage():
5+
6+
def go_to_data_url(self, sb):
7+
sb.open("data:text/html,<p>Hello!</p><input />")
8+
9+
def add_input_text(self, sb, text):
10+
sb.type("input", text)
11+
12+
13+
class ObjTests():
14+
15+
def test_data_url_page(self, sb):
16+
DataPage().go_to_data_url(sb)
17+
sb.assert_text("Hello!", "p")
18+
DataPage().add_input_text(sb, "Goodbye!")

examples/offline_examples/test_request_fixture.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def test_request_fixture(request):
1515

1616
# Use the pytest "request" fixture to get the "sb" fixture (in class)
1717
@pytest.mark.offline
18-
class Test_Request_Fixture():
18+
class RequestTests():
1919
def test_request_fixture_in_class(self, request):
2020
sb = request.getfixturevalue('sb')
2121
sb.open("data:text/html,<p>Hello<br><input></p>")

examples/test_download_files.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,11 @@ def test_download_files(self):
6262
math.floor(whl_file_kb) - math.floor(whl_displayed_kb)) < 2)
6363
self.assert_true(abs(
6464
math.floor(tar_gz_file_kb) - math.floor(tar_gz_displayed_kb)) < 2)
65+
66+
# Delete the downloaded files from the [Downloads Folder]
67+
self.delete_downloaded_file_if_present(whl_file)
68+
self.delete_downloaded_file_if_present(tar_gz_file)
69+
70+
# Verify that the downloaded files have been successfully deleted
71+
self.assert_false(self.is_downloaded_file_present(whl_file))
72+
self.assert_false(self.is_downloaded_file_present(tar_gz_file))

0 commit comments

Comments
 (0)