- Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathtest_request_fixture.py
26 lines (22 loc) · 845 Bytes
/
test_request_fixture.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
importpytest
# Use the pytest "request" fixture to get the "sb" fixture (no class)
@pytest.mark.offline
deftest_request_fixture(request):
sb=request.getfixturevalue("sb")
sb.open("data:text/html,<p>Hello<br><input></p>")
sb.assert_element("html > body")
sb.assert_text("Hello", "body p")
sb.type("input", "Goodbye")
sb.click("body p")
sb.tearDown()
# Use the pytest "request" fixture to get the "sb" fixture (in class)
@pytest.mark.offline
classRequestTests:
deftest_request_fixture_in_class(self, request):
sb=request.getfixturevalue("sb")
sb.open("data:text/html,<p>Hello<br><input></p>")
sb.assert_element("html > body")
sb.assert_text("Hello", "body p")
sb.type("input", "Goodbye")
sb.click("body p")
sb.tearDown()