test_sample.py 885 B

1234567891011121314151617181920212223242526272829
  1. #! /usr/bin/env python3
  2. #
  3. # BitBake Toaster Implementation
  4. #
  5. # Copyright (C) 2013-2016 Intel Corporation
  6. #
  7. # SPDX-License-Identifier: GPL-2.0-only
  8. #
  9. """
  10. A small example test demonstrating the basics of writing a test with
  11. Toaster's SeleniumTestCase; this just fetches the Toaster home page
  12. and checks it has the word "Toaster" in the brand link
  13. New test files should follow this structure, should be named "test_*.py",
  14. and should be in the same directory as this sample.
  15. """
  16. from django.urls import reverse
  17. from tests.browser.selenium_helpers import SeleniumTestCase
  18. class TestSample(SeleniumTestCase):
  19. """ Test landing page shows the Toaster brand """
  20. def test_landing_page_has_brand(self):
  21. url = reverse('landing')
  22. self.get(url)
  23. brand_link = self.find('.toaster-navbar-brand a.brand')
  24. self.assertEqual(brand_link.text.strip(), 'Toaster')