diff mbox series

[1/3] Toaster: Check info_sign is visible and clickable in landing page

Message ID 20231030222618.404081-1-alassane.yattara@savoirfairelinux.com
State New
Headers show
Series [1/3] Toaster: Check info_sign is visible and clickable in landing page | expand

Commit Message

Alassane Yattara Oct. 30, 2023, 10:26 p.m. UTC
Check the information icon is visible and clickable
Also if popup appearing when clicked and contain "Toaster version information"

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
---
 lib/toaster/tests/browser/test_landing_page.py | 17 +++++++++++++++++
 lib/toaster/toastergui/templates/base.html     |  2 +-
 2 files changed, 18 insertions(+), 1 deletion(-)

Comments

Tim Orling Oct. 31, 2023, 3:28 p.m. UTC | #1
On Mon, Oct 30, 2023 at 3:26 PM Alassane Yattara <
alassane.yattara@savoirfairelinux.com> wrote:

> Check the information icon is visible and clickable
> Also if popup appearing when clicked and contain "Toaster version
> information"
>
> Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
> ---
>  lib/toaster/tests/browser/test_landing_page.py | 17 +++++++++++++++++
>  lib/toaster/toastergui/templates/base.html     |  2 +-
>  2 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/lib/toaster/tests/browser/test_landing_page.py
> b/lib/toaster/tests/browser/test_landing_page.py
> index 8bb64b9f..2f092400 100644
> --- a/lib/toaster/tests/browser/test_landing_page.py
> +++ b/lib/toaster/tests/browser/test_landing_page.py
> @@ -7,6 +7,7 @@
>  # Copyright (C) 2013-2016 Intel Corporation
>  #
>
> +from time import sleep
>

This import is unused in this commit. Also, in general we want to avoid
tests that rely on specific timing anyway.


>  from django.urls import reverse
>  from django.utils import timezone
>  from tests.browser.selenium_helpers import SeleniumTestCase
> @@ -29,6 +30,22 @@ class TestLandingPage(SeleniumTestCase):
>          self.project.is_default = True
>          self.project.save()
>
>
The test case itself seems reasonable.


> +    def test_icon_info_visible_and_clickable(self):
> +        """ Test that the information icon is visible and clickable """
> +        self.get(reverse('landing'))
> +        info_sign = self.find('#toaster-version-info-sign')
> +
> +        # check that the info sign is visible
> +        self.assertTrue(info_sign.is_displayed())
> +
> +        # check that the info sign is clickable
> +        # and info modal is appearing when clicking on the info sign
> +        info_sign.click() # click on the info sign make attribute
> 'aria-describedby' visible
> +        info_model_id = info_sign.get_attribute('aria-describedby')
> +        info_modal = self.find(f'#{info_model_id}')
> +        self.assertTrue(info_modal.is_displayed())
> +        self.assertTrue("Toaster version information" in info_modal.text)
> +
>      def test_only_default_project(self):
>          """
>          No projects except default
> diff --git a/lib/toaster/toastergui/templates/base.html
> b/lib/toaster/toastergui/templates/base.html
> index e8600f3e..041448d1 100644
> --- a/lib/toaster/toastergui/templates/base.html
> +++ b/lib/toaster/toastergui/templates/base.html
> @@ -94,7 +94,7 @@
>              </a>
>              <a class="brand" href="/">Toaster</a>
>              {% if DEBUG %}
> -            <span class="glyphicon glyphicon-info-sign"
> title="<strong>Toaster version information</strong>"
> data-content="<dl><dt>Git branch</dt><dd>{{TOASTER_BRANCH}}</dd><dt>Git
> revision</dt><dd>{{TOASTER_REVISION}}</dd></dl>"></i>
> +            <span id="toaster-version-info-sign" class="glyphicon
> glyphicon-info-sign" title="<strong>Toaster version information</strong>"
> data-content="<dl><dt>Git branch</dt><dd>{{TOASTER_BRANCH}}</dd><dt>Git
> revision</dt><dd>{{TOASTER_REVISION}}</dd></dl>">


Adding an id for the span is very helpful for both testing and using e.g.
Developer Tools in Chromium or Firefox. Good idea.


> </i>
>              {% endif %}
>            </div>
>          </div>
> --
> 2.34.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#15333):
> https://lists.openembedded.org/g/bitbake-devel/message/15333
> Mute This Topic: https://lists.openembedded.org/mt/102286644/924729
> Group Owner: bitbake-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [
> ticotimo@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Alassane Yattara Oct. 31, 2023, 6:25 p.m. UTC | #2
Tim,

> This import is unused in this commit. Also, in general we want to avoidtests that rely on specific timing anyway.
Yes, i already created a [patch 4/4] to delete this import.
https://lists.yoctoproject.org/g/toaster/topic/patch_4_4_toaster_remove/102297871?p=,,,20,0,0,0::recentpostdate/sticky,,,20,2,0,102297871,previd%3D1698774201827565394,nextid%3D1698695506149157438&previd=1698774201827565394&nextid=1698695506149157438   

----- Mail original -----
De: "Tim Orling" <ticotimo@gmail.com>
À: "Alassane Yattara" <alassane.yattara@savoirfairelinux.com>
Cc: "bitbake-devel" <bitbake-devel@lists.openembedded.org>, "toaster" <toaster@lists.yoctoproject.org>
Envoyé: Mardi 31 Octobre 2023 16:28:57
Objet: Re: [bitbake-devel] [PATCH 1/3] Toaster: Check info_sign is visible and clickable in landing page

On Mon, Oct 30, 2023 at 3:26 PM Alassane Yattara <
alassane.yattara@savoirfairelinux.com> wrote:

> Check the information icon is visible and clickable
> Also if popup appearing when clicked and contain "Toaster version
> information"
>
> Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
> ---
>  lib/toaster/tests/browser/test_landing_page.py | 17 +++++++++++++++++
>  lib/toaster/toastergui/templates/base.html     |  2 +-
>  2 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/lib/toaster/tests/browser/test_landing_page.py
> b/lib/toaster/tests/browser/test_landing_page.py
> index 8bb64b9f..2f092400 100644
> --- a/lib/toaster/tests/browser/test_landing_page.py
> +++ b/lib/toaster/tests/browser/test_landing_page.py
> @@ -7,6 +7,7 @@
>  # Copyright (C) 2013-2016 Intel Corporation
>  #
>
> +from time import sleep
>

This import is unused in this commit. Also, in general we want to avoid
tests that rely on specific timing anyway.


>  from django.urls import reverse
>  from django.utils import timezone
>  from tests.browser.selenium_helpers import SeleniumTestCase
> @@ -29,6 +30,22 @@ class TestLandingPage(SeleniumTestCase):
>          self.project.is_default = True
>          self.project.save()
>
>
The test case itself seems reasonable.


> +    def test_icon_info_visible_and_clickable(self):
> +        """ Test that the information icon is visible and clickable """
> +        self.get(reverse('landing'))
> +        info_sign = self.find('#toaster-version-info-sign')
> +
> +        # check that the info sign is visible
> +        self.assertTrue(info_sign.is_displayed())
> +
> +        # check that the info sign is clickable
> +        # and info modal is appearing when clicking on the info sign
> +        info_sign.click() # click on the info sign make attribute
> 'aria-describedby' visible
> +        info_model_id = info_sign.get_attribute('aria-describedby')
> +        info_modal = self.find(f'#{info_model_id}')
> +        self.assertTrue(info_modal.is_displayed())
> +        self.assertTrue("Toaster version information" in info_modal.text)
> +
>      def test_only_default_project(self):
>          """
>          No projects except default
> diff --git a/lib/toaster/toastergui/templates/base.html
> b/lib/toaster/toastergui/templates/base.html
> index e8600f3e..041448d1 100644
> --- a/lib/toaster/toastergui/templates/base.html
> +++ b/lib/toaster/toastergui/templates/base.html
> @@ -94,7 +94,7 @@
>              </a>
>              <a class="brand" href="/">Toaster</a>
>              {% if DEBUG %}
> -            <span class="glyphicon glyphicon-info-sign"
> title="<strong>Toaster version information</strong>"
> data-content="<dl><dt>Git branch</dt><dd>{{TOASTER_BRANCH}}</dd><dt>Git
> revision</dt><dd>{{TOASTER_REVISION}}</dd></dl>"></i>
> +            <span id="toaster-version-info-sign" class="glyphicon
> glyphicon-info-sign" title="<strong>Toaster version information</strong>"
> data-content="<dl><dt>Git branch</dt><dd>{{TOASTER_BRANCH}}</dd><dt>Git
> revision</dt><dd>{{TOASTER_REVISION}}</dd></dl>">


Adding an id for the span is very helpful for both testing and using e.g.
Developer Tools in Chromium or Firefox. Good idea.


> </i>
>              {% endif %}
>            </div>
>          </div>
> --
> 2.34.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#15333):
> https://lists.openembedded.org/g/bitbake-devel/message/15333
> Mute This Topic: https://lists.openembedded.org/mt/102286644/924729
> Group Owner: bitbake-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [
> ticotimo@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
diff mbox series

Patch

diff --git a/lib/toaster/tests/browser/test_landing_page.py b/lib/toaster/tests/browser/test_landing_page.py
index 8bb64b9f..2f092400 100644
--- a/lib/toaster/tests/browser/test_landing_page.py
+++ b/lib/toaster/tests/browser/test_landing_page.py
@@ -7,6 +7,7 @@ 
 # Copyright (C) 2013-2016 Intel Corporation
 #
 
+from time import sleep
 from django.urls import reverse
 from django.utils import timezone
 from tests.browser.selenium_helpers import SeleniumTestCase
@@ -29,6 +30,22 @@  class TestLandingPage(SeleniumTestCase):
         self.project.is_default = True
         self.project.save()
 
+    def test_icon_info_visible_and_clickable(self):
+        """ Test that the information icon is visible and clickable """
+        self.get(reverse('landing'))
+        info_sign = self.find('#toaster-version-info-sign')
+
+        # check that the info sign is visible
+        self.assertTrue(info_sign.is_displayed())
+
+        # check that the info sign is clickable
+        # and info modal is appearing when clicking on the info sign
+        info_sign.click() # click on the info sign make attribute 'aria-describedby' visible
+        info_model_id = info_sign.get_attribute('aria-describedby')
+        info_modal = self.find(f'#{info_model_id}')
+        self.assertTrue(info_modal.is_displayed())
+        self.assertTrue("Toaster version information" in info_modal.text)
+
     def test_only_default_project(self):
         """
         No projects except default
diff --git a/lib/toaster/toastergui/templates/base.html b/lib/toaster/toastergui/templates/base.html
index e8600f3e..041448d1 100644
--- a/lib/toaster/toastergui/templates/base.html
+++ b/lib/toaster/toastergui/templates/base.html
@@ -94,7 +94,7 @@ 
             </a>
             <a class="brand" href="/">Toaster</a>
             {% if DEBUG %}
-            <span class="glyphicon glyphicon-info-sign" title="<strong>Toaster version information</strong>" data-content="<dl><dt>Git branch</dt><dd>{{TOASTER_BRANCH}}</dd><dt>Git revision</dt><dd>{{TOASTER_REVISION}}</dd></dl>"></i>
+            <span id="toaster-version-info-sign" class="glyphicon glyphicon-info-sign" title="<strong>Toaster version information</strong>" data-content="<dl><dt>Git branch</dt><dd>{{TOASTER_BRANCH}}</dd><dt>Git revision</dt><dd>{{TOASTER_REVISION}}</dd></dl>"></i>
             {% endif %}
           </div>
         </div>