summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui
diff options
context:
space:
mode:
authorElliot Smith <elliot.smith@intel.com>2016-03-31 19:55:44 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-04-01 07:14:58 +0100
commit961cd90375630773f376328f8921804438e0f033 (patch)
treec468c35dac8565bed6a684f3b182ba1c75e5eb8d /bitbake/lib/toaster/toastergui
parentf859a3d40e91e64d4b5292cefd880075a27ddaf9 (diff)
downloadpoky-961cd90375630773f376328f8921804438e0f033.tar.gz
bitbake: toaster: tests Migrate all builds page and project page tests to Selenium
(Bitbake rev: 4fda6be831d10e6d266b11975a0e9a35a7f35a77) Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui')
-rw-r--r--bitbake/lib/toaster/toastergui/tests.py140
1 files changed, 0 insertions, 140 deletions
diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py
index 6b05916f32..78b7c04255 100644
--- a/bitbake/lib/toaster/toastergui/tests.py
+++ b/bitbake/lib/toaster/toastergui/tests.py
@@ -897,146 +897,6 @@ class ProjectBuildsPageTests(TestCase):
897 self.assertEqual(len(tabs), 1, 897 self.assertEqual(len(tabs), 1,
898 'should be a top bar shown for non-command-line builds') 898 'should be a top bar shown for non-command-line builds')
899 899
900class AllBuildsPageTests(TestCase):
901 """ Tests for all builds page /builds/ """
902
903 def setUp(self):
904 bbv = BitbakeVersion.objects.create(name="bbv1", giturl="/tmp/",
905 branch="master", dirpath="")
906 release = Release.objects.create(name="release1",
907 bitbake_version=bbv)
908 self.project1 = Project.objects.create_project(name=PROJECT_NAME,
909 release=release)
910 self.default_project = Project.objects.create_project(
911 name=CLI_BUILDS_PROJECT_NAME,
912 release=release
913 )
914 self.default_project.is_default = True
915 self.default_project.save()
916
917 # parameters for builds to associate with the projects
918 now = timezone.now()
919
920 self.project1_build_success = {
921 "project": self.project1,
922 "started_on": now,
923 "completed_on": now,
924 "outcome": Build.SUCCEEDED
925 }
926
927 self.default_project_build_success = {
928 "project": self.default_project,
929 "started_on": now,
930 "completed_on": now,
931 "outcome": Build.SUCCEEDED
932 }
933
934 def _get_row_for_build(self, data, build_id):
935 """ Get the object representing the table data for a project """
936 return [row for row in data['rows']
937 if row['id'] == build_id][0]
938
939 def test_show_tasks_in_allbuilds(self):
940 """ Task should be shown as suffix on build name """
941 build = Build.objects.create(**self.project1_build_success)
942 Target.objects.create(build=build, target='bash', task='clean')
943
944 url = reverse('all-builds')
945 response = self.client.get(url, {'format': 'json'}, follow=True)
946 data = json.loads(response.content)
947 cell = data['rows'][0]['static:target']
948
949 result = re.findall('bash:clean', cell, re.MULTILINE)
950 self.assertEqual(len(result), 1)
951
952 def test_run_again(self):
953 """
954 "Rebuild" button should not be shown for command-line builds,
955 but should be shown for other builds
956 """
957 build1 = Build.objects.create(**self.project1_build_success)
958 default_build = Build.objects.create(**self.default_project_build_success)
959 url = reverse('all-builds')
960 response = self.client.get(url, follow=True)
961 soup = BeautifulSoup(response.content)
962
963 # shouldn't see a run again button for command-line builds
964 attrs = {'data-latest-build-result': default_build.id}
965 result = soup.find('div', attrs=attrs)
966 run_again_button = result.select('button')
967 self.assertEqual(len(run_again_button), 0)
968
969 # should see a run again button for non-command-line builds
970 attrs = {'data-latest-build-result': build1.id}
971 result = soup.find('div', attrs=attrs)
972 run_again_button = result.select('button')
973 self.assertEqual(len(run_again_button), 1)
974
975 def test_tooltips_on_project_name(self):
976 """
977 A tooltip should be present next to the command line
978 builds project name in the all builds page, but not for
979 other projects
980 """
981 build1 = Build.objects.create(**self.project1_build_success)
982 default_build = Build.objects.create(**self.default_project_build_success)
983
984 url = reverse('all-builds')
985 response = self.client.get(url, {'format': 'json'}, follow=True)
986 data = json.loads(response.content)
987
988 # get the data row for the non-command-line builds project
989 other_project_row = self._get_row_for_build(data, build1.id)
990
991 # make sure there is some HTML
992 soup = BeautifulSoup(other_project_row['static:project'])
993 self.assertEqual(len(soup.select('a')), 1,
994 'should be a project name link')
995
996 # no help icon on non-default project name
997 icons = soup.select('i.get-help')
998 self.assertEqual(len(icons), 0,
999 'should not be a help icon for non-cli builds name')
1000
1001 # get the data row for the command-line builds project
1002 default_project_row = self._get_row_for_build(data, default_build.id)
1003
1004 # help icon on default project name
1005 soup = BeautifulSoup(default_project_row['static:project'])
1006 icons = soup.select('i.get-help')
1007 self.assertEqual(len(icons), 1,
1008 'should be a help icon for cli builds name')
1009
1010class ProjectPageTests(TestCase):
1011 """ Test project data at /project/X/ is displayed correctly """
1012 CLI_BUILDS_PROJECT_NAME = 'Command line builds'
1013
1014 def test_command_line_builds_in_progress(self):
1015 """
1016 In progress builds should not cause an error to be thrown
1017 when navigating to "command line builds" project page;
1018 see https://bugzilla.yoctoproject.org/show_bug.cgi?id=8277
1019 """
1020
1021 # add the "command line builds" default project; this mirrors what
1022 # we do in migration 0026_set_default_project.py
1023 default_project = Project.objects.create_project(self.CLI_BUILDS_PROJECT_NAME, None)
1024 default_project.is_default = True
1025 default_project.save()
1026
1027 # add an "in progress" build for the default project
1028 now = timezone.now()
1029 build = Build.objects.create(project=default_project,
1030 started_on=now,
1031 completed_on=now,
1032 outcome=Build.IN_PROGRESS)
1033
1034 # navigate to the project page for the default project
1035 url = reverse("project", args=(default_project.id,))
1036 response = self.client.get(url, follow=True)
1037
1038 self.assertEqual(response.status_code, 200)
1039
1040class BuildDashboardTests(TestCase): 900class BuildDashboardTests(TestCase):
1041 """ Tests for the build dashboard /build/X """ 901 """ Tests for the build dashboard /build/X """
1042 902