Skip to content

Commit 013e262

Browse files
committed
Update the example test
1 parent 805682c commit 013e262

File tree

3 files changed

+19
-21
lines changed

3 files changed

+19
-21
lines changed

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")

0 commit comments

Comments
 (0)