toaster.lists.yoctoproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] toaster: use docs for BitBake link on landing page
@ 2023-11-11 19:17 Tim Orling
  2023-11-11 19:17 ` [PATCH 2/3] toaster: fix obsolete use of find_element_by_link_text Tim Orling
  2023-11-11 19:17 ` [PATCH 3/3] toaster: test_create_new_project typos, whitespace Tim Orling
  0 siblings, 2 replies; 3+ messages in thread
From: Tim Orling @ 2023-11-11 19:17 UTC (permalink / raw)
  To: bitbake-devel, toaster; +Cc: Tim Orling

With the webpage refresh in November 2023, the old BitBake link
https://www.yoctoproject.org/tools-resources/projects/bitbake on
the landing page is no longer valid.

Point the BitBake link in the landing page to https://docs.yoctoproject.org/bitbake.html

Fix the test_landing_page.py test case to test for the new link.

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
---
 lib/toaster/tests/browser/test_landing_page.py | 2 +-
 lib/toaster/toastergui/templates/landing.html  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/toaster/tests/browser/test_landing_page.py b/lib/toaster/tests/browser/test_landing_page.py
index 7b425344..e010c59c 100644
--- a/lib/toaster/tests/browser/test_landing_page.py
+++ b/lib/toaster/tests/browser/test_landing_page.py
@@ -80,7 +80,7 @@ class TestLandingPage(SeleniumTestCase):
         bitbake = jumbotron.find_element_by_link_text('BitBake')
         self.assertTrue(bitbake.is_displayed())
         bitbake.click()
-        self.assertTrue("yoctoproject.org/software-item/bitbake" in self.driver.current_url)
+        self.assertTrue("docs.yoctoproject.org/bitbake.html" in self.driver.current_url)
 
     def test_yoctoproject_jumbotron_link_visible_and_clickable(self):
         """ Test Yocto Project link jumbotron is visible and clickable: """
diff --git a/lib/toaster/toastergui/templates/landing.html b/lib/toaster/toastergui/templates/landing.html
index 08b40fb2..22bbed69 100644
--- a/lib/toaster/toastergui/templates/landing.html
+++ b/lib/toaster/toastergui/templates/landing.html
@@ -12,7 +12,7 @@
             <div class="col-md-6">
               <h1>This is Toaster</h1>
 
-              <p>A web interface to <a href="https://www.openembedded.org">OpenEmbedded</a> and <a href="https://www.yoctoproject.org/tools-resources/projects/bitbake">BitBake</a>, the <a href="https://www.yoctoproject.org">Yocto Project</a> build system.</p>
+              <p>A web interface to <a href="https://www.openembedded.org">OpenEmbedded</a> and <a href="https://docs.yoctoproject.org/bitbake.html">BitBake</a>, the <a href="https://www.yoctoproject.org">Yocto Project</a> build system.</p>
 
 		          <p class="top-air">
 		            <a class="btn btn-info btn-lg" href="http://docs.yoctoproject.org/toaster-manual/setup-and-use.html#setting-up-and-using-toaster">
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/3] toaster: fix obsolete use of find_element_by_link_text
  2023-11-11 19:17 [PATCH 1/3] toaster: use docs for BitBake link on landing page Tim Orling
@ 2023-11-11 19:17 ` Tim Orling
  2023-11-11 19:17 ` [PATCH 3/3] toaster: test_create_new_project typos, whitespace Tim Orling
  1 sibling, 0 replies; 3+ messages in thread
From: Tim Orling @ 2023-11-11 19:17 UTC (permalink / raw)
  To: bitbake-devel, toaster; +Cc: Tim Orling

The find_element_by_* commands were deprecated in 4.1.4 and have been
removed in 4.3.0:
https://github.com/SeleniumHQ/selenium/blob/selenium-4.3.0/py/CHANGES#L2
as they relied on the use of APIs only intended for internal use.

The recommended method is to use find_elements(By.*) instead.

https://www.selenium.dev/documentation/webdriver/elements/finders/#find-elements-from-element

Also fix some trailing whitespace errors.

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
---
 .../tests/browser/test_landing_page.py        | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/lib/toaster/tests/browser/test_landing_page.py b/lib/toaster/tests/browser/test_landing_page.py
index e010c59c..7ec52a4b 100644
--- a/lib/toaster/tests/browser/test_landing_page.py
+++ b/lib/toaster/tests/browser/test_landing_page.py
@@ -10,6 +10,7 @@
 from django.urls import reverse
 from django.utils import timezone
 from tests.browser.selenium_helpers import SeleniumTestCase
+from selenium.webdriver.common.by import By
 
 from orm.models import Layer, Layer_Version, Project, Build
 
@@ -52,11 +53,11 @@ class TestLandingPage(SeleniumTestCase):
 
         # check that the documentation link is visible
         self.assertTrue(documentation_link.is_displayed())
-        
+
         # check browser open new tab toaster manual when clicking on the documentation link
         self.assertEqual(documentation_link.get_attribute('target') , '_blank')
         self.assertEqual(
-            documentation_link.get_attribute('href'), 
+            documentation_link.get_attribute('href'),
             'http://docs.yoctoproject.org/toaster-manual/index.html#toaster-user-manual')
         self.assertTrue("Documentation" in documentation_link.text)
 
@@ -66,7 +67,7 @@ class TestLandingPage(SeleniumTestCase):
         jumbotron = self.find('.jumbotron')
 
         # check OpenEmbedded
-        openembedded = jumbotron.find_element_by_link_text('OpenEmbedded')
+        openembedded = jumbotron.find_element(By.LINK_TEXT, 'OpenEmbedded')
         self.assertTrue(openembedded.is_displayed())
         openembedded.click()
         self.assertTrue("openembedded.org" in self.driver.current_url)
@@ -77,7 +78,7 @@ class TestLandingPage(SeleniumTestCase):
         jumbotron = self.find('.jumbotron')
 
         # check BitBake
-        bitbake = jumbotron.find_element_by_link_text('BitBake')
+        bitbake = jumbotron.find_element(By.LINK_TEXT, 'BitBake')
         self.assertTrue(bitbake.is_displayed())
         bitbake.click()
         self.assertTrue("docs.yoctoproject.org/bitbake.html" in self.driver.current_url)
@@ -88,7 +89,7 @@ class TestLandingPage(SeleniumTestCase):
         jumbotron = self.find('.jumbotron')
 
         # check Yocto Project
-        yoctoproject = jumbotron.find_element_by_link_text('Yocto Project')
+        yoctoproject = jumbotron.find_element(By.LINK_TEXT, 'Yocto Project')
         self.assertTrue(yoctoproject.is_displayed())
         yoctoproject.click()
         self.assertTrue("yoctoproject.org" in self.driver.current_url)
@@ -101,7 +102,7 @@ class TestLandingPage(SeleniumTestCase):
         jumbotron = self.find('.jumbotron')
 
         # check Big magenta button
-        big_magenta_button = jumbotron.find_element_by_link_text(
+        big_magenta_button = jumbotron.find_element(By.LINK_TEXT,
             'Toaster is ready to capture your command line builds'
         )
         self.assertTrue(big_magenta_button.is_displayed())
@@ -118,7 +119,7 @@ class TestLandingPage(SeleniumTestCase):
         jumbotron = self.find('.jumbotron')
 
         # check Big Blue button
-        big_blue_button = jumbotron.find_element_by_link_text(
+        big_blue_button = jumbotron.find_element(By.LINK_TEXT,
             'Create your first Toaster project to run manage builds'
         )
         self.assertTrue(big_blue_button.is_displayed())
@@ -131,7 +132,7 @@ class TestLandingPage(SeleniumTestCase):
         jumbotron = self.find('.jumbotron')
 
         # check Read the Toaster manual
-        toaster_manual = jumbotron.find_element_by_link_text('Read the Toaster manual')
+        toaster_manual = jumbotron.find_element(By.LINK_TEXT, 'Read the Toaster manual')
         self.assertTrue(toaster_manual.is_displayed())
         toaster_manual.click()
         self.assertTrue("https://docs.yoctoproject.org/toaster-manual/index.html#toaster-user-manual" in self.driver.current_url)
@@ -142,7 +143,7 @@ class TestLandingPage(SeleniumTestCase):
         jumbotron = self.find('.jumbotron')
 
         # check Contribute to Toaster
-        contribute_to_toaster = jumbotron.find_element_by_link_text('Contribute to Toaster')
+        contribute_to_toaster = jumbotron.find_element(By.LINK_TEXT, 'Contribute to Toaster')
         self.assertTrue(contribute_to_toaster.is_displayed())
         contribute_to_toaster.click()
         self.assertTrue("wiki.yoctoproject.org/wiki/contribute_to_toaster" in str(self.driver.current_url).lower())
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 3/3] toaster: test_create_new_project typos, whitespace
  2023-11-11 19:17 [PATCH 1/3] toaster: use docs for BitBake link on landing page Tim Orling
  2023-11-11 19:17 ` [PATCH 2/3] toaster: fix obsolete use of find_element_by_link_text Tim Orling
@ 2023-11-11 19:17 ` Tim Orling
  1 sibling, 0 replies; 3+ messages in thread
From: Tim Orling @ 2023-11-11 19:17 UTC (permalink / raw)
  To: bitbake-devel, toaster; +Cc: Tim Orling

* Cleanup an extraneous # at the end of the hash bang line.
* Cleanup some trailing whitespace errors.
* Fix typo inf dunfull -> dunfell.

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
---
 .../tests/functional/test_create_new_project.py        | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/toaster/tests/functional/test_create_new_project.py b/lib/toaster/tests/functional/test_create_new_project.py
index a211d8b7..051709b4 100644
--- a/lib/toaster/tests/functional/test_create_new_project.py
+++ b/lib/toaster/tests/functional/test_create_new_project.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python3 #
+#! /usr/bin/env python3
 # BitBake Toaster UI tests implementation
 #
 # Copyright (C) 2023 Savoir-faire Linux
@@ -49,7 +49,7 @@ class TestCreateNewProject(SeleniumFunctionalTestCase):
 
         element = self.wait_until_visible('#project-created-notification')
         self.assertTrue(
-            self.element_exists('#project-created-notification'), 
+            self.element_exists('#project-created-notification'),
             f"Project:{project_name} creation notification not shown"
         )
         self.assertTrue(
@@ -57,7 +57,7 @@ class TestCreateNewProject(SeleniumFunctionalTestCase):
             f"New project name:{project_name} not in new project notification"
         )
         self.assertTrue(
-            Project.objects.filter(name=project_name).count(), 
+            Project.objects.filter(name=project_name).count(),
             f"New project:{project_name} not found in database"
         )
 
@@ -101,7 +101,7 @@ class TestCreateNewProject(SeleniumFunctionalTestCase):
             True,
         )
 
-    def test_create_new_project_dunfull(self):
+    def test_create_new_project_dunfell(self):
         """ Test create new project using:
           - Project Name: Any string
           - Release: Yocto Project 3.1 "Dunfell" (option value: 5)
@@ -116,7 +116,7 @@ class TestCreateNewProject(SeleniumFunctionalTestCase):
             release_title,
             False,
         )
-    
+
     def test_create_new_project_local(self):
         """ Test create new project using:
           - Project Name: Any string
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-11 19:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-11 19:17 [PATCH 1/3] toaster: use docs for BitBake link on landing page Tim Orling
2023-11-11 19:17 ` [PATCH 2/3] toaster: fix obsolete use of find_element_by_link_text Tim Orling
2023-11-11 19:17 ` [PATCH 3/3] toaster: test_create_new_project typos, whitespace Tim Orling

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).