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 | 131 |
1 files changed, 128 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..8fe5fea467 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,6 +31,130 @@ 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 | info_sign = self.find('#toaster-version-info-sign') | ||
38 | |||
39 | # check that the info sign is visible | ||
40 | self.assertTrue(info_sign.is_displayed()) | ||
41 | |||
42 | # check that the info sign is clickable | ||
43 | # and info modal is appearing when clicking on the info sign | ||
44 | info_sign.click() # click on the info sign make attribute 'aria-describedby' visible | ||
45 | info_model_id = info_sign.get_attribute('aria-describedby') | ||
46 | info_modal = self.find(f'#{info_model_id}') | ||
47 | self.assertTrue(info_modal.is_displayed()) | ||
48 | self.assertTrue("Toaster version information" in info_modal.text) | ||
49 | |||
50 | def test_documentation_link_displayed(self): | ||
51 | """ Test that the documentation link is displayed """ | ||
52 | self.get(reverse('landing')) | ||
53 | documentation_link = self.find('#navbar-docs > a') | ||
54 | |||
55 | # check that the documentation link is visible | ||
56 | self.assertTrue(documentation_link.is_displayed()) | ||
57 | |||
58 | # check browser open new tab toaster manual when clicking on the documentation link | ||
59 | self.assertEqual(documentation_link.get_attribute('target'), '_blank') | ||
60 | self.assertEqual( | ||
61 | documentation_link.get_attribute('href'), | ||
62 | 'http://docs.yoctoproject.org/toaster-manual/index.html#toaster-user-manual') | ||
63 | self.assertTrue("Documentation" in documentation_link.text) | ||
64 | |||
65 | def test_openembedded_jumbotron_link_visible_and_clickable(self): | ||
66 | """ Test OpenEmbedded link jumbotron is visible and clickable: """ | ||
67 | self.get(reverse('landing')) | ||
68 | jumbotron = self.find('.jumbotron') | ||
69 | |||
70 | # check OpenEmbedded | ||
71 | openembedded = jumbotron.find_element(By.LINK_TEXT, 'OpenEmbedded') | ||
72 | self.assertTrue(openembedded.is_displayed()) | ||
73 | openembedded.click() | ||
74 | self.assertTrue("openembedded.org" in self.driver.current_url) | ||
75 | |||
76 | def test_bitbake_jumbotron_link_visible_and_clickable(self): | ||
77 | """ Test BitBake link jumbotron is visible and clickable: """ | ||
78 | self.get(reverse('landing')) | ||
79 | jumbotron = self.find('.jumbotron') | ||
80 | |||
81 | # check BitBake | ||
82 | bitbake = jumbotron.find_element(By.LINK_TEXT, 'BitBake') | ||
83 | self.assertTrue(bitbake.is_displayed()) | ||
84 | bitbake.click() | ||
85 | self.assertTrue( | ||
86 | "docs.yoctoproject.org/bitbake.html" in self.driver.current_url) | ||
87 | |||
88 | def test_yoctoproject_jumbotron_link_visible_and_clickable(self): | ||
89 | """ Test Yocto Project link jumbotron is visible and clickable: """ | ||
90 | self.get(reverse('landing')) | ||
91 | jumbotron = self.find('.jumbotron') | ||
92 | |||
93 | # check Yocto Project | ||
94 | yoctoproject = jumbotron.find_element(By.LINK_TEXT, 'Yocto Project') | ||
95 | self.assertTrue(yoctoproject.is_displayed()) | ||
96 | yoctoproject.click() | ||
97 | self.assertTrue("yoctoproject.org" in self.driver.current_url) | ||
98 | |||
99 | def test_link_setup_using_toaster_visible_and_clickable(self): | ||
100 | """ Test big magenta button setting up and using toaster link in jumbotron | ||
101 | if visible and clickable | ||
102 | """ | ||
103 | self.get(reverse('landing')) | ||
104 | jumbotron = self.find('.jumbotron') | ||
105 | |||
106 | # check Big magenta button | ||
107 | big_magenta_button = jumbotron.find_element(By.LINK_TEXT, | ||
108 | 'Toaster is ready to capture your command line builds' | ||
109 | ) | ||
110 | self.assertTrue(big_magenta_button.is_displayed()) | ||
111 | big_magenta_button.click() | ||
112 | self.assertTrue( | ||
113 | "docs.yoctoproject.org/toaster-manual/setup-and-use.html#setting-up-and-using-toaster" in self.driver.current_url) | ||
114 | |||
115 | def test_link_create_new_project_in_jumbotron_visible_and_clickable(self): | ||
116 | """ Test big blue button create new project jumbotron if visible and clickable """ | ||
117 | # Create a layer and a layer version to make visible the big blue button | ||
118 | layer = Layer.objects.create(name='bar') | ||
119 | Layer_Version.objects.create(layer=layer) | ||
120 | |||
121 | self.get(reverse('landing')) | ||
122 | jumbotron = self.find('.jumbotron') | ||
123 | |||
124 | # check Big Blue button | ||
125 | big_blue_button = jumbotron.find_element(By.LINK_TEXT, | ||
126 | 'Create your first Toaster project to run manage builds' | ||
127 | ) | ||
128 | self.assertTrue(big_blue_button.is_displayed()) | ||
129 | big_blue_button.click() | ||
130 | self.assertTrue("toastergui/newproject/" in self.driver.current_url) | ||
131 | |||
132 | def test_toaster_manual_link_visible_and_clickable(self): | ||
133 | """ Test Read the Toaster manual link jumbotron is visible and clickable: """ | ||
134 | self.get(reverse('landing')) | ||
135 | jumbotron = self.find('.jumbotron') | ||
136 | |||
137 | # check Read the Toaster manual | ||
138 | toaster_manual = jumbotron.find_element( | ||
139 | By.LINK_TEXT, 'Read the Toaster manual') | ||
140 | self.assertTrue(toaster_manual.is_displayed()) | ||
141 | toaster_manual.click() | ||
142 | self.assertTrue( | ||
143 | "https://docs.yoctoproject.org/toaster-manual/index.html#toaster-user-manual" in self.driver.current_url) | ||
144 | |||
145 | def test_contrib_to_toaster_link_visible_and_clickable(self): | ||
146 | """ Test Contribute to Toaster link jumbotron is visible and clickable: """ | ||
147 | self.get(reverse('landing')) | ||
148 | jumbotron = self.find('.jumbotron') | ||
149 | |||
150 | # check Contribute to Toaster | ||
151 | contribute_to_toaster = jumbotron.find_element( | ||
152 | By.LINK_TEXT, 'Contribute to Toaster') | ||
153 | self.assertTrue(contribute_to_toaster.is_displayed()) | ||
154 | contribute_to_toaster.click() | ||
155 | self.assertTrue( | ||
156 | "wiki.yoctoproject.org/wiki/contribute_to_toaster" in str(self.driver.current_url).lower()) | ||
157 | |||
32 | def test_only_default_project(self): | 158 | def test_only_default_project(self): |
33 | """ | 159 | """ |
34 | No projects except default | 160 | No projects except default |
@@ -87,10 +213,9 @@ class TestLandingPage(SeleniumTestCase): | |||
87 | 213 | ||
88 | self.get(reverse('landing')) | 214 | self.get(reverse('landing')) |
89 | 215 | ||
216 | self.wait_until_visible("#latest-builds", poll=3) | ||
90 | elements = self.find_all('#allbuildstable') | 217 | elements = self.find_all('#allbuildstable') |
91 | self.assertEqual(len(elements), 1, 'should redirect to builds') | 218 | self.assertEqual(len(elements), 1, 'should redirect to builds') |
92 | content = self.get_page_source() | 219 | content = self.get_page_source() |
93 | self.assertTrue(self.PROJECT_NAME in content, | 220 | self.assertTrue(self.PROJECT_NAME in content, |
94 | 'should show builds for project %s' % self.PROJECT_NAME) | 221 | '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') | ||