From patchwork Thu Oct 12 17:40:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marlon Rodriguez Garcia X-Patchwork-Id: 32046 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 BD8F8CDB47E for ; Thu, 12 Oct 2023 17:40:23 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web11.18967.1697132418788912366 for ; Thu, 12 Oct 2023 10:40:19 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=lOLM1YKr; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: marlon.rodriguez-garcia@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id E521C9C2B79 for ; Thu, 12 Oct 2023 13:40:17 -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 s-ppwbZpaeTl; Thu, 12 Oct 2023 13:40:16 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id E53349C2A80; Thu, 12 Oct 2023 13:40:15 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com E53349C2A80 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1697132415; bh=SLykfg4YiOWNLMqWyYQ/6sUKweEBma3/8UUHofpF/ZI=; h=From:To:Date:Message-Id:MIME-Version; b=lOLM1YKrsbNnxN8RQCKAqnsxV6/o6FdZmaK+RAyel/ktV2dQwEhEk9yb3qIbNXa2n xxk+8DgkuD6H35ZC/KwgTd/uObhT/v7mmnr2MBj7Bot/VUQbRiBKbDhqGPtlO30V+O n4oMKsGQFKUTslAGT02FHIMbrhsynO3CgNn4GFADkXDd175guYClWZJTGgX9iQTxYD 25l47KjJr8KRYkaorBJkKYX3swSheWLNSL35JQPMaXCet3PuQOVZMTsQfonAhf7Fft 4LyDszASbIXvgYQHfNlv9JqENEZwdghHmSVRXLURUvDiy4IcbOWK71x5YAByGuyPSa TSsfyZNchZLJA== 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 hEppuVPpwMlX; Thu, 12 Oct 2023 13:40:15 -0400 (EDT) Received: from savoirfairelinux.mtl.sfl (unknown [192.168.51.254]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id C31479C2800; Thu, 12 Oct 2023 13:40:15 -0400 (EDT) From: Marlon Rodriguez Garcia To: toaster@lists.yoctoproject.org Cc: Marlon Rodriguez Garcia Subject: [PATCH 3/3] toaster: fixed functional test Date: Thu, 12 Oct 2023 13:40:13 -0400 Message-Id: <20231012174013.62283-1-marlon.rodriguez-garcia@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, 12 Oct 2023 17:40:23 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/toaster/message/5856 Updated functional test file to fix url access and added waiting time after click operations to allow following elements to be available for tests, this will needed to be revisited when autobuilder is ready Signed-off-by: Marlon Rodriguez Garcia Signed-off-by: Marlon Rodriguez Garcia --- .../tests/functional/test_functional_basic.py | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/lib/toaster/tests/functional/test_functional_basic.py b/lib/toaster/tests/functional/test_functional_basic.py index 067ad99a..b0def544 100644 --- a/lib/toaster/tests/functional/test_functional_basic.py +++ b/lib/toaster/tests/functional/test_functional_basic.py @@ -7,7 +7,8 @@ # SPDX-License-Identifier: GPL-2.0-only # -import re +import re, time +from django.urls import reverse from tests.functional.functional_helpers import SeleniumFunctionalTestCase from orm.models import Project from selenium.webdriver.common.by import By @@ -17,11 +18,11 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): # testcase (1514) def test_create_slenium_project(self): project_name = 'selenium-project' - self.get('') - self.driver.find_element(By.LINK_TEXT, "To start building, create your first Toaster project").click() + self.get(reverse('newproject')) self.driver.find_element(By.ID, "new-project-name").send_keys(project_name) self.driver.find_element(By.ID, 'projectversion').click() self.driver.find_element(By.ID, "create-project-button").click() + time.sleep(2) 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, @@ -31,15 +32,18 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): # testcase (1515) def test_verify_left_bar_menu(self): - self.get('') + self.get(reverse('all-projects')) self.wait_until_visible('#projectstable') self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() + time.sleep(2) self.assertTrue(self.element_exists('#config-nav'),'Configuration Tab does not exist') project_URL=self.get_URL() self.driver.find_element(By.XPATH, '//a[@href="'+project_URL+'"]').click() + time.sleep(2) try: self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'customimages/"'+"]").click() + time.sleep(2) self.assertTrue(re.search("Custom images",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'Custom images information is not loading properly') except: self.fail(msg='No Custom images tab available') @@ -78,14 +82,16 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): def test_review_configuration_information(self): self.get('') self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() + time.sleep(2) self.wait_until_visible('#projectstable') self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() project_URL=self.get_URL() - + time.sleep(2) try: self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist') self.assertTrue(re.search("qemux86",self.driver.find_element(By.XPATH, "//span[@id='project-machine-name']").text),'The machine type is not assigned') self.driver.find_element(By.XPATH, "//span[@id='change-machine-toggle']").click() + time.sleep(2) self.wait_until_visible('#select-machine-form') self.wait_until_visible('#cancel-machine-change') self.driver.find_element(By.XPATH, "//form[@id='select-machine-form']/a[@id='cancel-machine-change']").click() @@ -123,13 +129,16 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): def test_verify_machine_information(self): self.get('') self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() + time.sleep(2) self.wait_until_visible('#projectstable') self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() + time.sleep(2) try: self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist') self.assertTrue(re.search("qemux86",self.driver.find_element(By.ID, "project-machine-name").text),'The machine type is not assigned') self.driver.find_element(By.ID, "change-machine-toggle").click() + time.sleep(2) self.wait_until_visible('#select-machine-form') self.wait_until_visible('#cancel-machine-change') self.driver.find_element(By.ID, "cancel-machine-change").click() @@ -140,14 +149,15 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): def test_verify_most_built_recipes_information(self): self.get('') self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() - + time.sleep(2) self.wait_until_visible('#projectstable') self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() project_URL=self.get_URL() - + time.sleep(2) try: self.assertTrue(re.search("You haven't built any recipes yet",self.driver.find_element(By.ID, "no-most-built").text),'Default message of no builds is not present') self.driver.find_element(By.XPATH, "//div[@id='no-most-built']/p/a[@href="+'"'+project_URL+'images/"'+"]").click() + time.sleep(2) self.assertTrue(re.search("Compatible image recipes",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Choose a recipe to build link is not working properly') except: self.fail(msg='No Most built information in project detail page') @@ -156,8 +166,10 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): def test_verify_project_release_information(self): self.get('') self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() + time.sleep(2) self.wait_until_visible('#projectstable') self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() + time.sleep(2) try: self.assertTrue(re.search("Yocto Project master",self.driver.find_element(By.ID, "project-release-title").text),'The project release is not defined') @@ -171,12 +183,12 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): self.wait_until_visible('#projectstable') self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() project_URL=self.get_URL() - + time.sleep(2) try: self.driver.find_element(By.XPATH, "//div[@id='layer-container']") self.assertTrue(re.search("3",self.driver.find_element(By.ID, "project-layers-count").text),'There should be 3 layers listed in the layer count') layer_list = self.driver.find_element(By.ID, "layers-in-project-list") - layers = layer_list.find_element(By.TAG_NAME, "li") + layers = layer_list.find_elements(By.TAG_NAME, "li") for layer in layers: if re.match ("openembedded-core",layer.text): @@ -199,10 +211,11 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): def test_verify_project_detail_links(self): self.get('') self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() + time.sleep(2) self.wait_until_visible('#projectstable') self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() project_URL=self.get_URL() - + time.sleep(2) self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li[@id='topbar-configuration-tab']/a[@href="+'"'+project_URL+'"'+"]").click() self.assertTrue(re.search("Configuration",self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li[@id='topbar-configuration-tab']/a[@href="+'"'+project_URL+'"'+"]").text), 'Configuration tab in project topbar is misspelled')