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