summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorSujith H <sujith.h@gmail.com>2016-05-19 11:43:32 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-20 10:09:02 +0100
commit8fba59ce45de865354b0b115e1b33f5a59172614 (patch)
tree6bfcb838c8580ffb521ff84733210d2e3e710f70 /bitbake
parent1aab29ed8d52010026d6fbc326585207f612d737 (diff)
downloadpoky-8fba59ce45de865354b0b115e1b33f5a59172614.tar.gz
bitbake: toaster-tests: tests for project config
Add basic tests to validate the value user types in the text box for IMAGEFS_TYPES. Added a test case to show the checkbox get automatically selected when user types value available in the check list. Added a test case to verify if the check box is enabled then the text box should also get updated accordingly. [YOCTO #7828] (Bitbake rev: 62c74eb38f44d98b40427edf56e40785b076a938) Signed-off-by: Sujith H <sujith.h@gmail.com> Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/tests/browser/test_project_config_page.py115
1 files changed, 115 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/tests/browser/test_project_config_page.py b/bitbake/lib/toaster/tests/browser/test_project_config_page.py
new file mode 100644
index 0000000000..ede53b6456
--- /dev/null
+++ b/bitbake/lib/toaster/tests/browser/test_project_config_page.py
@@ -0,0 +1,115 @@
1#! /usr/bin/env python
2# ex:ts=4:sw=4:sts=4:et
3# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
4#
5# BitBake Toaster Implementation
6#
7# Copyright (C) 2013-2016 Intel Corporation
8#
9# This program is free software; you can redistribute it and/or modify
10# it under the terms of the GNU General Public License version 2 as
11# published by the Free Software Foundation.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License along
19# with this program; if not, write to the Free Software Foundation, Inc.,
20# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
22import re
23
24from django.core.urlresolvers import reverse
25from django.utils import timezone
26from tests.browser.selenium_helpers import SeleniumTestCase
27
28from orm.models import BitbakeVersion, Release, Project, ProjectVariable
29
30class TestProjectConfigsPage(SeleniumTestCase):
31 """ Test data at /project/X/builds is displayed correctly """
32
33 PROJECT_NAME = 'test project'
34
35 def setUp(self):
36 bbv = BitbakeVersion.objects.create(name='bbv1', giturl='/tmp/',
37 branch='master', dirpath='')
38 release = Release.objects.create(name='release1',
39 bitbake_version=bbv)
40 self.project1 = Project.objects.create_project(name=self.PROJECT_NAME,
41 release=release)
42 self.project1.save()
43
44
45 def test_no_underscore_iamgefs_type(self):
46 """
47 Should not accept IMAGEFS_TYPE with an underscore
48 """
49
50 imagefs_type = "foo_bar"
51
52 ProjectVariable.objects.get_or_create(project = self.project1, name = "IMAGE_FSTYPES", value = "abcd ")
53 url = reverse('projectconf', args=(self.project1.id,));
54 self.get(url);
55
56 self.click('#change-image_fstypes-icon')
57
58 self.enter_text('#new-imagefs_types', imagefs_type)
59
60 element = self.wait_until_visible('#hintError-image-fs_type')
61
62 self.assertTrue(("A valid image type cannot include underscores" in element.text),
63 "Did not find underscore error message")
64
65
66 def test_checkbox_verification(self):
67 """
68 Should automatically check the checkbox if user enters value
69 text box, if value is there in the checkbox.
70 """
71 imagefs_type = "btrfs"
72
73 ProjectVariable.objects.get_or_create(project = self.project1, name = "IMAGE_FSTYPES", value = "abcd ")
74 url = reverse('projectconf', args=(self.project1.id,));
75 self.get(url);
76
77 self.click('#change-image_fstypes-icon')
78
79 self.enter_text('#new-imagefs_types', imagefs_type)
80
81 checkboxes = self.driver.find_elements_by_xpath("//input[@class='fs-checkbox-fstypes']")
82
83 for checkbox in checkboxes:
84 if checkbox.get_attribute("value") == "btrfs":
85 self.assertEqual(checkbox.is_selected(), True)
86
87
88 def test_textbox_with_checkbox_verification(self):
89 """
90 Should automatically add or remove value in textbox, if user checks
91 or unchecks checkboxes.
92 """
93
94 ProjectVariable.objects.get_or_create(project = self.project1, name = "IMAGE_FSTYPES", value = "abcd ")
95 url = reverse('projectconf', args=(self.project1.id,));
96 self.get(url);
97
98 self.click('#change-image_fstypes-icon')
99
100 self.wait_until_visible('#new-imagefs_types')
101
102 checkboxes = self.driver.find_elements_by_xpath("//input[@class='fs-checkbox-fstypes']")
103
104 for checkbox in checkboxes:
105 if checkbox.get_attribute("value") == "cpio":
106 checkbox.click()
107 element = self.driver.find_element_by_id('new-imagefs_types')
108
109 self.wait_until_visible('#new-imagefs_types')
110
111 self.assertTrue(("cpio" in element.get_attribute('value'),
112 "Imagefs not added into the textbox"))
113 checkbox.click()
114 self.assertTrue(("cpio" not in element.text),
115 "Image still present in the textbox")