Skip to content

Commit 8f02749

Browse files
authored
Merge pull request #1463 from seleniumbase/seleniumbase-4
SeleniumBase 4 / Case Plans / and more
2 parents d4a7d8f + 6e76e1f commit 8f02749

File tree

63 files changed

+1989
-303
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1989
-303
lines changed

README.md

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/console_scripts/ReadMe.md">🔮 Scripts</a> |
1919
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/mobile_testing.md">📱 Phone</a>
2020
<br />
21-
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/method_summary.md">📙 APIs</a> |
22-
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/syntax_formats.md">📝 Formats</a> |
23-
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/example_logs/ReadMe.md">🔵 Dashboard</a> |
21+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/method_summary.md">📚 APIs</a> |
22+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/syntax_formats.md">🔠 Formats</a> |
23+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/example_logs/ReadMe.md"> Dashboard</a> |
2424
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/recorder_mode.md">🔴 Recorder</a> |
2525
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/locale_codes.md">🗾 Locales</a> |
2626
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md">🌐 Grid</a>
@@ -32,11 +32,18 @@
3232
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/chart_maker/ReadMe.md">📊 Charts</a> |
3333
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/ReadMe.md">🚎 Tours</a>
3434
<br />
35-
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/github/workflows/ReadMe.md">🤖 CI</a> |
36-
<a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/boilerplates">♻️ Boilerplates</a> |
35+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/how_it_works.md">👁️ How</a> |
36+
<a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/migration/raw_selenium">🚝 Migrate</a> |
37+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/case_plans.md">📒 CasePlans</a> |
38+
<a href="https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/node_js">🚉 NodeGUI</a> |
39+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/master_qa/ReadMe.md">🧬 Hybrid</a> |
40+
<a href="https://seleniumbase.io/devices/?url=seleniumbase.com">💻 Farm</a>
41+
<br />
42+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/github/workflows/ReadMe.md">🤖 CI/CD</a> |
43+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/js_package_manager.md">🕹️ JSMgr</a> |
44+
<a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/boilerplates">♻️ Templates</a> |
3745
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/html_inspector.md">🔎 Inspector</a> |
38-
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/js_package_manager.md">🕹️ JSCode</a> |
39-
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/dialog_boxes/ReadMe.md">🛂 Dialogs</a> |
46+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/dialog_boxes/ReadMe.md">🛂 Boxes</a> |
4047
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/visual_testing/ReadMe.md">🖼️ Visual</a>
4148
<br />
4249
</p>
@@ -54,7 +61,7 @@ pytest test_demo_site.py --chrome
5461

5562
<div></div>
5663
<details>
57-
<summary> ▶️ How is SeleniumBase different from raw Selenium? (<b><u>click to expand</u></b>)</summary>
64+
<summary> ▶️ How is SeleniumBase different from raw Selenium? (<b>click to expand</b>)</summary>
5865
<div>
5966

6067
<p>💡 SeleniumBase is a Python test framework for the <a href="https://www.w3.org/TR/webdriver2/#endpoints" target="_blank">Selenium/WebDriver</a> browser automation library. This framework incorporates test-runners such as <code>pytest</code>, <code>nosetests</code>, and <code>behave</code> to provide organized structure, test discovery, test execution, test state (<i>eg. passed, failed, or skipped</i>), and command-line options for changing default settings (<i>such as choosing the browser to use</i>). With raw Selenium, you would need to set up your own options-parser for configuring tests from the command-line.</p>
@@ -200,6 +207,7 @@ COMMANDS:
200207
behave-options (List common behave options)
201208
gui / commander [OPTIONAL PATH or TEST FILE]
202209
behave-gui (SBase Commander for Behave)
210+
caseplans [OPTIONAL PATH or TEST FILE]
203211
mkdir [DIRECTORY] [OPTIONS]
204212
mkfile [FILE.py] [OPTIONS]
205213
mkrec / codegen [FILE.py] [OPTIONS]
@@ -768,7 +776,7 @@ pytest user_agent_test.py --agent="Mozilla/5.0 (Nintendo 3DS; U; ; en) Version/1
768776
769777
<div></div>
770778
<details>
771-
<summary> ▶️ Here are some things you can do to set up a production environment for your testing. (<b><u>click to expand</u></b>)</summary>
779+
<summary> ▶️ Here are some things you can do to set up a production environment for your testing. (<b>click to expand</b>)</summary>
772780
773781
<ul>
774782
<li>You can set up a <a href="https://jenkins.io/" target="_blank">Jenkins</a> build server for running tests at regular intervals. For a real-world Jenkins example of headless browser automation in action, check out the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/azure/jenkins/ReadMe.md">SeleniumBase Jenkins example on Azure</a> or the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/google_cloud/ReadMe.md">SeleniumBase Jenkins example on Google Cloud</a>.</li>
@@ -936,7 +944,7 @@ def is_there_a_cloaked_klingon_ship_on_this_page():
936944
937945
<div></div>
938946
<details>
939-
<summary> ▶️ is_text_visible(text, selector) # is text visible on a page (<b><u>click to expand</u></b>)</summary>
947+
<summary> ▶️ is_text_visible(text, selector) # is text visible on a page (<b>click to expand</b>)</summary>
940948
941949
```python
942950
def get_mirror_universe_captain_picard_superbowl_ad(superbowl_year):
@@ -1002,7 +1010,7 @@ self.activate_jquery()
10021010
10031011
<div></div>
10041012
<details>
1005-
<summary> ▶️ Here are some examples of using jQuery in your scripts. (<b><u>click to expand</u></b>)</summary>
1013+
<summary> ▶️ Here are some examples of using jQuery in your scripts. (<b>click to expand</b>)</summary>
10061014
10071015
```python
10081016
self.execute_script("jQuery, window.scrollTo(0, 600)") # Scrolling the page
@@ -1032,7 +1040,7 @@ self.execute_script("return jQuery('textarea')[2].value") # Returns the css "va
10321040
10331041
<div></div>
10341042
<details>
1035-
<summary> ▶️ In this example, JavaScript creates a referral button on a page, which is then clicked. (<b><u>click to expand</u></b>)</summary>
1043+
<summary> ▶️ In this example, JavaScript creates a referral button on a page, which is then clicked. (<b>click to expand</b>)</summary>
10361044
10371045
```python
10381046
start_page = "https://xkcd.com/465/"

examples/boilerplates/samples/sb_swag_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ def test_swag_labs_login(self, sb):
1515
sb.assert_element("div.inventory_list")
1616
sb.assert_element('div:contains("Sauce Labs Backpack")')
1717
sb.js_click("a#logout_sidebar_link")
18+
sb.assert_element("div#login_button_container")

examples/boilerplates/samples/swag_labs_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ def test_swag_labs_login(self):
1717
self.assert_element("div.inventory_list")
1818
self.assert_element('div:contains("Sauce Labs Backpack")')
1919
self.js_click("a#logout_sidebar_link")
20+
self.assert_element("div#login_button_container")

examples/boilerplates/samples/test_page_objects.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,7 @@ def do_search(self, sb, search_term):
1010
sb.type('input[title="Search"]', search_term + "\n")
1111

1212
def click_search_result(self, sb, content):
13-
sb.click('a[href*="%s"]' % content)
14-
15-
16-
class SeleniumBaseGitHubPage:
17-
def click_seleniumbase_io_link(self, sb):
18-
link = '#readme article a[href*="seleniumbase.io"]'
19-
sb.wait_for_element_visible(link)
20-
sb.js_click(link)
21-
sb.switch_to_newest_window()
13+
sb.click('a:contains("%s")' % content)
2214

2315

2416
class SeleniumBaseIOPage:
@@ -29,12 +21,11 @@ def do_search_and_click(self, sb, search_term):
2921

3022
class MyTests(BaseCase):
3123
def test_page_objects(self):
32-
search_term = "SeleniumBase GitHub"
33-
expected_text = "seleniumbase/SeleniumBase"
24+
search_term = "SeleniumBase.io Docs"
25+
expected_text = "SeleniumBase"
3426
GooglePage().go_to_google(self)
3527
GooglePage().do_search(self, search_term)
3628
self.assert_text(expected_text, "#search")
3729
GooglePage().click_search_result(self, expected_text)
38-
SeleniumBaseGitHubPage().click_seleniumbase_io_link(self)
3930
SeleniumBaseIOPage().do_search_and_click(self, "Dashboard")
4031
self.assert_text("Dashboard", "main h1")
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
``basic_test.py::MyTestClass::test_basics``
2+
---
3+
| # | Step Description | Expected Result |
4+
| - | ---------------- | --------------- |
5+
| 1 | Log in to https://www.saucedemo.com with ``standard_user``. | Login was successful. |
6+
| 2 | Click on the ``Backpack`` ``ADD TO CART`` button. | The button text changed to ``REMOVE``. |
7+
| 3 | Click on the cart icon. | The ``Backpack`` is seen in the cart. |
8+
| 4 | Remove the ``Backpack`` from the cart. | The ``Backpack`` is no longer in the cart. |
9+
| 5 | Log out from the website. | Logout was successful. |
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
``list_assert_test.py::MyTestClass::test_assert_list_of_elements``
2+
---
3+
| # | Step Description | Expected Result |
4+
| - | ---------------- | --------------- |
5+
| 1 | Open https://seleniumbase.io/demo_page. | |
6+
| 2 | Use ``self.assert_elements_present("head", "style", "script")`` to verify that multiple elements are present in the HTML. | The assertion is successful. |
7+
| 3 | Use ``self.assert_elements("h1", "h2", "h3")`` to verify that multiple elements are visible. | The assertion is successful. |
8+
| 4 | Use ``self.assert_elements(["#myDropdown", "#myButton", "#svgRect"])`` to verify that multiple elements are visible. | The assertion is successful. |
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
``my_first_test.py::MyTestClass::test_swag_labs``
2+
---
3+
| # | Step Description | Expected Result |
4+
| - | ---------------- | --------------- |
5+
| 1 | Log in to https://www.saucedemo.com with ``standard_user``. | Login was successful. |
6+
| 2 | Click on the ``Backpack`` ``ADD TO CART`` button. | The button text changed to ``REMOVE``. |
7+
| 3 | Click on the cart icon. | The ``Backpack`` is seen in the cart. |
8+
| 4 | Click on the ``CHECKOUT`` button. <br /> Enter user details and click ``CONTINUE``. | The ``Backpack`` is seen in the cart on the ``CHECKOUT: OVERVIEW`` page. |
9+
| 5 | Click on the ``FINISH`` button. | There is a ``Thank You`` message and a ``Pony Express`` delivery logo. |
10+
| 6 | Log out from the website. | Logout was successful. |
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
``shadow_root_test.py::ShadowRootTest::test_shadow_root``
2+
---
3+
| # | Step Description | Expected Result |
4+
| - | ---------------- | --------------- |
5+
| 1 | Open https://seleniumbase.io/other/shadow_dom. <br /> Click each tab and verify the text contained within the Shadow Root sections. | Tab 1 text: ``Content Panel 1`` <br /> Tab 2 text: ``Content Panel 2`` <br /> Tab 3 text: ``Content Panel 3`` |
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
``test_calculator.py::CalculatorTests::test_6_times_7_plus_12_equals_54``
2+
---
3+
| # | Step Description | Expected Result |
4+
| - | ---------------- | --------------- |
5+
| 1 | Open https://seleniumbase.io/apps/calculator. <br /> Perform the following calculation: ``6 × 7 + 12`` | The output is ``54`` after pressing ``=`` |
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
``test_demo_site.py::DemoSiteTests::test_demo_site``
2+
---
3+
| # | Step Description | Expected Result |
4+
| - | ---------------- | --------------- |
5+
| 1 | Open https://seleniumbase.io/demo_page | |
6+
| 2 | Assert the title of the current web page. <br /> Assert that a given element is visible on the page. <br /> Assert that a text substring appears in an element's text. | The assertions were successful. |
7+
| 3 | Type text into various text fields and then verify. | The assertions were successful. |
8+
| 4 | Verify that a hover dropdown link changes page text. | The assertion was successful. |
9+
| 5 | Verify that a button click changes text on the page. | The assertion was successful. |
10+
| 6 | Verify that an SVG element is located on the page. | The assertion was successful. |
11+
| 7 | Verify that a slider control updates a progress bar. | The assertion was successful. |
12+
| 8 | Verify that a "select" option updates a meter bar. | The assertion was successful. |
13+
| 9 | Assert an element located inside an iFrame. | The assertion was successful. |
14+
| 10 | Assert text located inside an iFrame. | The assertion was successful. |
15+
| 11 | Verify that clicking a radio button selects it. | The assertion was successful. |
16+
| 12 | Verify that clicking an empty checkbox makes it selected. | The assertion was successful. |
17+
| 13 | Verify clicking on multiple elements with one call. | The assertions were successful. |
18+
| 14 | Verify that clicking an iFrame checkbox selects it. | The assertions were successful. |
19+
| 15 | Verify that Drag and Drop works. | The assertion was successful. |
20+
| 16 | Assert link text. | The assertion was successful. |
21+
| 17 | Verify clicking on link text. | The action was successful. |
22+
| 18 | Assert exact text in an element. | The assertion was successful. |
23+
| 19 | Highlight a page element. | The action was successful. |
24+
| 20 | Verify that Demo Mode works. | The assertion was successful. |

0 commit comments

Comments
 (0)