Skip to content

Commit 71c2f25

Browse files
committed
Added test for 404 error page.
Testing 3 different un-existing routes.
1 parent c77b5f5 commit 71c2f25

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

tests/common/404_page/__init__.py

Whitespace-only changes.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from codebender_testing.utils import SeleniumTestCase
2+
from selenium.webdriver.common.by import By
3+
4+
# Global variables
5+
ERROR_MESSAGE = 'Oops! Something seems to be broken :/'
6+
ROUTES_404 = [
7+
'/hello',
8+
'/foo',
9+
'/bar'
10+
]
11+
12+
class Test404Page(SeleniumTestCase):
13+
def test_404_page(self, testing_url):
14+
"""
15+
Test for 404 error page.
16+
Visits URLs registered at ROUTES_404 and verifies that the 404 error page opens
17+
"""
18+
19+
for url in ROUTES_404:
20+
self.open(url)
21+
logo = self.get_element(By.CSS_SELECTOR, '.brand')
22+
assert logo.get_attribute('href')[:-1] == self.site_url # check href attribute of .brand
23+
24+
error_message = self.get_element(By.CSS_SELECTOR, '.container-fluid .span12 .span12 h1')
25+
assert error_message.text.strip() == ERROR_MESSAGE # check text value of error message h1

0 commit comments

Comments
 (0)