Files
poky/bitbake/lib/toaster/tests/browser/test_sample.py
Alassane Yattara 8efe835e3b bitbake: toaster/test: from test_no_builds_message.py wait for the empty state div to appear
>From tests/browser/test_sample.py wait for the empty state div to appear

(Bitbake rev: 56ea671526d6ec81b0d69f1bab6ac8f6796b8018)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-06 22:28:03 +00:00

40 lines
1.3 KiB
Python

#! /usr/bin/env python3
#
# BitBake Toaster Implementation
#
# Copyright (C) 2013-2016 Intel Corporation
#
# SPDX-License-Identifier: GPL-2.0-only
#
"""
A small example test demonstrating the basics of writing a test with
Toaster's SeleniumTestCase; this just fetches the Toaster home page
and checks it has the word "Toaster" in the brand link
New test files should follow this structure, should be named "test_*.py",
and should be in the same directory as this sample.
"""
from django.urls import reverse
from tests.browser.selenium_helpers import SeleniumTestCase
class TestSample(SeleniumTestCase):
""" Test landing page shows the Toaster brand """
def test_landing_page_has_brand(self):
url = reverse('landing')
self.get(url)
brand_link = self.find('.toaster-navbar-brand a.brand')
self.assertEqual(brand_link.text.strip(), 'Toaster')
def test_no_builds_message(self):
""" Test that a message is shown when there are no builds """
url = reverse('all-builds')
self.get(url)
self.wait_until_visible('#empty-state-allbuildstable') # wait for the empty state div to appear
div_msg = self.find('#empty-state-allbuildstable .alert-info')
msg = 'Sorry - no data found'
self.assertEqual(div_msg.text, msg)