From patchwork Thu Nov 9 21:54:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 34216 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6142C4167D for ; Thu, 9 Nov 2023 21:55:09 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web10.14129.1699566902374361292 for ; Thu, 09 Nov 2023 13:55:03 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=t6W4eeSY; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id EAA7E9C3290 for ; Thu, 9 Nov 2023 16:54:57 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id rtP75mcxsO8A; Thu, 9 Nov 2023 16:54:57 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id E78ED9C34BF; Thu, 9 Nov 2023 16:54:56 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com E78ED9C34BF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1699566896; bh=eqbkR8nD5mdfw6OFyTWm9llMg0npwMTZmlZCcxBAXdA=; h=From:To:Date:Message-Id:MIME-Version; b=t6W4eeSYtrhXcRTynbidWMq4fMhP9Jan0RCQ2KCD3ZVgxWkjZkvPIrbjs5KIjymrt aL7o84wZKHIbh7/0Du3o9AcgXinuVrX/O1OAJthEx+El6d11vapxgA5ODe7X57DcTB xhF+Xqw7cuJUcf7lzaBCoSSucrVUTbH7dmtSOIPTrzTsHVMIauIvA30LeSNDNQWJJ5 q50gsAZq42osKSR4RFcDoYyiQPm9epQ8c+z1wAe6y0WVpZ1FchySfTMrfi5+gINHSH iZSRrYt+NjJqjvKXC0HtXKvI51dZWGwYQK8vp8Eovv56APezZduiow+soay1tnYAAg bvCFfQsGwyGSw== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id LBQVQMhr8ZhV; Thu, 9 Nov 2023 16:54:56 -0500 (EST) Received: from jedi.. (unknown [196.127.183.75]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 27E499C3471; Thu, 9 Nov 2023 16:54:55 -0500 (EST) From: Alassane Yattara To: bitbake-devel@lists.openembedded.org Cc: Alassane Yattara Subject: [PATCH v2 1/3] Toaster: Write UI TestCase create new project Date: Thu, 9 Nov 2023 22:54:49 +0100 Message-Id: <20231109215451.90799-1-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 09 Nov 2023 21:55:09 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15485 Test create new project using: - Project Name: Any string - Release: Master/Kirkstone/Dunfell/Local - Merge Toaster settings: False/True Signed-off-by: Alassane Yattara --- .../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, + ) From patchwork Thu Nov 9 21:54:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 34215 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B503DC4332F for ; Thu, 9 Nov 2023 21:55:09 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web10.14131.1699566902600490532 for ; Thu, 09 Nov 2023 13:55:03 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=MzuqogcO; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 81E5B9C3361 for ; Thu, 9 Nov 2023 16:54:58 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id 971XcfVbtccw; Thu, 9 Nov 2023 16:54:58 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 0D9AC9C3279; Thu, 9 Nov 2023 16:54:58 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 0D9AC9C3279 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1699566898; bh=PwLzQk6tNo/0wOagfMqwlwu6q8x6/om/Xt3pF54+ydw=; h=From:To:Date:Message-Id:MIME-Version; b=MzuqogcOPWDl0fmFmR/2Dl4xN7wLfxvjdTRIPj8jnGsBsFlm6Gu6USGgVXsfkcM3I Ir7sql5rKDUxJf0CmFdAuHsHCeCTd5f6C7VzstZMdprYADbmObApw1joYtPplEBfll fZsqV4JWBExCMJXSY3/7a8EDtBaSmfStu38O66BCGX8mKGnYdz5Vh8tPAo2fyhPcxR e1MOAo3afMRKjpvX7h+aASzvdih7XiUQ5zH95dkrTduzPon8vVwoADgLsORqs4LCZS q636MivSDX7Y1Rdn7EDE+p1aJPp19Jh2RH5cpsn5RruMG3lwKIwho7qIRt3CAm5osB MyW+VbCgRb3Qg== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id ovU6ai1Xv6Jq; Thu, 9 Nov 2023 16:54:58 -0500 (EST) Received: from jedi.. (unknown [196.127.183.75]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 2C1DC9C2CD7; Thu, 9 Nov 2023 16:54:56 -0500 (EST) From: Alassane Yattara To: bitbake-devel@lists.openembedded.org Cc: Alassane Yattara Subject: [PATCH v2 2/3] Toaster: Test create new project without project name Date: Thu, 9 Nov 2023 22:54:50 +0100 Message-Id: <20231109215451.90799-2-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231109215451.90799-1-alassane.yattara@savoirfairelinux.com> References: <20231109215451.90799-1-alassane.yattara@savoirfairelinux.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 09 Nov 2023 21:55:09 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15484 Signed-off-by: Alassane Yattara --- .../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') From patchwork Thu Nov 9 21:54:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 34214 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5088C4167B for ; Thu, 9 Nov 2023 21:55:09 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web10.14132.1699566904205916298 for ; Thu, 09 Nov 2023 13:55:04 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=Sw5baC02; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 8C9729C2CD7 for ; Thu, 9 Nov 2023 16:55:01 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id vKTgDCyi0MXF; Thu, 9 Nov 2023 16:54:59 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 63B8F9C3279; Thu, 9 Nov 2023 16:54:59 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 63B8F9C3279 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1699566899; bh=UMsqjOmiwQ/x6Qa/Lv5LWs5O4pYWi2OTxYYh7ViM1d8=; h=From:To:Date:Message-Id:MIME-Version; b=Sw5baC020aCe0l47pAdNjA7bQJ1muk7QHR446iYO6y1ewPlwRjvOQ4+G1gel/u1+2 JnFnOk5leLX6bKVR0wYy8MwxRTFjOcLcL8yrhmh9izkYdPB73jmb8GmJmMWvRcCK/h 85eM7BTp7QeUZnn6alcjsXlmKyw/e7pXXDMqIX/gJp2aR/3SfIdXRKydFxGnojO7in 73P2ArfQg+N6884bma8nr2PWJzvm1dWrJu5iydIGRWL8zcHdg/sAtqQk6ZqDEUuJ1d z4i9688yo0rITxWGh7MIuo3Ajl9Teq7wZeO6zDVqkH6qmy2acZbhhyeRDGMfdkmy37 nocgxSGdw0QgA== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id ZxuJKc6A6m4B; Thu, 9 Nov 2023 16:54:59 -0500 (EST) Received: from jedi.. (unknown [196.127.183.75]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 63CC49C2CD7; Thu, 9 Nov 2023 16:54:58 -0500 (EST) From: Alassane Yattara To: bitbake-devel@lists.openembedded.org Cc: Alassane Yattara Subject: [PATCH v2 3/3] Toaster: Write UI TestCase import new project using Date: Thu, 9 Nov 2023 22:54:51 +0100 Message-Id: <20231109215451.90799-3-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231109215451.90799-1-alassane.yattara@savoirfairelinux.com> References: <20231109215451.90799-1-alassane.yattara@savoirfairelinux.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 09 Nov 2023 21:55:09 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15486 * Test import new project using: - Project Name: Any string - Project type: select (Import command line project) - Import existing project directory: Wrong Path * Update copyright, remove "Inc" Signed-off-by: Alassane Yattara --- .../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")