Skip to content

Commit b2a9d6c

Browse files
authored
Merge pull request #747 from seleniumbase/small-updates
A few small updates
2 parents 164df92 + eceeca7 commit b2a9d6c

File tree

9 files changed

+84
-6
lines changed

9 files changed

+84
-6
lines changed

.github/workflows/python-package.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ jobs:
4949
run: |
5050
echo "def test_1(): pass" > nothing.py
5151
pytest nothing.py
52+
- name: Make sure nosetests is working
53+
run: |
54+
echo "def test_2(): pass" > nothing2.py
55+
nosetests nothing2.py
56+
- name: Run pytest verify_framework.py --browser=chrome --headless
57+
run: |
58+
pytest examples/unit_tests/verify_framework.py --browser=chrome --headless -v -s --junit-xml=junit/test-results.xml
5259
- name: Run pytest boilerplate_test.py --browser=chrome --headless
5360
run: |
5461
pytest examples/boilerplates/boilerplate_test.py --browser=chrome --headless -v -s --junit-xml=junit/test-results.xml

docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
regex>=2020.11.13
2-
tqdm>=4.54.0
2+
tqdm>=4.54.1
33
livereload==2.6.3;python_version>="3.6"
44
Markdown==3.3.3
55
readme-renderer==28.0

examples/unit_tests/ReadMe.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="20" /> pytest-specific unit tests
2+
3+
The tests in this folder are for basic verification of the SeleniumBase framework with pytest.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
""" Run with pytest """
2+
3+
4+
def test_simple_cases(testdir):
5+
""" Verify a simple passing test and a simple failing test. """
6+
testdir.makepyfile(
7+
"""
8+
from seleniumbase import BaseCase
9+
class MyTestCase(BaseCase):
10+
def test_passing(self):
11+
self.assert_equal('yes', 'yes')
12+
def test_failing(self):
13+
self.assert_equal('yes', 'no')
14+
"""
15+
)
16+
result = testdir.inline_run("--headless", "--rs")
17+
assert result.matchreport("test_passing").passed
18+
assert result.matchreport("test_failing").failed
19+
20+
21+
def test_basecase(testdir):
22+
testdir.makepyfile(
23+
"""
24+
from seleniumbase import BaseCase
25+
class MyTest(BaseCase):
26+
def test_basecase(self):
27+
self.open("data:text/html,<p>Hello<br><input></p>")
28+
self.assert_element("html > body") # selector
29+
self.assert_text("Hello", "body p") # text, selector
30+
self.type("input", "Goodbye") # selector, text
31+
self.click("body p") # selector
32+
"""
33+
)
34+
result = testdir.inline_run("--headless")
35+
assert result.matchreport("test_basecase").passed
36+
37+
38+
def test_sb_fixture(testdir):
39+
testdir.makepyfile(
40+
"""
41+
def test_sb_fixture(sb):
42+
sb.open("data:text/html,<p>Hello<br><input></p>")
43+
sb.assert_element("html > body") # selector
44+
sb.assert_text("Hello", "body p") # text, selector
45+
sb.type("input", "Goodbye") # selector, text
46+
sb.click("body p") # selector
47+
"""
48+
)
49+
result = testdir.inline_run("--headless")
50+
assert result.matchreport("test_sb_fixture").passed
51+
52+
53+
def test_request_sb_fixture(testdir):
54+
testdir.makepyfile(
55+
"""
56+
def test_request_sb_fixture(request):
57+
sb = request.getfixturevalue('sb')
58+
sb.open("data:text/html,<p>Hello<br><input></p>")
59+
sb.assert_element("html > body") # selector
60+
sb.assert_text("Hello", "body p") # text, selector
61+
sb.type("input", "Goodbye") # selector, text
62+
sb.click("body p") # selector
63+
sb.tearDown()
64+
"""
65+
)
66+
result = testdir.inline_run("--headless")
67+
assert result.matchreport("test_request_sb_fixture").passed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ packaging>=20.7
33
setuptools>=44.1.1;python_version<"3.5"
44
setuptools>=50.3.2;python_version>="3.5"
55
setuptools-scm>=4.1.2
6-
wheel>=0.36.0
6+
wheel>=0.36.1
77
attrs>=20.3.0
88
certifi>=2020.11.8
99
six==1.15.0

seleniumbase/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# seleniumbase package
2-
__version__ = "1.50.17"
2+
__version__ = "1.50.18"

seleniumbase/plugins/pytest_plugin.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from seleniumbase.core import log_helper
99
from seleniumbase.core import proxy_helper
1010
from seleniumbase.fixtures import constants
11+
pytest_plugins = ["pytester"] # Adds the "testdir" fixture
1112

1213

1314
def pytest_addoption(parser):

seleniumbase/plugins/selenium_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ def beforeTest(self, test):
433433
test.test.use_auto_ext = self.options.use_auto_ext
434434
test.test.no_sandbox = self.options.no_sandbox
435435
test.test.disable_gpu = self.options.disable_gpu
436-
test.text.remote_debug = self.options.remote_debug
436+
test.test.remote_debug = self.options.remote_debug
437437
test.test.swiftshader = self.options.swiftshader
438438
test.test.incognito = self.options.incognito
439439
test.test.guest_mode = self.options.guest_mode

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
print("\n*** Installing twine: *** (Required for PyPI uploads)\n")
5050
os.system("python -m pip install --upgrade 'twine>=1.15.0'")
5151
print("\n*** Installing tqdm: *** (Required for PyPI uploads)\n")
52-
os.system("python -m pip install --upgrade 'tqdm>=4.54.0'")
52+
os.system("python -m pip install --upgrade 'tqdm>=4.54.1'")
5353
print("\n*** Publishing The Release to PyPI: ***\n")
5454
os.system('python -m twine upload dist/*') # Requires ~/.pypirc Keys
5555
print("\n*** The Release was PUBLISHED SUCCESSFULLY to PyPI! :) ***\n")
@@ -107,7 +107,7 @@
107107
'setuptools>=44.1.1;python_version<"3.5"',
108108
'setuptools>=50.3.2;python_version>="3.5"',
109109
'setuptools-scm',
110-
'wheel>=0.36.0',
110+
'wheel>=0.36.1',
111111
'attrs>=20.3.0',
112112
'certifi>=2020.11.8',
113113
'six',

0 commit comments

Comments
 (0)