summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/tests/browser/test_builddashboard_page_artifacts.py
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:52 +0100
commit8d08a73225ca665189fa922b87618638f86ca0f9 (patch)
treef125d392cdbfa15c39241649e1066a6ba8aa5482 /bitbake/lib/toaster/tests/browser/test_builddashboard_page_artifacts.py
parent8ccf8392aa07c14b99f946585f27aff8f2e425de (diff)
downloadpoky-8d08a73225ca665189fa922b87618638f86ca0f9.tar.gz
bitbake: 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. (Bitbake rev: 3d5090af4475b1d0bb56911a8e30abf9097c1b3c) 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 'bitbake/lib/toaster/tests/browser/test_builddashboard_page_artifacts.py')
-rw-r--r--bitbake/lib/toaster/tests/browser/test_builddashboard_page_artifacts.py42
1 files changed, 41 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/tests/browser/test_builddashboard_page_artifacts.py b/bitbake/lib/toaster/tests/browser/test_builddashboard_page_artifacts.py
index 18e4475711..39b0e207fc 100644
--- a/bitbake/lib/toaster/tests/browser/test_builddashboard_page_artifacts.py
+++ b/bitbake/lib/toaster/tests/browser/test_builddashboard_page_artifacts.py
@@ -24,8 +24,9 @@ from django.utils import timezone
24 24
25from tests.browser.selenium_helpers import SeleniumTestCase 25from tests.browser.selenium_helpers import SeleniumTestCase
26 26
27from orm.models import Project, Release, BitbakeVersion, Build, Target 27from orm.models import Project, Release, BitbakeVersion, Build, Target, Package
28from orm.models import Target_Image_File, TargetSDKFile, TargetKernelFile 28from orm.models import Target_Image_File, TargetSDKFile, TargetKernelFile
29from orm.models import Target_Installed_Package
29 30
30class TestBuildDashboardPageArtifacts(SeleniumTestCase): 31class TestBuildDashboardPageArtifacts(SeleniumTestCase):
31 """ Tests for artifacts on the build dashboard /build/X """ 32 """ Tests for artifacts on the build dashboard /build/X """
@@ -86,6 +87,8 @@ class TestBuildDashboardPageArtifacts(SeleniumTestCase):
86 """ 87 """
87 If a build produced SDK artifacts, they should be shown, but the section 88 If a build produced SDK artifacts, they should be shown, but the section
88 for image files and the images menu option should be hidden. 89 for image files and the images menu option should be hidden.
90
91 The packages count and size should also be hidden.
89 """ 92 """
90 now = timezone.now() 93 now = timezone.now()
91 build = Build.objects.create(project=self.project, 94 build = Build.objects.create(project=self.project,
@@ -120,11 +123,28 @@ class TestBuildDashboardPageArtifacts(SeleniumTestCase):
120 self.assertEqual(len(sdk_artifact_links), 2, 123 self.assertEqual(len(sdk_artifact_links), 2,
121 'should be links to 2 SDK artifacts') 124 'should be links to 2 SDK artifacts')
122 125
126 # package count and size should not be visible, no link on
127 # target name
128 selector = '[data-value="target-package-count"]'
129 self.assertFalse(self.element_exists(selector),
130 'package count should not be shown for non-image builds')
131
132 selector = '[data-value="target-package-size"]'
133 self.assertFalse(self.element_exists(selector),
134 'package size should not be shown for non-image builds')
135
136 selector = '[data-link="target-packages"]'
137 self.assertFalse(self.element_exists(selector),
138 'link to target packages should not be on target heading')
139
123 def test_image_artifacts(self): 140 def test_image_artifacts(self):
124 """ 141 """
125 If a build produced image files, kernel artifacts, and manifests, 142 If a build produced image files, kernel artifacts, and manifests,
126 they should all be shown, as well as the image link in the left-hand 143 they should all be shown, as well as the image link in the left-hand
127 menu. 144 menu.
145
146 The packages count and size should be shown, with a link to the
147 package display page.
128 """ 148 """
129 now = timezone.now() 149 now = timezone.now()
130 build = Build.objects.create(project=self.project, 150 build = Build.objects.create(project=self.project,
@@ -145,6 +165,11 @@ class TestBuildDashboardPageArtifacts(SeleniumTestCase):
145 kernel_file2 = TargetKernelFile.objects.create(target=target, 165 kernel_file2 = TargetKernelFile.objects.create(target=target,
146 file_name='/home/foo/bzImage', file_size=2000) 166 file_name='/home/foo/bzImage', file_size=2000)
147 167
168 package = Package.objects.create(build=build, name='foo', size=1024,
169 installed_name='foo1')
170 installed_package = Target_Installed_Package.objects.create(
171 target=target, package=package)
172
148 self._get_build_dashboard(build) 173 self._get_build_dashboard(build)
149 174
150 # check build artifacts heading 175 # check build artifacts heading
@@ -175,3 +200,18 @@ class TestBuildDashboardPageArtifacts(SeleniumTestCase):
175 selector = 'a[data-link="package-manifest"]' 200 selector = 'a[data-link="package-manifest"]'
176 self.assertTrue(self.element_exists(selector), 201 self.assertTrue(self.element_exists(selector),
177 'should be a link to the package manifest (selector %s)' % selector) 202 'should be a link to the package manifest (selector %s)' % selector)
203
204 # check package count and size, link on target name
205 selector = '[data-value="target-package-count"]'
206 element = self.find(selector)
207 self.assertEquals(element.text, '1',
208 'package count should be shown for image builds')
209
210 selector = '[data-value="target-package-size"]'
211 element = self.find(selector)
212 self.assertEquals(element.text, '1.0 KB',
213 'package size should be shown for image builds')
214
215 selector = '[data-link="target-packages"]'
216 self.assertTrue(self.element_exists(selector),
217 'link to target packages should be on target heading')