Skip to content

Commit 4189b87

Browse files
committed
Update the example test
1 parent c48a7ad commit 4189b87

File tree

3 files changed

+15
-18
lines changed

3 files changed

+15
-18
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,13 @@ class MyTestClass(BaseCase):
7272
self.open('http://xkcd.com/353/')
7373
self.assert_element('img[alt="Python"]')
7474
self.click('a[rel="license"]')
75-
self.assert_text('copy and reuse', 'div center')
75+
text = self.get_text("div center")
76+
self.assertTrue("reuse any of my drawings" in text)
7677
self.open('http://xkcd.com/1481/')
77-
caption = self.get_attribute('#comic img', 'title')
78-
self.assertTrue('connections to the server' in caption)
78+
title = self.get_attribute('#comic img', 'title')
79+
self.assertTrue('connections to the server' in title)
7980
self.click_link_text('Blag')
80-
self.assert_text('xkcd', '#site-title')
81-
header_text = self.get_text('header h2')
82-
self.assertTrue('The blag of the webcomic' in header_text)
81+
self.assert_text('The blag of the webcomic', 'h2')
8382
self.update_text('input#s', 'Robots!\n')
8483
self.assert_text('Hooray robots!', '#content')
8584
self.open('http://xkcd.com/1319/')

examples/my_first_test.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ def test_basic(self):
77
self.open('http://xkcd.com/353/') # Navigate to the web page
88
self.assert_element('img[alt="Python"]') # Assert element on page
99
self.click('a[rel="license"]') # Click element on page
10-
self.assert_text('copy and reuse', 'div center') # Assert element text
10+
text = self.get_text("div center") # Grab text from page element
11+
self.assertTrue("reuse any of my drawings" in text)
1112
self.open('http://xkcd.com/1481/')
12-
caption = self.get_attribute('#comic img', 'title') # Get attribute
13-
self.assertTrue('connections to the server' in caption)
13+
title = self.get_attribute('#comic img', 'title') # Grab an attribute
14+
self.assertTrue('connections to the server' in title)
1415
self.click_link_text('Blag') # Click on link with the text
15-
self.assert_text('xkcd', '#site-title')
16-
header_text = self.get_text('header h2') # Grab text from page element
17-
self.assertTrue('The blag of the webcomic' in header_text)
16+
self.assert_text('The blag of the webcomic', 'h2') # Assert text in h2
1817
self.update_text('input#s', 'Robots!\n') # Fill in field with the text
1918
self.assert_text('Hooray robots!', '#content')
2019
self.open('http://xkcd.com/1319/')

integrations/node_js/my_first_test.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ def test_basic(self):
77
self.open('http://xkcd.com/353/')
88
self.assert_element('img[alt="Python"]')
99
self.click('a[rel="license"]')
10-
self.assert_text('copy and reuse', 'div center')
10+
text = self.get_text("div center")
11+
self.assertTrue("reuse any of my drawings" in text)
1112
self.open('http://xkcd.com/1481/')
12-
caption = self.get_attribute('#comic img', 'title')
13-
self.assertTrue('connections to the server' in caption)
13+
title = self.get_attribute('#comic img', 'title')
14+
self.assertTrue('connections to the server' in title)
1415
self.click_link_text('Blag')
15-
self.assert_text('xkcd', '#site-title')
16-
header_text = self.get_text('header h2')
17-
self.assertTrue('The blag of the webcomic' in header_text)
16+
self.assert_text('The blag of the webcomic', 'h2')
1817
self.update_text('input#s', 'Robots!\n')
1918
self.assert_text('Hooray robots!', '#content')
2019
self.open('http://xkcd.com/1319/')

0 commit comments

Comments
 (0)