Skip to content

Commit b60c7a0

Browse files
authored
Merge pull request #820 from seleniumbase/update-console-scripts
Update console scripts (sbase mkdir DIR)
2 parents 3f3c8c8 + e80bdbb commit b60c7a0

File tree

8 files changed

+58
-6
lines changed

8 files changed

+58
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ ui_tests/
430430
│ ├── __init__.py
431431
│ ├── base_test_case.py
432432
│ ├── boilerplate_test.py
433+
│ ├── classic_obj_test.py
433434
│ ├── page_objects.py
434435
│ └── samples/
435436
│ ├── __init__.py

examples/boilerplates/ReadMe.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* <b>[base_test_case.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/boilerplates/base_test_case.py):</b> This example demonstrates a test class inheriting [BaseCase](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/fixtures/base_case.py) for adding new methods.
1111
* <b>[page_objects.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/boilerplates/page_objects.py):</b> This example demonstrates Page Objects for reusing commonly-used selectors in tests.
1212
* <b>[boilerplate_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/boilerplates/boilerplate_test.py):</b> This example demonstrates inheritance of the above files for making a complete test.
13+
* <b>[classic_obj_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/boilerplates/classic_obj_test.py):</b> This example demonstrates the classic Page Object Model for structuring tests.
1314

1415
--------
1516

examples/boilerplates/classic_obj_test.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@
44
class DataPage():
55

66
def go_to_data_url(self, sb):
7-
sb.open("data:text/html,<p>Hello!</p>")
7+
sb.open("data:text/html,<p>Hello!</p><input />")
88

9+
def add_input_text(self, sb, text):
10+
sb.type("input", text)
911

10-
class MyTests(BaseCase):
1112

12-
def test_go_to_data_url(self):
13+
class ObjTests(BaseCase):
14+
15+
def test_data_url_page(self):
1316
DataPage().go_to_data_url(self)
1417
self.assert_text("Hello!", "p")
18+
DataPage().add_input_text(self, "Goodbye!")

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ toml==0.10.2
7878
Pillow==6.2.2;python_version<"3.5"
7979
Pillow==7.2.0;python_version>="3.5" and python_version<"3.6"
8080
Pillow==8.1.0;python_version>="3.6"
81-
rich==9.11.0;python_version>="3.6" and python_version<"4.0"
81+
rich==9.11.1;python_version>="3.6" and python_version<"4.0"
8282
flake8==3.7.9;python_version<"3.5"
8383
flake8==3.8.4;python_version>="3.5"
8484
pyflakes==2.1.1;python_version<"3.5"

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.55.5"
2+
__version__ = "1.55.6"

seleniumbase/console_scripts/ReadMe.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,27 @@ sample tests for helping new users get started,
7070
and Python boilerplates for setting up customized
7171
test frameworks.
7272

73+
```bash
74+
.
75+
├── __init__.py
76+
├── boilerplates/
77+
│ ├── __init__.py
78+
│ ├── base_test_case.py
79+
│ ├── boilerplate_test.py
80+
│ ├── classic_obj_test.py
81+
│ ├── page_objects.py
82+
│ └── samples/
83+
│ ├── __init__.py
84+
│ ├── google_objects.py
85+
│ └── google_test.py
86+
├── my_first_test.py
87+
├── parameterized_test.py
88+
├── pytest.ini
89+
├── requirements.txt
90+
├── setup.cfg
91+
└── test_demo_site.py
92+
```
93+
7394
### mkfile
7495

7596
* Usage:

seleniumbase/console_scripts/sb_mkdir.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,31 @@ def main():
485485
file.writelines("\r\n".join(data))
486486
file.close()
487487

488+
data = []
489+
data.append("from seleniumbase import BaseCase")
490+
data.append("")
491+
data.append("")
492+
data.append("class DataPage():")
493+
data.append("")
494+
data.append(" def go_to_data_url(self, sb):")
495+
data.append(" sb.open(\"data:text/html,<p>Hello!</p><input />\")")
496+
data.append("")
497+
data.append(" def add_input_text(self, sb, text):")
498+
data.append(" sb.type(\"input\", text)")
499+
data.append("")
500+
data.append("")
501+
data.append("class ObjTests(BaseCase):")
502+
data.append("")
503+
data.append(" def test_data_url_page(self):")
504+
data.append(" DataPage().go_to_data_url(self)")
505+
data.append(" self.assert_text(\"Hello!\", \"p\")")
506+
data.append(" DataPage().add_input_text(self, \"Goodbye!\")")
507+
data.append("")
508+
file_path = "%s/%s" % (dir_name_2, "classic_obj_test.py")
509+
file = codecs.open(file_path, "w+", "utf-8")
510+
file.writelines("\r\n".join(data))
511+
file.close()
512+
488513
dir_name_3 = dir_name_2 + "/" + "samples"
489514
os.mkdir(dir_name_3)
490515

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@
182182
'Pillow==6.2.2;python_version<"3.5"',
183183
'Pillow==7.2.0;python_version>="3.5" and python_version<"3.6"',
184184
'Pillow==8.1.0;python_version>="3.6"',
185-
'rich==9.11.0;python_version>="3.6" and python_version<"4.0"',
185+
'rich==9.11.1;python_version>="3.6" and python_version<"4.0"',
186186
'flake8==3.7.9;python_version<"3.5"',
187187
'flake8==3.8.4;python_version>="3.5"',
188188
'pyflakes==2.1.1;python_version<"3.5"',

0 commit comments

Comments
 (0)