diff options
author | David Reyna <David.Reyna@windriver.com> | 2017-04-05 15:18:20 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-04-10 23:00:32 +0100 |
commit | 123ec6ebc252f46a2efdd69bd65ded533712bd99 (patch) | |
tree | d8405374c6892cb414e51b288a3d311b9c36ffec /bitbake | |
parent | f45a5a5de8ee8e7b014a780aa45b37774a4b06a1 (diff) | |
download | poky-123ec6ebc252f46a2efdd69bd65ded533712bd99.tar.gz |
bitbake: toaster:test:Create selenium tests for project dashboard page
Added 7 new testcases that verify the UI interface and elements of the project detail page.
This testcases can be found on testopia in the links:
Verifies that the project is created and that you get redirected to the configuration page
https://bugzilla.yoctoproject.org/tr_show_case.cgi?case_id=1514
Verifies that the left side bar menu, all links are clickable and they show on the UI
https://bugzilla.yoctoproject.org/tr_show_case.cgi?case_id=1515
Verifies that after creating a project the default project configuration is created
https://bugzilla.yoctoproject.org/tr_show_case.cgi?case_id=1516
Verifies that the default machine is set, once creating the project
https://bugzilla.yoctoproject.org/tr_show_case.cgi?case_id=1517
Verifies the built recipes information of the project detail page
https://bugzilla.yoctoproject.org/tr_show_case.cgi?case_id=1518
Verifies the default release information of the project
https://bugzilla.yoctoproject.org/tr_show_case.cgi?case_id=1519
Verifies that the default layers are assigned to the project
https://bugzilla.yoctoproject.org/tr_show_case.cgi?case_id=1520
Verifies that the links to the Configuration, Builds, Import layer and New Custom Image are present and work.
[YOCTO #9808]
(Bitbake rev: eaeddaf96efb8079b307652eac208f4ab5019ad4)
Signed-off-by: Libertad Cruz <libertad.cruz@intel.com>
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: David Reyna <David.Reyna@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/toaster/tests/builds/buildtest.py | 110 | ||||
-rw-r--r-- | bitbake/lib/toaster/tests/functional/__init__.py | 0 | ||||
-rw-r--r-- | bitbake/lib/toaster/tests/functional/functional_helpers.py | 122 | ||||
-rw-r--r-- | bitbake/lib/toaster/tests/functional/test_functional_basic.py | 243 |
4 files changed, 421 insertions, 54 deletions
diff --git a/bitbake/lib/toaster/tests/builds/buildtest.py b/bitbake/lib/toaster/tests/builds/buildtest.py index bf147f09e5..5a56a110a7 100644 --- a/bitbake/lib/toaster/tests/builds/buildtest.py +++ b/bitbake/lib/toaster/tests/builds/buildtest.py | |||
@@ -41,6 +41,61 @@ logger = logging.getLogger("toaster") | |||
41 | # want to wrap everything in a database transaction as an external process | 41 | # want to wrap everything in a database transaction as an external process |
42 | # (bitbake needs access to the database) | 42 | # (bitbake needs access to the database) |
43 | 43 | ||
44 | def load_build_environment(): | ||
45 | call_command('loaddata', 'settings.xml', app_label="orm") | ||
46 | call_command('loaddata', 'poky.xml', app_label="orm") | ||
47 | |||
48 | current_builddir = os.environ.get("BUILDDIR") | ||
49 | if current_builddir: | ||
50 | BuildTest.BUILDDIR = current_builddir | ||
51 | else: | ||
52 | # Setup a builddir based on default layout | ||
53 | # bitbake inside openebedded-core | ||
54 | oe_init_build_env_path = os.path.join( | ||
55 | os.path.dirname(os.path.abspath(__file__)), | ||
56 | os.pardir, | ||
57 | os.pardir, | ||
58 | os.pardir, | ||
59 | os.pardir, | ||
60 | os.pardir, | ||
61 | 'oe-init-build-env' | ||
62 | ) | ||
63 | if not os.path.exists(oe_init_build_env_path): | ||
64 | raise Exception("We had no BUILDDIR set and couldn't " | ||
65 | "find oe-init-build-env to set this up " | ||
66 | "ourselves please run oe-init-build-env " | ||
67 | "before running these tests") | ||
68 | |||
69 | oe_init_build_env_path = os.path.realpath(oe_init_build_env_path) | ||
70 | cmd = "bash -c 'source oe-init-build-env %s'" % BuildTest.BUILDDIR | ||
71 | p = subprocess.Popen( | ||
72 | cmd, | ||
73 | cwd=os.path.dirname(oe_init_build_env_path), | ||
74 | shell=True, | ||
75 | stdout=subprocess.PIPE, | ||
76 | stderr=subprocess.PIPE) | ||
77 | |||
78 | output, err = p.communicate() | ||
79 | p.wait() | ||
80 | |||
81 | logger.info("oe-init-build-env %s %s" % (output, err)) | ||
82 | |||
83 | os.environ['BUILDDIR'] = BuildTest.BUILDDIR | ||
84 | |||
85 | # Setup the path to bitbake we know where to find this | ||
86 | bitbake_path = os.path.join( | ||
87 | os.path.dirname(os.path.abspath(__file__)), | ||
88 | os.pardir, | ||
89 | os.pardir, | ||
90 | os.pardir, | ||
91 | os.pardir, | ||
92 | 'bin', | ||
93 | 'bitbake') | ||
94 | if not os.path.exists(bitbake_path): | ||
95 | raise Exception("Could not find bitbake at the expected path %s" | ||
96 | % bitbake_path) | ||
97 | |||
98 | os.environ['BBBASEDIR'] = bitbake_path | ||
44 | 99 | ||
45 | class BuildTest(unittest.TestCase): | 100 | class BuildTest(unittest.TestCase): |
46 | 101 | ||
@@ -59,60 +114,7 @@ class BuildTest(unittest.TestCase): | |||
59 | if built: | 114 | if built: |
60 | return built | 115 | return built |
61 | 116 | ||
62 | call_command('loaddata', 'settings.xml', app_label="orm") | 117 | load_build_environment() |
63 | call_command('loaddata', 'poky.xml', app_label="orm") | ||
64 | |||
65 | current_builddir = os.environ.get("BUILDDIR") | ||
66 | if current_builddir: | ||
67 | BuildTest.BUILDDIR = current_builddir | ||
68 | else: | ||
69 | # Setup a builddir based on default layout | ||
70 | # bitbake inside openebedded-core | ||
71 | oe_init_build_env_path = os.path.join( | ||
72 | os.path.dirname(os.path.abspath(__file__)), | ||
73 | os.pardir, | ||
74 | os.pardir, | ||
75 | os.pardir, | ||
76 | os.pardir, | ||
77 | os.pardir, | ||
78 | 'oe-init-build-env' | ||
79 | ) | ||
80 | if not os.path.exists(oe_init_build_env_path): | ||
81 | raise Exception("We had no BUILDDIR set and couldn't " | ||
82 | "find oe-init-build-env to set this up " | ||
83 | "ourselves please run oe-init-build-env " | ||
84 | "before running these tests") | ||
85 | |||
86 | oe_init_build_env_path = os.path.realpath(oe_init_build_env_path) | ||
87 | cmd = "bash -c 'source oe-init-build-env %s'" % BuildTest.BUILDDIR | ||
88 | p = subprocess.Popen( | ||
89 | cmd, | ||
90 | cwd=os.path.dirname(oe_init_build_env_path), | ||
91 | shell=True, | ||
92 | stdout=subprocess.PIPE, | ||
93 | stderr=subprocess.PIPE) | ||
94 | |||
95 | output, err = p.communicate() | ||
96 | p.wait() | ||
97 | |||
98 | logger.info("oe-init-build-env %s %s" % (output, err)) | ||
99 | |||
100 | os.environ['BUILDDIR'] = BuildTest.BUILDDIR | ||
101 | |||
102 | # Setup the path to bitbake we know where to find this | ||
103 | bitbake_path = os.path.join( | ||
104 | os.path.dirname(os.path.abspath(__file__)), | ||
105 | os.pardir, | ||
106 | os.pardir, | ||
107 | os.pardir, | ||
108 | os.pardir, | ||
109 | 'bin', | ||
110 | 'bitbake') | ||
111 | if not os.path.exists(bitbake_path): | ||
112 | raise Exception("Could not find bitbake at the expected path %s" | ||
113 | % bitbake_path) | ||
114 | |||
115 | os.environ['BBBASEDIR'] = bitbake_path | ||
116 | 118 | ||
117 | BuildEnvironment.objects.get_or_create( | 119 | BuildEnvironment.objects.get_or_create( |
118 | betype=BuildEnvironment.TYPE_LOCAL, | 120 | betype=BuildEnvironment.TYPE_LOCAL, |
diff --git a/bitbake/lib/toaster/tests/functional/__init__.py b/bitbake/lib/toaster/tests/functional/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/bitbake/lib/toaster/tests/functional/__init__.py | |||
diff --git a/bitbake/lib/toaster/tests/functional/functional_helpers.py b/bitbake/lib/toaster/tests/functional/functional_helpers.py new file mode 100644 index 0000000000..486078a615 --- /dev/null +++ b/bitbake/lib/toaster/tests/functional/functional_helpers.py | |||
@@ -0,0 +1,122 @@ | |||
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 os | ||
23 | import logging | ||
24 | import subprocess | ||
25 | import signal | ||
26 | import time | ||
27 | import re | ||
28 | |||
29 | from tests.browser.selenium_helpers_base import SeleniumTestCaseBase | ||
30 | from tests.builds.buildtest import load_build_environment | ||
31 | |||
32 | logger = logging.getLogger("toaster") | ||
33 | |||
34 | class SeleniumFunctionalTestCase(SeleniumTestCaseBase): | ||
35 | wait_toaster_time = 5 | ||
36 | |||
37 | @classmethod | ||
38 | def setUpClass(cls): | ||
39 | # So that the buildinfo helper uses the test database' | ||
40 | if os.environ.get('DJANGO_SETTINGS_MODULE', '') != \ | ||
41 | 'toastermain.settings_test': | ||
42 | raise RuntimeError("Please initialise django with the tests settings: " \ | ||
43 | "DJANGO_SETTINGS_MODULE='toastermain.settings_test'") | ||
44 | |||
45 | load_build_environment() | ||
46 | |||
47 | # start toaster | ||
48 | cmd = "bash -c 'source toaster start'" | ||
49 | p = subprocess.Popen( | ||
50 | cmd, | ||
51 | cwd=os.environ.get("BUILDDIR"), | ||
52 | shell=True) | ||
53 | if p.wait() != 0: | ||
54 | raise RuntimeError("Can't initialize toaster") | ||
55 | |||
56 | super(SeleniumFunctionalTestCase, cls).setUpClass() | ||
57 | cls.live_server_url = 'http://localhost:8000/' | ||
58 | |||
59 | @classmethod | ||
60 | def tearDownClass(cls): | ||
61 | super(SeleniumFunctionalTestCase, cls).tearDownClass() | ||
62 | |||
63 | # XXX: source toaster stop gets blocked, to review why? | ||
64 | # from now send SIGTERM by hand | ||
65 | time.sleep(cls.wait_toaster_time) | ||
66 | builddir = os.environ.get("BUILDDIR") | ||
67 | |||
68 | with open(os.path.join(builddir, '.toastermain.pid'), 'r') as f: | ||
69 | toastermain_pid = int(f.read()) | ||
70 | os.kill(toastermain_pid, signal.SIGTERM) | ||
71 | with open(os.path.join(builddir, '.runbuilds.pid'), 'r') as f: | ||
72 | runbuilds_pid = int(f.read()) | ||
73 | os.kill(runbuilds_pid, signal.SIGTERM) | ||
74 | |||
75 | |||
76 | def get_URL(self): | ||
77 | rc=self.get_page_source() | ||
78 | project_url=re.search("(projectPageUrl\s:\s\")(.*)(\",)",rc) | ||
79 | return project_url.group(2) | ||
80 | |||
81 | |||
82 | def find_element_by_link_text_in_table(self, table_id, link_text): | ||
83 | """ | ||
84 | Assume there're multiple suitable "find_element_by_link_text". | ||
85 | In this circumstance we need to specify "table". | ||
86 | """ | ||
87 | try: | ||
88 | table_element = self.get_table_element(table_id) | ||
89 | element = table_element.find_element_by_link_text(link_text) | ||
90 | except NoSuchElementException as e: | ||
91 | print('no element found') | ||
92 | raise | ||
93 | return element | ||
94 | |||
95 | def get_table_element(self, table_id, *coordinate): | ||
96 | if len(coordinate) == 0: | ||
97 | #return whole-table element | ||
98 | element_xpath = "//*[@id='" + table_id + "']" | ||
99 | try: | ||
100 | element = self.driver.find_element_by_xpath(element_xpath) | ||
101 | except NoSuchElementException as e: | ||
102 | raise | ||
103 | return element | ||
104 | row = coordinate[0] | ||
105 | |||
106 | if len(coordinate) == 1: | ||
107 | #return whole-row element | ||
108 | element_xpath = "//*[@id='" + table_id + "']/tbody/tr[" + str(row) + "]" | ||
109 | try: | ||
110 | element = self.driver.find_element_by_xpath(element_xpath) | ||
111 | except NoSuchElementException as e: | ||
112 | return False | ||
113 | return element | ||
114 | #now we are looking for an element with specified X and Y | ||
115 | column = coordinate[1] | ||
116 | |||
117 | element_xpath = "//*[@id='" + table_id + "']/tbody/tr[" + str(row) + "]/td[" + str(column) + "]" | ||
118 | try: | ||
119 | element = self.driver.find_element_by_xpath(element_xpath) | ||
120 | except NoSuchElementException as e: | ||
121 | return False | ||
122 | return element | ||
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 | |||