summaryrefslogtreecommitdiffstats
path: root/lib/toaster/tests
diff options
context:
space:
mode:
authorElliot Smith <elliot.smith@intel.com>2016-07-12 15:54:58 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-19 08:56:45 +0100
commit3d5090af4475b1d0bb56911a8e30abf9097c1b3c (patch)
tree99ade77d5f7880ebc5778a432e69d75fda753175 /lib/toaster/tests
parent9bc014d89434400c1493fa9f07ce3a51d37dab51 (diff)
downloadbitbake-3d5090af4475b1d0bb56911a8e30abf9097c1b3c.tar.gz
toaster-tests: package count/size shouldn't show for non-image builds
If a build doesn't produce any image files, the package count and size shouldn't be shown. Also add some metadata to build dashboard elements so it is clear what they're for, and so they can be queried by the tests. Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: bavery <brian.avery@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/toaster/tests')
-rw-r--r--lib/toaster/tests/browser/test_builddashboard_page_artifacts.py42
1 files changed, 41 insertions, 1 deletions
diff --git a/lib/toaster/tests/browser/test_builddashboard_page_artifacts.py b/lib/toaster/tests/browser/test_builddashboard_page_artifacts.py
index 18e447571..39b0e207f 100644
--- a/lib/toaster/tests/browser/test_builddashboard_page_artifacts.py
+++ b/lib/toaster/tests/browser/test_builddashboard_page_artifacts.py
@@ -24,8 +24,9 @@ from django.utils import timezone
from tests.browser.selenium_helpers import SeleniumTestCase
-from orm.models import Project, Release, BitbakeVersion, Build, Target
+from orm.models import Project, Release, BitbakeVersion, Build, Target, Package
from orm.models import Target_Image_File, TargetSDKFile, TargetKernelFile
+from orm.models import Target_Installed_Package
class TestBuildDashboardPageArtifacts(SeleniumTestCase):
""" Tests for artifacts on the build dashboard /build/X """
@@ -86,6 +87,8 @@ class TestBuildDashboardPageArtifacts(SeleniumTestCase):
"""
If a build produced SDK artifacts, they should be shown, but the section
for image files and the images menu option should be hidden.
+
+ The packages count and size should also be hidden.
"""
now = timezone.now()
build = Build.objects.create(project=self.project,
@@ -120,11 +123,28 @@ class TestBuildDashboardPageArtifacts(SeleniumTestCase):
self.assertEqual(len(sdk_artifact_links), 2,
'should be links to 2 SDK artifacts')
+ # package count and size should not be visible, no link on
+ # target name
+ selector = '[data-value="target-package-count"]'
+ self.assertFalse(self.element_exists(selector),
+ 'package count should not be shown for non-image builds')
+
+ selector = '[data-value="target-package-size"]'
+ self.assertFalse(self.element_exists(selector),
+ 'package size should not be shown for non-image builds')
+
+ selector = '[data-link="target-packages"]'
+ self.assertFalse(self.element_exists(selector),
+ 'link to target packages should not be on target heading')
+
def test_image_artifacts(self):
"""
If a build produced image files, kernel artifacts, and manifests,
they should all be shown, as well as the image link in the left-hand
menu.
+
+ The packages count and size should be shown, with a link to the
+ package display page.
"""
now = timezone.now()
build = Build.objects.create(project=self.project,
@@ -145,6 +165,11 @@ class TestBuildDashboardPageArtifacts(SeleniumTestCase):
kernel_file2 = TargetKernelFile.objects.create(target=target,
file_name='/home/foo/bzImage', file_size=2000)
+ package = Package.objects.create(build=build, name='foo', size=1024,
+ installed_name='foo1')
+ installed_package = Target_Installed_Package.objects.create(
+ target=target, package=package)
+
self._get_build_dashboard(build)
# check build artifacts heading
@@ -175,3 +200,18 @@ class TestBuildDashboardPageArtifacts(SeleniumTestCase):
selector = 'a[data-link="package-manifest"]'
self.assertTrue(self.element_exists(selector),
'should be a link to the package manifest (selector %s)' % selector)
+
+ # check package count and size, link on target name
+ selector = '[data-value="target-package-count"]'
+ element = self.find(selector)
+ self.assertEquals(element.text, '1',
+ 'package count should be shown for image builds')
+
+ selector = '[data-value="target-package-size"]'
+ element = self.find(selector)
+ self.assertEquals(element.text, '1.0 KB',
+ 'package size should be shown for image builds')
+
+ selector = '[data-link="target-packages"]'
+ self.assertTrue(self.element_exists(selector),
+ 'link to target packages should be on target heading')