Skip to content

Commit 5f4a611

Browse files
committed
Add SeleniumBase Case Plans
1 parent dbef904 commit 5f4a611

10 files changed

+636
-0
lines changed
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. |
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
``test_login.py::SwagLabsLoginTests::test_swag_labs_login``
2+
---
3+
| # | Step Description | Expected Result |
4+
| - | ---------------- | --------------- |
5+
| 1 | Log in to https://www.saucedemo.com with ``standard_user``. | Login was successful. |
6+
| 2 | Log out from the website. | Logout was successful. |
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
``test_mfa_login.py::TestMFALogin::test_mfa_login``
2+
---
3+
| # | Step Description | Expected Result |
4+
| - | ---------------- | --------------- |
5+
| 1 | Open https://seleniumbase.io/realworld/login <br /> Enter credentials and Sign In. | Sign In was successful. |
6+
| 2 | Click the ``This Page`` button. <br /> Save a screenshot to the logs. | |
7+
| 3 | Click to Sign Out | Sign Out was successful. |

seleniumbase/console_scripts/run.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
sbase options
1212
sbase commander
1313
sbase behave-gui
14+
sbase caseplans
1415
sbase mkdir ui_tests
1516
sbase mkfile new_test.py
1617
sbase mkrec new_test.py
@@ -83,6 +84,7 @@ def show_basic_usage():
8384
sc += " behave-options (List common behave options)\n"
8485
sc += " gui / commander [OPTIONAL PATH or TEST FILE]\n"
8586
sc += " behave-gui (SBase Commander for Behave)\n"
87+
sc += " caseplans [OPTIONAL PATH or TEST FILE]\n"
8688
sc += " mkdir [DIRECTORY] [OPTIONS]\n"
8789
sc += " mkfile [FILE.py] [OPTIONS]\n"
8890
sc += " mkrec / codegen [FILE.py] [OPTIONS]\n"
@@ -200,6 +202,27 @@ def show_behave_gui_usage():
200202
print("")
201203

202204

205+
def show_caseplans_usage():
206+
c2 = colorama.Fore.BLUE + colorama.Back.LIGHTGREEN_EX
207+
c3 = colorama.Fore.BLUE + colorama.Back.LIGHTYELLOW_EX
208+
cr = colorama.Style.RESET_ALL
209+
sc = " " + c2 + "** " + c3 + "caseplans" + c2 + " **" + cr
210+
print(sc)
211+
print("")
212+
print(" Usage:")
213+
print(" seleniumbase caseplans [OPTIONAL PATH or TEST FILE]")
214+
print(" OR: sbase caseplans [OPTIONAL PATH or TEST FILE]")
215+
print(" Examples:")
216+
print(" sbase caseplans")
217+
print(" sbase caseplans -k agent")
218+
print(" sbase caseplans -m marker2")
219+
print(" sbase caseplans test_suite.py")
220+
print(" sbase caseplans offline_examples/")
221+
print(" Output:")
222+
print(" Launches the SeleniumBase Case Plans Generator.")
223+
print("")
224+
225+
203226
def show_mkdir_usage():
204227
c2 = colorama.Fore.BLUE + colorama.Back.LIGHTGREEN_EX
205228
c3 = colorama.Fore.BLUE + colorama.Back.LIGHTYELLOW_EX
@@ -879,6 +902,7 @@ def show_detailed_help():
879902
show_install_usage()
880903
show_commander_usage()
881904
show_behave_gui_usage()
905+
show_caseplans_usage()
882906
show_mkdir_usage()
883907
show_mkfile_usage()
884908
show_mkrec_usage()
@@ -932,6 +956,10 @@ def main():
932956
from seleniumbase.console_scripts import sb_behave_gui
933957

934958
sb_behave_gui.main()
959+
elif command == "caseplans" or command == "case-plans":
960+
from seleniumbase.console_scripts import sb_caseplans
961+
962+
sb_caseplans.main()
935963
elif (
936964
command == "recorder"
937965
or (command == "record" and len(command_args) == 0)
@@ -1135,6 +1163,14 @@ def main():
11351163
print("")
11361164
show_behave_gui_usage()
11371165
return
1166+
elif command_args[0] == "caseplans":
1167+
print("")
1168+
show_caseplans_usage()
1169+
return
1170+
elif command_args[0] == "case-plans":
1171+
print("")
1172+
show_caseplans_usage()
1173+
return
11381174
elif command_args[0] == "mkdir":
11391175
print("")
11401176
show_mkdir_usage()

0 commit comments

Comments
 (0)