diff options
author | Sujith H <sujith.h@gmail.com> | 2016-06-22 10:10:42 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-07-08 09:57:27 +0100 |
commit | 9d730f4747a3ec2af4929af57bedcfa203179b57 (patch) | |
tree | 33fc48523cd739e024206c92371e5fb119f891c9 /bitbake | |
parent | dabb49be869c5cbd220d30f18323ed12ed54e381 (diff) | |
download | poky-9d730f4747a3ec2af4929af57bedcfa203179b57.tar.gz |
bitbake: bitbake: toaster-tests: tests for project config
Add basic tests to validate the value, user types
in the text box for DL_DIR and SSTATE_DIR. Added
test case to validate the first char and inclusion
of space between the characters.
[YOCTO #9646]
(Bitbake rev: 1531e98c5ae1693d11d692c3589df29dff9364df)
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.py | 113 |
1 files changed, 113 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 index 7fc1252182..0710084995 100644 --- a/bitbake/lib/toaster/tests/browser/test_project_config_page.py +++ b/bitbake/lib/toaster/tests/browser/test_project_config_page.py | |||
@@ -31,6 +31,9 @@ class TestProjectConfigsPage(SeleniumTestCase): | |||
31 | """ Test data at /project/X/builds is displayed correctly """ | 31 | """ Test data at /project/X/builds is displayed correctly """ |
32 | 32 | ||
33 | PROJECT_NAME = 'test project' | 33 | PROJECT_NAME = 'test project' |
34 | INVALID_PATH_START_TEXT = 'The directory path should either start with a /' | ||
35 | INVALID_PATH_CHAR_TEXT = 'The directory path cannot include spaces or ' \ | ||
36 | 'any of these characters' | ||
34 | 37 | ||
35 | def setUp(self): | 38 | def setUp(self): |
36 | bbv = BitbakeVersion.objects.create(name='bbv1', giturl='/tmp/', | 39 | bbv = BitbakeVersion.objects.create(name='bbv1', giturl='/tmp/', |
@@ -116,3 +119,113 @@ class TestProjectConfigsPage(SeleniumTestCase): | |||
116 | checkbox.click() | 119 | checkbox.click() |
117 | self.assertTrue(("cpio" not in element.text), | 120 | self.assertTrue(("cpio" not in element.text), |
118 | "Image still present in the textbox") | 121 | "Image still present in the textbox") |
122 | |||
123 | def test_set_download_dir(self): | ||
124 | """ | ||
125 | Validate the allowed and disallowed types in the directory field for | ||
126 | DL_DIR | ||
127 | """ | ||
128 | |||
129 | ProjectVariable.objects.get_or_create(project=self.project1, | ||
130 | name='DL_DIR') | ||
131 | url = reverse('projectconf', args=(self.project1.id,)) | ||
132 | self.get(url) | ||
133 | |||
134 | # activate the input to edit download dir | ||
135 | self.click('#change-dl_dir-icon') | ||
136 | self.wait_until_visible('#new-dl_dir') | ||
137 | |||
138 | # downloads dir path doesn't start with / or ${...} | ||
139 | self.enter_text('#new-dl_dir', 'home/foo') | ||
140 | element = self.wait_until_visible('#hintError-initialChar-dl_dir') | ||
141 | |||
142 | msg = 'downloads directory path starts with invalid character but ' \ | ||
143 | 'treated as valid' | ||
144 | self.assertTrue((self.INVALID_PATH_START_TEXT in element.text), msg) | ||
145 | |||
146 | # downloads dir path has a space | ||
147 | self.driver.find_element_by_id('new-dl_dir').clear() | ||
148 | self.enter_text('#new-dl_dir', '/foo/bar a') | ||
149 | |||
150 | element = self.wait_until_visible('#hintError-dl_dir') | ||
151 | msg = 'downloads directory path characters invalid but treated as valid' | ||
152 | self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) | ||
153 | |||
154 | # downloads dir path starts with ${...} but has a space | ||
155 | self.driver.find_element_by_id('new-dl_dir').clear() | ||
156 | self.enter_text('#new-dl_dir', '${TOPDIR}/down foo') | ||
157 | |||
158 | element = self.wait_until_visible('#hintError-dl_dir') | ||
159 | msg = 'downloads directory path characters invalid but treated as valid' | ||
160 | self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) | ||
161 | |||
162 | # downloads dir path starts with / | ||
163 | self.driver.find_element_by_id('new-dl_dir').clear() | ||
164 | self.enter_text('#new-dl_dir', '/bar/foo') | ||
165 | |||
166 | hidden_element = self.driver.find_element_by_id('hintError-dl_dir') | ||
167 | self.assertEqual(hidden_element.is_displayed(), False, | ||
168 | 'downloads directory path valid but treated as invalid') | ||
169 | |||
170 | # downloads dir path starts with ${...} | ||
171 | self.driver.find_element_by_id('new-dl_dir').clear() | ||
172 | self.enter_text('#new-dl_dir', '${TOPDIR}/down') | ||
173 | |||
174 | hidden_element = self.driver.find_element_by_id('hintError-dl_dir') | ||
175 | self.assertEqual(hidden_element.is_displayed(), False, | ||
176 | 'downloads directory path valid but treated as invalid') | ||
177 | |||
178 | def test_set_sstate_dir(self): | ||
179 | """ | ||
180 | Validate the allowed and disallowed types in the directory field for | ||
181 | SSTATE_DIR | ||
182 | """ | ||
183 | |||
184 | ProjectVariable.objects.get_or_create(project=self.project1, | ||
185 | name='SSTATE_DIR') | ||
186 | url = reverse('projectconf', args=(self.project1.id,)) | ||
187 | self.get(url) | ||
188 | |||
189 | self.click('#change-sstate_dir-icon') | ||
190 | |||
191 | self.wait_until_visible('#new-sstate_dir') | ||
192 | |||
193 | # path doesn't start with / or ${...} | ||
194 | self.enter_text('#new-sstate_dir', 'home/foo') | ||
195 | element = self.wait_until_visible('#hintError-initialChar-sstate_dir') | ||
196 | |||
197 | msg = 'sstate directory path starts with invalid character but ' \ | ||
198 | 'treated as valid' | ||
199 | self.assertTrue((self.INVALID_PATH_START_TEXT in element.text), msg) | ||
200 | |||
201 | # path has a space | ||
202 | self.driver.find_element_by_id('new-sstate_dir').clear() | ||
203 | self.enter_text('#new-sstate_dir', '/foo/bar a') | ||
204 | |||
205 | element = self.wait_until_visible('#hintError-sstate_dir') | ||
206 | msg = 'sstate directory path characters invalid but treated as valid' | ||
207 | self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) | ||
208 | |||
209 | # path starts with ${...} but has a space | ||
210 | self.driver.find_element_by_id('new-sstate_dir').clear() | ||
211 | self.enter_text('#new-sstate_dir', '${TOPDIR}/down foo') | ||
212 | |||
213 | element = self.wait_until_visible('#hintError-sstate_dir') | ||
214 | msg = 'sstate directory path characters invalid but treated as valid' | ||
215 | self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) | ||
216 | |||
217 | # path starts with / | ||
218 | self.driver.find_element_by_id('new-sstate_dir').clear() | ||
219 | self.enter_text('#new-sstate_dir', '/bar/foo') | ||
220 | |||
221 | hidden_element = self.driver.find_element_by_id('hintError-sstate_dir') | ||
222 | self.assertEqual(hidden_element.is_displayed(), False, | ||
223 | 'sstate directory path valid but treated as invalid') | ||
224 | |||
225 | # paths starts with ${...} | ||
226 | self.driver.find_element_by_id('new-sstate_dir').clear() | ||
227 | self.enter_text('#new-sstate_dir', '${TOPDIR}/down') | ||
228 | |||
229 | hidden_element = self.driver.find_element_by_id('hintError-sstate_dir') | ||
230 | self.assertEqual(hidden_element.is_displayed(), False, | ||
231 | 'sstate directory path valid but treated as invalid') \ No newline at end of file | ||