Skip to content

Commit 751d5de

Browse files
authored
Merge pull request #358 from seleniumbase/example-update
Update example test & console scripts "seleniumbase mkdir"
2 parents 805682c + e5c2ba7 commit 751d5de

File tree

7 files changed

+27
-34
lines changed

7 files changed

+27
-34
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
✅ Everything you need to automate Web/UI testing.
66

7-
<img src="https://cdn2.hubspot.net/hubfs/100006/sb_demo_mode.gif" title="SeleniumBase" height="236"><br />
7+
<img src="https://cdn2.hubspot.net/hubfs/100006/images/new_demo_gif.gif" title="SeleniumBase" height="236"><br />
88
(<i>Above: [my_first_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py) from [examples/](https://github.com/seleniumbase/SeleniumBase/tree/master/examples) running in demo mode, which adds JavaScript for highlighting page actions.</i>)<br />
99
```
1010
pytest my_first_test.py --demo_mode

examples/basic_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class MyTestClass(BaseCase):
1010
def test_basic(self):
1111
self.open("https://xkcd.com/353/")
1212
self.click('a[rel="license"]')
13-
self.open("https://xkcd.com/1481/")
14-
self.click("link=Store")
15-
self.update_text("input#top-search-input", "xkcd book\n")
16-
self.open("https://xkcd.com/1319/")
13+
self.go_back()
14+
self.click("link=About")
15+
self.open("https://store.xkcd.com/collections/everything")
16+
self.update_text("input.search-input", "xkcd book\n")

examples/my_first_test.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,12 @@ def test_basic(self):
88
self.assert_element('img[alt="Python"]')
99
self.click('a[rel="license"]')
1010
self.assert_text("free to copy and reuse")
11-
self.open("https://xkcd.com/1481/")
12-
title = self.get_attribute("#comic img", "title")
13-
self.assert_true("86,400 seconds per day" in title)
14-
self.click("link=Store")
15-
self.assert_element('[alt="The xkcd store"]')
11+
self.go_back()
12+
self.click("link=About")
13+
self.assert_text("xkcd.com", "h2")
14+
self.open("https://store.xkcd.com/collections/everything")
1615
self.update_text("input.search-input", "xkcd book\n")
17-
self.assert_text("xkcd: volume 0", "h3")
18-
self.open("https://xkcd.com/1319/")
19-
self.assert_exact_text("Automation", "#ctitle")
16+
self.assert_exact_text("xkcd: volume 0", "h3")
2017

2118
####
2219

@@ -43,7 +40,7 @@ def test_basic(self):
4340
#
4441
# 2. Most methods have the optional `timeout` argument. Ex:
4542
# [
46-
# self.get_text("#content", timeout=15)
43+
# self.assert_element('img[alt="Python"]', timeout=15)
4744
# ]
4845
# The `timeout` argument tells the method how many seconds to wait
4946
# for an element to appear before raising an exception. This is
@@ -76,6 +73,10 @@ def test_basic(self):
7673
# title = element.get_attribute("title")
7774
# ]
7875
#
76+
# 4. self.assert_exact_text(TEXT) ignores leading and trailing
77+
# whitespace in the TEXT assertion.
78+
# So, self.assert_exact_text("Some Text") will find [" Some Text "].
79+
#
7980
# For backwards-compatibilty, some SeleniumBase methods that do the
8081
# same thing have multiple names, kept on from previous versions.
8182
# Ex: wait_for_element_visible() is the same as find_element().

integrations/node_js/my_first_test.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,9 @@ def test_basic(self):
88
self.assert_element('img[alt="Python"]')
99
self.click('a[rel="license"]')
1010
self.assert_text("free to copy and reuse")
11-
self.open("https://xkcd.com/1481/")
12-
title = self.get_attribute("#comic img", "title")
13-
self.assert_true("86,400 seconds per day" in title)
14-
self.click("link=Store")
15-
self.assert_element('[alt="The xkcd store"]')
11+
self.go_back()
12+
self.click("link=About")
13+
self.assert_text("xkcd.com", "h2")
14+
self.open("https://store.xkcd.com/collections/everything")
1615
self.update_text("input.search-input", "xkcd book\n")
17-
self.assert_text("xkcd: volume 0", "h3")
18-
self.open("https://xkcd.com/1319/")
19-
self.assert_exact_text("Automation", "#ctitle")
16+
self.assert_exact_text("xkcd: volume 0", "h3")

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pip>=19.2.1
1+
pip>=19.2.2
22
setuptools>=41.0.1
33
wheel>=0.33.4
44
six

seleniumbase/console_scripts/sb_mkdir.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,14 @@ def main():
8383
data.append(" self.assert_element('img[alt=\"Python\"]')")
8484
data.append(" self.click('a[rel=\"license\"]')")
8585
data.append(' self.assert_text("free to copy and reuse")')
86-
data.append(' self.open("https://xkcd.com/1481/")')
87-
data.append(
88-
" title = self.get_attribute(\"#comic img\", \"title\")")
89-
data.append(
90-
" self.assert_true(\"86,400 seconds per day\" in title)")
91-
data.append(' self.click("link=Store")')
92-
data.append(
93-
" self.assert_element('[alt=\"The xkcd store\"]')")
86+
data.append(' self.go_back()')
87+
data.append(' self.click("link=About")')
88+
data.append(' self.assert_text("xkcd.com", "h2")')
89+
data.append(' self.open('
90+
'"https://store.xkcd.com/collections/everything")')
9491
data.append(
9592
' self.update_text("input.search-input", "xkcd book\\n")')
9693
data.append(' self.assert_text("xkcd: volume 0", "h3")')
97-
data.append(' self.open("https://xkcd.com/1319/")')
98-
data.append(' self.assert_exact_text("Automation", "#ctitle")')
9994
data.append("")
10095
file_path = "%s/%s" % (dir_name, "my_first_test.py")
10196
file = codecs.open(file_path, "w+", "utf-8")

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
setup(
1919
name='seleniumbase',
20-
version='1.28.2',
20+
version='1.28.3',
2121
description='Fast, Easy, and Reliable Browser Automation & Testing.',
2222
long_description=long_description,
2323
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)