summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMihail Stanciu <stanciux.mihail@intel.com>2015-12-07 15:53:00 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-12-07 17:39:08 +0000
commitfe8a0a3697a333d89fc087a6b22843771d0807be (patch)
tree6da54882b6755f780e546bb4a986f14e3ffca49e
parent0497b570e5544a241a64fa05cf6c69db3e930226 (diff)
downloadpoky-fe8a0a3697a333d89fc087a6b22843771d0807be.tar.gz
bitbake: toaster: tests Automated build-mode backend tests
Add tests to check various backend scenarios that require UI interaction. Add necessary files for above tests (the sqlite file and the default config json). (Bitbake rev: 8dcad75ad1d9b8adddeca57e996b8d904b209df5) Signed-off-by: Mihail Stanciu <stanciux.mihail@intel.com> Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
l---------bitbake/lib/toaster/contrib/tts/toasteruitest/toaster.sqlite1
-rwxr-xr-xbitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py383
l---------bitbake/lib/toaster/contrib/tts/toasteruitest/toasterconf.json1
3 files changed, 384 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/contrib/tts/toasteruitest/toaster.sqlite b/bitbake/lib/toaster/contrib/tts/toasteruitest/toaster.sqlite
new file mode 120000
index 0000000000..656b8e8db2
--- /dev/null
+++ b/bitbake/lib/toaster/contrib/tts/toasteruitest/toaster.sqlite
@@ -0,0 +1 @@
../../../../../../toaster.sqlite \ No newline at end of file
diff --git a/bitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py b/bitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py
index 8be9ce236d..3d3ebd8e3c 100755
--- a/bitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py
+++ b/bitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py
@@ -23,13 +23,14 @@
23# step 2 - 3 needs to be run manually 23# step 2 - 3 needs to be run manually
24 24
25import unittest, time, re, sys, getopt, os, logging, string, errno, exceptions 25import unittest, time, re, sys, getopt, os, logging, string, errno, exceptions
26import shutil, argparse, ConfigParser, platform 26import shutil, argparse, ConfigParser, platform, json
27from selenium import webdriver 27from selenium import webdriver
28from selenium.common.exceptions import NoSuchElementException 28from selenium.common.exceptions import NoSuchElementException
29from selenium import selenium 29from selenium import selenium
30from selenium.webdriver.common.by import By 30from selenium.webdriver.common.by import By
31from selenium.webdriver.common.keys import Keys 31from selenium.webdriver.common.keys import Keys
32from selenium.webdriver.support.ui import Select 32from selenium.webdriver.support.ui import Select
33import sqlite3 as sqlite
33 34
34 35
35########################################### 36###########################################
@@ -1814,3 +1815,383 @@ class toaster_cases(toaster_cases_base):
1814 if not self.is_text_present("Toaster Manual"): 1815 if not self.is_text_present("Toaster Manual"):
1815 self.assertFalse(True, msg=("please check [Toaster manual] link on page")) 1816 self.assertFalse(True, msg=("please check [Toaster manual] link on page"))
1816 1817
1818####################################################################################################
1819# Starting backend tests ###########################################################################
1820####################################################################################################
1821
1822 ##############
1823 # CASE 1066 #
1824 ##############
1825 def test_1066(self):
1826 self.case_no = self.get_case_number()
1827 self.log.info(' CASE %s log: ' % str(self.case_no))
1828 con=sqlite.connect('toaster.sqlite')
1829 cursor = con.cursor()
1830 query = "select count(name) from orm_project a, auth_user b where a.user_id = b.id and b.username='_anonuser';"
1831 cursor.execute(query)
1832 data = cursor.fetchone()
1833 self.failUnless(data >= 1)
1834
1835
1836 ##############
1837 # CASE 1071 #
1838 ##############
1839 def test_1071(self):
1840 self.case_no = self.get_case_number()
1841 self.log.info(' CASE %s log: ' % str(self.case_no))
1842 con=sqlite.connect('toaster.sqlite')
1843 cursor = con.cursor()
1844 query = "select name from orm_release;"
1845 cursor.execute(query)
1846 data = cursor.fetchall()
1847 for i in range(0,4):
1848 data[i] = data[i][0]
1849 data.sort()
1850 print data
1851 json_parse = json.loads(open('toasterconf.json').read())
1852 json_data = []
1853 for i in range (0,4):
1854 json_data.append(json_parse['releases'][i]['name'])
1855 json_data.sort()
1856 print json_data
1857 self.failUnless(data == json_data)
1858
1859 ##############
1860 # CASE 1072 #
1861 ##############
1862 def test_1072(self):
1863 self.case_no = self.get_case_number()
1864 self.log.info(' CASE %s log: ' % str(self.case_no))
1865 con=sqlite.connect('toaster.sqlite')
1866 cursor = con.cursor()
1867 query = "select value from orm_toastersetting where name like 'DEFCONF%';"
1868 cursor.execute(query)
1869 data = cursor.fetchall()
1870 for i in range(0,6):
1871 data[i] = data[i][0]
1872 print data
1873 json_parse = json.loads(open('toasterconf.json').read())
1874 json_data=json_parse['config']
1875 json_data = json_data.values()
1876 print json_data
1877 self.failUnless(data == json_data)
1878
1879
1880 ##############
1881 # CASE 1074 #
1882 ##############
1883 def test_1074(self):
1884 self.case_no = self.get_case_number()
1885 self.log.info(' CASE %s log: ' % str(self.case_no))
1886 con=sqlite.connect('toaster.sqlite')
1887 cursor = con.cursor()
1888 query = "select name from orm_layersource;"
1889 cursor.execute(query)
1890 data = cursor.fetchall()
1891 for i in range(0,3):
1892 data[i] = data[i][0]
1893 print data
1894 json_parse = json.loads(open('toasterconf.json').read())
1895 json_data = []
1896 for i in range(0,3):
1897 json_data.append(json_parse['layersources'][i]['name'])
1898 print json_data
1899 self.failUnless(set(data) == set(json_data))
1900
1901 ##############
1902 # CASE 1075 #
1903 ##############
1904 def test_1075(self):
1905 self.case_no = self.get_case_number()
1906 self.log.info(' CASE %s log: ' % str(self.case_no))
1907 con=sqlite.connect('toaster.sqlite')
1908 cursor = con.cursor()
1909 query = "select value from orm_toastersetting where name like 'DEFAULT_RELEASE';"
1910 cursor.execute(query)
1911 data = cursor.fetchall()
1912 data = data[0][0]
1913 print data
1914 json_parse = json.loads(open('toasterconf.json').read())
1915 json_data = json_parse['defaultrelease']
1916 print json_data
1917 self.failUnless(set(data) == set(json_data))
1918
1919 ##############
1920 # CASE 1076 #
1921 ##############
1922 def test_1076(self):
1923 self.case_no = self.get_case_number()
1924 self.log.info(' CASE %s log: ' % str(self.case_no))
1925
1926 print 'Checking branches for "Local Yocto Project"'
1927 con=sqlite.connect('toaster.sqlite')
1928 cursor = con.cursor()
1929 query = "select name from orm_branch where layer_source_id=1;"
1930 cursor.execute(query)
1931 data = cursor.fetchall()
1932 for i in range(0,4):
1933 data[i] = data[i][0]
1934 print data
1935 json_parse = json.loads(open('toasterconf.json').read())
1936 json_data = json_parse['layersources'][0]['branches']
1937 print json_data
1938 self.failUnless(set(data) == set(json_data))
1939
1940 print 'Checking branches for "OpenEmbedded"'
1941 con=sqlite.connect('toaster.sqlite')
1942 cursor = con.cursor()
1943 query = "select name from orm_branch where layer_source_id=2;"
1944 cursor.execute(query)
1945 data = cursor.fetchall()
1946 for i in range(0,3):
1947 data[i] = data[i][0]
1948 print data
1949 json_parse = json.loads(open('toasterconf.json').read())
1950 json_data = json_parse['layersources'][1]['branches']
1951 print json_data
1952 self.failUnless(set(data) == set(json_data))
1953
1954 print 'Checking branches for "Imported layers"'
1955 con=sqlite.connect('toaster.sqlite')
1956 cursor = con.cursor()
1957 query = "select name from orm_branch where layer_source_id=3;"
1958 cursor.execute(query)
1959 data = cursor.fetchall()
1960 for i in range(0,4):
1961 data[i] = data[i][0]
1962 print data
1963 json_parse = json.loads(open('toasterconf.json').read())
1964 json_data = json_parse['layersources'][2]['branches']
1965 print json_data
1966 self.failUnless(set(data) == set(json_data))
1967
1968
1969 ##############
1970 # CASE 1077 #
1971 ##############
1972 def test_1077(self):
1973 self.case_no = self.get_case_number()
1974 self.log.info(' CASE %s log: ' % str(self.case_no))
1975 con=sqlite.connect('toaster.sqlite')
1976 cursor = con.cursor()
1977 query = "select name from orm_bitbakeversion;"
1978 cursor.execute(query)
1979 data = cursor.fetchall()
1980 for i in range(0,4):
1981 data[i] = data[i][0]
1982 print data
1983 json_parse = json.loads(open('toasterconf.json').read())
1984 json_data = []
1985 for i in range(0,4):
1986 json_data.append(json_parse['bitbake'][i]['name'])
1987 print json_data
1988 self.failUnless(set(data) == set(json_data))
1989
1990 ##############
1991 # CASE 1083 #
1992 ##############
1993 def test_1083(self):
1994 self.case_no = self.get_case_number()
1995 self.log.info(' CASE %s log: ' % str(self.case_no))
1996 self.driver.maximize_window()
1997 self.driver.get(self.base_url)
1998 self.driver.find_element_by_id("new-project-button").click()
1999 self.driver.find_element_by_id("new-project-name").send_keys("new-test-project")
2000 self.driver.find_element_by_id("create-project-button").click()
2001 con=sqlite.connect('toaster.sqlite')
2002 cursor = con.cursor()
2003 query = "select count(name) from orm_project where name = 'new-test-project';"
2004 cursor.execute(query)
2005 data = cursor.fetchone()
2006 print 'data: %s' % data
2007 self.failUnless(data >= 1)
2008
2009 ##############
2010 # CASE 1084 #
2011 ##############
2012 def test_1084(self):
2013 self.case_no = self.get_case_number()
2014 self.log.info(' CASE %s log: ' % str(self.case_no))
2015 self.driver.maximize_window()
2016 self.driver.get(self.base_url)
2017 self.driver.find_element_by_id("new-project-button").click()
2018 self.driver.find_element_by_id("new-project-name").send_keys("new-default-project")
2019 self.driver.find_element_by_id("create-project-button").click()
2020 con=sqlite.connect('toaster.sqlite')
2021 cursor = con.cursor()
2022 query = "select a.name from orm_release a, orm_project b where a.id = b.release_id and b.name = 'new-default-project' limit 1;"
2023 cursor.execute(query)
2024 db_data = str(cursor.fetchone()[0])
2025 json_parse = json.loads(open('toasterconf.json').read())
2026 json_data = str(json_parse['defaultrelease'])
2027 self.failUnless(db_data == json_data)
2028
2029 ##############
2030 # CASE 1088 #
2031 ##############
2032 def test_1088(self):
2033 self.case_no = self.get_case_number()
2034 self.log.info(' CASE %s log: ' % str(self.case_no))
2035 self.driver.maximize_window()
2036 self.driver.get(self.base_url)
2037 self.driver.find_element_by_css_selector("a[href='/toastergui/projects/']").click()
2038 self.driver.find_element_by_link_text('new-default-project').click()
2039 self.driver.find_element_by_id('project-change-form-toggle').click()
2040 self.driver.find_element_by_id('project-name-change-input').clear()
2041 self.driver.find_element_by_id('project-name-change-input').send_keys('new-name')
2042 self.driver.find_element_by_id('project-name-change-btn').click()
2043 con=sqlite.connect('toaster.sqlite')
2044 cursor = con.cursor()
2045 query = "select count(name) from orm_project where name = 'new-name';"
2046 cursor.execute(query)
2047 data = cursor.fetchone()[0]
2048 self.failUnless(data == 1)
2049 #reseting project name
2050 self.driver.find_element_by_id('project-change-form-toggle').click()
2051 self.driver.find_element_by_id('project-name-change-input').clear()
2052 self.driver.find_element_by_id('project-name-change-input').send_keys('new-default-project')
2053 self.driver.find_element_by_id('project-name-change-btn').click()
2054
2055
2056 ##############
2057 # CASE 1089 #
2058 ##############
2059 def test_1089(self):
2060 self.case_no = self.get_case_number()
2061 self.log.info(' CASE %s log: ' % str(self.case_no))
2062 self.driver.maximize_window()
2063 self.driver.get(self.base_url)
2064 self.driver.find_element_by_css_selector("a[href='/toastergui/projects/']").click()
2065 self.driver.find_element_by_link_text('new-default-project').click()
2066 self.driver.find_element_by_id('change-machine-toggle').click()
2067 self.driver.find_element_by_id('machine-change-input').clear()
2068 self.driver.find_element_by_id('machine-change-input').send_keys('qemuarm64')
2069 self.driver.find_element_by_id('machine-change-input').send_keys(Keys.RETURN)
2070 self.driver.find_element_by_id('machine-change-btn').click()
2071 con=sqlite.connect('toaster.sqlite')
2072 cursor = con.cursor()
2073 query = "select count(id) from orm_projectvariable where name like 'machine' and value like 'qemuarm64';"
2074 cursor.execute(query)
2075 data = cursor.fetchone()[0]
2076 self.failUnless(data == 1)
2077 #resetting machine to default value
2078 self.driver.find_element_by_id('change-machine-toggle').click()
2079 self.driver.find_element_by_id('machine-change-input').clear()
2080 self.driver.find_element_by_id('machine-change-input').send_keys('qemux86')
2081 self.driver.find_element_by_id('machine-change-input').send_keys(Keys.RETURN)
2082 self.driver.find_element_by_id('machine-change-btn').click()
2083
2084 ##############
2085 # CASE 1090 #
2086 ##############
2087 def test_1090(self):
2088 self.case_no = self.get_case_number()
2089 self.log.info(' CASE %s log: ' % str(self.case_no))
2090 con=sqlite.connect('toaster.sqlite')
2091 cursor = con.cursor()
2092 query = "select username from auth_user where is_superuser = 1;"
2093 cursor.execute(query)
2094 data = cursor.fetchall()
2095 try:
2096 data = data[0]
2097 except:
2098 pass
2099 print data
2100 self.failUnless(data == 'toaster_admin')
2101
2102 ##############
2103 # CASE 1091 #
2104 ##############
2105 def test_1091(self):
2106 self.case_no = self.get_case_number()
2107 self.log.info(' CASE %s log: ' % str(self.case_no))
2108 self.driver.maximize_window()
2109 self.driver.get(self.base_url)
2110 self.driver.find_element_by_css_selector("a[href='/toastergui/projects/']").click()
2111 self.driver.find_element_by_link_text('new-default-project').click()
2112 self.driver.find_element_by_id('release-change-toggle').click()
2113 dropdown = self.driver.find_element_by_css_selector('select')
2114 for option in dropdown.find_elements_by_tag_name('option'):
2115 if option.text == 'Local Yocto Project':
2116 option.click()
2117 self.driver.find_element_by_id('change-release-btn').click()
2118 #wait for the changes to register in the DB
2119 time.sleep(1)
2120 con=sqlite.connect('toaster.sqlite')
2121 cursor = con.cursor()
2122 query = "select count(*) from orm_layer_version a, orm_projectlayer b, orm_project c where a.\"commit\"=\"HEAD\" and a.id = b.layercommit_id and b.project_id=c.id and c.name='new-default-project';"
2123 cursor.execute(query)
2124 data = cursor.fetchone()[0]
2125 #resetting release to default
2126 self.driver.find_element_by_id('release-change-toggle').click()
2127 dropdown = self.driver.find_element_by_css_selector('select')
2128 for option in dropdown.find_elements_by_tag_name('option'):
2129 if option.text == 'Yocto Project master':
2130 option.click()
2131 self.driver.find_element_by_id('change-release-btn').click()
2132 #wait for the changes to register in the DB
2133 time.sleep(1)
2134 self.failUnless(data == 3)
2135
2136 ##############
2137 # CASE 1092 #
2138 ##############
2139 def test_1092(self):
2140 self.case_no = self.get_case_number()
2141 self.log.info(' CASE %s log: ' % str(self.case_no))
2142 self.driver.maximize_window()
2143 con=sqlite.connect('toaster.sqlite')
2144 cursor = con.cursor()
2145 query = "select a.name, a.value from orm_projectvariable a, orm_project b where a.project_id = b.id and b.name = 'new-default-project';"
2146 cursor.execute(query)
2147 data = dict(cursor.fetchall())
2148 print data
2149 default_values = {u'IMAGE_INSTALL_append': u'', u'PACKAGE_CLASSES': u'package_rpm', u'MACHINE': u'qemux86', u'SDKMACHINE': u'x86_64', u'DISTRO': u'poky', u'IMAGE_FSTYPES': u'ext3 jffs2 tar.bz2'}
2150 self.failUnless(data == default_values)
2151
2152 ##############
2153 # CASE 1093 #
2154 ##############
2155 def test_1093(self):
2156 self.case_no = self.get_case_number()
2157 self.log.info(' CASE %s log: ' % str(self.case_no))
2158
2159 #get initial values
2160 con=sqlite.connect('toaster.sqlite')
2161 cursor = con.cursor()
2162 query = "select layercommit_id from orm_projectlayer a, orm_project b where a.project_id=b.id and b.name='new-default-project';"
2163 cursor.execute(query)
2164 data_initial = cursor.fetchall()
2165 print data_initial
2166
2167 self.driver.maximize_window()
2168 self.driver.get('localhost:8000')#self.base_url)
2169 self.driver.find_element_by_css_selector("a[href='/toastergui/projects/']").click()
2170 self.driver.find_element_by_link_text('new-default-project').click()
2171 self.driver.find_element_by_id('release-change-toggle').click()
2172 dropdown = self.driver.find_element_by_css_selector('select')
2173 for option in dropdown.find_elements_by_tag_name('option'):
2174 if option.text == 'Local Yocto Project':
2175 option.click()
2176 self.driver.find_element_by_id('change-release-btn').click()
2177 #wait for the changes to register in the DB
2178 time.sleep(1)
2179
2180 #get changed values
2181 con=sqlite.connect('toaster.sqlite')
2182 cursor = con.cursor()
2183 query = "select layercommit_id from orm_projectlayer a, orm_project b where a.project_id=b.id and b.name='new-default-project';"
2184 cursor.execute(query)
2185 data_changed = cursor.fetchall()
2186 print data_changed
2187
2188 #resetting release to default
2189 self.driver.find_element_by_id('release-change-toggle').click()
2190 dropdown = self.driver.find_element_by_css_selector('select')
2191 for option in dropdown.find_elements_by_tag_name('option'):
2192 if option.text == 'Yocto Project master':
2193 option.click()
2194 self.driver.find_element_by_id('change-release-btn').click()
2195 #wait for the changes to register in the DB
2196 time.sleep(1)
2197 self.failUnless(data_initial != data_changed)
diff --git a/bitbake/lib/toaster/contrib/tts/toasteruitest/toasterconf.json b/bitbake/lib/toaster/contrib/tts/toasteruitest/toasterconf.json
new file mode 120000
index 0000000000..9b33bccde0
--- /dev/null
+++ b/bitbake/lib/toaster/contrib/tts/toasteruitest/toasterconf.json
@@ -0,0 +1 @@
../../../../../../meta-yocto/conf/toasterconf.json \ No newline at end of file