All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/3] Toaster: Write UI TestCase create new project
@ 2023-11-09 22:15 Alassane Yattara
  2023-11-09 22:15 ` [PATCH v3 2/3] Toaster: Test create new project without project name Alassane Yattara
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Alassane Yattara @ 2023-11-09 22:15 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Alassane Yattara

Test create new project using:
- Project Name: Any string
- Release: Master/Kirkstone/Dunfell/Local
- Merge Toaster settings: False/True

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
---
 .../functional/test_create_new_project.py     | 134 ++++++++++++++++++
 1 file changed, 134 insertions(+)
 create mode 100644 lib/toaster/tests/functional/test_create_new_project.py

diff --git a/lib/toaster/tests/functional/test_create_new_project.py b/lib/toaster/tests/functional/test_create_new_project.py
new file mode 100644
index 00000000..81355eaf
--- /dev/null
+++ b/lib/toaster/tests/functional/test_create_new_project.py
@@ -0,0 +1,134 @@
+#! /usr/bin/env python3 #
+# BitBake Toaster UI tests implementation
+#
+# Copyright (C) 2023 Savoir-faire Linux
+#
+# SPDX-License-Identifier: GPL-2.0-only
+#
+
+import re
+import pytest
+from django.urls import reverse
+from selenium.webdriver.support.ui import Select
+from tests.functional.functional_helpers import SeleniumFunctionalTestCase
+from orm.models import Project
+from selenium.webdriver.common.by import By
+
+@pytest.mark.django_db
+class TestCreateNewProject(SeleniumFunctionalTestCase):
+
+    def _create_test_new_project(
+        self,
+        project_name,
+        release,
+        release_title,
+        merge_toaster_settings,
+    ):
+        """ Create/Test new project using:
+          - Project Name: Any string
+          - Release: Any string
+          - Merge Toaster settings: True or False
+        """
+        self.get(reverse('newproject'))
+        self.driver.find_element(By.ID,
+                                 "new-project-name").send_keys(project_name)
+
+        select = Select(self.find('#projectversion'))
+        select.select_by_value(release)
+
+        # check merge toaster settings
+        checkbox = self.find('.checkbox-mergeattr')
+        if merge_toaster_settings:
+            if not checkbox.is_selected():
+                checkbox.click()
+        else:
+            if checkbox.is_selected():
+                checkbox.click()
+
+        self.driver.find_element(By.ID, "create-project-button").click()
+
+        element = self.wait_until_visible('#project-created-notification')
+        self.assertTrue(
+            self.element_exists('#project-created-notification'), 
+            f"Project:{project_name} creation notification not shown"
+        )
+        self.assertTrue(
+            project_name in element.text,
+            f"New project name:{project_name} not in new project notification"
+        )
+        self.assertTrue(
+            Project.objects.filter(name=project_name).count(), 
+            f"New project:{project_name} not found in database"
+        )
+
+        # check release
+        self.assertTrue(re.search(
+            release_title,
+            self.driver.find_element(By.XPATH,
+                                     "//span[@id='project-release-title']"
+                                     ).text),
+                        'The project release is not defined')
+
+    def test_create_new_project_master(self):
+        """ Test create new project using:
+          - Project Name: Any string
+          - Release: Yocto Project master (option value: 3)
+          - Merge Toaster settings: False
+        """
+        release = '3'
+        release_title = 'Yocto Project master'
+        project_name = 'projectmaster'
+        self._create_test_new_project(
+            project_name,
+            release,
+            release_title,
+            False,
+        )
+
+    def test_create_new_project_kirkstone(self):
+        """ Test create new project using:
+          - Project Name: Any string
+          - Release: Yocto Project 4.0 "Kirkstone" (option value: 1)
+          - Merge Toaster settings: True
+        """
+        release = '1'
+        release_title = 'Yocto Project 4.0 "Kirkstone"'
+        project_name = 'projectkirkstone'
+        self._create_test_new_project(
+            project_name,
+            release,
+            release_title,
+            True,
+        )
+
+    def test_create_new_project_dunfull(self):
+        """ Test create new project using:
+          - Project Name: Any string
+          - Release: Yocto Project 3.1 "Dunfell" (option value: 5)
+          - Merge Toaster settings: False
+        """
+        release = '5'
+        release_title = 'Yocto Project 3.1 "Dunfell"'
+        project_name = 'projectdunfull'
+        self._create_test_new_project(
+            project_name,
+            release,
+            release_title,
+            False,
+        )
+    
+    def test_create_new_project_local(self):
+        """ Test create new project using:
+          - Project Name: Any string
+          - Release: Local Yocto Project (option value: 2)
+          - Merge Toaster settings: True
+        """
+        release = '2'
+        release_title = 'Local Yocto Project'
+        project_name = 'projectlocal'
+        self._create_test_new_project(
+            project_name,
+            release,
+            release_title,
+            True,
+        )
-- 
2.34.1



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

* [PATCH v3 2/3] Toaster: Test create new project without project name
  2023-11-09 22:15 [PATCH v3 1/3] Toaster: Write UI TestCase create new project Alassane Yattara
@ 2023-11-09 22:15 ` Alassane Yattara
  2023-11-09 22:15 ` [PATCH v3 3/3] Toaster: Write UI TestCase import new project using Alassane Yattara
  2023-11-10  8:09 ` [bitbake-devel] [PATCH v3 1/3] Toaster: Write UI TestCase create new project Alexandre Belloni
  2 siblings, 0 replies; 5+ messages in thread
From: Alassane Yattara @ 2023-11-09 22:15 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Alassane Yattara

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
---
 .../tests/functional/test_create_new_project.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/lib/toaster/tests/functional/test_create_new_project.py b/lib/toaster/tests/functional/test_create_new_project.py
index 81355eaf..f33eb16d 100644
--- a/lib/toaster/tests/functional/test_create_new_project.py
+++ b/lib/toaster/tests/functional/test_create_new_project.py
@@ -132,3 +132,20 @@ class TestCreateNewProject(SeleniumFunctionalTestCase):
             release_title,
             True,
         )
+
+    def test_create_new_project_without_name(self):
+        """ Test create new project without project name """
+        self.get(reverse('newproject'))
+
+        select = Select(self.find('#projectversion'))
+        select.select_by_value(str(3))
+
+        # Check input name has required attribute
+        input_name = self.driver.find_element(By.ID, "new-project-name")
+        self.assertIsNotNone(input_name.get_attribute('required'),
+                        'Input name has not required attribute')
+
+        # Check create button is disabled
+        create_btn = self.driver.find_element(By.ID, "create-project-button")
+        self.assertIsNotNone(create_btn.get_attribute('disabled'),
+                        'Create button is not disabled')
-- 
2.34.1



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

* [PATCH v3 3/3] Toaster: Write UI TestCase import new project using
  2023-11-09 22:15 [PATCH v3 1/3] Toaster: Write UI TestCase create new project Alassane Yattara
  2023-11-09 22:15 ` [PATCH v3 2/3] Toaster: Test create new project without project name Alassane Yattara
@ 2023-11-09 22:15 ` Alassane Yattara
  2023-11-10  8:09 ` [bitbake-devel] [PATCH v3 1/3] Toaster: Write UI TestCase create new project Alexandre Belloni
  2 siblings, 0 replies; 5+ messages in thread
From: Alassane Yattara @ 2023-11-09 22:15 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Alassane Yattara

* Test import new project using:
  - Project Name: Any string
  - Project type: select (Import command line project)
  - Import existing project directory: Wrong Path

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
---
 .../functional/test_create_new_project.py     | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/lib/toaster/tests/functional/test_create_new_project.py b/lib/toaster/tests/functional/test_create_new_project.py
index f33eb16d..a211d8b7 100644
--- a/lib/toaster/tests/functional/test_create_new_project.py
+++ b/lib/toaster/tests/functional/test_create_new_project.py
@@ -149,3 +149,28 @@ class TestCreateNewProject(SeleniumFunctionalTestCase):
         create_btn = self.driver.find_element(By.ID, "create-project-button")
         self.assertIsNotNone(create_btn.get_attribute('disabled'),
                         'Create button is not disabled')
+
+    def test_import_new_project(self):
+        """ Test import new project using:
+          - Project Name: Any string
+          - Project type: select (Import command line project)
+          - Import existing project directory: Wrong Path
+        """
+        project_name = 'projectimport'
+        self.get(reverse('newproject'))
+        self.driver.find_element(By.ID,
+                                 "new-project-name").send_keys(project_name)
+        # select import project
+        self.find('#type-import').click()
+
+        # set wrong path
+        wrong_path = '/wrongpath'
+        self.driver.find_element(By.ID,
+                                 "import-project-dir").send_keys(wrong_path)
+        self.driver.find_element(By.ID, "create-project-button").click()
+
+        # check error message
+        self.assertTrue(self.element_exists('.alert-danger'),
+                        'Allert message not shown')
+        self.assertTrue(wrong_path in self.find('.alert-danger').text,
+                        "Wrong path not in alert message")
-- 
2.34.1



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

* Re: [bitbake-devel] [PATCH v3 1/3] Toaster: Write UI TestCase create new project
  2023-11-09 22:15 [PATCH v3 1/3] Toaster: Write UI TestCase create new project Alassane Yattara
  2023-11-09 22:15 ` [PATCH v3 2/3] Toaster: Test create new project without project name Alassane Yattara
  2023-11-09 22:15 ` [PATCH v3 3/3] Toaster: Write UI TestCase import new project using Alassane Yattara
@ 2023-11-10  8:09 ` Alexandre Belloni
  2023-11-10 13:34   ` Alassane Yattara
  2 siblings, 1 reply; 5+ messages in thread
From: Alexandre Belloni @ 2023-11-10  8:09 UTC (permalink / raw)
  To: Alassane Yattara; +Cc: bitbake-devel

Hello Alassane,

On 09/11/2023 23:15:15+0100, Alassane Yattara wrote:
> Test create new project using:
> - Project Name: Any string
> - Release: Master/Kirkstone/Dunfell/Local
> - Merge Toaster settings: False/True
> 
> Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
> ---

Please include a changelog here. At least, explain why you are sending
multiple versions of the series on the same day, this would make the
maintainers job easier.

Thanks!

>  .../functional/test_create_new_project.py     | 134 ++++++++++++++++++
>  1 file changed, 134 insertions(+)
>  create mode 100644 lib/toaster/tests/functional/test_create_new_project.py
> 
> diff --git a/lib/toaster/tests/functional/test_create_new_project.py b/lib/toaster/tests/functional/test_create_new_project.py
> new file mode 100644
> index 00000000..81355eaf
> --- /dev/null
> +++ b/lib/toaster/tests/functional/test_create_new_project.py
> @@ -0,0 +1,134 @@
> +#! /usr/bin/env python3 #
> +# BitBake Toaster UI tests implementation
> +#
> +# Copyright (C) 2023 Savoir-faire Linux
> +#
> +# SPDX-License-Identifier: GPL-2.0-only
> +#
> +
> +import re
> +import pytest
> +from django.urls import reverse
> +from selenium.webdriver.support.ui import Select
> +from tests.functional.functional_helpers import SeleniumFunctionalTestCase
> +from orm.models import Project
> +from selenium.webdriver.common.by import By
> +
> +@pytest.mark.django_db
> +class TestCreateNewProject(SeleniumFunctionalTestCase):
> +
> +    def _create_test_new_project(
> +        self,
> +        project_name,
> +        release,
> +        release_title,
> +        merge_toaster_settings,
> +    ):
> +        """ Create/Test new project using:
> +          - Project Name: Any string
> +          - Release: Any string
> +          - Merge Toaster settings: True or False
> +        """
> +        self.get(reverse('newproject'))
> +        self.driver.find_element(By.ID,
> +                                 "new-project-name").send_keys(project_name)
> +
> +        select = Select(self.find('#projectversion'))
> +        select.select_by_value(release)
> +
> +        # check merge toaster settings
> +        checkbox = self.find('.checkbox-mergeattr')
> +        if merge_toaster_settings:
> +            if not checkbox.is_selected():
> +                checkbox.click()
> +        else:
> +            if checkbox.is_selected():
> +                checkbox.click()
> +
> +        self.driver.find_element(By.ID, "create-project-button").click()
> +
> +        element = self.wait_until_visible('#project-created-notification')
> +        self.assertTrue(
> +            self.element_exists('#project-created-notification'), 
> +            f"Project:{project_name} creation notification not shown"
> +        )
> +        self.assertTrue(
> +            project_name in element.text,
> +            f"New project name:{project_name} not in new project notification"
> +        )
> +        self.assertTrue(
> +            Project.objects.filter(name=project_name).count(), 
> +            f"New project:{project_name} not found in database"
> +        )
> +
> +        # check release
> +        self.assertTrue(re.search(
> +            release_title,
> +            self.driver.find_element(By.XPATH,
> +                                     "//span[@id='project-release-title']"
> +                                     ).text),
> +                        'The project release is not defined')
> +
> +    def test_create_new_project_master(self):
> +        """ Test create new project using:
> +          - Project Name: Any string
> +          - Release: Yocto Project master (option value: 3)
> +          - Merge Toaster settings: False
> +        """
> +        release = '3'
> +        release_title = 'Yocto Project master'
> +        project_name = 'projectmaster'
> +        self._create_test_new_project(
> +            project_name,
> +            release,
> +            release_title,
> +            False,
> +        )
> +
> +    def test_create_new_project_kirkstone(self):
> +        """ Test create new project using:
> +          - Project Name: Any string
> +          - Release: Yocto Project 4.0 "Kirkstone" (option value: 1)
> +          - Merge Toaster settings: True
> +        """
> +        release = '1'
> +        release_title = 'Yocto Project 4.0 "Kirkstone"'
> +        project_name = 'projectkirkstone'
> +        self._create_test_new_project(
> +            project_name,
> +            release,
> +            release_title,
> +            True,
> +        )
> +
> +    def test_create_new_project_dunfull(self):
> +        """ Test create new project using:
> +          - Project Name: Any string
> +          - Release: Yocto Project 3.1 "Dunfell" (option value: 5)
> +          - Merge Toaster settings: False
> +        """
> +        release = '5'
> +        release_title = 'Yocto Project 3.1 "Dunfell"'
> +        project_name = 'projectdunfull'
> +        self._create_test_new_project(
> +            project_name,
> +            release,
> +            release_title,
> +            False,
> +        )
> +    
> +    def test_create_new_project_local(self):
> +        """ Test create new project using:
> +          - Project Name: Any string
> +          - Release: Local Yocto Project (option value: 2)
> +          - Merge Toaster settings: True
> +        """
> +        release = '2'
> +        release_title = 'Local Yocto Project'
> +        project_name = 'projectlocal'
> +        self._create_test_new_project(
> +            project_name,
> +            release,
> +            release_title,
> +            True,
> +        )
> -- 
> 2.34.1
> 

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#15487): https://lists.openembedded.org/g/bitbake-devel/message/15487
> Mute This Topic: https://lists.openembedded.org/mt/102496102/3617179
> Group Owner: bitbake-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [alexandre.belloni@bootlin.com]
> -=-=-=-=-=-=-=-=-=-=-=-
> 


-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


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

* Re: [bitbake-devel] [PATCH v3 1/3] Toaster: Write UI TestCase create new project
  2023-11-10  8:09 ` [bitbake-devel] [PATCH v3 1/3] Toaster: Write UI TestCase create new project Alexandre Belloni
@ 2023-11-10 13:34   ` Alassane Yattara
  0 siblings, 0 replies; 5+ messages in thread
From: Alassane Yattara @ 2023-11-10 13:34 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: bitbake-devel

Hello Alexander,

There is no difference, that's same patch.
 
Sorry about duplicate, my commandeline '$git send-email' was block when sending the patch series,
I canceled the process, then try again, but the first patch 1/3 was already sent in first process.

Thanks!
Alassane.
----- Mail original -----
De: "Alexandre Belloni via lists.openembedded.org" <alexandre.belloni=bootlin.com@lists.openembedded.org>
À: "Alassane Yattara" <alassane.yattara@savoirfairelinux.com>
Cc: "bitbake-devel" <bitbake-devel@lists.openembedded.org>
Envoyé: Vendredi 10 Novembre 2023 09:09:43
Objet: Re: [bitbake-devel] [PATCH v3 1/3] Toaster: Write UI TestCase create new project

Hello Alassane,

On 09/11/2023 23:15:15+0100, Alassane Yattara wrote:
> Test create new project using:
> - Project Name: Any string
> - Release: Master/Kirkstone/Dunfell/Local
> - Merge Toaster settings: False/True
> 
> Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
> ---

Please include a changelog here. At least, explain why you are sending
multiple versions of the series on the same day, this would make the
maintainers job easier.

Thanks!

>  .../functional/test_create_new_project.py     | 134 ++++++++++++++++++
>  1 file changed, 134 insertions(+)
>  create mode 100644 lib/toaster/tests/functional/test_create_new_project.py
> 
> diff --git a/lib/toaster/tests/functional/test_create_new_project.py b/lib/toaster/tests/functional/test_create_new_project.py
> new file mode 100644
> index 00000000..81355eaf
> --- /dev/null
> +++ b/lib/toaster/tests/functional/test_create_new_project.py
> @@ -0,0 +1,134 @@
> +#! /usr/bin/env python3 #
> +# BitBake Toaster UI tests implementation
> +#
> +# Copyright (C) 2023 Savoir-faire Linux
> +#
> +# SPDX-License-Identifier: GPL-2.0-only
> +#
> +
> +import re
> +import pytest
> +from django.urls import reverse
> +from selenium.webdriver.support.ui import Select
> +from tests.functional.functional_helpers import SeleniumFunctionalTestCase
> +from orm.models import Project
> +from selenium.webdriver.common.by import By
> +
> +@pytest.mark.django_db
> +class TestCreateNewProject(SeleniumFunctionalTestCase):
> +
> +    def _create_test_new_project(
> +        self,
> +        project_name,
> +        release,
> +        release_title,
> +        merge_toaster_settings,
> +    ):
> +        """ Create/Test new project using:
> +          - Project Name: Any string
> +          - Release: Any string
> +          - Merge Toaster settings: True or False
> +        """
> +        self.get(reverse('newproject'))
> +        self.driver.find_element(By.ID,
> +                                 "new-project-name").send_keys(project_name)
> +
> +        select = Select(self.find('#projectversion'))
> +        select.select_by_value(release)
> +
> +        # check merge toaster settings
> +        checkbox = self.find('.checkbox-mergeattr')
> +        if merge_toaster_settings:
> +            if not checkbox.is_selected():
> +                checkbox.click()
> +        else:
> +            if checkbox.is_selected():
> +                checkbox.click()
> +
> +        self.driver.find_element(By.ID, "create-project-button").click()
> +
> +        element = self.wait_until_visible('#project-created-notification')
> +        self.assertTrue(
> +            self.element_exists('#project-created-notification'), 
> +            f"Project:{project_name} creation notification not shown"
> +        )
> +        self.assertTrue(
> +            project_name in element.text,
> +            f"New project name:{project_name} not in new project notification"
> +        )
> +        self.assertTrue(
> +            Project.objects.filter(name=project_name).count(), 
> +            f"New project:{project_name} not found in database"
> +        )
> +
> +        # check release
> +        self.assertTrue(re.search(
> +            release_title,
> +            self.driver.find_element(By.XPATH,
> +                                     "//span[@id='project-release-title']"
> +                                     ).text),
> +                        'The project release is not defined')
> +
> +    def test_create_new_project_master(self):
> +        """ Test create new project using:
> +          - Project Name: Any string
> +          - Release: Yocto Project master (option value: 3)
> +          - Merge Toaster settings: False
> +        """
> +        release = '3'
> +        release_title = 'Yocto Project master'
> +        project_name = 'projectmaster'
> +        self._create_test_new_project(
> +            project_name,
> +            release,
> +            release_title,
> +            False,
> +        )
> +
> +    def test_create_new_project_kirkstone(self):
> +        """ Test create new project using:
> +          - Project Name: Any string
> +          - Release: Yocto Project 4.0 "Kirkstone" (option value: 1)
> +          - Merge Toaster settings: True
> +        """
> +        release = '1'
> +        release_title = 'Yocto Project 4.0 "Kirkstone"'
> +        project_name = 'projectkirkstone'
> +        self._create_test_new_project(
> +            project_name,
> +            release,
> +            release_title,
> +            True,
> +        )
> +
> +    def test_create_new_project_dunfull(self):
> +        """ Test create new project using:
> +          - Project Name: Any string
> +          - Release: Yocto Project 3.1 "Dunfell" (option value: 5)
> +          - Merge Toaster settings: False
> +        """
> +        release = '5'
> +        release_title = 'Yocto Project 3.1 "Dunfell"'
> +        project_name = 'projectdunfull'
> +        self._create_test_new_project(
> +            project_name,
> +            release,
> +            release_title,
> +            False,
> +        )
> +    
> +    def test_create_new_project_local(self):
> +        """ Test create new project using:
> +          - Project Name: Any string
> +          - Release: Local Yocto Project (option value: 2)
> +          - Merge Toaster settings: True
> +        """
> +        release = '2'
> +        release_title = 'Local Yocto Project'
> +        project_name = 'projectlocal'
> +        self._create_test_new_project(
> +            project_name,
> +            release,
> +            release_title,
> +            True,
> +        )
> -- 
> 2.34.1
> 

> 
> 
> 


-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#15490): https://lists.openembedded.org/g/bitbake-devel/message/15490
Mute This Topic: https://lists.openembedded.org/mt/102496102/7896845
Group Owner: bitbake-devel+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [alassane.yattara@savoirfairelinux.com]
-=-=-=-=-=-=-=-=-=-=-=-


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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-09 22:15 [PATCH v3 1/3] Toaster: Write UI TestCase create new project Alassane Yattara
2023-11-09 22:15 ` [PATCH v3 2/3] Toaster: Test create new project without project name Alassane Yattara
2023-11-09 22:15 ` [PATCH v3 3/3] Toaster: Write UI TestCase import new project using Alassane Yattara
2023-11-10  8:09 ` [bitbake-devel] [PATCH v3 1/3] Toaster: Write UI TestCase create new project Alexandre Belloni
2023-11-10 13:34   ` Alassane Yattara

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.