Skip to content

Commit 1a33d49

Browse files
committed
Update the docs
1 parent 38aab95 commit 1a33d49

File tree

7 files changed

+92
-62
lines changed

7 files changed

+92
-62
lines changed

docs/prepare.py

Lines changed: 76 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,31 @@ def process_file(file_name):
7171

7272
def main(*args, **kwargs):
7373
files_to_process = ["README.md"]
74-
for dir_ in os.listdir(ROOT_DIR / "help_docs"):
75-
files_to_process.append(os.path.join("help_docs", dir_))
74+
scanned_dir_list = []
75+
scanned_dir_list.append("help_docs")
76+
scanned_dir_list.append("examples/example_logs")
77+
scanned_dir_list.append("examples/visual_testing")
78+
scanned_dir_list.append("integrations/google_cloud")
79+
for scanned_dir in scanned_dir_list:
80+
for dir_ in os.listdir(ROOT_DIR / scanned_dir):
81+
files_to_process.append(os.path.join(scanned_dir, dir_))
82+
83+
video_embed = (
84+
'<figure class="wp-block-embed wp-block-embed-youtube is-type-video '
85+
'is-provider-youtube"><div class="wp-block-embed__wrapper">'
86+
'<div class="epyt-video-wrapper fluid-width-video-wrapper" '
87+
'style="padding-top: 3px !important;"><iframe loading="lazy" '
88+
'id="_ytid_36718" data-origwidth="1200" data-origheight="675" '
89+
'src="https://www.youtube.com/embed/yt_code?enablejsapi=1&amp;'
90+
'origin=https://seleniumbase.io&amp;autoplay=0&amp;cc_load_policy=0'
91+
'&amp;cc_lang_pref=&amp;iv_load_policy=1&amp;loop=0&amp;'
92+
'modestbranding=1&amp;rel=0&amp;fs=1&amp;playsinline=0&amp;'
93+
'autohide=2&amp;theme=dark&amp;color=red&amp;controls=1&amp;" '
94+
'class="__youtube_prefs__ no-lazyload" title="YouTube player" '
95+
'allow="autoplay; encrypted-media" allowfullscreen="" '
96+
'data-no-lazy="1" data-skipgform_ajax_framebjll="">'
97+
'</iframe></div></div></figure>'
98+
)
7699

77100
updated_files_to_process = []
78101
for file_ in files_to_process:
@@ -82,44 +105,54 @@ def main(*args, **kwargs):
82105
for file_ in updated_files_to_process:
83106
process_file(file_)
84107

85-
readme_file = "./docs/README.md"
86-
with open(readme_file, "r", encoding="utf-8") as f:
87-
all_code = f.read()
88-
code_lines = all_code.split("\n")
89-
90-
changed = False
91-
seleniumbase_lines = []
92-
for line in code_lines:
93-
if ' href="' in line and '.md"' in line:
94-
changed = True
95-
line = line.replace('.md"', '/"')
96-
if "<!-- View on GitHub -->" in line:
97-
changed = True
98-
line = (
99-
r'<p align="center"><div align="center">'
100-
r'<a href="https://github.com/seleniumbase/SeleniumBase">'
101-
r'<img src="https://img.shields.io/badge/'
102-
r"✅%20💛%20View%20Code-on%20GitHub%20🌎%20🚀"
103-
r'-02A79E.svg" alt="SeleniumBase on GitHub" />'
104-
r"</a></div></p>"
105-
)
106-
if "<!-- SeleniumBase Header1 -->" in line:
107-
changed = True
108-
line = (
109-
'<section align="center"><div align="center">'
110-
"<h2>✅ Reliable Browser Testing</h2>"
111-
"</div></section>"
112-
)
113-
if "<!-- SeleniumBase Docs -->" in line:
114-
changed = True
115-
line = (
116-
'<h2><img src="https://seleniumbase.io/img/sb_icon.png" '
117-
'title="SeleniumBase" width="20" /> SeleniumBase Docs '
118-
'<img src="https://seleniumbase.io/img/sb_icon.png" '
119-
'title="SeleniumBase" width="20" /></h2>'
120-
)
121-
seleniumbase_lines.append(line)
122-
if changed:
123-
out_file = codecs.open(readme_file, "w+", encoding="utf-8")
124-
out_file.writelines("\r\n".join(seleniumbase_lines))
125-
out_file.close()
108+
for file_ in updated_files_to_process:
109+
readme_file = "./docs/" + file_
110+
with open(readme_file, "r", encoding="utf-8") as f:
111+
all_code = f.read()
112+
code_lines = all_code.split("\n")
113+
114+
changed = False
115+
seleniumbase_lines = []
116+
for line in code_lines:
117+
if ' href="' in line and '.md"' in line:
118+
changed = True
119+
line = line.replace('.md"', '/"')
120+
if "<!-- View on GitHub -->" in line:
121+
changed = True
122+
line = (
123+
r'<p align="center"><div align="center">'
124+
r'<a href="https://github.com/seleniumbase/SeleniumBase">'
125+
r'<img src="https://img.shields.io/badge/'
126+
r"✅%20💛%20View%20Code-on%20GitHub%20🌎%20🚀"
127+
r'-02A79E.svg" alt="SeleniumBase on GitHub" />'
128+
r"</a></div></p>"
129+
)
130+
if "<!-- GitHub Only -->" in line:
131+
changed = True
132+
continue
133+
if '<!-- YouTube View -->' in line and "watch?v=" in line:
134+
start_pt = line.find("watch?v=") + len("watch?v=")
135+
end_pt = line.find('"', start_pt + 1)
136+
yt_code = line[start_pt:end_pt]
137+
changed = True
138+
line = video_embed.replace("yt_code", yt_code)
139+
if "<!-- SeleniumBase Header1 -->" in line:
140+
changed = True
141+
line = (
142+
'<section align="center"><div align="center">'
143+
"<h2>✅ Reliable Browser Testing</h2>"
144+
"</div></section>"
145+
)
146+
if "<!-- SeleniumBase Docs -->" in line:
147+
changed = True
148+
line = (
149+
'<h2><img src="https://seleniumbase.io/img/sb_icon.png" '
150+
'title="SeleniumBase" width="20" /> SeleniumBase Docs '
151+
'<img src="https://seleniumbase.io/img/sb_icon.png" '
152+
'title="SeleniumBase" width="20" /></h2>'
153+
)
154+
seleniumbase_lines.append(line)
155+
if changed:
156+
out_file = codecs.open(readme_file, "w+", encoding="utf-8")
157+
out_file.writelines("\r\n".join(seleniumbase_lines))
158+
out_file.close()

examples/example_logs/ReadMe.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Logs, The Dashboard, & Reports:</h3>
1+
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Logs, The Dashboard, and Reports:</h3>
22

3-
[<img src="http://img.youtube.com/vi/XpuJCjJhJwQ/0.jpg" title="SeleniumBase Features" width="285">](https://www.youtube.com/watch?v=XpuJCjJhJwQ)
4-
<p>(<b><a href="https://www.youtube.com/watch?v=XpuJCjJhJwQ">The Dashboard Tutorial on YouTube</a></b>)</p>
3+
<!-- YouTube View --><a href="https://www.youtube.com/watch?v=XpuJCjJhJwQ"><img src="http://img.youtube.com/vi/XpuJCjJhJwQ/0.jpg" title="SeleniumBase on YouTube" width="285" /></a>
4+
<!-- GitHub Only --><p>(<b><a href="https://www.youtube.com/watch?v=XpuJCjJhJwQ">The Dashboard Tutorial on YouTube</a></b>)</p>
55

66
🔵 During test failures, logs and screenshots from the most recent test run will get saved to the ``latest_logs/`` folder. If ``--archive-logs`` is specified (or if ARCHIVE_EXISTING_LOGS is set to True in [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py)), test logs will also get archived to the ``archived_logs/`` folder. Otherwise, the log files will be cleaned out when the next test run begins (by default).
77

examples/visual_testing/ReadMe.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44

55
Automated Visual Regression Testing can help you detect when the layout of a web page has changed. Instead of comparing pixels from screenshots, layout differences can be detected by comparing HTML tags and attributes with a baseline. If a change is detected, it could mean that something broke, the web page was redesigned, or dynamic content changed.
66

7-
<p>(<b><a href="https://www.youtube.com/watch?v=erwkoiDeNzA">Watch the tutorial on YouTube ↘️</a></b>)</p>
8-
9-
[<img src="https://img.youtube.com/vi/erwkoiDeNzA/0.jpg" title="Automated Visual Regression Testing" width="376">](https://www.youtube.com/watch?v=erwkoiDeNzA)
7+
<!-- YouTube View --><a href="https://www.youtube.com/watch?v=erwkoiDeNzA"><img src="http://img.youtube.com/vi/erwkoiDeNzA/0.jpg" title="SeleniumBase on YouTube" width="285" /></a>
8+
<!-- GitHub Only --><p>(<b><a href="https://www.youtube.com/watch?v=erwkoiDeNzA">Watch the tutorial on YouTube</a></b>)</p>
109

1110
To handle automated visual testing, SeleniumBase uses the ``self.check_window()`` method, which can set visual baselines for comparison and then compare the latest versions of web pages to the existing baseline.
1211

help_docs/features_list.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[<img src="https://seleniumbase.io/cdn/img/super_logo_sb.png" title="SeleniumBase" width="285">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
22

3-
[<img src="http://img.youtube.com/vi/Sjzq9kU5kOw/0.jpg" title="SeleniumBase Features" width="285">](https://www.youtube.com/watch?v=Sjzq9kU5kOw)
4-
<p>(<b><a href="https://www.youtube.com/watch?v=Sjzq9kU5kOw">Watch the tutorial on YouTube</a></b>)</p>
3+
<!-- YouTube View --><a href="https://www.youtube.com/watch?v=Sjzq9kU5kOw"><img src="http://img.youtube.com/vi/Sjzq9kU5kOw/0.jpg" title="SeleniumBase on YouTube" width="285" /></a>
4+
<!-- GitHub Only --><p>(<b><a href="https://www.youtube.com/watch?v=Sjzq9kU5kOw">Watch the tutorial on YouTube</a></b>)</p>
55

66
<a id="feature_list"></a>
77
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> ⛲ Features: 🗂️</h2>
@@ -42,5 +42,5 @@
4242

4343
--------
4444

45-
[<img src="http://img.youtube.com/vi/yEQeAU_mrg0/0.jpg" title="SeleniumBase Features" width="285">](https://www.youtube.com/watch?v=yEQeAU_mrg0)
46-
<p>(<b><a href="https://www.youtube.com/watch?v=yEQeAU_mrg0">Video of SeleniumBase features</a></b>)</p>
45+
<!-- YouTube View --><a href="https://www.youtube.com/watch?v=yEQeAU_mrg0"><img src="http://img.youtube.com/vi/yEQeAU_mrg0/0.jpg" title="SeleniumBase on YouTube" width="285" /></a>
46+
<!-- GitHub Only --><p>(<b><a href="https://www.youtube.com/watch?v=yEQeAU_mrg0">Have fun with test automation!</a></b>)</p>

help_docs/method_summary.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[<img src="https://seleniumbase.io/cdn/img/sb_text_f.png" title="SeleniumBase" align="center" width="360">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
22

3-
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Method Summary (API Reference)</h2>
3+
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Methods (API Reference)</h2>
44

5-
[<img src="https://seleniumbase.io/cdn/img/sb_api_youtube.png" title="SeleniumBase Features" width="285">](https://www.youtube.com/watch?v=_yNJlHnp2JA)
6-
<p>(<b><a href="https://www.youtube.com/watch?v=_yNJlHnp2JA">Common API Methods on YouTube</a></b>)</p>
5+
<!-- YouTube View --><a href="https://www.youtube.com/watch?v=_yNJlHnp2JA"><img src="https://seleniumbase.io/cdn/img/sb_api_youtube.png" title="SeleniumBase on YouTube" width="285" /></a>
6+
<!-- GitHub Only --><p>(<b><a href="https://www.youtube.com/watch?v=_yNJlHnp2JA">Common API Methods on YouTube</a></b>)</p>
77

88
Here's a list of SeleniumBase method definitions, which are defined in [base_case.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/fixtures/base_case.py)
99

help_docs/syntax_formats.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
<a id="syntax_formats"></a>
44
<h2><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> The 17 syntax formats</h2>
55

6-
<p>(<b><a href="https://youtu.be/VvwtS9_1m0s">Watch this tutorial on YouTube</a></b>)</p>
7-
8-
[<img src="http://img.youtube.com/vi/VvwtS9_1m0s/mq1.jpg" title="17 SeleniumBase syntax formats" width="270">](https://youtu.be/VvwtS9_1m0s)
6+
<!-- YouTube View --><a href="https://www.youtube.com/watch?v=VvwtS9_1m0s"><img src="http://img.youtube.com/vi/VvwtS9_1m0s/mq1.jpg" title="SeleniumBase on YouTube" width="285" /></a>
7+
<!-- GitHub Only --><p>(<b><a href="https://www.youtube.com/watch?v=VvwtS9_1m0s">Watch this tutorial on YouTube</a></b>)</p>
98

109
--------
1110

integrations/google_cloud/ReadMe.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
(This tutorial, [from a previous Google Cloud Meetup](https://www.meetup.com/Boston-Google-Cloud-Meetup/events/230839686/?showDescription=true), will teach you how to setup a Linux server for running automated browser tests. The cost of running this server is about [$13.61/month on Google Cloud](https://console.cloud.google.com/launcher/details/bitnami-launchpad/jenkins) (enough to handle **5 parallel tests**). This is less expensive than using other platforms such as [BrowserStack](https://www.browserstack.com/pricing) or [Sauce Labs](https://saucelabs.com/pricing).)
44

5-
([Here's a quick video recap on YouTube:](https://www.youtube.com/watch?v=n-sno20R9P0))
6-
7-
[<img src="https://seleniumbase.io/other/gcp_video_thumb.png" title="SeleniumBase on Google Cloud Platform" width="304">](https://www.youtube.com/watch?v=n-sno20R9P0)
5+
<!-- YouTube View --><a href="https://www.youtube.com/watch?v=n-sno20R9P0"><img src="https://seleniumbase.io/other/gcp_video_thumb.png" title="SeleniumBase on YouTube" width="285" /></a>
6+
<!-- GitHub Only --><p>(<b><a href="https://www.youtube.com/watch?v=n-sno20R9P0">SeleniumBase Google Cloud Video</a></b>)</p>
87

98
#### Step 1. Open the Google Cloud Platform Cloud Launcher
109

0 commit comments

Comments
 (0)