Update examples

This commit is contained in:
Michael Mintz 2020-11-21 14:50:02 -05:00
parent f11c25b1a4
commit 4397bbbd4c
3 changed files with 28 additions and 2 deletions

View File

@ -1,6 +1,7 @@
import pytest
# Use the pytest "request" fixture to get the "sb" fixture (no class)
@pytest.mark.offline
def test_request_fixture(request):
sb = request.getfixturevalue('sb')
@ -10,3 +11,16 @@ def test_request_fixture(request):
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
class Test_Request_Fixture():
def test_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()

View File

@ -1,3 +1,4 @@
# Use the pytest "request" fixture to get the "sb" fixture (no class)
def test_request_sb_fixture(request):
sb = request.getfixturevalue('sb')
sb.open("https://seleniumbase.io/demo_page")
@ -6,3 +7,16 @@ def test_request_sb_fixture(request):
sb.type("#myTextarea", "This is me")
sb.click("#myButton")
sb.tearDown()
# Use the pytest "request" fixture to get the "sb" fixture (in class)
class Test_Request_Fixture():
def test_request_sb_fixture_in_class(self, request):
sb = request.getfixturevalue('sb')
sb.open("https://seleniumbase.io/demo_page")
sb.assert_element("input#myTextInput")
sb.type("#myTextarea", "Automated")
sb.assert_text("This Text is Green", "#pText")
sb.click("#myButton")
sb.assert_text("This Text is Purple", "#pText")
sb.tearDown()

View File

@ -1,5 +1,3 @@
# "sb" pytest fixture test in a method with no class
def test_sb_fixture_with_no_class(sb):
sb.open("https://google.com/ncr")