diff options
Diffstat (limited to 'bitbake/lib/toaster/tests/browser/test_landing_page.py')
-rw-r--r-- | bitbake/lib/toaster/tests/browser/test_landing_page.py | 143 |
1 files changed, 140 insertions, 3 deletions
diff --git a/bitbake/lib/toaster/tests/browser/test_landing_page.py b/bitbake/lib/toaster/tests/browser/test_landing_page.py index 8bb64b9f3e..210359d561 100644 --- a/bitbake/lib/toaster/tests/browser/test_landing_page.py +++ b/bitbake/lib/toaster/tests/browser/test_landing_page.py | |||
@@ -10,8 +10,10 @@ | |||
10 | from django.urls import reverse | 10 | from django.urls import reverse |
11 | from django.utils import timezone | 11 | from django.utils import timezone |
12 | from tests.browser.selenium_helpers import SeleniumTestCase | 12 | from tests.browser.selenium_helpers import SeleniumTestCase |
13 | from selenium.webdriver.common.by import By | ||
14 | |||
15 | from orm.models import Layer, Layer_Version, Project, Build | ||
13 | 16 | ||
14 | from orm.models import Project, Build | ||
15 | 17 | ||
16 | class TestLandingPage(SeleniumTestCase): | 18 | class TestLandingPage(SeleniumTestCase): |
17 | """ Tests for redirects on the landing page """ | 19 | """ Tests for redirects on the landing page """ |
@@ -29,12 +31,147 @@ class TestLandingPage(SeleniumTestCase): | |||
29 | self.project.is_default = True | 31 | self.project.is_default = True |
30 | self.project.save() | 32 | self.project.save() |
31 | 33 | ||
34 | def test_icon_info_visible_and_clickable(self): | ||
35 | """ Test that the information icon is visible and clickable """ | ||
36 | self.get(reverse('landing')) | ||
37 | self.wait_until_visible('#toaster-version-info-sign') | ||
38 | info_sign = self.find('#toaster-version-info-sign') | ||
39 | |||
40 | # check that the info sign is visible | ||
41 | self.assertTrue(info_sign.is_displayed()) | ||
42 | |||
43 | # check that the info sign is clickable | ||
44 | # and info modal is appearing when clicking on the info sign | ||
45 | info_sign.click() # click on the info sign make attribute 'aria-describedby' visible | ||
46 | info_model_id = info_sign.get_attribute('aria-describedby') | ||
47 | self.wait_until_visible(f'#{info_model_id}') | ||
48 | info_modal = self.find(f'#{info_model_id}') | ||
49 | self.assertTrue(info_modal.is_displayed()) | ||
50 | self.assertTrue("Toaster version information" in info_modal.text) | ||
51 | |||
52 | def test_documentation_link_displayed(self): | ||
53 | """ Test that the documentation link is displayed """ | ||
54 | self.get(reverse('landing')) | ||
55 | self.wait_until_visible('#navbar-docs') | ||
56 | documentation_link = self.find('#navbar-docs > a') | ||
57 | |||
58 | # check that the documentation link is visible | ||
59 | self.assertTrue(documentation_link.is_displayed()) | ||
60 | |||
61 | # check browser open new tab toaster manual when clicking on the documentation link | ||
62 | self.assertEqual(documentation_link.get_attribute('target'), '_blank') | ||
63 | self.assertEqual( | ||
64 | documentation_link.get_attribute('href'), | ||
65 | 'http://docs.yoctoproject.org/toaster-manual/index.html#toaster-user-manual') | ||
66 | self.assertTrue("Documentation" in documentation_link.text) | ||
67 | |||
68 | def test_openembedded_jumbotron_link_visible_and_clickable(self): | ||
69 | """ Test OpenEmbedded link jumbotron is visible and clickable: """ | ||
70 | self.get(reverse('landing')) | ||
71 | self.wait_until_visible('.jumbotron') | ||
72 | jumbotron = self.find('.jumbotron') | ||
73 | |||
74 | # check OpenEmbedded | ||
75 | openembedded = jumbotron.find_element(By.LINK_TEXT, 'OpenEmbedded') | ||
76 | self.assertTrue(openembedded.is_displayed()) | ||
77 | openembedded.click() | ||
78 | self.assertTrue("openembedded.org" in self.driver.current_url) | ||
79 | |||
80 | def test_bitbake_jumbotron_link_visible_and_clickable(self): | ||
81 | """ Test BitBake link jumbotron is visible and clickable: """ | ||
82 | self.get(reverse('landing')) | ||
83 | self.wait_until_visible('.jumbotron') | ||
84 | jumbotron = self.find('.jumbotron') | ||
85 | |||
86 | # check BitBake | ||
87 | bitbake = jumbotron.find_element(By.LINK_TEXT, 'BitBake') | ||
88 | self.assertTrue(bitbake.is_displayed()) | ||
89 | bitbake.click() | ||
90 | self.assertTrue( | ||
91 | "docs.yoctoproject.org/bitbake.html" in self.driver.current_url) | ||
92 | |||
93 | def test_yoctoproject_jumbotron_link_visible_and_clickable(self): | ||
94 | """ Test Yocto Project link jumbotron is visible and clickable: """ | ||
95 | self.get(reverse('landing')) | ||
96 | self.wait_until_visible('.jumbotron') | ||
97 | jumbotron = self.find('.jumbotron') | ||
98 | |||
99 | # check Yocto Project | ||
100 | yoctoproject = jumbotron.find_element(By.LINK_TEXT, 'Yocto Project') | ||
101 | self.assertTrue(yoctoproject.is_displayed()) | ||
102 | yoctoproject.click() | ||
103 | self.assertTrue("yoctoproject.org" in self.driver.current_url) | ||
104 | |||
105 | def test_link_setup_using_toaster_visible_and_clickable(self): | ||
106 | """ Test big magenta button setting up and using toaster link in jumbotron | ||
107 | if visible and clickable | ||
108 | """ | ||
109 | self.get(reverse('landing')) | ||
110 | self.wait_until_visible('.jumbotron') | ||
111 | jumbotron = self.find('.jumbotron') | ||
112 | |||
113 | # check Big magenta button | ||
114 | big_magenta_button = jumbotron.find_element(By.LINK_TEXT, | ||
115 | 'Toaster is ready to capture your command line builds' | ||
116 | ) | ||
117 | self.assertTrue(big_magenta_button.is_displayed()) | ||
118 | big_magenta_button.click() | ||
119 | self.assertTrue( | ||
120 | "docs.yoctoproject.org/toaster-manual/setup-and-use.html#setting-up-and-using-toaster" in self.driver.current_url) | ||
121 | |||
122 | def test_link_create_new_project_in_jumbotron_visible_and_clickable(self): | ||
123 | """ Test big blue button create new project jumbotron if visible and clickable """ | ||
124 | # Create a layer and a layer version to make visible the big blue button | ||
125 | layer = Layer.objects.create(name='bar') | ||
126 | Layer_Version.objects.create(layer=layer) | ||
127 | |||
128 | self.get(reverse('landing')) | ||
129 | self.wait_until_visible('.jumbotron') | ||
130 | jumbotron = self.find('.jumbotron') | ||
131 | |||
132 | # check Big Blue button | ||
133 | big_blue_button = jumbotron.find_element(By.LINK_TEXT, | ||
134 | 'Create your first Toaster project to run manage builds' | ||
135 | ) | ||
136 | self.assertTrue(big_blue_button.is_displayed()) | ||
137 | big_blue_button.click() | ||
138 | self.assertTrue("toastergui/newproject/" in self.driver.current_url) | ||
139 | |||
140 | def test_toaster_manual_link_visible_and_clickable(self): | ||
141 | """ Test Read the Toaster manual link jumbotron is visible and clickable: """ | ||
142 | self.get(reverse('landing')) | ||
143 | self.wait_until_visible('.jumbotron') | ||
144 | jumbotron = self.find('.jumbotron') | ||
145 | |||
146 | # check Read the Toaster manual | ||
147 | toaster_manual = jumbotron.find_element( | ||
148 | By.LINK_TEXT, 'Read the Toaster manual') | ||
149 | self.assertTrue(toaster_manual.is_displayed()) | ||
150 | toaster_manual.click() | ||
151 | self.assertTrue( | ||
152 | "https://docs.yoctoproject.org/toaster-manual/index.html#toaster-user-manual" in self.driver.current_url) | ||
153 | |||
154 | def test_contrib_to_toaster_link_visible_and_clickable(self): | ||
155 | """ Test Contribute to Toaster link jumbotron is visible and clickable: """ | ||
156 | self.get(reverse('landing')) | ||
157 | self.wait_until_visible('.jumbotron') | ||
158 | jumbotron = self.find('.jumbotron') | ||
159 | |||
160 | # check Contribute to Toaster | ||
161 | contribute_to_toaster = jumbotron.find_element( | ||
162 | By.LINK_TEXT, 'Contribute to Toaster') | ||
163 | self.assertTrue(contribute_to_toaster.is_displayed()) | ||
164 | contribute_to_toaster.click() | ||
165 | self.assertTrue( | ||
166 | "wiki.yoctoproject.org/wiki/contribute_to_toaster" in str(self.driver.current_url).lower()) | ||
167 | |||
32 | def test_only_default_project(self): | 168 | def test_only_default_project(self): |
33 | """ | 169 | """ |
34 | No projects except default | 170 | No projects except default |
35 | => should see the landing page | 171 | => should see the landing page |
36 | """ | 172 | """ |
37 | self.get(reverse('landing')) | 173 | self.get(reverse('landing')) |
174 | self.wait_until_visible('.jumbotron') | ||
38 | self.assertTrue(self.LANDING_PAGE_TITLE in self.get_page_source()) | 175 | self.assertTrue(self.LANDING_PAGE_TITLE in self.get_page_source()) |
39 | 176 | ||
40 | def test_default_project_has_build(self): | 177 | def test_default_project_has_build(self): |
@@ -67,6 +204,7 @@ class TestLandingPage(SeleniumTestCase): | |||
67 | user_project.save() | 204 | user_project.save() |
68 | 205 | ||
69 | self.get(reverse('landing')) | 206 | self.get(reverse('landing')) |
207 | self.wait_until_visible('#projectstable') | ||
70 | 208 | ||
71 | elements = self.find_all('#projectstable') | 209 | elements = self.find_all('#projectstable') |
72 | self.assertEqual(len(elements), 1, 'should redirect to projects') | 210 | self.assertEqual(len(elements), 1, 'should redirect to projects') |
@@ -87,10 +225,9 @@ class TestLandingPage(SeleniumTestCase): | |||
87 | 225 | ||
88 | self.get(reverse('landing')) | 226 | self.get(reverse('landing')) |
89 | 227 | ||
228 | self.wait_until_visible("#latest-builds") | ||
90 | elements = self.find_all('#allbuildstable') | 229 | elements = self.find_all('#allbuildstable') |
91 | self.assertEqual(len(elements), 1, 'should redirect to builds') | 230 | self.assertEqual(len(elements), 1, 'should redirect to builds') |
92 | content = self.get_page_source() | 231 | content = self.get_page_source() |
93 | self.assertTrue(self.PROJECT_NAME in content, | 232 | self.assertTrue(self.PROJECT_NAME in content, |
94 | 'should show builds for project %s' % self.PROJECT_NAME) | 233 | 'should show builds for project %s' % self.PROJECT_NAME) |
95 | self.assertFalse(self.CLI_BUILDS_PROJECT_NAME in content, | ||
96 | 'should not show builds for cli project') | ||