hugo_themes_report/test/test_title.py

30 lines
1.2 KiB
Python
Raw Normal View History

2021-08-20 11:40:12 -07:00
from test.test_selenium import TestSelenium
2021-08-21 09:56:14 -07:00
from unittest import TestCase
2021-08-20 11:40:12 -07:00
2021-08-21 09:56:14 -07:00
class TestTitle(TestSelenium, TestCase):
2021-08-20 11:40:12 -07:00
def setUp(self):
super(TestTitle, self).setUp()
self.x = self.driver.find_elements_by_tag_name('h1')
def test_title(self):
self.assertEqual(len(self.x), 1)
self.assertEqual(self.x[0].get_attribute('id'), 'title')
2021-08-21 15:18:09 -07:00
self.assertEqual(
self.x[0].value_of_css_property('text-align'), 'center')
2021-08-20 11:40:12 -07:00
self.assertEqual(self.x[0].value_of_css_property('display'), 'block')
self.assertEqual(self.x[0].value_of_css_property('max-width'), '736px')
self.assertEqual(self.x[0].value_of_css_property('font-size'), '32px')
self.assertEqual(self.x[0].value_of_css_property('font-weight'), '700')
2021-08-21 15:18:09 -07:00
self.assertEqual(
self.x[0].value_of_css_property('font-family'), 'sans-serif')
2021-08-20 11:40:12 -07:00
def test_title_anchor(self):
x_anchors = self.x[0].find_elements_by_tag_name('a')
self.assertEqual(len(x_anchors), 1)
2021-08-21 09:56:14 -07:00
self.assertEqual(
x_anchors[0].get_attribute('href'),
'https://github.com/TrentSPalmer/hugo_themes_report'
)
2021-08-20 11:40:12 -07:00
self.assertEqual(x_anchors[0].get_attribute('target'), '_blank')