Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame^] | 1 | #! /usr/bin/env python3 |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 2 | # |
| 3 | # BitBake Toaster Implementation |
| 4 | # |
| 5 | # Copyright (C) 2013-2016 Intel Corporation |
| 6 | # |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 7 | # SPDX-License-Identifier: GPL-2.0-only |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 8 | # |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 9 | |
| 10 | """ |
| 11 | A small example test demonstrating the basics of writing a test with |
| 12 | Toaster's SeleniumTestCase; this just fetches the Toaster home page |
| 13 | and checks it has the word "Toaster" in the brand link |
| 14 | |
| 15 | New test files should follow this structure, should be named "test_*.py", |
| 16 | and should be in the same directory as this sample. |
| 17 | """ |
| 18 | |
| 19 | from django.core.urlresolvers import reverse |
| 20 | from tests.browser.selenium_helpers import SeleniumTestCase |
| 21 | |
| 22 | class TestSample(SeleniumTestCase): |
| 23 | """ Test landing page shows the Toaster brand """ |
| 24 | |
| 25 | def test_landing_page_has_brand(self): |
| 26 | url = reverse('landing') |
| 27 | self.get(url) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 28 | brand_link = self.find('.toaster-navbar-brand a.brand') |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 29 | self.assertEqual(brand_link.text.strip(), 'Toaster') |