Skip to content

Commit 1c8d4be

Browse files
authored
Merge pull request #1 from seleniumbase/master
sync fork
2 parents ce2e4d7 + e7d5b36 commit 1c8d4be

19 files changed

+288
-44
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</p>
2323

2424
<p>
25-
SeleniumBase is an all-in-one framework for web automation, end-to-end testing, and website tours.
25+
SeleniumBase is an all-in-one framework for web automation, end-to-end testing, web presentations, and website tours.
2626
Tests are run with "pytest". Browsers are controlled by WebDriver.
2727
</p>
2828

examples/presenter/ReadMe.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pytest my_presentation.py
2121
### Creating a new presentation:
2222

2323
```python
24-
self.create_presentation(name=None, theme="serif", show_notes=True)
24+
self.create_presentation(name=None, theme="serif")
2525
""" Creates a Reveal-JS presentation that you can add slides to.
2626
@Params
2727
name - If creating multiple presentations at the same time,
@@ -30,8 +30,6 @@ self.create_presentation(name=None, theme="serif", show_notes=True)
3030
Valid themes: "serif" (default), "sky", "white", "black",
3131
"simple", "league", "moon", "night",
3232
"beige", "blood", and "solarized".
33-
show_notes - When set to True, the Notes feature becomes enabled,
34-
which allows presenters to see notes next to slides.
3533
"""
3634
```
3735

@@ -64,13 +62,16 @@ self.add_slide(content=None, image=None, code=None, iframe=None,
6462
### Running a presentation:
6563

6664
```python
67-
self.begin_presentation(filename="my_presentation.html", interval=0)
65+
self.begin_presentation(
66+
filename="my_presentation.html", show_notes=True, interval=0)
6867
""" Begin a Reveal-JS Presentation in the web browser.
6968
@Params
7069
name - If creating multiple presentations at the same time,
7170
use this to select the one you wish to add slides to.
7271
filename - The name of the HTML file that you wish to
7372
save the presentation to. (filename must end in ".html")
73+
show_notes - When set to True, the Notes feature becomes enabled,
74+
which allows presenters to see notes next to slides.
7475
interval - The delay time between autoplaying slides. (in seconds)
7576
If set to 0 (default), autoplay is disabled.
7677
"""
@@ -161,7 +162,7 @@ class MyPresenterClass(BaseCase):
161162
'from seleniumbase import BaseCase\n\n'
162163
'class MyPresenterClass(BaseCase):\n\n'
163164
' def test_presenter(self):\n'
164-
' self.create_presentation()\n'
165+
' self.create_presentation(theme="serif")\n'
165166
' self.add_slide("Welcome to Presenter!")\n'
166167
' self.add_slide(\n'
167168
' "Add code to slides:",\n'
@@ -170,7 +171,8 @@ class MyPresenterClass(BaseCase):
170171
' "class MyPresenterClass(BaseCase):\\n\\n"\n'
171172
' " def test_presenter(self):\\n"\n'
172173
' " self.create_presentation()\\n"))\n'
173-
' self.begin_presentation(filename="demo.html")'))
174+
' self.begin_presentation(\n'
175+
' filename="demo.html", show_notes=True)'))
174176
self.add_slide(
175177
'<h3>Include <b>notes</b> with slides:</h3><br />',
176178
code=('self.add_slide("[Your HTML goes here]",\n'
@@ -195,7 +197,8 @@ class MyPresenterClass(BaseCase):
195197
self.add_slide(
196198
'<h2><b>The End</b></h2>',
197199
image="https://seleniumbase.io/img/sb_logo_10.png")
198-
self.begin_presentation(filename="presenter.html", interval=0)
200+
self.begin_presentation(
201+
filename="presenter.html", show_notes=True, interval=0)
199202
```
200203

201204
#### This example is from [my_presentation.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/presenter/my_presentation.py), which you can run from the ``examples/presenter`` folder with the following command:
@@ -209,10 +212,10 @@ pytest my_presentation.py
209212
If you want to save the presentation you created as an HTML file, use:
210213

211214
```python
212-
self.save_presentation(filename="my_presentation.html")
215+
self.save_presentation(filename="my_presentation.html", show_notes=True)
213216
```
214217

215218
Presentations automatically get saved when calling:
216219
```python
217-
self.begin_presentation()
220+
self.begin_presentation(show_notes=True)
218221
```

examples/presenter/my_presentation.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def test_presenter(self):
7575
'from seleniumbase import BaseCase\n\n'
7676
'class MyPresenterClass(BaseCase):\n\n'
7777
' def test_presenter(self):\n'
78-
' self.create_presentation()\n'
78+
' self.create_presentation(theme="serif")\n'
7979
' self.add_slide("Welcome to Presenter!")\n'
8080
' self.add_slide(\n'
8181
' "Add code to slides:",\n'
@@ -84,7 +84,8 @@ def test_presenter(self):
8484
' "class MyPresenterClass(BaseCase):\\n\\n"\n'
8585
' " def test_presenter(self):\\n"\n'
8686
' " self.create_presentation()\\n"))\n'
87-
' self.begin_presentation(filename="demo.html")'))
87+
' self.begin_presentation(\n'
88+
' filename="demo.html", show_notes=True)'))
8889
self.add_slide(
8990
'<h3>Include <b>notes</b> with slides:</h3><br />',
9091
code=('self.add_slide("[Your HTML goes here]",\n'
@@ -109,4 +110,5 @@ def test_presenter(self):
109110
self.add_slide(
110111
'<h2><b>The End</b></h2>',
111112
image="https://seleniumbase.io/img/sb_logo_10.png")
112-
self.begin_presentation(filename="presenter.html", interval=0)
113+
self.begin_presentation(
114+
filename="presenter.html", show_notes=True, interval=0)

help_docs/method_summary.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -356,14 +356,14 @@ self.add_meta_tag(http_equiv=None, content=None)
356356

357357
############
358358

359-
self.create_presentation(name=None, theme="default", show_notes=True)
359+
self.create_presentation(name=None, theme="default")
360360

361361
self.add_slide(content=None, image=None, code=None, iframe=None,
362362
content2=None, notes=None, name=None)
363363

364-
self.save_presentation(name=None, filename=None, interval=0)
364+
self.save_presentation(name=None, filename=None, show_notes=True, interval=0)
365365

366-
self.begin_presentation(name=None, filename=None, interval=0)
366+
self.begin_presentation(name=None, filename=None, show_notes=True, interval=0)
367367

368368
############
369369

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ coverage==5.1
4242
pyotp==2.3.0
4343
boto==2.49.0
4444
cffi==1.14.0
45-
rich==3.0.0;python_version>="3.6" and python_version<"4.0"
45+
rich==3.0.2;python_version>="3.6" and python_version<"4.0"
4646
flake8==3.7.9;python_version<"3.5"
4747
flake8==3.8.3;python_version>="3.5"
4848
pyflakes==2.1.1;python_version<"3.5"

seleniumbase/common/obfuscate.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def main():
3030
print("\nInside a test, use the following to decrypt it:\n")
3131
time.sleep(0.2)
3232
print(" from seleniumbase import encryption")
33-
print(" encryption.decrypt('%s')" % encrypted_password)
33+
print(' encryption.decrypt("%s")' % encrypted_password)
3434
time.sleep(0.2)
3535
except KeyboardInterrupt:
3636
print("\nExiting...\n")

seleniumbase/console_scripts/sb_mkdir.py

+14-4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def invalid_run_command(msg=None):
4343

4444
def main():
4545
colorama.init(autoreset=True)
46+
c1 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
4647
c5 = colorama.Fore.RED + colorama.Back.LIGHTYELLOW_EX
4748
cr = colorama.Style.RESET_ALL
4849
error_msg = None
@@ -58,14 +59,21 @@ def main():
5859
'Directory name must not include slashes ("/", "\\")!')
5960
elif os.path.exists(os.getcwd() + '/' + dir_name):
6061
error_msg = (
61-
'Directory "%s" already exists in the current path!\n'
62-
'' % dir_name)
62+
'Directory "%s" already exists in the current path!' % dir_name)
6363
if error_msg:
6464
error_msg = c5 + error_msg + cr
6565
invalid_run_command(error_msg)
6666

6767
os.mkdir(dir_name)
6868

69+
data = []
70+
data.append("seleniumbase")
71+
data.append("")
72+
file_path = "%s/%s" % (dir_name, "requirements.txt")
73+
file = codecs.open(file_path, "w+", "utf-8")
74+
file.writelines("\r\n".join(data))
75+
file.close()
76+
6977
data = []
7078
data.append("[pytest]")
7179
data.append("addopts = --capture=no --ignore conftest.py "
@@ -348,8 +356,10 @@ def main():
348356
file = codecs.open(file_path, "w+", "utf-8")
349357
file.writelines("\r\n".join(data))
350358
file.close()
351-
print('''\n* Directory "%s" was created with config files '''
352-
'''and sample tests! *\n''' % dir_name)
359+
success = (
360+
'\n' + c1 + '* Directory "' + dir_name + '" was created '
361+
'with config files and sample tests! *' + cr + '\n')
362+
print(success)
353363

354364

355365
if __name__ == "__main__":

seleniumbase/fixtures/base_case.py

+18-8
Original file line numberDiff line numberDiff line change
@@ -3151,7 +3151,7 @@ def add_meta_tag(self, http_equiv=None, content=None):
31513151

31523152
############
31533153

3154-
def create_presentation(self, name=None, theme="default", show_notes=True):
3154+
def create_presentation(self, name=None, theme="default"):
31553155
""" Creates a Reveal-JS presentation that you can add slides to.
31563156
@Params
31573157
name - If creating multiple presentations at the same time,
@@ -3160,8 +3160,6 @@ def create_presentation(self, name=None, theme="default", show_notes=True):
31603160
Valid themes: "serif" (default), "sky", "white", "black",
31613161
"simple", "league", "moon", "night",
31623162
"beige", "blood", and "solarized".
3163-
show_notes - When set to True, the Notes feature becomes enabled,
3164-
which allows presenters to see notes next to slides.
31653163
"""
31663164
if not name:
31673165
name = "default"
@@ -3242,7 +3240,7 @@ def add_slide(self, content=None, image=None, code=None, iframe=None,
32423240
name = "default"
32433241
if name not in self._presentation_slides:
32443242
# Create a presentation if it doesn't already exist
3245-
self.create_presentation(name=name, show_notes=True)
3243+
self.create_presentation(name=name)
32463244
if not content:
32473245
content = ""
32483246
if not content2:
@@ -3273,13 +3271,16 @@ def add_slide(self, content=None, image=None, code=None, iframe=None,
32733271

32743272
self._presentation_slides[name].append(html)
32753273

3276-
def save_presentation(self, name=None, filename=None, interval=0):
3274+
def save_presentation(
3275+
self, name=None, filename=None, show_notes=True, interval=0):
32773276
""" Saves a Reveal-JS Presentation to a file for later use.
32783277
@Params
32793278
name - If creating multiple presentations at the same time,
32803279
use this to select the one you wish to add slides to.
32813280
filename - The name of the HTML file that you wish to
32823281
save the presentation to. (filename must end in ".html")
3282+
show_notes - When set to True, the Notes feature becomes enabled,
3283+
which allows presenters to see notes next to slides.
32833284
interval - The delay time between autoplaying slides. (in seconds)
32843285
If set to 0 (default), autoplay is disabled.
32853286
"""
@@ -3300,6 +3301,10 @@ def save_presentation(self, name=None, filename=None, interval=0):
33003301
raise Exception('The "interval" cannot be a negative number!')
33013302
interval_ms = float(interval) * 1000.0
33023303

3304+
show_notes_str = "false"
3305+
if show_notes:
3306+
show_notes_str = "true"
3307+
33033308
the_html = ""
33043309
for slide in self._presentation_slides[name]:
33053310
the_html += slide
@@ -3310,13 +3315,14 @@ def save_presentation(self, name=None, filename=None, interval=0):
33103315
'<script src="%s"></script>\n'
33113316
'<script src="%s"></script>\n'
33123317
'<script>Reveal.initialize('
3313-
'{showNotes: true, slideNumber: true, '
3318+
'{showNotes: %s, slideNumber: true, '
33143319
'autoSlide: %s,});'
33153320
'</script>\n'
33163321
'</body>\n'
33173322
'</html>\n'
33183323
'' % (constants.Reveal.MIN_JS,
33193324
constants.PrettifyJS.RUN_PRETTIFY_JS,
3325+
show_notes_str,
33203326
interval_ms))
33213327

33223328
saved_presentations_folder = constants.Presentations.SAVED_FOLDER
@@ -3334,13 +3340,16 @@ def save_presentation(self, name=None, filename=None, interval=0):
33343340
print('\n>>> [%s] was saved!\n' % file_path)
33353341
return file_path
33363342

3337-
def begin_presentation(self, name=None, filename=None, interval=0):
3343+
def begin_presentation(
3344+
self, name=None, filename=None, show_notes=True, interval=0):
33383345
""" Begin a Reveal-JS Presentation in the web browser.
33393346
@Params
33403347
name - If creating multiple presentations at the same time,
33413348
use this to select the one you wish to add slides to.
33423349
filename - The name of the HTML file that you wish to
33433350
save the presentation to. (filename must end in ".html")
3351+
show_notes - When set to True, the Notes feature becomes enabled,
3352+
which allows presenters to see notes next to slides.
33443353
interval - The delay time between autoplaying slides. (in seconds)
33453354
If set to 0 (default), autoplay is disabled.
33463355
"""
@@ -3366,7 +3375,8 @@ def begin_presentation(self, name=None, filename=None, interval=0):
33663375
'<p class="End_Presentation_Now"> </p>\n</section>\n')
33673376
self._presentation_slides[name].append(end_slide)
33683377
file_path = self.save_presentation(
3369-
name=name, filename=filename, interval=interval)
3378+
name=name, filename=filename,
3379+
show_notes=show_notes, interval=interval)
33703380
self._presentation_slides[name].pop()
33713381

33723382
self.open_html_file(file_path)

seleniumbase/translate/chinese.py

+19
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,25 @@ def 按值选择选项(self, *args, **kwargs):
301301
# select_option_by_value(dropdown_selector, option)
302302
return self.select_option_by_value(*args, **kwargs)
303303

304+
def 创建演示文稿(self, *args, **kwargs):
305+
# create_presentation(name=None, theme="default")
306+
return self.create_presentation(*args, **kwargs)
307+
308+
def 添加幻灯片(self, *args, **kwargs):
309+
# add_slide(content=None, image=None, code=None, iframe=None,
310+
# content2=None, notes=None, name=None)
311+
return self.add_slide(*args, **kwargs)
312+
313+
def 保存演示文稿(self, *args, **kwargs):
314+
# save_presentation(name=None, filename=None,
315+
# show_notes=True, interval=0)
316+
return self.save_presentation(*args, **kwargs)
317+
318+
def 开始演示文稿(self, *args, **kwargs):
319+
# begin_presentation(name=None, filename=None,
320+
# show_notes=True, interval=0)
321+
return self.begin_presentation(*args, **kwargs)
322+
304323
def 创建游览(self, *args, **kwargs):
305324
# create_tour(name=None, theme=None)
306325
return self.create_tour(*args, **kwargs)

seleniumbase/translate/dutch.py

+19
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,25 @@ def optie_selecteren_op_waarde(self, *args, **kwargs):
301301
# select_option_by_value(dropdown_selector, option)
302302
return self.select_option_by_value(*args, **kwargs)
303303

304+
def een_presentatie_maken(self, *args, **kwargs):
305+
# create_presentation(name=None, theme="default")
306+
return self.create_presentation(*args, **kwargs)
307+
308+
def een_dia_toevoegen(self, *args, **kwargs):
309+
# add_slide(content=None, image=None, code=None, iframe=None,
310+
# content2=None, notes=None, name=None)
311+
return self.add_slide(*args, **kwargs)
312+
313+
def de_presentatie_opslaan(self, *args, **kwargs):
314+
# save_presentation(name=None, filename=None,
315+
# show_notes=True, interval=0)
316+
return self.save_presentation(*args, **kwargs)
317+
318+
def de_presentatie_starten(self, *args, **kwargs):
319+
# begin_presentation(name=None, filename=None,
320+
# show_notes=True, interval=0)
321+
return self.begin_presentation(*args, **kwargs)
322+
304323
def maak_een_tour(self, *args, **kwargs):
305324
# create_tour(name=None, theme=None)
306325
return self.create_tour(*args, **kwargs)

seleniumbase/translate/french.py

+19
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,25 @@ def sélectionner_option_par_valeur(self, *args, **kwargs):
301301
# select_option_by_value(dropdown_selector, option)
302302
return self.select_option_by_value(*args, **kwargs)
303303

304+
def créer_une_présentation(self, *args, **kwargs):
305+
# create_presentation(name=None, theme="default")
306+
return self.create_presentation(*args, **kwargs)
307+
308+
def ajouter_une_diapositive(self, *args, **kwargs):
309+
# add_slide(content=None, image=None, code=None, iframe=None,
310+
# content2=None, notes=None, name=None)
311+
return self.add_slide(*args, **kwargs)
312+
313+
def enregistrer_la_présentation(self, *args, **kwargs):
314+
# save_presentation(name=None, filename=None,
315+
# show_notes=True, interval=0)
316+
return self.save_presentation(*args, **kwargs)
317+
318+
def démarrer_la_présentation(self, *args, **kwargs):
319+
# begin_presentation(name=None, filename=None,
320+
# show_notes=True, interval=0)
321+
return self.begin_presentation(*args, **kwargs)
322+
304323
def créer_une_visite(self, *args, **kwargs):
305324
# create_tour(name=None, theme=None)
306325
return self.create_tour(*args, **kwargs)

seleniumbase/translate/italian.py

+19
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,25 @@ def selezionare_opzione_per_valore(self, *args, **kwargs):
301301
# select_option_by_value(dropdown_selector, option)
302302
return self.select_option_by_value(*args, **kwargs)
303303

304+
def creare_una_presentazione(self, *args, **kwargs):
305+
# create_presentation(name=None, theme="default")
306+
return self.create_presentation(*args, **kwargs)
307+
308+
def aggiungere_una_diapositiva(self, *args, **kwargs):
309+
# add_slide(content=None, image=None, code=None, iframe=None,
310+
# content2=None, notes=None, name=None)
311+
return self.add_slide(*args, **kwargs)
312+
313+
def salvare_la_presentazione(self, *args, **kwargs):
314+
# save_presentation(name=None, filename=None,
315+
# show_notes=True, interval=0)
316+
return self.save_presentation(*args, **kwargs)
317+
318+
def avviare_la_presentazione(self, *args, **kwargs):
319+
# begin_presentation(name=None, filename=None,
320+
# show_notes=True, interval=0)
321+
return self.begin_presentation(*args, **kwargs)
322+
304323
def creare_un_tour(self, *args, **kwargs):
305324
# create_tour(name=None, theme=None)
306325
return self.create_tour(*args, **kwargs)

0 commit comments

Comments
 (0)