Skip to content

Commit bcdd9da

Browse files
authored
Merge pull request #1708 from seleniumbase/mostly-uc-mode-improvements
Mostly UC Mode improvements
2 parents 5d6a816 + 5c5130f commit bcdd9da

25 files changed

+133
-109
lines changed

examples/boilerplates/samples/google_test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
"""google.com example test that uses page objects"""
2-
32
from seleniumbase import BaseCase
43
from .google_objects import HomePage, ResultsPage
54

65

76
class GoogleTests(BaseCase):
87
def test_google_dot_com(self):
98
self.open("https://google.com/ncr")
10-
self.sleep(0.1)
9+
self.sleep(0.5)
1110
self.hide_elements('iframe[name="callout"]')
1211
self.save_screenshot_to_logs() # ("./latest_logs" folder)
1312
self.type(HomePage.search_box, "github.com")

examples/migration/protractor/example_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from seleniumbase import BaseCase
2+
BaseCase.main(__name__, __file__)
23

34

45
class AngularJSHomePageTests(BaseCase):

examples/migration/protractor/input_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from seleniumbase import BaseCase
2+
BaseCase.main(__name__, __file__)
23

34

45
class AngularMaterialInputTests(BaseCase):

examples/migration/protractor/mat_paginator_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from seleniumbase import BaseCase
2+
BaseCase.main(__name__, __file__)
23

34

45
class AngularMaterialPaginatorTests(BaseCase):

examples/parameterized_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
class GoogleTests(BaseCase):
77
@parameterized.expand(
88
[
9-
["Download Python", "Download Python", "img.python-logo"],
10-
["Wikipedia", "www.wikipedia.org", "img.central-featured-logo"],
11-
["SeleniumBase.io Docs", "SeleniumBase", 'img[alt*="SeleniumB"]'],
9+
["site:Python.org Download", "Download Python", "img.python-logo"],
10+
["site:SeleniumBase.io", "SeleniumBase", 'img[alt*="SeleniumB"]'],
11+
["site:Wikipedia.org", "Wikipedia", "img.central-featured-logo"],
1212
]
1313
)
1414
def test_parameterized_google_search(self, search_key, expected_text, img):

examples/rate_limiting_test.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
""" This test demonstrates the use of the "rate_limited" decorator.
2-
You can use this decorator on any method to rate-limit it. """
3-
1+
"""This test demonstrates the use of the "rate_limited" decorator.
2+
You can use this decorator on any method to rate-limit it."""
43
from seleniumbase import BaseCase
54
from seleniumbase import decorators
65

@@ -11,6 +10,10 @@ def print_item(self, item):
1110
print(item)
1211

1312
def test_rate_limited_printing(self):
13+
if self._multithreaded:
14+
self.open("data:,")
15+
print("Skipping test in multi-threaded mode.")
16+
self.skip("Skipping test in multi-threaded mode.")
1417
message = "Running rate-limited print() on the command line"
1518
self.open("data:text/html,<p>%s</p>" % message)
1619
print("\n%s:" % message)

examples/raw_file_call.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
"""Call a file with "python" instead of "pytest".
2-
To run, use: "python raw_file_call.py".
3-
On newer version of SeleniumBase, use:
4-
BaseCase.main(__name__, __file__)"""
2+
To run, use: "python raw_file_call.py"."""
53
from seleniumbase import BaseCase
6-
7-
if __name__ == "__main__":
8-
from pytest import main
9-
main([__file__, "-s"])
4+
BaseCase.main(__name__, __file__)
105

116

127
class TinyMceTest(BaseCase):

examples/swag_labs_user_tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from parameterized import parameterized
22
from seleniumbase import BaseCase
3+
BaseCase.main(__name__, __file__)
34

45

56
class SwagLabsTests(BaseCase):

examples/test_calculator.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
"""Test the SeleniumBase Calculator App with SeleniumBase."""
1+
"""Test the SeleniumBase Calculator App"""
22
from seleniumbase import BaseCase
3+
BaseCase.main(__name__, __file__)
34

45

56
class CalculatorTests(BaseCase):
@@ -13,8 +14,3 @@ def test_6_times_7_plus_12_equals_54(self):
1314
self.click('button[id="2"]')
1415
self.click("button#equal")
1516
self.assert_exact_text("54", "input#output")
16-
17-
18-
if __name__ == "__main__":
19-
from pytest import main
20-
main([__file__, "-s"])

examples/test_canvas.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Use SeleniumBase methods to interact with "canvas" elements."""
22
from seleniumbase import BaseCase
3+
BaseCase.main(__name__, __file__)
34

45

56
class CanvasTests(BaseCase):

0 commit comments

Comments
 (0)