diff options
Diffstat (limited to 'bitbake/lib/toaster/tests/functional/test_functional_basic.py')
| -rw-r--r-- | bitbake/lib/toaster/tests/functional/test_functional_basic.py | 243 |
1 files changed, 243 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/tests/functional/test_functional_basic.py b/bitbake/lib/toaster/tests/functional/test_functional_basic.py new file mode 100644 index 0000000000..cfa2b0fdf0 --- /dev/null +++ b/bitbake/lib/toaster/tests/functional/test_functional_basic.py | |||
| @@ -0,0 +1,243 @@ | |||
| 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 functional tests implementation | ||
| 6 | # | ||
| 7 | # Copyright (C) 2017 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 | |||
| 22 | import time | ||
| 23 | import re | ||
| 24 | from tests.functional.functional_helpers import SeleniumFunctionalTestCase | ||
| 25 | from orm.models import Project | ||
| 26 | |||
| 27 | class FuntionalTestBasic(SeleniumFunctionalTestCase): | ||
| 28 | |||
| 29 | # testcase (1514) | ||
| 30 | def test_create_slenium_project(self): | ||
| 31 | project_name = 'selenium-project' | ||
| 32 | self.get('') | ||
| 33 | self.driver.find_element_by_link_text("To start building, create your first Toaster project").click() | ||
| 34 | self.driver.find_element_by_id("new-project-name").send_keys(project_name) | ||
| 35 | self.driver.find_element_by_id('projectversion').click() | ||
| 36 | self.driver.find_element_by_id("create-project-button").click() | ||
| 37 | element = self.wait_until_visible('#project-created-notification') | ||
| 38 | self.assertTrue(self.element_exists('#project-created-notification'),'Project creation notification not shown') | ||
| 39 | self.assertTrue(project_name in element.text, | ||
| 40 | "New project name not in new project notification") | ||
| 41 | self.assertTrue(Project.objects.filter(name=project_name).count(), | ||
| 42 | "New project not found in database") | ||
| 43 | |||
| 44 | # testcase (1515) | ||
| 45 | def test_verify_left_bar_menu(self): | ||
| 46 | self.get('') | ||
| 47 | self.wait_until_visible('#projectstable') | ||
| 48 | self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() | ||
| 49 | self.assertTrue(self.element_exists('#config-nav'),'Configuration Tab does not exist') | ||
| 50 | project_URL=self.get_URL() | ||
| 51 | self.driver.find_element_by_xpath('//a[@href="'+project_URL+'"]').click() | ||
| 52 | |||
| 53 | try: | ||
| 54 | self.driver.find_element_by_xpath("//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'customimages/"'+"]").click() | ||
| 55 | self.assertTrue(re.search("Custom images",self.driver.find_element_by_xpath("//div[@class='col-md-10']").text),'Custom images information is not loading properly') | ||
| 56 | except: | ||
| 57 | self.fail(msg='No Custom images tab available') | ||
| 58 | |||
| 59 | try: | ||
| 60 | self.driver.find_element_by_xpath("//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'images/"'+"]").click() | ||
| 61 | self.assertTrue(re.search("Compatible image recipes",self.driver.find_element_by_xpath("//div[@class='col-md-10']").text),'The Compatible image recipes information is not loading properly') | ||
| 62 | except: | ||
| 63 | self.fail(msg='No Compatible image tab available') | ||
| 64 | |||
| 65 | try: | ||
| 66 | self.driver.find_element_by_xpath("//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'softwarerecipes/"'+"]").click() | ||
| 67 | self.assertTrue(re.search("Compatible software recipes",self.driver.find_element_by_xpath("//div[@class='col-md-10']").text),'The Compatible software recipe information is not loading properly') | ||
| 68 | except: | ||
| 69 | self.fail(msg='No Compatible software recipe tab available') | ||
| 70 | |||
| 71 | try: | ||
| 72 | self.driver.find_element_by_xpath("//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'machines/"'+"]").click() | ||
| 73 | self.assertTrue(re.search("Compatible machines",self.driver.find_element_by_xpath("//div[@class='col-md-10']").text),'The Compatible machine information is not loading properly') | ||
| 74 | except: | ||
| 75 | self.fail(msg='No Compatible machines tab available') | ||
| 76 | |||
| 77 | try: | ||
| 78 | self.driver.find_element_by_xpath("//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'layers/"'+"]").click() | ||
| 79 | self.assertTrue(re.search("Compatible layers",self.driver.find_element_by_xpath("//div[@class='col-md-10']").text),'The Compatible layer information is not loading properly') | ||
| 80 | except: | ||
| 81 | self.fail(msg='No Compatible layers tab available') | ||
| 82 | |||
| 83 | try: | ||
| 84 | self.driver.find_element_by_xpath("//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'configuration"'+"]").click() | ||
| 85 | self.assertTrue(re.search("Bitbake variables",self.driver.find_element_by_xpath("//div[@class='col-md-10']").text),'The Bitbake variables information is not loading properly') | ||
| 86 | except: | ||
| 87 | self.fail(msg='No Bitbake variables tab available') | ||
| 88 | |||
| 89 | # testcase (1516) | ||
| 90 | def test_review_configuration_information(self): | ||
| 91 | self.get('') | ||
| 92 | self.driver.find_element_by_xpath("//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() | ||
| 93 | self.wait_until_visible('#projectstable') | ||
| 94 | self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() | ||
| 95 | project_URL=self.get_URL() | ||
| 96 | |||
| 97 | try: | ||
| 98 | self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist') | ||
| 99 | self.assertTrue(re.search("qemux86",self.driver.find_element_by_xpath("//span[@id='project-machine-name']").text),'The machine type is not assigned') | ||
| 100 | self.driver.find_element_by_xpath("//span[@id='change-machine-toggle']").click() | ||
| 101 | self.wait_until_visible('#select-machine-form') | ||
| 102 | self.wait_until_visible('#cancel-machine-change') | ||
| 103 | self.driver.find_element_by_xpath("//form[@id='select-machine-form']/a[@id='cancel-machine-change']").click() | ||
| 104 | except: | ||
| 105 | self.fail(msg='The machine information is wrong in the configuration page') | ||
| 106 | |||
| 107 | try: | ||
| 108 | self.driver.find_element_by_id('no-most-built') | ||
| 109 | except: | ||
| 110 | self.fail(msg='No Most built information in project detail page') | ||
| 111 | |||
| 112 | try: | ||
| 113 | self.assertTrue(re.search("Yocto Project master",self.driver.find_element_by_xpath("//span[@id='project-release-title']").text),'The project release is not defined') | ||
| 114 | except: | ||
| 115 | self.fail(msg='No project release title information in project detail page') | ||
| 116 | |||
| 117 | try: | ||
| 118 | self.driver.find_element_by_xpath("//div[@id='layer-container']") | ||
| 119 | self.assertTrue(re.search("3",self.driver.find_element_by_id("project-layers-count").text),'There should be 3 layers listed in the layer count') | ||
| 120 | layer_list = self.driver.find_element_by_id("layers-in-project-list") | ||
| 121 | layers = layer_list.find_elements_by_tag_name("li") | ||
| 122 | for layer in layers: | ||
| 123 | if re.match ("openembedded-core",layer.text): | ||
| 124 | print ("openembedded-core layer is a default layer in the project configuration") | ||
| 125 | elif re.match ("meta-poky",layer.text): | ||
| 126 | print ("meta-poky layer is a default layer in the project configuration") | ||
| 127 | elif re.match ("meta-yocto-bsp",layer.text): | ||
| 128 | print ("meta-yocto-bsp is a default layer in the project configuratoin") | ||
| 129 | else: | ||
| 130 | self.fail(msg='default layers are missing from the project configuration') | ||
| 131 | except: | ||
| 132 | self.fail(msg='No Layer information in project detail page') | ||
| 133 | |||
| 134 | # testcase (1517) | ||
| 135 | def test_verify_machine_information(self): | ||
| 136 | self.get('') | ||
| 137 | self.driver.find_element_by_xpath("//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() | ||
| 138 | self.wait_until_visible('#projectstable') | ||
| 139 | self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() | ||
| 140 | |||
| 141 | try: | ||
| 142 | self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist') | ||
| 143 | self.assertTrue(re.search("qemux86",self.driver.find_element_by_id("project-machine-name").text),'The machine type is not assigned') | ||
| 144 | self.driver.find_element_by_id("change-machine-toggle").click() | ||
| 145 | self.wait_until_visible('#select-machine-form') | ||
| 146 | self.wait_until_visible('#cancel-machine-change') | ||
| 147 | self.driver.find_element_by_id("cancel-machine-change").click() | ||
| 148 | except: | ||
| 149 | self.fail(msg='The machine information is wrong in the configuration page') | ||
| 150 | |||
| 151 | # testcase (1518) | ||
| 152 | def test_verify_most_built_recipes_information(self): | ||
| 153 | self.get('') | ||
| 154 | self.driver.find_element_by_xpath("//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() | ||
| 155 | self.wait_until_visible('#projectstable') | ||
| 156 | self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() | ||
| 157 | project_URL=self.get_URL() | ||
| 158 | |||
| 159 | try: | ||
| 160 | self.assertTrue(re.search("You haven't built any recipes yet",self.driver.find_element_by_id("no-most-built").text),'Default message of no builds is not present') | ||
| 161 | self.driver.find_element_by_xpath("//div[@id='no-most-built']/p/a[@href="+'"'+project_URL+'images/"'+"]").click() | ||
| 162 | self.assertTrue(re.search("Compatible image recipes",self.driver.find_element_by_xpath("//div[@class='col-md-10']").text),'The Choose a recipe to build link is not working properly') | ||
| 163 | except: | ||
| 164 | self.fail(msg='No Most built information in project detail page') | ||
| 165 | |||
| 166 | # testcase (1519) | ||
| 167 | def test_verify_project_release_information(self): | ||
| 168 | self.get('') | ||
| 169 | self.driver.find_element_by_xpath("//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() | ||
| 170 | self.wait_until_visible('#projectstable') | ||
| 171 | self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() | ||
| 172 | |||
| 173 | try: | ||
| 174 | self.assertTrue(re.search("Yocto Project master",self.driver.find_element_by_id("project-release-title").text),'The project release is not defined') | ||
| 175 | except: | ||
| 176 | self.fail(msg='No project release title information in project detail page') | ||
| 177 | |||
| 178 | # testcase (1520) | ||
| 179 | def test_verify_layer_information(self): | ||
| 180 | self.get('') | ||
| 181 | self.driver.find_element_by_xpath("//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() | ||
| 182 | self.wait_until_visible('#projectstable') | ||
| 183 | self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() | ||
| 184 | project_URL=self.get_URL() | ||
| 185 | |||
| 186 | try: | ||
| 187 | self.driver.find_element_by_xpath("//div[@id='layer-container']") | ||
| 188 | self.assertTrue(re.search("3",self.driver.find_element_by_id("project-layers-count").text),'There should be 3 layers listed in the layer count') | ||
| 189 | layer_list = self.driver.find_element_by_id("layers-in-project-list") | ||
| 190 | layers = layer_list.find_elements_by_tag_name("li") | ||
| 191 | |||
| 192 | for layer in layers: | ||
| 193 | if re.match ("openembedded-core",layer.text): | ||
| 194 | print ("openembedded-core layer is a default layer in the project configuration") | ||
| 195 | elif re.match ("meta-poky",layer.text): | ||
| 196 | print ("meta-poky layer is a default layer in the project configuration") | ||
| 197 | elif re.match ("meta-yocto-bsp",layer.text): | ||
| 198 | print ("meta-yocto-bsp is a default layer in the project configuratoin") | ||
| 199 | else: | ||
| 200 | self.fail(msg='default layers are missing from the project configuration') | ||
| 201 | |||
| 202 | self.driver.find_element_by_xpath("//input[@id='layer-add-input']") | ||
| 203 | self.driver.find_element_by_xpath("//button[@id='add-layer-btn']") | ||
| 204 | self.driver.find_element_by_xpath("//div[@id='layer-container']/form[@class='form-inline']/p/a[@id='view-compatible-layers']") | ||
| 205 | self.driver.find_element_by_xpath("//div[@id='layer-container']/form[@class='form-inline']/p/a[@href="+'"'+project_URL+'importlayer"'+"]") | ||
| 206 | except: | ||
| 207 | self.fail(msg='No Layer information in project detail page') | ||
| 208 | |||
| 209 | # testcase (1521) | ||
| 210 | def test_verify_project_detail_links(self): | ||
| 211 | self.get('') | ||
| 212 | self.driver.find_element_by_xpath("//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() | ||
| 213 | self.wait_until_visible('#projectstable') | ||
| 214 | self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() | ||
| 215 | project_URL=self.get_URL() | ||
| 216 | |||
| 217 | self.driver.find_element_by_xpath("//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li[@id='topbar-configuration-tab']/a[@href="+'"'+project_URL+'"'+"]").click() | ||
| 218 | self.assertTrue(re.search("Configuration",self.driver.find_element_by_xpath("//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li[@id='topbar-configuration-tab']/a[@href="+'"'+project_URL+'"'+"]").text), 'Configuration tab in project topbar is misspelled') | ||
| 219 | |||
| 220 | try: | ||
| 221 | self.driver.find_element_by_xpath("//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'builds/"'+"]").click() | ||
| 222 | self.assertTrue(re.search("Builds",self.driver.find_element_by_xpath("//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'builds/"'+"]").text), 'Builds tab in project topbar is misspelled') | ||
| 223 | self.driver.find_element_by_xpath("//div[@id='empty-state-projectbuildstable']") | ||
| 224 | except: | ||
| 225 | self.fail(msg='Builds tab information is not present') | ||
| 226 | |||
| 227 | try: | ||
| 228 | self.driver.find_element_by_xpath("//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'importlayer"'+"]").click() | ||
| 229 | self.assertTrue(re.search("Import layer",self.driver.find_element_by_xpath("//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'importlayer"'+"]").text), 'Import layer tab in project topbar is misspelled') | ||
| 230 | self.driver.find_element_by_xpath("//fieldset[@id='repo-select']") | ||
| 231 | self.driver.find_element_by_xpath("//fieldset[@id='git-repo']") | ||
| 232 | except: | ||
| 233 | self.fail(msg='Import layer tab not loading properly') | ||
| 234 | |||
| 235 | try: | ||
| 236 | self.driver.find_element_by_xpath("//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'newcustomimage/"'+"]").click() | ||
| 237 | self.assertTrue(re.search("New custom image",self.driver.find_element_by_xpath("//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'newcustomimage/"'+"]").text), 'New custom image tab in project topbar is misspelled') | ||
| 238 | self.assertTrue(re.search("Select the image recipe you want to customise",self.driver.find_element_by_xpath("//div[@class='col-md-12']/h2").text),'The new custom image tab is not loading correctly') | ||
| 239 | except: | ||
| 240 | self.fail(msg='New custom image tab not loading properly') | ||
| 241 | |||
| 242 | |||
| 243 | |||
