From patchwork Wed Nov 1 22:13:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 33409 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 E3367C4167B for ; Wed, 1 Nov 2023 22:14:32 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web10.1311.1698876862446414206 for ; Wed, 01 Nov 2023 15:14:23 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=J2hrhfUw; 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 37F569C33B8 for ; Wed, 1 Nov 2023 18:14:16 -0400 (EDT) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id wXQSUFXdkB6H; Wed, 1 Nov 2023 18:14:12 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 1958C9C33C3; Wed, 1 Nov 2023 18:14:12 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 1958C9C33C3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1698876852; bh=NoK4hE1FLfEI7njH+YDpHmOAuL+kStL1Imfptcwm9m4=; h=From:To:Date:Message-Id:MIME-Version; b=J2hrhfUwTlW8F+qROlk39jkvx2m6+m/ZZQoqLyFl2JAyxPzA9Kn4z239IQUXqUA59 63ei19qJ2rMgZzaWURP2BWDjtkx61f+hzQodBqCiu/dFWglddDTRyMrKwTBHvEnfay 9bL3edd/JatieilQsF5p8gJxPA5ebllLdanDLgD4bTCIwjl8VW+Te5R2m1l70jHLDf xc0ca+14qvtw877UvAZFkspgwgawRiBHPLqbdjnvP4llus48KW1DuK6FRmeetk8+7p XVlnkTg1d6Ehu5reAF1cI3YRukOpV9NgSnTp2EgHmk5jxyYSJkINs/9cwZ1u4DdLrd JlDWjUZXOhqvQ== 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 kEwLdzc_po6b; Wed, 1 Nov 2023 18:14:12 -0400 (EDT) Received: from jedi.. (unknown [196.127.183.75]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 439709C314F; Wed, 1 Nov 2023 18:14:09 -0400 (EDT) From: Alassane Yattara To: toaster@lists.yoctoproject.org Cc: Alassane Yattara Subject: [PATCH 1/8] Toaster: Write UI TestCase create new Master project Date: Wed, 1 Nov 2023 23:13:48 +0100 Message-Id: <20231101221355.239053-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 ; Wed, 01 Nov 2023 22:14:32 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/toaster/message/5934 Test create new project using: - Project Name: Any string - Release: Yocto Project master (option value: 3) - Merge Toaster settings: False Signed-off-by: Alassane Yattara --- .../functional/test_create_new_project.py | 57 +++++++++++++++++++ 1 file changed, 57 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..2b3c98ac --- /dev/null +++ b/lib/toaster/tests/functional/test_create_new_project.py @@ -0,0 +1,57 @@ +#! /usr/bin/env python3 +# +# BitBake Toaster UI tests implementation +# +# Copyright (C) 2023 Savoir-faire Linux Inc +# +# 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 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 = 'Yocto Project master' + project_name = 'projectmaster' + 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(str(3)) + + # uncheck merge toaster settings + checkbox = self.find('.checkbox-mergeattr') + 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'), + 'Project creation notification not shown') + self.assertTrue(project_name in element.text, + "New project name not in new project notification") + self.assertTrue(Project.objects.filter(name=project_name).count(), + "New project not found in database") + + # check release + self.assertTrue(re.search( + release, + self.driver.find_element(By.XPATH, + "//span[@id='project-release-title']" + ).text), + 'The project release is not defined')