From patchwork Wed Oct 23 09:59:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51099 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 94924CDD0F9 for ; Wed, 23 Oct 2024 09:59:59 +0000 (UTC) Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by mx.groups.io with SMTP id smtpd.web10.5133.1729677593492478647 for ; Wed, 23 Oct 2024 02:59:53 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=K26HX7fR; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.54, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4314c4cb752so69720335e9.2 for ; Wed, 23 Oct 2024 02:59:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677591; x=1730282391; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=/DBT5iADvxGq4dxMQB/2a2s7WeYLRYVXxfSdIfvi0p4=; b=K26HX7fRlmVvIX8G9K/FdggJ0dkFFah+6xY3CWBODiQa+wOVOyhsWL98/ajL8+DHBI GjEypsv82c3wOynMZ5U0MWtz2mqMf88Zzo2k0zQ3oEupwHN6HkyBH5pJyLAQCC5XkRgX HfGzem7C3zhvTBgWStT0ds3I4jiSW2M9TT5TA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677591; x=1730282391; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/DBT5iADvxGq4dxMQB/2a2s7WeYLRYVXxfSdIfvi0p4=; b=pBFf3BL7CB3+7BAkdFxFVMujz9XQjdpCCSb9ojBu0cvcYlwh6cYRw+56Ym8pII8pmX y3TgdMOF1yG7OBV5ugyR1ezFssWs44/sFAmhGBbKJU7DczWjiqmrgKWq7sDCW43mOlM3 g/iX7E97qt4qf+mCqpsb64eKgvcKrOAJYm2z6sJxEqzQXu7YuUEme9Stp5jq3TK79RxH oPUHPqpPu3oEYX2H5G57TZKSNPCTvcbGZQAwLQuwSvExe6meeWwJKuDMkoTCFGTO7stf 1RBQN6827hhxMk99+pO9l3DWr1v28yrMV7CJuH95BI+EWflUrQXfizjaeZGSQ6JwFPcZ F7ow== X-Gm-Message-State: AOJu0YwxXlTnKUFpcuJeoeVzqK56QDbdyFdfuzk3xWoSTKZMs8j+o992 745xoaM5GrlWLmKtOdvmO/KygqfGtASspXpbMoXp+Zi2aMzH6xN4gOulLqJtqNQEWdlws6LWQWc z X-Google-Smtp-Source: AGHT+IHIMa+NJprsNga2EQFhh2GEBRrFs7Bf9qxH0p+YeKoWc6h6oDjPZ12SbaUtGgm8rsI4e01N6g== X-Received: by 2002:a05:600c:45cb:b0:42f:8515:e490 with SMTP id 5b1f17b1804b1-431841341e2mr16728575e9.5.1729677590873; Wed, 23 Oct 2024 02:59:50 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.02.59.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 02:59:50 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 01/28] toaster/test/functional: Move _create_test_new_project to base class as helper Date: Wed, 23 Oct 2024 10:59:22 +0100 Message-ID: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 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, 23 Oct 2024 09:59:59 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16692 The test project creation is needed by mutliple tests. Move it to the base class as a helper function for reuse. Signed-off-by: Richard Purdie --- .../tests/functional/functional_helpers.py | 72 +++++++++++++++++++ .../functional/test_create_new_project.py | 69 ------------------ 2 files changed, 72 insertions(+), 69 deletions(-) diff --git a/lib/toaster/tests/functional/functional_helpers.py b/lib/toaster/tests/functional/functional_helpers.py index 7c20437d14..d3e38b658b 100644 --- a/lib/toaster/tests/functional/functional_helpers.py +++ b/lib/toaster/tests/functional/functional_helpers.py @@ -12,9 +12,12 @@ import logging import subprocess import signal import re +import requests +from django.urls import reverse from tests.browser.selenium_helpers_base import SeleniumTestCaseBase from selenium.webdriver.common.by import By +from selenium.webdriver.support.select import Select from selenium.common.exceptions import NoSuchElementException logger = logging.getLogger("toaster") @@ -136,3 +139,72 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase): except NoSuchElementException: return False return element + + 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 + """ + + # Obtain a CSRF token from a suitable URL + projs = requests.get(self.live_server_url + reverse('newproject')) + csrftoken = projs.cookies.get('csrftoken') + + # Use the projects typeahead to find out if the project already exists + req = requests.get(self.live_server_url + reverse('xhr_projectstypeahead'), {'search': project_name, 'format' : 'json'}) + data = req.json() + # Delete any existing projects + for result in data['results']: + del_url = reverse('xhr_project', args=(result['id'],)) + del_response = requests.delete(self.live_server_url + del_url, cookies={'csrftoken': csrftoken}, headers={'X-CSRFToken': csrftoken}) + self.assertEqual(del_response.status_code, 200) + + self.get(reverse('newproject')) + self.wait_until_visible('#new-project-name', poll=3) + 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', poll=3) + 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" + ) + + # Use the projects typeahead again to check the project now exists + req = requests.get(self.live_server_url + reverse('xhr_projectstypeahead'), {'search': project_name, 'format' : 'json'}) + data = req.json() + self.assertGreater(len(data['results']), 0, 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') + diff --git a/lib/toaster/tests/functional/test_create_new_project.py b/lib/toaster/tests/functional/test_create_new_project.py index 577ca7239d..168a396717 100644 --- a/lib/toaster/tests/functional/test_create_new_project.py +++ b/lib/toaster/tests/functional/test_create_new_project.py @@ -8,7 +8,6 @@ import re import pytest -import requests from django.urls import reverse from selenium.webdriver.support.select import Select from tests.functional.functional_helpers import SeleniumFunctionalTestCase @@ -16,74 +15,6 @@ from selenium.webdriver.common.by import By 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 - """ - - # Obtain a CSRF token from a suitable URL - projs = requests.get(self.live_server_url + reverse('newproject')) - csrftoken = projs.cookies.get('csrftoken') - - # Use the projects typeahead to find out if the project already exists - req = requests.get(self.live_server_url + reverse('xhr_projectstypeahead'), {'search': project_name, 'format' : 'json'}) - data = req.json() - # Delete any existing projects - for result in data['results']: - del_url = reverse('xhr_project', args=(result['id'],)) - del_response = requests.delete(self.live_server_url + del_url, cookies={'csrftoken': csrftoken}, headers={'X-CSRFToken': csrftoken}) - self.assertEqual(del_response.status_code, 200) - - self.get(reverse('newproject')) - self.wait_until_visible('#new-project-name', poll=3) - 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', poll=3) - 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" - ) - - # Use the projects typeahead again to check the project now exists - req = requests.get(self.live_server_url + reverse('xhr_projectstypeahead'), {'search': project_name, 'format' : 'json'}) - data = req.json() - self.assertGreater(len(data['results']), 0, 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 From patchwork Wed Oct 23 09:59:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51098 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 95753D1712C for ; Wed, 23 Oct 2024 09:59:59 +0000 (UTC) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by mx.groups.io with SMTP id smtpd.web11.5141.1729677594272328114 for ; Wed, 23 Oct 2024 02:59:54 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=ctvuF5w2; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.42, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4315baec69eso62161595e9.2 for ; Wed, 23 Oct 2024 02:59:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677592; x=1730282392; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=OBJ9yjGoQOzU/sVLOJfAHgJN/JZtHxnMi8UgM3Aj24w=; b=ctvuF5w2jzGyCiDXrX0Ix33l8Wed7d2m3rlWC+sUs+iW0VgNEzlA1LvIfav3AOD0HX LhyZc50jx2TmU7ur8cKTXBd3wrNKGisDqnIqsMy9cF69NGsfrjOYMJz3xVKyZyn4p4cD /XDKyJNGUXhNizrDkV0F/aAPPTdEwNreT2yqM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677592; x=1730282392; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OBJ9yjGoQOzU/sVLOJfAHgJN/JZtHxnMi8UgM3Aj24w=; b=GMjbdrQhQKOaDRajvv34qkTWNKSkasXL8sYIe0vymW9sPoJOHHIVhUAfbCtkOjsiMd SSSRJzAOOVH19Gv7W3FP0yxah9dQhnT31jC4LIfObht99R1xntd8txucX2BTAF3ruJBV WDawAnDp7iQLS28gTxNyvcKvoa/bvcr1t3WeEhZTQ7wf/ov85P8hd3dZaOB5SrlO9xU5 MfeB5yAQN8XnKdfBqJqD33SJG7FNwmy5GHi1gyJGlvKCs93mNB1pvH80RKPsB6RzFXRI Ko+whEH1lbA/+Zlv5jHkFn/pQbulHlj5Yaz3NJIVmPF1eklqfvmsG+jaTSNVu72HhOZP TnuQ== X-Gm-Message-State: AOJu0YwPUJPunSxsYojR0/S5lKkvP7LAqBVK2T937fuLqQWR4ynu674R Ru6QrkVAfWAudQNM8bQLXf23yM+3HSXI4NciezUZ5ApcwxnYcbafx7HenlmjSmsRMzXilu3dE2R O X-Google-Smtp-Source: AGHT+IFmQgjda+tOQoFQyDi4zJMc7mAKjyp8dUTkWb7Ip5+HBr+RhxYbWJIEyF93vkU/Kjf3ll3dUQ== X-Received: by 2002:a05:600c:3496:b0:431:4b88:d408 with SMTP id 5b1f17b1804b1-431841ee388mr16819195e9.5.1729677592274; Wed, 23 Oct 2024 02:59:52 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.02.59.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 02:59:51 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 02/28] toaster/tests/functional: Tweak the project creation function for better reuse Date: Wed, 23 Oct 2024 10:59:23 +0100 Message-ID: <20241023095949.3351980-2-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 09:59:59 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16693 Tweak the function name and return the created project ID. Allow the release_name test to be skipped with a value of None. Add an extra wait call to ensure the create project button is ready before clicking it. Signed-off-by: Richard Purdie --- .../tests/functional/functional_helpers.py | 18 +++++++++++++----- .../functional/test_create_new_project.py | 8 ++++---- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/lib/toaster/tests/functional/functional_helpers.py b/lib/toaster/tests/functional/functional_helpers.py index d3e38b658b..cc508e98d9 100644 --- a/lib/toaster/tests/functional/functional_helpers.py +++ b/lib/toaster/tests/functional/functional_helpers.py @@ -140,7 +140,7 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase): return False return element - def _create_test_new_project( + def create_new_project( self, project_name, release, @@ -183,6 +183,8 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase): if checkbox.is_selected(): checkbox.click() + self.wait_until_clickable('#create-project-button') + self.driver.find_element(By.ID, "create-project-button").click() element = self.wait_until_visible('#project-created-notification', poll=3) @@ -200,11 +202,17 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase): data = req.json() self.assertGreater(len(data['results']), 0, f"New project:{project_name} not found in database") + project_id = data['results'][0]['id'] + + self.wait_until_visible('#project-release-title') + # check release - self.assertTrue(re.search( - release_title, - self.driver.find_element(By.XPATH, + if release_title is not None: + self.assertTrue(re.search( + release_title, + self.driver.find_element(By.XPATH, "//span[@id='project-release-title']" ).text), - 'The project release is not defined') + 'The project release is not defined') + return project_id diff --git a/lib/toaster/tests/functional/test_create_new_project.py b/lib/toaster/tests/functional/test_create_new_project.py index 168a396717..342e008f55 100644 --- a/lib/toaster/tests/functional/test_create_new_project.py +++ b/lib/toaster/tests/functional/test_create_new_project.py @@ -24,7 +24,7 @@ class TestCreateNewProject(SeleniumFunctionalTestCase): release = '3' release_title = 'Yocto Project master' project_name = 'projectmaster' - self._create_test_new_project( + self.create_new_project( project_name, release, release_title, @@ -40,7 +40,7 @@ class TestCreateNewProject(SeleniumFunctionalTestCase): release = '1' release_title = 'Yocto Project 5.0 "Scarthgap"' project_name = 'projectscarthgap' - self._create_test_new_project( + self.create_new_project( project_name, release, release_title, @@ -56,7 +56,7 @@ class TestCreateNewProject(SeleniumFunctionalTestCase): release = '5' release_title = 'Yocto Project 4.0 "Kirkstone"' project_name = 'projectkirkstone' - self._create_test_new_project( + self.create_new_project( project_name, release, release_title, @@ -72,7 +72,7 @@ class TestCreateNewProject(SeleniumFunctionalTestCase): release = '2' release_title = 'Local Yocto Project' project_name = 'projectlocal' - self._create_test_new_project( + self.create_new_project( project_name, release, release_title, From patchwork Wed Oct 23 09:59:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51100 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 9EF7AD2E03F for ; Wed, 23 Oct 2024 09:59:59 +0000 (UTC) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by mx.groups.io with SMTP id smtpd.web11.5142.1729677594902163327 for ; Wed, 23 Oct 2024 02:59:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=JHRX2dAI; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.53, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-43163667f0eso50970915e9.0 for ; Wed, 23 Oct 2024 02:59:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677593; x=1730282393; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=WHNOSvxKg5b36CBcYVO15YwQs6pAcJ8WLeVqp6dPNrU=; b=JHRX2dAILvVaxnetC4p9vXXbIwsQjSv6C3XUlziSu9wI1rgaiMe9ZJQXXM/tC+KMo9 rSQqKEDrW2NjkLUWn9l+Z1oPVs9360WmNfuwYXnV46D5f9PNZ34nN2hnfH9QMyrEMFDw eKGKpH3HP35M+QCfiJ4UbTVjGn1aBbtlXDpoA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677593; x=1730282393; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WHNOSvxKg5b36CBcYVO15YwQs6pAcJ8WLeVqp6dPNrU=; b=VCwwh/UuW1mn7ussDdG6rwXC0sNWDtEngjylS6TFLpKTyPAc/UjvjpCeM0I8kHqQ/Z Kxq3NSLXyoRkJcsrGutkJBqWyNIHgvYSqS/vArRZ0obOznL1Ggq0RX0R5fMrFgAWaECk W84Z5E0w2HZKljlNuO2/VI1Mvg0YCcUjNQ8o0xkFUYP6mOO/cV/wON9/wkSgy1NQtsFS EtPy0uRxOE81UfvnlDGUFbUt1aSoW8SozMKyKQiWJ7i0qpKwXJS4ejgEnAcc+Y/9gpU0 2vK2p8bvXN7NUAVFgokkb4eZXkP//WxJlOX2TdRUqH0W4ZJ/XR3rQJQYel08C4/Zv2Ad /cnw== X-Gm-Message-State: AOJu0Yz0TWfvli2tJhTXQGKXOyHyShp6Rt+M4Ax/u0P23N9EFgrHkzs4 qauSVE78Xq1MRtzlRDmPkT/5IQKWEarI9Lu/6bc9jLLqFDyD0CPkLKlCP0kE/t6cp9jqEzCbqOM O X-Google-Smtp-Source: AGHT+IH2NQRsFBAoDuaT7j+jJH/JYcLx1zVuYn6+s8EmvZ7qQdLPSnmB1Dhjaoi3Bdk/fr41HSF0dQ== X-Received: by 2002:a05:600c:3ca3:b0:426:6e86:f82 with SMTP id 5b1f17b1804b1-4318423bb1amr17674335e9.22.1729677592970; Wed, 23 Oct 2024 02:59:52 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.02.59.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 02:59:52 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 03/28] toaster/tests/functional_basic: Reuse common project creation code Date: Wed, 23 Oct 2024 10:59:24 +0100 Message-ID: <20241023095949.3351980-3-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 09:59:59 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16694 Switch this test module to use the common project creation code which contains race fixes. That code requires the database access wrapper be dropped and we no longer have ordering constraints. Signed-off-by: Richard Purdie --- .../tests/functional/test_functional_basic.py | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/lib/toaster/tests/functional/test_functional_basic.py b/lib/toaster/tests/functional/test_functional_basic.py index e4070fbb88..e2d1c7dd86 100644 --- a/lib/toaster/tests/functional/test_functional_basic.py +++ b/lib/toaster/tests/functional/test_functional_basic.py @@ -17,8 +17,6 @@ from selenium.webdriver.common.by import By from tests.functional.utils import get_projectId_from_url -@pytest.mark.django_db -@pytest.mark.order("second_to_last") class FuntionalTestBasic(SeleniumFunctionalTestCase): """Basic functional tests for Toaster""" project_id = None @@ -26,25 +24,7 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): def setUp(self): super(FuntionalTestBasic, self).setUp() if not FuntionalTestBasic.project_id: - self._create_slenium_project() - current_url = self.driver.current_url - FuntionalTestBasic.project_id = get_projectId_from_url(current_url) - -# testcase (1514) - def _create_slenium_project(self): - project_name = 'selenium-project' - self.get(reverse('newproject')) - self.wait_until_visible('#new-project-name', poll=3) - 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() - element = self.wait_until_visible('#project-created-notification', poll=10) - 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") - return Project.objects.last().id + FuntionalTestBasic.project_id = self.create_new_project('selenium-project', '3', None, False) # testcase (1515) def test_verify_left_bar_menu(self): From patchwork Wed Oct 23 09:59:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51097 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 A4AF9D1713E for ; Wed, 23 Oct 2024 09:59:59 +0000 (UTC) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by mx.groups.io with SMTP id smtpd.web11.5143.1729677595888574280 for ; Wed, 23 Oct 2024 02:59:56 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=F70YtMlg; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.45, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4314fa33a35so67868365e9.1 for ; Wed, 23 Oct 2024 02:59:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677594; x=1730282394; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Du6IyycMlm4fxtNe3ElSIQRjxe5L7G3dyPFdVTs3OX4=; b=F70YtMlgBpwL+Sy60FPr35sGSBHqtmFSzU0f1y0eKxa3Mg46F/JWzoS2CwsGyCzQna w2/AbOtq+In97y2Qelf71tIbyhM8Y/Nhq82L6r4lKYhDGl6NarAR26+ulO0UmLgeGgD8 HxnMttCyULBEeF1EqqVYvwd3k+uCl/uzLqdeQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677594; x=1730282394; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Du6IyycMlm4fxtNe3ElSIQRjxe5L7G3dyPFdVTs3OX4=; b=FoR/lI7o+K4lR60GsTLN7/L4qo9Vb7RqzM2jr2cXGlRSCHEBg/ta7OcoqD++pifQbD yXDq7HUccejCSpySB/MM/UR5n3zvlOe83s6rpQdr9FycGkHd2dfAUw0td6NTC+ag0kk6 PIAx89Yub1XHoeJeupYQ3at1ZJtOQqSNgvi2pH/89CQHKvkM/PgyWaN6U+PDz2uor1OI qIhInCSwauJIx9FNUTMTcWwMNmaeMT7cZQ2Q8R6aUZGZtnkJvk85uKinXlOsme0Fq9pb TtKtVlZqcRRCnEv4SgNe1J+0WR1vZSl+vEd0dUzHHbrb2orylt54yqimo0n8QLyMdjHt YOmg== X-Gm-Message-State: AOJu0Ywk1JD4vT3pjGXB0fUR9kNOkL2DCKcWMxVFumv6xslzjZ/q8THJ mInVqA2I7JynLk24FmmJFysQGywebAkLbCK5IcRmBlbyRnW4xFNgYnIgv99mznrmEOnHU5Jdav2 + X-Google-Smtp-Source: AGHT+IH+sOEUpheMD3o+05mvOts09H9oGKQauhocEvVVFez8lezezi6Y3H7B8o7lHp4H71apq61Xvg== X-Received: by 2002:a05:600c:1d27:b0:431:58cd:b260 with SMTP id 5b1f17b1804b1-4318418a568mr15978585e9.25.1729677593935; Wed, 23 Oct 2024 02:59:53 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.02.59.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 02:59:53 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 04/28] toaster/tests/project_config: Reuse common project creation code Date: Wed, 23 Oct 2024 10:59:25 +0100 Message-ID: <20241023095949.3351980-4-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 09:59:59 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16695 Switch this test module to use the common project creation code which contains race fixes. That code requires the database access wrapper be dropped and we no longer have ordering constraints. Signed-off-by: Richard Purdie --- .../tests/functional/test_project_config.py | 50 ++----------------- 1 file changed, 4 insertions(+), 46 deletions(-) diff --git a/lib/toaster/tests/functional/test_project_config.py b/lib/toaster/tests/functional/test_project_config.py index dbee36aa4e..41149e5e55 100644 --- a/lib/toaster/tests/functional/test_project_config.py +++ b/lib/toaster/tests/functional/test_project_config.py @@ -7,7 +7,6 @@ # import string -import random import pytest from django.urls import reverse from selenium.webdriver import Keys @@ -18,9 +17,6 @@ from selenium.webdriver.common.by import By from .utils import get_projectId_from_url - -@pytest.mark.django_db -@pytest.mark.order("last") class TestProjectConfig(SeleniumFunctionalTestCase): project_id = None PROJECT_NAME = 'TestProjectConfig' @@ -28,42 +24,6 @@ class TestProjectConfig(SeleniumFunctionalTestCase): INVALID_PATH_CHAR_TEXT = 'The directory path cannot include spaces or ' \ 'any of these characters' - def _create_project(self, project_name): - """ Create/Test new project using: - - Project Name: Any string - - Release: Any string - - Merge Toaster settings: True or False - """ - self.get(reverse('newproject')) - self.wait_until_visible('#new-project-name', poll=2) - self.find("#new-project-name").send_keys(project_name) - select = Select(self.find("#projectversion")) - select.select_by_value('3') - - # check merge toaster settings - checkbox = self.find('.checkbox-mergeattr') - if not checkbox.is_selected(): - checkbox.click() - - if self.PROJECT_NAME != 'TestProjectConfig': - # Reset project name if it's not the default one - self.PROJECT_NAME = 'TestProjectConfig' - - self.find("#create-project-button").click() - - try: - self.wait_until_visible('#hint-error-project-name', poll=2) - url = reverse('project', args=(TestProjectConfig.project_id, )) - self.get(url) - self.wait_until_visible('#config-nav', poll=3) - except TimeoutException: - self.wait_until_visible('#config-nav', poll=3) - - def _random_string(self, length): - return ''.join( - random.choice(string.ascii_letters) for _ in range(length) - ) - def _get_config_nav_item(self, index): config_nav = self.find('#config-nav') return config_nav.find_elements(By.TAG_NAME, 'li')[index] @@ -72,12 +32,10 @@ class TestProjectConfig(SeleniumFunctionalTestCase): """ Navigate to project BitBake variables page """ # check if the menu is displayed if TestProjectConfig.project_id is None: - self._create_project(project_name=self._random_string(10)) - current_url = self.driver.current_url - TestProjectConfig.project_id = get_projectId_from_url(current_url) - else: - url = reverse('projectconf', args=(TestProjectConfig.project_id,)) - self.get(url) + TestProjectConfig.project_id = self.create_new_project(self.PROJECT_NAME, '3', None, True) + + url = reverse('projectconf', args=(TestProjectConfig.project_id,)) + self.get(url) self.wait_until_visible('#config-nav', poll=3) bbv_page_link = self._get_config_nav_item(9) bbv_page_link.click() From patchwork Wed Oct 23 09:59:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51101 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 AFE74D2C56C for ; Wed, 23 Oct 2024 09:59:59 +0000 (UTC) Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by mx.groups.io with SMTP id smtpd.web11.5144.1729677597562350303 for ; Wed, 23 Oct 2024 02:59:57 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=ZURcfqgF; spf=pass (domain: linuxfoundation.org, ip: 209.85.221.48, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-37d55f0cf85so4718534f8f.3 for ; Wed, 23 Oct 2024 02:59:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677596; x=1730282396; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=LedckD95iwBVE2phJ3gNNH1vyjovrnxZWR45dEBd0jo=; b=ZURcfqgF5wWlWVgwx/aKVJhIstEOlRkGLUL4C8TJ8mr/gccLiJcQKXwIQloghyyyR9 t0UGdKdo40h+JLzwbeLuhazD+kbzCbn/JkcZvlndq/w7Xr1Ua14EdyDDoQhvIE2+NHIh caS/pHgEvJXsiVaAzbgumyfMwCd9j42pTFS9M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677596; x=1730282396; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LedckD95iwBVE2phJ3gNNH1vyjovrnxZWR45dEBd0jo=; b=X9/U71FAXLuQIm2QQvyoNjunJxCD/p4LYIHj1n0nj00CqdXbH23HpdNuMYiGmVXWnz h0Eyu/qCxED4h6jEtfno5ElcoEl0En+zd3FVhxtRh4o7PS8VNOLrAyut/kPjOGwryKHE UEi8OCjd8xQZ39P7eSwe92otP/KqDVDLuO8WV3ZJXCkYCbuXSV81fH41RTu37OjPeyVz QNl0Lhrv35wPifoONAmMfo/oSj1PQ6MGe9qi4EofMYlLMTz1HYR/N0yXmTJDTooDN+Wl RaTVFsFlv1CFkdxNejEcJ+x/M41RKqEuVDRg9wWD9BuW4VXXjzRgGj8IUnqEl3bT42So kn+Q== X-Gm-Message-State: AOJu0YyWD5MJKJ068Fm0GRai6bUOg05C2lbaNwg6G4HK4O8mf2lGBAR+ zqklDzGKiZQcnhXC8ESVWDDyAJD/gnVdJwPiCIJPNnvONzVBfmGaIuEQxh1Hh1K5caofxrCDS0x E X-Google-Smtp-Source: AGHT+IHtgUcAUPWkMdbAfjNxNFYaq6hBG0CjjvDePiXzs5r9l/peKdbp9q2akfe1a5mYAxJKSQEnXA== X-Received: by 2002:adf:ea92:0:b0:37d:4956:b0be with SMTP id ffacd0b85a97d-37efcf069b1mr1203236f8f.18.1729677595533; Wed, 23 Oct 2024 02:59:55 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.02.59.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 02:59:54 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 05/28] toaster/tests/function/basic: Improve exception handling for error readability Date: Wed, 23 Oct 2024 10:59:26 +0100 Message-ID: <20241023095949.3351980-5-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 09:59:59 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16696 The 'fail' calls are useful for find() failures but not for wrapping existing asserts where they hide more useful error messages. Rework the code flow to give more readable error reporting. Signed-off-by: Richard Purdie --- .../tests/functional/test_functional_basic.py | 108 ++++++++++-------- 1 file changed, 59 insertions(+), 49 deletions(-) diff --git a/lib/toaster/tests/functional/test_functional_basic.py b/lib/toaster/tests/functional/test_functional_basic.py index e2d1c7dd86..a95ce4862c 100644 --- a/lib/toaster/tests/functional/test_functional_basic.py +++ b/lib/toaster/tests/functional/test_functional_basic.py @@ -40,44 +40,44 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): try: self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'customimages/"'+"]").click() self.wait_until_present('#config-nav', poll=10) - 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') + 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') try: self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'images/"'+"]").click() self.wait_until_present('#config-nav', poll=10) - self.assertTrue(re.search("Compatible image recipes",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible image recipes information is not loading properly') except: self.fail(msg='No Compatible image tab available') + self.assertTrue(re.search("Compatible image recipes",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible image recipes information is not loading properly') try: self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'softwarerecipes/"'+"]").click() self.wait_until_present('#config-nav', poll=10) - self.assertTrue(re.search("Compatible software recipes",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible software recipe information is not loading properly') except: self.fail(msg='No Compatible software recipe tab available') + self.assertTrue(re.search("Compatible software recipes",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible software recipe information is not loading properly') try: self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'machines/"'+"]").click() self.wait_until_present('#config-nav', poll=10) - self.assertTrue(re.search("Compatible machines",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible machine information is not loading properly') except: self.fail(msg='No Compatible machines tab available') + self.assertTrue(re.search("Compatible machines",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible machine information is not loading properly') try: self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'layers/"'+"]").click() self.wait_until_present('#config-nav', poll=10) - self.assertTrue(re.search("Compatible layers",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible layer information is not loading properly') except: self.fail(msg='No Compatible layers tab available') + self.assertTrue(re.search("Compatible layers",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible layer information is not loading properly') try: self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'configuration"'+"]").click() self.wait_until_present('#config-nav', poll=10) - self.assertTrue(re.search("Bitbake variables",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Bitbake variables information is not loading properly') except: self.fail(msg='No Bitbake variables tab available') + self.assertTrue(re.search("Bitbake variables",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Bitbake variables information is not loading properly') # testcase (1516) def test_review_configuration_information(self): @@ -86,9 +86,11 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() project_URL=self.get_URL() self.wait_until_present('#config-nav', poll=10) + + # Machine section of page + self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist') + self.assertTrue(re.search("qemux86-64",self.driver.find_element(By.XPATH, "//span[@id='project-machine-name']").text),'The machine type is not assigned') try: - self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist') - self.assertTrue(re.search("qemux86-64",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() self.wait_until_visible('#select-machine-form', poll=10) self.wait_until_visible('#cancel-machine-change', poll=10) @@ -96,33 +98,34 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): except: self.fail(msg='The machine information is wrong in the configuration page') + # Most built recipes section try: self.driver.find_element(By.ID, 'no-most-built') except: self.fail(msg='No Most built information in project detail page') - try: - self.assertTrue(re.search("Yocto Project master",self.driver.find_element(By.XPATH, "//span[@id='project-release-title']").text),'The project release is not defined') - except: - self.fail(msg='No project release title information in project detail page') + # Project Release title + self.assertTrue(re.search("Yocto Project master",self.driver.find_element(By.XPATH, "//span[@id='project-release-title']").text), 'The project release is not defined in the project detail page') + # List of layers in project + 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') 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_elements(By.TAG_NAME, "li") - for layer in layers: - if re.match ("openembedded-core",layer.text): - print ("openembedded-core layer is a default layer in the project configuration") - elif re.match ("meta-poky",layer.text): - print ("meta-poky layer is a default layer in the project configuration") - elif re.match ("meta-yocto-bsp",layer.text): - print ("meta-yocto-bsp is a default layer in the project configuratoin") - else: - self.fail(msg='default layers are missing from the project configuration') except: self.fail(msg='No Layer information in project detail page') + for layer in layers: + if re.match ("openembedded-core", layer.text): + print ("openembedded-core layer is a default layer in the project configuration") + elif re.match ("meta-poky", layer.text): + print ("meta-poky layer is a default layer in the project configuration") + elif re.match ("meta-yocto-bsp", layer.text): + print ("meta-yocto-bsp is a default layer in the project configuratoin") + else: + self.fail(msg='default layers are missing from the project configuration') + # testcase (1517) def test_verify_machine_information(self): self.get(reverse('all-projects')) @@ -130,9 +133,9 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() self.wait_until_present('#config-nav', poll=10) + self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist') + self.assertTrue(re.search("qemux86-64",self.driver.find_element(By.ID, "project-machine-name").text),'The machine type is not assigned') try: - self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist') - self.assertTrue(re.search("qemux86-64",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() self.wait_until_visible('#select-machine-form', poll=10) self.wait_until_visible('#cancel-machine-change', poll=10) @@ -147,13 +150,13 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() self.wait_until_present('#config-nav', poll=10) project_URL=self.get_URL() + 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') 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() - self.wait_until_present('#config-nav', poll=10) - 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') + self.wait_until_present('#config-nav', poll=10) + 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') # testcase (1519) def test_verify_project_release_information(self): @@ -161,11 +164,7 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): self.wait_until_present('#projectstable', poll=10) self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() self.wait_until_present('#config-nav', poll=10) - - try: - self.assertTrue(re.search("Yocto Project master",self.driver.find_element(By.ID, "project-release-title").text),'The project release is not defined') - except: - self.fail(msg='No project release title information in project detail page') + self.assertTrue(re.search("Yocto Project master",self.driver.find_element(By.ID, "project-release-title").text), 'No project release title information in project detail page') # testcase (1520) def test_verify_layer_information(self): @@ -174,28 +173,32 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() self.wait_until_present('#config-nav', poll=10) project_URL=self.get_URL() + 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') + 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_elements(By.TAG_NAME, "li") + except: + self.fail(msg='No Layer information in project detail page') - for layer in layers: - if re.match ("openembedded-core",layer.text): - print ("openembedded-core layer is a default layer in the project configuration") - elif re.match ("meta-poky",layer.text): - print ("meta-poky layer is a default layer in the project configuration") - elif re.match ("meta-yocto-bsp",layer.text): - print ("meta-yocto-bsp is a default layer in the project configuratoin") - else: - self.fail(msg='default layers are missing from the project configuration') + for layer in layers: + if re.match ("openembedded-core",layer.text): + print ("openembedded-core layer is a default layer in the project configuration") + elif re.match ("meta-poky",layer.text): + print ("meta-poky layer is a default layer in the project configuration") + elif re.match ("meta-yocto-bsp",layer.text): + print ("meta-yocto-bsp is a default layer in the project configuratoin") + else: + self.fail(msg='default layers are missing from the project configuration') + try: self.driver.find_element(By.XPATH, "//input[@id='layer-add-input']") self.driver.find_element(By.XPATH, "//button[@id='add-layer-btn']") self.driver.find_element(By.XPATH, "//div[@id='layer-container']/form[@class='form-inline']/p/a[@id='view-compatible-layers']") self.driver.find_element(By.XPATH, "//div[@id='layer-container']/form[@class='form-inline']/p/a[@href="+'"'+project_URL+'importlayer"'+"]") except: - self.fail(msg='No Layer information in project detail page') + self.fail(msg='Layer configuration controls missing') # testcase (1521) def test_verify_project_detail_links(self): @@ -211,7 +214,11 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): try: self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'builds/"'+"]").click() self.wait_until_visible('#project-topbar', poll=10) - self.assertTrue(re.search("Builds",self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'builds/"'+"]").text), 'Builds tab in project topbar is misspelled') + except: + self.fail(msg='Builds tab information is not present') + + self.assertTrue(re.search("Builds",self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'builds/"'+"]").text), 'Builds tab in project topbar is misspelled') + try: self.driver.find_element(By.XPATH, "//div[@id='empty-state-projectbuildstable']") except: self.fail(msg='Builds tab information is not present') @@ -219,7 +226,10 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): try: self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'importlayer"'+"]").click() self.wait_until_visible('#project-topbar', poll=10) - self.assertTrue(re.search("Import layer",self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'importlayer"'+"]").text), 'Import layer tab in project topbar is misspelled') + except: + self.fail(msg='Import layer tab not loading properly') + self.assertTrue(re.search("Import layer",self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'importlayer"'+"]").text), 'Import layer tab in project topbar is misspelled') + try: self.driver.find_element(By.XPATH, "//fieldset[@id='repo-select']") self.driver.find_element(By.XPATH, "//fieldset[@id='git-repo']") except: @@ -228,10 +238,10 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): try: self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'newcustomimage/"'+"]").click() self.wait_until_visible('#project-topbar', poll=10) - self.assertTrue(re.search("New custom image",self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'newcustomimage/"'+"]").text), 'New custom image tab in project topbar is misspelled') - self.assertTrue(re.search("Select the image recipe you want to customise",self.driver.find_element(By.XPATH, "//div[@class='col-md-12']/h2").text),'The new custom image tab is not loading correctly') except: self.fail(msg='New custom image tab not loading properly') + self.assertTrue(re.search("New custom image",self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'newcustomimage/"'+"]").text), 'New custom image tab in project topbar is misspelled') + self.assertTrue(re.search("Select the image recipe you want to customise",self.driver.find_element(By.XPATH, "//div[@class='col-md-12']/h2").text),'The new custom image tab is not loading correctly') From patchwork Wed Oct 23 09:59:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51102 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 B7B67CDDE41 for ; Wed, 23 Oct 2024 09:59:59 +0000 (UTC) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by mx.groups.io with SMTP id smtpd.web10.5135.1729677598926775548 for ; Wed, 23 Oct 2024 02:59:59 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=ghy1Gray; spf=pass (domain: linuxfoundation.org, ip: 209.85.221.46, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-37d4821e6b4so4514186f8f.3 for ; Wed, 23 Oct 2024 02:59:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677597; x=1730282397; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Sj/uS8zMOpUt+1r2muESS8WuGMMZ7DCPNNNVCzoDHAg=; b=ghy1GraycUJX9wRZqoXIAGyPWMAQSwnzQjkrXAS94YrWq+A+TIAoDSwNmp7qCIXbX6 B96/bY5uZAkooP0u5swUSqoigd3w+dDffEwZHT8R5twLa7HCDPv3+ZqsEKAyeQPYCmEN np7dzulIgQVLLrlsnFSAqde5EcN8pJIzVsWls= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677597; x=1730282397; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Sj/uS8zMOpUt+1r2muESS8WuGMMZ7DCPNNNVCzoDHAg=; b=GnkNcYcbEHkO8CxXZZUDmlW+GTwS9MgeuarlmUyvNGM7BNZlN1TCoeYZ+a05O+VONk rRpAkxv0p49HmyTLSghanRn5CoukOmDSvMYb2v2N5/PNnkRbDP3MvzJk/J0QxGrMnkj2 dXhQXRZrEFAeBRqSLtoGDSqCpwqWH2Ek32M+B3DO6tiWZPMVktbHSOxj+dkZWxy+dq8l WcBdGZugisEjUspyxClfhToDkpcL8SCFuW103nswKqANNsskvkqp4tY1HXmQFIXXhXcA q+LM/Z+i7Fl80OOKnaURrnUMceV6P1O9kgoDZFBMqIxs5EH7p3Qpxz9jnQ2pqtuaWsqQ kJdg== X-Gm-Message-State: AOJu0Yx6d1uJVbJjogUJDRp+kitxaSzAeDjiGwkQian0yt/KatEWcPd3 R0ba1DL3UKPmJrdL7ozVc/KOstiCePiXR+TUBAVGM8YFHh2WqENa/fxg7KmGUMsCKCCpy8MUjdS m X-Google-Smtp-Source: AGHT+IHg/AhIh3OiTqcD13PhRQgPnXc6Jfyb7Y9YVOvWXbXONOP6x7A+C4N66GFs9FFG6xE1N5gevA== X-Received: by 2002:a5d:558a:0:b0:37d:4a82:6412 with SMTP id ffacd0b85a97d-37efcf84cdcmr1253210f8f.46.1729677596801; Wed, 23 Oct 2024 02:59:56 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.02.59.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 02:59:55 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 06/28] toaster/tests/function/basic: Make element detection more specific Date: Wed, 23 Oct 2024 10:59:27 +0100 Message-ID: <20241023095949.3351980-6-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 09:59:59 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16697 The tests would race and potentially fail as the elements on the page being waited for were not specific enough. Add suitable elements to wait for and drop the remainder of the poll parameters since these are no longer needed since we no longer need to sleep for things to appear. Signed-off-by: Richard Purdie --- .../tests/functional/test_functional_basic.py | 55 +++++++++++-------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/lib/toaster/tests/functional/test_functional_basic.py b/lib/toaster/tests/functional/test_functional_basic.py index a95ce4862c..c73a278f6c 100644 --- a/lib/toaster/tests/functional/test_functional_basic.py +++ b/lib/toaster/tests/functional/test_functional_basic.py @@ -31,50 +31,50 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): self.get(reverse('all-projects')) self.wait_until_present('#projectstable', poll=10) self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() - self.wait_until_present('#config-nav', poll=10) + self.wait_until_present('#config-nav') 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() - self.wait_until_present('#config-nav', poll=10) try: + self.wait_until_present('#config-nav') self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'customimages/"'+"]").click() - self.wait_until_present('#config-nav', poll=10) + self.wait_until_present('#filter-modal-customimagestable') except: self.fail(msg='No Custom images tab available') 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') try: self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'images/"'+"]").click() - self.wait_until_present('#config-nav', poll=10) + self.wait_until_present('#filter-modal-imagerecipestable') except: self.fail(msg='No Compatible image tab available') self.assertTrue(re.search("Compatible image recipes",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible image recipes information is not loading properly') try: self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'softwarerecipes/"'+"]").click() - self.wait_until_present('#config-nav', poll=10) + self.wait_until_present('#filter-modal-softwarerecipestable') except: self.fail(msg='No Compatible software recipe tab available') self.assertTrue(re.search("Compatible software recipes",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible software recipe information is not loading properly') try: self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'machines/"'+"]").click() - self.wait_until_present('#config-nav', poll=10) + self.wait_until_present('#filter-modal-machinestable') except: self.fail(msg='No Compatible machines tab available') self.assertTrue(re.search("Compatible machines",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible machine information is not loading properly') try: self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'layers/"'+"]").click() - self.wait_until_present('#config-nav', poll=10) + self.wait_until_present('#filter-modal-layerstable') except: self.fail(msg='No Compatible layers tab available') self.assertTrue(re.search("Compatible layers",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible layer information is not loading properly') try: self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'configuration"'+"]").click() - self.wait_until_present('#config-nav', poll=10) + self.wait_until_present('#configvar-list') except: self.fail(msg='No Bitbake variables tab available') self.assertTrue(re.search("Bitbake variables",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Bitbake variables information is not loading properly') @@ -85,20 +85,21 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): self.wait_until_present('#projectstable', poll=10) self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() project_URL=self.get_URL() - self.wait_until_present('#config-nav', poll=10) # Machine section of page + self.wait_until_visible('#machine-section') self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist') self.assertTrue(re.search("qemux86-64",self.driver.find_element(By.XPATH, "//span[@id='project-machine-name']").text),'The machine type is not assigned') try: self.driver.find_element(By.XPATH, "//span[@id='change-machine-toggle']").click() - self.wait_until_visible('#select-machine-form', poll=10) - self.wait_until_visible('#cancel-machine-change', poll=10) + 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() except: self.fail(msg='The machine information is wrong in the configuration page') # Most built recipes section + self.wait_until_visible('#no-most-built') try: self.driver.find_element(By.ID, 'no-most-built') except: @@ -108,6 +109,7 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): self.assertTrue(re.search("Yocto Project master",self.driver.find_element(By.XPATH, "//span[@id='project-release-title']").text), 'The project release is not defined in the project detail page') # List of layers in project + self.wait_until_visible('#layer-container') 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') try: @@ -131,14 +133,15 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): self.get(reverse('all-projects')) self.wait_until_present('#projectstable', poll=10) self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() - self.wait_until_present('#config-nav', poll=10) + self.wait_until_visible('#machine-section') self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist') + self.wait_until_visible('#project-machine-name') self.assertTrue(re.search("qemux86-64",self.driver.find_element(By.ID, "project-machine-name").text),'The machine type is not assigned') try: self.driver.find_element(By.ID, "change-machine-toggle").click() - self.wait_until_visible('#select-machine-form', poll=10) - self.wait_until_visible('#cancel-machine-change', poll=10) + self.wait_until_visible('#select-machine-form') + self.wait_until_visible('#cancel-machine-change') self.driver.find_element(By.ID, "cancel-machine-change").click() except: self.fail(msg='The machine information is wrong in the configuration page') @@ -148,14 +151,16 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): self.get(reverse('all-projects')) self.wait_until_present('#projectstable', poll=10) self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() - self.wait_until_present('#config-nav', poll=10) + self.wait_until_present('#config-nav') project_URL=self.get_URL() + + self.wait_until_visible('#no-most-built') 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') try: self.driver.find_element(By.XPATH, "//div[@id='no-most-built']/p/a[@href="+'"'+project_URL+'images/"'+"]").click() except: self.fail(msg='No Most built information in project detail page') - self.wait_until_present('#config-nav', poll=10) + self.wait_until_visible('#config-nav') 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') # testcase (1519) @@ -163,7 +168,7 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): self.get(reverse('all-projects')) self.wait_until_present('#projectstable', poll=10) self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() - self.wait_until_present('#config-nav', poll=10) + self.wait_until_visible('#project-release-title') self.assertTrue(re.search("Yocto Project master",self.driver.find_element(By.ID, "project-release-title").text), 'No project release title information in project detail page') # testcase (1520) @@ -171,9 +176,11 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): self.get(reverse('all-projects')) self.wait_until_present('#projectstable', poll=10) self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() - self.wait_until_present('#config-nav', poll=10) + self.wait_until_present('#config-nav') project_URL=self.get_URL() + self.wait_until_visible('#layer-container') self.driver.find_element(By.XPATH, "//div[@id='layer-container']") + self.wait_until_visible('#project-layers-count') 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') try: @@ -205,18 +212,18 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): self.get(reverse('all-projects')) self.wait_until_present('#projectstable', poll=10) self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() - self.wait_until_present('#config-nav', poll=10) + self.wait_until_present('#config-nav') project_URL=self.get_URL() 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.wait_until_present('#config-nav', poll=10) + self.wait_until_visible('#topbar-configuration-tab') 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') try: self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'builds/"'+"]").click() - self.wait_until_visible('#project-topbar', poll=10) except: self.fail(msg='Builds tab information is not present') + self.wait_until_visible('#project-topbar') self.assertTrue(re.search("Builds",self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'builds/"'+"]").text), 'Builds tab in project topbar is misspelled') try: self.driver.find_element(By.XPATH, "//div[@id='empty-state-projectbuildstable']") @@ -225,9 +232,10 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): try: self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'importlayer"'+"]").click() - self.wait_until_visible('#project-topbar', poll=10) except: self.fail(msg='Import layer tab not loading properly') + + self.wait_until_visible('#project-topbar') self.assertTrue(re.search("Import layer",self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'importlayer"'+"]").text), 'Import layer tab in project topbar is misspelled') try: self.driver.find_element(By.XPATH, "//fieldset[@id='repo-select']") @@ -237,9 +245,10 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): try: self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'newcustomimage/"'+"]").click() - self.wait_until_visible('#project-topbar', poll=10) except: self.fail(msg='New custom image tab not loading properly') + + self.wait_until_visible('#project-topbar') self.assertTrue(re.search("New custom image",self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'newcustomimage/"'+"]").text), 'New custom image tab in project topbar is misspelled') self.assertTrue(re.search("Select the image recipe you want to customise",self.driver.find_element(By.XPATH, "//div[@class='col-md-12']/h2").text),'The new custom image tab is not loading correctly') From patchwork Wed Oct 23 09:59:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51103 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 AEC64CDDE42 for ; Wed, 23 Oct 2024 10:00:09 +0000 (UTC) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by mx.groups.io with SMTP id smtpd.web11.5146.1729677599703658958 for ; Wed, 23 Oct 2024 03:00:00 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=TmyaXrgo; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.53, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4314a26002bso72856645e9.0 for ; Wed, 23 Oct 2024 02:59:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677598; x=1730282398; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ly2tjwbquGn6oPbLMnzzW9tlwgWxk5nEctjLh7eyQiw=; b=TmyaXrgoYel0CdgK+hXT/3maJrXhihXrhjASFX6P7KN/PiMJq1kl5MIKK6h80GqVVP 9Tlk+NGRuOjNch5cNB2NKeEA3MX2fAnuG9nMow6eN9X7vnLz9uzwB//VG7DL3BU9GHM8 6nhDp0JQYOnFRxxEdXaB1zCcm8DqufBwYK3VY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677598; x=1730282398; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ly2tjwbquGn6oPbLMnzzW9tlwgWxk5nEctjLh7eyQiw=; b=mP20/29TiFtOtSdPSnBrAQIAtqNyw/3sVtlNvugP1S4z3ZPghLIyg6pTQuIgH6BG7O DmSvv2Cllhw1pj0WMpqPVeu8OgWY88uSbgV8vejHRwMSapvBnoqFXd2bKtSUvOVRAjKF HOi88XauuMGsLYWoBdFNEcWNWWmo0v/QVhxE9e5gBywiz5sk0iXfF/Sp6BUGJHzRDWRf CeJXOPINxSiaz6Fxg7x2SNWVhLmNhmGwdJSXBmVW9L9IBX362muWMY35LsIt7o0o16wJ Bwq/jTHAUo/+x499yCF1h9IlkofUCdhuxU1txm1cxxQux/elvj/FQIkD3XXquGzV9CjQ zG6A== X-Gm-Message-State: AOJu0YxCVSohGqCix/bpP5/ZXvijXlmbpV7IgNsE8ttleINkoFrzcm+v 3yHDPT8qsRCraKG4DpdMVGYdE4bFMXo2kutKCnxDakM7Vx38g152gKzs2OSCJIhYkcdE2rCk/ss 7 X-Google-Smtp-Source: AGHT+IEvLdKLTnzZz6Z9RIZv6UHdbYBrhQ8ozZip89IZM8z58faa10YSVjucdE0mOXYfW/71TsplFQ== X-Received: by 2002:a05:600c:1d9b:b0:431:4e82:ffa6 with SMTP id 5b1f17b1804b1-43184188334mr19252305e9.24.1729677597792; Wed, 23 Oct 2024 02:59:57 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.02.59.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 02:59:57 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 07/28] toaster/tests/browser: Increase the default wait timeout Date: Wed, 23 Oct 2024 10:59:28 +0100 Message-ID: <20241023095949.3351980-7-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 10:00:09 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16698 Rather than hardcoded poll and sleep values, we want an overall long timeout and to drop all the other 'sleeping' code. To facilitate this, increase the overall timeout so we can then start to remove the other values. Signed-off-by: Richard Purdie --- lib/toaster/tests/browser/selenium_helpers_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/toaster/tests/browser/selenium_helpers_base.py b/lib/toaster/tests/browser/selenium_helpers_base.py index 2725f13382..b060133b1d 100644 --- a/lib/toaster/tests/browser/selenium_helpers_base.py +++ b/lib/toaster/tests/browser/selenium_helpers_base.py @@ -90,7 +90,7 @@ class Wait(WebDriverWait): Subclass of WebDriverWait with predetermined timeout and poll frequency. Also deals with a wider variety of exceptions. """ - _TIMEOUT = 10 + _TIMEOUT = 20 _POLL_FREQUENCY = 0.5 def __init__(self, driver, timeout=_TIMEOUT, poll=_POLL_FREQUENCY): From patchwork Wed Oct 23 09:59:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51108 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 C0844CDDE40 for ; Wed, 23 Oct 2024 10:00:09 +0000 (UTC) Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by mx.groups.io with SMTP id smtpd.web11.5147.1729677600594665726 for ; Wed, 23 Oct 2024 03:00:00 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=AOUGyQlU; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.43, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4314a26002bso72856795e9.0 for ; Wed, 23 Oct 2024 03:00:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677599; x=1730282399; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=rFGIN9R8u/3oSpdsb4RenPPPK9+HW3v6VQeYXJI+Mgs=; b=AOUGyQlU14mNDaCXfptcbnzprL6z8OVGdcmbbfVHKSsS9VvNk0/6mFd1tdHSRBIb8D LPUf6iHFPD3htF+3LgfONCvpAz1YYCWdo4L0+JzvGnpt9JbtxjGurLRWpiRBEKlmHZ+R 1lQVQIq4PGDkUmClUjApEtfbKC77HmfmOYDRg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677599; x=1730282399; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rFGIN9R8u/3oSpdsb4RenPPPK9+HW3v6VQeYXJI+Mgs=; b=oBD00Sk/+6Khl3gmdr5lNmUvG8XcstO05dAOSXm11h8BAZ7NJugjh1dmUf8A6LnOYs zworydRSze1Q/UGPtzubXRmMA6y5vssX1+HpkknsVjdetuMo9CQRGjRry57yPiQr6Xno xXFG6ZdoVJy0AZklGKz2+7pKlM/QGqQGtMzze9/abZtNm0SrJuYc/qsrWK+nOGOBVl/M AJvS/1VKFIstQcd4zUnFdtxGOgRrwwZSUXcQ2idxc6cDkVYi0ml+CTGymgJKq56qsKEJ bEslzheM7VfQii3C6ja84wy81CbbBvjpqrdXulMYGXsCwSaYpUz2FlEpmVrqTh4OH0dA 8ncg== X-Gm-Message-State: AOJu0YxVURrOmfj1Fi7x4TY1ktDk+VImXudrYW+6rxzqRZMnHJQnOMRE Cd9ztWFdYhySl91KOBOddRKqOn7SXg8WzfzdB5TumTo87jnBh0eyvU5lBid9eUzHjlmwq6e5r4+ W X-Google-Smtp-Source: AGHT+IGOVyw9Wrk5T+OAufhrzUeo+xEFGGuV85WSVyz6/3/wWl9Y/vTDocOpqyyAVHddxRbrq20nLg== X-Received: by 2002:a05:600c:45c3:b0:431:7ca6:57b1 with SMTP id 5b1f17b1804b1-431841a3bdamr19992895e9.32.1729677598682; Wed, 23 Oct 2024 02:59:58 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.02.59.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 02:59:58 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 08/28] toaster/tests/browser: Drop unneeded poll parameters Date: Wed, 23 Oct 2024 10:59:29 +0100 Message-ID: <20241023095949.3351980-8-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 10:00:09 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16699 In my testing I wasn't able to see issues needing the poll parameter in the browser tests. Drop those. Signed-off-by: Richard Purdie --- lib/toaster/tests/browser/test_all_builds_page.py | 6 +++--- lib/toaster/tests/browser/test_all_projects_page.py | 12 ++++++------ .../tests/browser/test_builddashboard_page.py | 2 +- lib/toaster/tests/browser/test_landing_page.py | 2 +- lib/toaster/tests/browser/test_layerdetails_page.py | 8 ++++---- .../tests/browser/test_new_custom_image_page.py | 2 +- lib/toaster/tests/browser/test_new_project_page.py | 8 ++++---- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/toaster/tests/browser/test_all_builds_page.py b/lib/toaster/tests/browser/test_all_builds_page.py index b9356a0344..a1f8057113 100644 --- a/lib/toaster/tests/browser/test_all_builds_page.py +++ b/lib/toaster/tests/browser/test_all_builds_page.py @@ -224,7 +224,7 @@ class TestAllBuildsPage(SeleniumTestCase): url = reverse('all-builds') self.get(url) - self.wait_until_visible('#allbuildstable', poll=3) + self.wait_until_visible('#allbuildstable') # get the project name cells from the table cells = self.find_all('#allbuildstable td[class="project"]') @@ -257,7 +257,7 @@ class TestAllBuildsPage(SeleniumTestCase): url = reverse('all-builds') self.get(url) - self.wait_until_visible('#allbuildstable', poll=3) + self.wait_until_visible('#allbuildstable') # test recent builds area for successful build element = self._get_build_time_element(build1) @@ -452,7 +452,7 @@ class TestAllBuildsPage(SeleniumTestCase): def test_show_rows(row_to_show, show_row_link): # Check that we can show rows == row_to_show show_row_link.select_by_value(str(row_to_show)) - self.wait_until_visible('#allbuildstable tbody tr', poll=3) + self.wait_until_visible('#allbuildstable tbody tr') # check at least some rows are visible self.assertTrue( len(self.find_all('#allbuildstable tbody tr')) > 0 diff --git a/lib/toaster/tests/browser/test_all_projects_page.py b/lib/toaster/tests/browser/test_all_projects_page.py index 9ed1901cc9..05e12892be 100644 --- a/lib/toaster/tests/browser/test_all_projects_page.py +++ b/lib/toaster/tests/browser/test_all_projects_page.py @@ -81,7 +81,7 @@ class TestAllProjectsPage(SeleniumTestCase): def _get_row_for_project(self, project_name): """ Get the HTML row for a project, or None if not found """ - self.wait_until_visible('#projectstable tbody tr', poll=3) + self.wait_until_visible('#projectstable tbody tr') rows = self.find_all('#projectstable tbody tr') # find the row with a project name matching the one supplied @@ -236,7 +236,7 @@ class TestAllProjectsPage(SeleniumTestCase): self.get(url) # Chseck search box is present and works - self.wait_until_visible('#projectstable tbody tr', poll=3) + self.wait_until_visible('#projectstable tbody tr') search_box = self.find('#search-input-projectstable') self.assertTrue(search_box.is_displayed()) @@ -244,7 +244,7 @@ class TestAllProjectsPage(SeleniumTestCase): search_box.send_keys('test project 10') search_btn = self.find('#search-submit-projectstable') search_btn.click() - self.wait_until_visible('#projectstable tbody tr', poll=3) + self.wait_until_visible('#projectstable tbody tr') rows = self.find_all('#projectstable tbody tr') self.assertTrue(len(rows) == 1) @@ -290,7 +290,7 @@ class TestAllProjectsPage(SeleniumTestCase): ) url = reverse('all-projects') self.get(url) - self.wait_until_visible('#projectstable tbody tr', poll=3) + self.wait_until_visible('#projectstable tbody tr') # Check edit column edit_column = self.find('#edit-columns-button') @@ -313,7 +313,7 @@ class TestAllProjectsPage(SeleniumTestCase): def test_show_rows(row_to_show, show_row_link): # Check that we can show rows == row_to_show show_row_link.select_by_value(str(row_to_show)) - self.wait_until_visible('#projectstable tbody tr', poll=3) + self.wait_until_visible('#projectstable tbody tr') # check at least some rows are visible self.assertTrue( len(self.find_all('#projectstable tbody tr')) > 0 @@ -321,7 +321,7 @@ class TestAllProjectsPage(SeleniumTestCase): url = reverse('all-projects') self.get(url) - self.wait_until_visible('#projectstable tbody tr', poll=3) + self.wait_until_visible('#projectstable tbody tr') show_rows = self.driver.find_elements( By.XPATH, diff --git a/lib/toaster/tests/browser/test_builddashboard_page.py b/lib/toaster/tests/browser/test_builddashboard_page.py index d838ce363a..82367108e2 100644 --- a/lib/toaster/tests/browser/test_builddashboard_page.py +++ b/lib/toaster/tests/browser/test_builddashboard_page.py @@ -162,7 +162,7 @@ class TestBuildDashboardPage(SeleniumTestCase): """ url = reverse('builddashboard', args=(build.id,)) self.get(url) - self.wait_until_visible('#global-nav', poll=3) + self.wait_until_visible('#global-nav') def _get_build_dashboard_errors(self, build): """ diff --git a/lib/toaster/tests/browser/test_landing_page.py b/lib/toaster/tests/browser/test_landing_page.py index 62fdf83c91..f3300430ba 100644 --- a/lib/toaster/tests/browser/test_landing_page.py +++ b/lib/toaster/tests/browser/test_landing_page.py @@ -224,7 +224,7 @@ class TestLandingPage(SeleniumTestCase): self.get(reverse('landing')) - self.wait_until_visible("#latest-builds", poll=3) + self.wait_until_visible("#latest-builds") elements = self.find_all('#allbuildstable') self.assertEqual(len(elements), 1, 'should redirect to builds') content = self.get_page_source() diff --git a/lib/toaster/tests/browser/test_layerdetails_page.py b/lib/toaster/tests/browser/test_layerdetails_page.py index 5c29548b78..c4f3f79d34 100644 --- a/lib/toaster/tests/browser/test_layerdetails_page.py +++ b/lib/toaster/tests/browser/test_layerdetails_page.py @@ -108,9 +108,9 @@ class TestLayerDetailsPage(SeleniumTestCase): save_btn.click() try: - self.wait_until_visible("#save-changes-for-switch", poll=3) + self.wait_until_visible("#save-changes-for-switch") btn_save_chg_for_switch = self.wait_until_clickable( - "#save-changes-for-switch", poll=3) + "#save-changes-for-switch") btn_save_chg_for_switch.click() except ElementClickInterceptedException: self.skipTest( @@ -148,9 +148,9 @@ class TestLayerDetailsPage(SeleniumTestCase): dir_input.send_keys(new_dir) try: - self.wait_until_visible("#save-changes-for-switch", poll=3) + self.wait_until_visible("#save-changes-for-switch") btn_save_chg_for_switch = self.wait_until_clickable( - "#save-changes-for-switch", poll=3) + "#save-changes-for-switch") btn_save_chg_for_switch.click() except ElementClickInterceptedException: self.skipTest( diff --git a/lib/toaster/tests/browser/test_new_custom_image_page.py b/lib/toaster/tests/browser/test_new_custom_image_page.py index 9f0b6397fe..bf0304dbec 100644 --- a/lib/toaster/tests/browser/test_new_custom_image_page.py +++ b/lib/toaster/tests/browser/test_new_custom_image_page.py @@ -90,7 +90,7 @@ class TestNewCustomImagePage(SeleniumTestCase): """ url = reverse('newcustomimage', args=(self.project.id,)) self.get(url) - self.wait_until_visible('#global-nav', poll=3) + self.wait_until_visible('#global-nav') self.click('button[data-recipe="%s"]' % self.recipe.id) diff --git a/lib/toaster/tests/browser/test_new_project_page.py b/lib/toaster/tests/browser/test_new_project_page.py index 458bb6538d..b6187db105 100644 --- a/lib/toaster/tests/browser/test_new_project_page.py +++ b/lib/toaster/tests/browser/test_new_project_page.py @@ -47,7 +47,7 @@ class TestNewProjectPage(SeleniumTestCase): url = reverse('newproject') self.get(url) - self.wait_until_visible('#new-project-name', poll=3) + self.wait_until_visible('#new-project-name') self.enter_text('#new-project-name', project_name) select = Select(self.find('#projectversion')) @@ -58,7 +58,7 @@ class TestNewProjectPage(SeleniumTestCase): # We should get redirected to the new project's page with the # notification at the top element = self.wait_until_visible( - '#project-created-notification', poll=3) + '#project-created-notification') self.assertTrue(project_name in element.text, "New project name not in new project notification") @@ -79,7 +79,7 @@ class TestNewProjectPage(SeleniumTestCase): url = reverse('newproject') self.get(url) - self.wait_until_visible('#new-project-name', poll=3) + self.wait_until_visible('#new-project-name') self.enter_text('#new-project-name', project_name) @@ -91,7 +91,7 @@ class TestNewProjectPage(SeleniumTestCase): self.click("#create-project-button") - self.wait_until_present('#hint-error-project-name', poll=3) + self.wait_until_present('#hint-error-project-name') element = self.find('#hint-error-project-name') self.assertTrue(("Project names must be unique" in element.text), From patchwork Wed Oct 23 09:59:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51104 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 C0F3FCDDE46 for ; Wed, 23 Oct 2024 10:00:09 +0000 (UTC) Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by mx.groups.io with SMTP id smtpd.web10.5136.1729677601364586506 for ; Wed, 23 Oct 2024 03:00:01 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=DPvX7Ilk; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.54, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4315df7b43fso66924505e9.0 for ; Wed, 23 Oct 2024 03:00:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677599; x=1730282399; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=PyrslNps/NUi6yiPu3AJoosTDm26ES04DdJ2F7mDL1c=; b=DPvX7IlkCFZraTK8u8BCBI6ym0rwnArQbMDLxS0HRQq8aQJJTCh4o05s/1cIKQuUd5 TXk1FNxM7PH0NrwVmUW98HqaLS7QBUgxXgtpKvymlj7m9s+FJud/uEoAZVB07UK0tRvu oZc/5t/DJTnGpv7BbHPhv41Mfi2aOJsvj8jzo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677599; x=1730282399; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PyrslNps/NUi6yiPu3AJoosTDm26ES04DdJ2F7mDL1c=; b=ZsGi7Ll35KaWAXeB39gKYuEgMtQI8w/VjHr+M0RW6cIi67kozqijXCA/tPddn470Ak UBZSZANa/IF2vvFjm9W7fuDScdbSBhld1Jc9vLWIhssoTexYwpZToVCa48kPQ1Jsr63i +FJ8JjxB3t8zG8XNivw5fQ++FCig9wKinQa4X54u/HCpv/rPNTzQR7nIbG8+jd5I2QaT kqAIuGrcd+LeV9FBAdtyU1jaE1xyoGi/HUh9jkFOmxjXWFk95yk2gxY2twDfdrmuyVTA nZ69yX/byTaQgdy4EehUqJfmYWaWl4BQmpcQmso4ZMfzlZWO0AIiayRiGiQ3RYUU5mms vt7Q== X-Gm-Message-State: AOJu0Yzc7NwZj/sV77Fdru64lv6IX7XenMLiIrPANXdgOGmLATJ0YVCF 76cB96zYV324nEhwhvgdpGIcAxNUjDuw9Fd/onJVlu49fcKog6YzxJ6k24peKNGp/0ZarLmta16 h X-Google-Smtp-Source: AGHT+IHbM1PdfIha0Hnnt/Nl/24CwxNxxL7iT8UPc2+VVz+tJk/OcN2yowipJyLEZRobF1pKoS8Taw== X-Received: by 2002:adf:fa87:0:b0:374:c8e5:d56a with SMTP id ffacd0b85a97d-37efcf8ec89mr1287346f8f.48.1729677599512; Wed, 23 Oct 2024 02:59:59 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.02.59.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 02:59:58 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 09/28] toaster/tests/functional/helpers: Drop unneeded poll values and sleep Date: Wed, 23 Oct 2024 10:59:30 +0100 Message-ID: <20241023095949.3351980-9-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 10:00:09 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16700 Drop the remaining poll values and the sleep within the main wait function as the races this was working around now seem to be resolved with the preceeding patches. Signed-off-by: Richard Purdie --- lib/toaster/tests/browser/selenium_helpers_base.py | 1 - lib/toaster/tests/functional/functional_helpers.py | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/toaster/tests/browser/selenium_helpers_base.py b/lib/toaster/tests/browser/selenium_helpers_base.py index b060133b1d..5a4a4ef8b4 100644 --- a/lib/toaster/tests/browser/selenium_helpers_base.py +++ b/lib/toaster/tests/browser/selenium_helpers_base.py @@ -225,7 +225,6 @@ class SeleniumTestCaseBase(unittest.TestCase): is_visible = lambda driver: self.find(selector).is_displayed() msg = 'An element matching "%s" should be visible' % selector Wait(self.driver, poll=poll).until(is_visible, msg) - time.sleep(poll) # wait for visibility to settle return self.find(selector) def wait_until_clickable(self, selector, poll=1): diff --git a/lib/toaster/tests/functional/functional_helpers.py b/lib/toaster/tests/functional/functional_helpers.py index cc508e98d9..a7a3459630 100644 --- a/lib/toaster/tests/functional/functional_helpers.py +++ b/lib/toaster/tests/functional/functional_helpers.py @@ -167,7 +167,7 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase): self.assertEqual(del_response.status_code, 200) self.get(reverse('newproject')) - self.wait_until_visible('#new-project-name', poll=3) + self.wait_until_visible('#new-project-name') self.driver.find_element(By.ID, "new-project-name").send_keys(project_name) @@ -187,7 +187,7 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase): self.driver.find_element(By.ID, "create-project-button").click() - element = self.wait_until_visible('#project-created-notification', poll=3) + element = self.wait_until_visible('#project-created-notification') self.assertTrue( self.element_exists('#project-created-notification'), f"Project:{project_name} creation notification not shown" From patchwork Wed Oct 23 09:59:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51107 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 CFFFCCDDE4A for ; Wed, 23 Oct 2024 10:00:09 +0000 (UTC) Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by mx.groups.io with SMTP id smtpd.web10.5138.1729677602782704450 for ; Wed, 23 Oct 2024 03:00:03 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=BqkqniOC; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.47, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4315839a7c9so72639265e9.3 for ; Wed, 23 Oct 2024 03:00:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677601; x=1730282401; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Fhpzv6XJPkz0xg7HJqtYVgbpFBZ7mGMyZCBsq0rCHok=; b=BqkqniOCTNrkb3aR3VdDCt3jbslMSrp51/GK5ABesX1B7/1WxQv1KGI5ca6sYQLYq4 sNsn4NRgizb/A21Ehsrz69JQekHVouGOzFCW8OBNlrE/tyq4jzG6Z/QHrGLiEvjFyjrZ nA2OoweYWP0jOydPLWICOFMRnhxFDZ/nC46lU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677601; x=1730282401; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Fhpzv6XJPkz0xg7HJqtYVgbpFBZ7mGMyZCBsq0rCHok=; b=ujO2LqrJDZyqcvD9FDU6WqaJgW7iJQzT7II3W512hFhNgixABxVc7jJtIkjs1Zjb3S r/336TXQ5lsBU22679XAjIroEZbz+Xx1feV7Hl+LP+R+DAFMhbHZN9LFnWlH9vjof7g3 BDhumxh6shHXxt6Ri/QawtHl6sLfONrAn2JGFWeN65KzBTycUsVlK3fLXf8wIAYzdN/s 7TM2eMETNqbJX426dyXUJt4Fbrd8NfnSc5Q+AYbW00LzYEhBq3Ou3pA0WEJKSaubntnI gi9MPMH54eLYnIEWty7aq0V16Ft9R6qh87aPgapp+lxCbnC3ar1OjRcbW+PrEIFfTeva ZaXQ== X-Gm-Message-State: AOJu0Yy/TJJOX+IizdBNBpo3FWOoJPWiTP5N/QCu0d/mFiVUAojz73Fj KlRmEibKxGkT8kOCqHKgcZWtjF1vf+k2wZu4YqgONiQQFfxHklvdZTKQKlSMHIHzKItfJ7sKPye v X-Google-Smtp-Source: AGHT+IGFZDmzU1ug7qMp5Py7N1KC4xf81eeCd59I179t7t1Pm3I3kY7FcTEglrewEN9fdkTMuKHcZA== X-Received: by 2002:a05:600c:1c9d:b0:431:12a8:7f1a with SMTP id 5b1f17b1804b1-4318415a497mr18654625e9.16.1729677600899; Wed, 23 Oct 2024 03:00:00 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.02.59.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 02:59:59 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 10/28] toaster/tests/functional/basic: Improve the projects table selection to a common function Date: Wed, 23 Oct 2024 10:59:31 +0100 Message-ID: <20241023095949.3351980-10-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 10:00:09 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16701 The project page selection code is race prone. Create a common function to resolve the race issue and use it from all the call sites rather than duplicate code. Signed-off-by: Richard Purdie --- .../tests/functional/functional_helpers.py | 6 ++++++ .../tests/functional/test_functional_basic.py | 15 ++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/toaster/tests/functional/functional_helpers.py b/lib/toaster/tests/functional/functional_helpers.py index a7a3459630..e28f2024f5 100644 --- a/lib/toaster/tests/functional/functional_helpers.py +++ b/lib/toaster/tests/functional/functional_helpers.py @@ -216,3 +216,9 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase): 'The project release is not defined') return project_id + + def load_projects_page_helper(self): + self.wait_until_present('#projectstable') + # Need to wait for some data in the table too + self.wait_until_present('td[class="updated"]') + diff --git a/lib/toaster/tests/functional/test_functional_basic.py b/lib/toaster/tests/functional/test_functional_basic.py index c73a278f6c..d5c9708617 100644 --- a/lib/toaster/tests/functional/test_functional_basic.py +++ b/lib/toaster/tests/functional/test_functional_basic.py @@ -20,6 +20,7 @@ from tests.functional.utils import get_projectId_from_url class FuntionalTestBasic(SeleniumFunctionalTestCase): """Basic functional tests for Toaster""" project_id = None + project_url = None def setUp(self): super(FuntionalTestBasic, self).setUp() @@ -29,7 +30,7 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): # testcase (1515) def test_verify_left_bar_menu(self): self.get(reverse('all-projects')) - self.wait_until_present('#projectstable', poll=10) + self.load_projects_page_helper() self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() self.wait_until_present('#config-nav') self.assertTrue(self.element_exists('#config-nav'),'Configuration Tab does not exist') @@ -82,7 +83,7 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): # testcase (1516) def test_review_configuration_information(self): self.get(reverse('all-projects')) - self.wait_until_present('#projectstable', poll=10) + self.load_projects_page_helper() self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() project_URL=self.get_URL() @@ -131,7 +132,7 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): # testcase (1517) def test_verify_machine_information(self): self.get(reverse('all-projects')) - self.wait_until_present('#projectstable', poll=10) + self.load_projects_page_helper() self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() self.wait_until_visible('#machine-section') @@ -149,7 +150,7 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): # testcase (1518) def test_verify_most_built_recipes_information(self): self.get(reverse('all-projects')) - self.wait_until_present('#projectstable', poll=10) + self.load_projects_page_helper() self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() self.wait_until_present('#config-nav') project_URL=self.get_URL() @@ -166,7 +167,7 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): # testcase (1519) def test_verify_project_release_information(self): self.get(reverse('all-projects')) - self.wait_until_present('#projectstable', poll=10) + self.load_projects_page_helper() self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() self.wait_until_visible('#project-release-title') self.assertTrue(re.search("Yocto Project master",self.driver.find_element(By.ID, "project-release-title").text), 'No project release title information in project detail page') @@ -174,7 +175,7 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): # testcase (1520) def test_verify_layer_information(self): self.get(reverse('all-projects')) - self.wait_until_present('#projectstable', poll=10) + self.load_projects_page_helper() self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() self.wait_until_present('#config-nav') project_URL=self.get_URL() @@ -210,7 +211,7 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): # testcase (1521) def test_verify_project_detail_links(self): self.get(reverse('all-projects')) - self.wait_until_present('#projectstable', poll=10) + self.load_projects_page_helper() self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() self.wait_until_present('#config-nav') project_URL=self.get_URL() From patchwork Wed Oct 23 09:59:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51106 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 CF4FBCDDE49 for ; Wed, 23 Oct 2024 10:00:09 +0000 (UTC) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by mx.groups.io with SMTP id smtpd.web10.5141.1729677604183341408 for ; Wed, 23 Oct 2024 03:00:04 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=YiABFCeD; spf=pass (domain: linuxfoundation.org, ip: 209.85.221.54, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-37d49ffaba6so4619754f8f.0 for ; Wed, 23 Oct 2024 03:00:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677602; x=1730282402; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=hBcJjJxtGAeG5XTX0gIQ8MFz+gZtuRpeHhXT0hG3RNQ=; b=YiABFCeDGam5QPwL4kPOQIUrTRyeiUMOVB/dfPJNzf+oy1MonF8nUKiOiJPLhxzMaZ 9xj7KQ+grY42OxhVTiR7FJC11PCoFo5EwsBiti0p/DLguI1UXZ1ewHQEraaDnVI3abvu cfByOBeGtpaaU/6GOK25Z1BWb9oFAVNo56K6A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677602; x=1730282402; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hBcJjJxtGAeG5XTX0gIQ8MFz+gZtuRpeHhXT0hG3RNQ=; b=rjRs8h+8OBiTAOFw4sX+P1tiKtbQTnw6yYIVE1iFq7MFsiPYhOj4AvkrNp0yEkaw82 6bTbELA7lCFQuxzOuZj1llyeZgE1Lm6y5D40Xj1T2oFMvaDl2ZNv6W7Ro1V9oGcFGLgn jUzeWrPPOBnLUI+f+MApG+XfM69annvfsibJlCfbEqoGeumtm6ZhWWYsgosQY3g9Xkcf wv5t66d6ji7NNgK9INFZwI9S+YYQcXn5YNxiQF0QDPttLrq/pIXoBz8pvg3pNsMNUsrS MGsJULXpbop8dyP3bfcDNZmI2wK8XE/l9lLoIWDHSgI2LvgeDeXGd+PbfW2kOXaYAjea 94Jw== X-Gm-Message-State: AOJu0YynTLJOI66WHbrDejkjGj+bXcitc0eD3sTyRTrBZQIBItwR4G2R fpnYX86iqU5RadnVTUrY3oamM9UXBybORozMuyYSaKOPpFlhge0DrFBbn90IW/vtEofCXqdgHMM l X-Google-Smtp-Source: AGHT+IFKAyiHWl0zQ0i7yxtPmt/u0DiEO6mpUQi97Zfyc16vqPrMSF9qmQIxYzK8BluC+j7o3hilQQ== X-Received: by 2002:adf:eb06:0:b0:374:c84d:1cfe with SMTP id ffacd0b85a97d-37efcf06b6bmr1164632f8f.21.1729677602322; Wed, 23 Oct 2024 03:00:02 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.03.00.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 03:00:01 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 11/28] toaster/tests/functional/project_config: Fix the wait calls to avoid polling Date: Wed, 23 Oct 2024 10:59:32 +0100 Message-ID: <20241023095949.3351980-11-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 10:00:09 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16702 Drop poll calls within the module, adding wait calls for elements of the page where testing showed it was needed. Signed-off-by: Richard Purdie --- .../tests/functional/test_project_config.py | 47 +++++++++---------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/lib/toaster/tests/functional/test_project_config.py b/lib/toaster/tests/functional/test_project_config.py index 41149e5e55..fcb1bc3284 100644 --- a/lib/toaster/tests/functional/test_project_config.py +++ b/lib/toaster/tests/functional/test_project_config.py @@ -36,10 +36,10 @@ class TestProjectConfig(SeleniumFunctionalTestCase): url = reverse('projectconf', args=(TestProjectConfig.project_id,)) self.get(url) - self.wait_until_visible('#config-nav', poll=3) + self.wait_until_visible('#config-nav') bbv_page_link = self._get_config_nav_item(9) bbv_page_link.click() - self.wait_until_visible('#config-nav', poll=3) + self.wait_until_visible('#config-nav') def test_no_underscore_iamgefs_type(self): """ @@ -48,13 +48,13 @@ class TestProjectConfig(SeleniumFunctionalTestCase): self._navigate_bbv_page() imagefs_type = "foo_bar" - self.wait_until_visible('#change-image_fstypes-icon', poll=2) + self.wait_until_visible('#change-image_fstypes-icon') self.click('#change-image_fstypes-icon') self.enter_text('#new-imagefs_types', imagefs_type) - element = self.wait_until_visible('#hintError-image-fs_type', poll=2) + element = self.wait_until_visible('#hintError-image-fs_type') self.assertTrue(("A valid image type cannot include underscores" in element.text), "Did not find underscore error message") @@ -68,7 +68,7 @@ class TestProjectConfig(SeleniumFunctionalTestCase): imagefs_type = "btrfs" - self.wait_until_visible('#change-image_fstypes-icon', poll=2) + self.wait_until_visible('#change-image_fstypes-icon') self.click('#change-image_fstypes-icon') @@ -87,22 +87,20 @@ class TestProjectConfig(SeleniumFunctionalTestCase): """ self._navigate_bbv_page() - self.wait_until_visible('#change-image_fstypes-icon', poll=2) - + self.wait_until_visible('#change-image_fstypes-icon') self.click('#change-image_fstypes-icon') checkboxes_selector = '.fs-checkbox-fstypes' - self.wait_until_visible(checkboxes_selector, poll=2) + self.wait_until_visible(checkboxes_selector) checkboxes = self.find_all(checkboxes_selector) for checkbox in checkboxes: if checkbox.get_attribute("value") == "cpio": checkbox.click() + self.wait_until_visible('#new-imagefs_types') element = self.driver.find_element(By.ID, 'new-imagefs_types') - self.wait_until_visible('#new-imagefs_types', poll=2) - self.assertTrue(("cpio" in element.get_attribute('value'), "Imagefs not added into the textbox")) checkbox.click() @@ -118,20 +116,19 @@ class TestProjectConfig(SeleniumFunctionalTestCase): # activate the input to edit download dir try: - change_dl_dir_btn = self.wait_until_visible('#change-dl_dir-icon', poll=2) + change_dl_dir_btn = self.wait_until_visible('#change-dl_dir-icon') except TimeoutException: # If download dir is not displayed, test is skipped change_dl_dir_btn = None if change_dl_dir_btn: - change_dl_dir_btn = self.wait_until_visible('#change-dl_dir-icon', poll=2) change_dl_dir_btn.click() # downloads dir path doesn't start with / or ${...} - input_field = self.wait_until_visible('#new-dl_dir', poll=2) + input_field = self.wait_until_visible('#new-dl_dir') input_field.clear() self.enter_text('#new-dl_dir', 'home/foo') - element = self.wait_until_visible('#hintError-initialChar-dl_dir', poll=2) + element = self.wait_until_visible('#hintError-initialChar-dl_dir') msg = 'downloads directory path starts with invalid character but ' \ 'treated as valid' @@ -141,7 +138,7 @@ class TestProjectConfig(SeleniumFunctionalTestCase): self.driver.find_element(By.ID, 'new-dl_dir').clear() self.enter_text('#new-dl_dir', '/foo/bar a') - element = self.wait_until_visible('#hintError-dl_dir', poll=2) + element = self.wait_until_visible('#hintError-dl_dir') msg = 'downloads directory path characters invalid but treated as valid' self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) @@ -149,7 +146,7 @@ class TestProjectConfig(SeleniumFunctionalTestCase): self.driver.find_element(By.ID,'new-dl_dir').clear() self.enter_text('#new-dl_dir', '${TOPDIR}/down foo') - element = self.wait_until_visible('#hintError-dl_dir', poll=2) + element = self.wait_until_visible('#hintError-dl_dir') msg = 'downloads directory path characters invalid but treated as valid' self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) @@ -177,10 +174,7 @@ class TestProjectConfig(SeleniumFunctionalTestCase): self._navigate_bbv_page() try: - btn_chg_sstate_dir = self.wait_until_visible( - '#change-sstate_dir-icon', - poll=2 - ) + btn_chg_sstate_dir = self.wait_until_visible('#change-sstate_dir-icon') self.click('#change-sstate_dir-icon') except TimeoutException: # If sstate_dir is not displayed, test is skipped @@ -188,10 +182,10 @@ class TestProjectConfig(SeleniumFunctionalTestCase): if btn_chg_sstate_dir: # Skip continuation if sstate_dir is not displayed # path doesn't start with / or ${...} - input_field = self.wait_until_visible('#new-sstate_dir', poll=2) + input_field = self.wait_until_visible('#new-sstate_dir') input_field.clear() self.enter_text('#new-sstate_dir', 'home/foo') - element = self.wait_until_visible('#hintError-initialChar-sstate_dir', poll=2) + element = self.wait_until_visible('#hintError-initialChar-sstate_dir') msg = 'sstate directory path starts with invalid character but ' \ 'treated as valid' @@ -201,7 +195,7 @@ class TestProjectConfig(SeleniumFunctionalTestCase): self.driver.find_element(By.ID, 'new-sstate_dir').clear() self.enter_text('#new-sstate_dir', '/foo/bar a') - element = self.wait_until_visible('#hintError-sstate_dir', poll=2) + element = self.wait_until_visible('#hintError-sstate_dir') msg = 'sstate directory path characters invalid but treated as valid' self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) @@ -209,7 +203,7 @@ class TestProjectConfig(SeleniumFunctionalTestCase): self.driver.find_element(By.ID,'new-sstate_dir').clear() self.enter_text('#new-sstate_dir', '${TOPDIR}/down foo') - element = self.wait_until_visible('#hintError-sstate_dir', poll=2) + element = self.wait_until_visible('#hintError-sstate_dir') msg = 'sstate directory path characters invalid but treated as valid' self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) @@ -233,13 +227,14 @@ class TestProjectConfig(SeleniumFunctionalTestCase): var_name, field, btn_id, input_id, value, save_btn, *_ = kwargs.values() """ Change bitbake variable value """ self._navigate_bbv_page() - self.wait_until_visible(f'#{btn_id}', poll=2) + self.wait_until_visible(f'#{btn_id}') if kwargs.get('new_variable'): self.find(f"#{btn_id}").clear() self.enter_text(f"#{btn_id}", f"{var_name}") else: self.click(f'#{btn_id}') - self.wait_until_visible(f'#{input_id}', poll=2) + + self.wait_until_visible(f'#{input_id}') if kwargs.get('is_select'): select = Select(self.find(f'#{input_id}')) From patchwork Wed Oct 23 09:59:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51110 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 DE024CDDE4B for ; Wed, 23 Oct 2024 10:00:09 +0000 (UTC) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by mx.groups.io with SMTP id smtpd.web10.5146.1729677605863828368 for ; Wed, 23 Oct 2024 03:00:06 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=G8Vprya6; spf=pass (domain: linuxfoundation.org, ip: 209.85.221.52, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-37d4d1b48f3so4784855f8f.1 for ; Wed, 23 Oct 2024 03:00:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677604; x=1730282404; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=p+855hAK9fRr4KCPn6ttUepqUDXIDDP+C8pwp/LiuBc=; b=G8Vprya6zBLChrB0a/vPtRK/lFrxeWrZp0X14rW2PzHLmv+6jLDo+xn5xAvftSRDv0 slZSZIdhm5l6OHdHHgRIhezJu2nGqycrNAKYTuNVdJf0PWw9bodDE0JLJCGjecHArpUP K5oByfz6u4TYqTVFAV6C578fHMI2qiiHa1Vwc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677604; x=1730282404; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=p+855hAK9fRr4KCPn6ttUepqUDXIDDP+C8pwp/LiuBc=; b=Xt1pKD1R2SktudrFbMau8WObmiLjSnRhMrecYTuRr5vV2OYc4iZOK1ifWx8ZWmuvtx hfMYhxPBWmQrDO1LpWm5H+TlS4PU/n7R5aGqwwwHpyLYzS7TonWHWoDRprNnaSh1RBKG MyPFV8x6JtSxgj9Vo+CgWoMbt34o0LpbxX2xXbY2pNiyOUJc3CgINlQYMnnW0buq8sT8 OqmL7a0gKC6dJhsJO6vviPiq5DBep158ZVC2AU/A29foHS3Q7TdqLv+1LtgMaWoP6H3Z RjnwNYGxMz4yG1RnWxW58M0Q04l2/KuD7lDmSIjHvSMJNNNuIqTM0cSjnAfV4fwNFygg rZ6Q== X-Gm-Message-State: AOJu0YxxLNxMHbD62YS7b02DfuXvny2sAOuH1xUkr9uCtjNP1NKYKCSa NpmgWdVqni4Tg7eL6kol7GvynlMVFFG0ldSHDruHR5mAl0PoTkMVTaCjHTdLAID7tiibftdT/JW o X-Google-Smtp-Source: AGHT+IGIocagPUKRibgSmzdMuE7Dct71QgMjCpVsJypa4C/Q6BIVV+Nampy53gHkn0bYvCHuGT47WQ== X-Received: by 2002:a5d:694f:0:b0:374:b6f3:728d with SMTP id ffacd0b85a97d-37efcf84c95mr1320984f8f.46.1729677603695; Wed, 23 Oct 2024 03:00:03 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.03.00.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 03:00:03 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 12/28] toaster/tests/functiona/project_page: Switch to using library create_project function Date: Wed, 23 Oct 2024 10:59:33 +0100 Message-ID: <20241023095949.3351980-12-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 10:00:09 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16703 Switch this test module to use the common project creation code which contains race fixes. That code requires the database access wrapper be dropped and we no longer have ordering constraints. There are two tests that do require database access. Move these to a separate class and allow database access there. Use ordering constraints to allow them to run after the main code. They depend on the project creation from the other class which isn't ideal but good enough for now. Signed-off-by: Richard Purdie --- .../tests/functional/test_project_page.py | 118 +++++++----------- 1 file changed, 42 insertions(+), 76 deletions(-) diff --git a/lib/toaster/tests/functional/test_project_page.py b/lib/toaster/tests/functional/test_project_page.py index 5d10513d9d..40ef5f486a 100644 --- a/lib/toaster/tests/functional/test_project_page.py +++ b/lib/toaster/tests/functional/test_project_page.py @@ -7,7 +7,6 @@ # import os -import random import string from unittest import skip import pytest @@ -22,58 +21,17 @@ from selenium.webdriver.common.by import By from .utils import get_projectId_from_url, wait_until_build, wait_until_build_cancelled - -@pytest.mark.django_db -@pytest.mark.order("last") -class TestProjectPage(SeleniumFunctionalTestCase): +class TestProjectPageBase(SeleniumFunctionalTestCase): project_id = None PROJECT_NAME = 'TestProjectPage' - def _create_project(self, project_name): - """ Create/Test new project using: - - Project Name: Any string - - Release: Any string - - Merge Toaster settings: True or False - """ - self.get(reverse('newproject')) - self.wait_until_visible('#new-project-name') - self.find("#new-project-name").send_keys(project_name) - select = Select(self.find("#projectversion")) - select.select_by_value('3') - - # check merge toaster settings - checkbox = self.find('.checkbox-mergeattr') - if not checkbox.is_selected(): - checkbox.click() - - if self.PROJECT_NAME != 'TestProjectPage': - # Reset project name if it's not the default one - self.PROJECT_NAME = 'TestProjectPage' - - self.find("#create-project-button").click() - - try: - self.wait_until_visible('#hint-error-project-name') - url = reverse('project', args=(TestProjectPage.project_id, )) - self.get(url) - self.wait_until_visible('#config-nav', poll=3) - except TimeoutException: - self.wait_until_visible('#config-nav', poll=3) - - def _random_string(self, length): - return ''.join( - random.choice(string.ascii_letters) for _ in range(length) - ) - def _navigate_to_project_page(self): # Navigate to project page - if TestProjectPage.project_id is None: - self._create_project(project_name=self._random_string(10)) - current_url = self.driver.current_url - TestProjectPage.project_id = get_projectId_from_url(current_url) - else: - url = reverse('project', args=(TestProjectPage.project_id,)) - self.get(url) + if TestProjectPageBase.project_id is None: + TestProjectPageBase.project_id = self.create_new_project(self.PROJECT_NAME, '3', None, True) + + url = reverse('project', args=(TestProjectPageBase.project_id,)) + self.get(url) self.wait_until_visible('#config-nav') def _get_create_builds(self, **kwargs): @@ -81,14 +39,14 @@ class TestProjectPage(SeleniumFunctionalTestCase): # parameters for builds to associate with the projects now = timezone.now() self.project1_build_success = { - 'project': Project.objects.get(id=TestProjectPage.project_id), + 'project': Project.objects.get(id=TestProjectPageBase.project_id), 'started_on': now, 'completed_on': now, 'outcome': Build.SUCCEEDED } self.project1_build_failure = { - 'project': Project.objects.get(id=TestProjectPage.project_id), + 'project': Project.objects.get(id=TestProjectPageBase.project_id), 'started_on': now, 'completed_on': now, 'outcome': Build.FAILED @@ -222,6 +180,8 @@ class TestProjectPage(SeleniumFunctionalTestCase): rows = self.find_all(f'#{table_selector} tbody tr') self.assertTrue(len(rows) > 0) +class TestProjectPage(TestProjectPageBase): + def test_create_project(self): """ Create/Test new project using: - Project Name: Any string @@ -230,26 +190,6 @@ class TestProjectPage(SeleniumFunctionalTestCase): """ self._create_project(project_name=self.PROJECT_NAME) - def test_image_recipe_editColumn(self): - """ Test the edit column feature in image recipe table on project page """ - self._get_create_builds(success=10, failure=10) - - url = reverse('projectimagerecipes', args=(TestProjectPage.project_id,)) - self.get(url) - self.wait_until_present('#imagerecipestable tbody tr') - - column_list = [ - 'get_description_or_summary', 'layer_version__get_vcs_reference', - 'layer_version__layer__name', 'license', 'recipe-file', 'section', - 'version' - ] - - # Check that we can hide the edit column - self._mixin_test_table_edit_column( - 'imagerecipestable', - 'edit-columns-button', - [f'checkbox-{column}' for column in column_list] - ) def test_page_header_on_project_page(self): """ Check page header in project page: @@ -379,7 +319,7 @@ class TestProjectPage(SeleniumFunctionalTestCase): self.assertEqual(config_tab.get_attribute('class'), 'active') self.assertIn('Configuration', str(config_tab.text)) self.assertIn( - f"/toastergui/project/{TestProjectPage.project_id}", str(self.driver.current_url) + f"/toastergui/project/{TestProjectPageBase.project_id}", str(self.driver.current_url) ) def get_tabs(): @@ -402,7 +342,7 @@ class TestProjectPage(SeleniumFunctionalTestCase): check_tab_link( 1, 'Builds', - f"/toastergui/project/{TestProjectPage.project_id}/builds" + f"/toastergui/project/{TestProjectPageBase.project_id}/builds" ) # check "Import layers" tab @@ -411,7 +351,7 @@ class TestProjectPage(SeleniumFunctionalTestCase): check_tab_link( 2, 'Import layer', - f"/toastergui/project/{TestProjectPage.project_id}/importlayer" + f"/toastergui/project/{TestProjectPageBase.project_id}/importlayer" ) # check "New custom image" tab @@ -420,7 +360,7 @@ class TestProjectPage(SeleniumFunctionalTestCase): check_tab_link( 3, 'New custom image', - f"/toastergui/project/{TestProjectPage.project_id}/newcustomimage" + f"/toastergui/project/{TestProjectPageBase.project_id}/newcustomimage" ) # check search box can be use to build recipes @@ -766,6 +706,10 @@ class TestProjectPage(SeleniumFunctionalTestCase): # Check layer description self.assertIn("Description", section.text) +@pytest.mark.django_db +@pytest.mark.order("last") +class TestProjectPageRecipes(TestProjectPageBase): + def test_single_recipe_page(self): """ Test recipe page - Check if title is displayed @@ -777,9 +721,9 @@ class TestProjectPage(SeleniumFunctionalTestCase): # Use a recipe which is likely to exist in the layer index but not enabled # in poky out the box - xen-image-minimal from meta-virtualization self._navigate_to_project_page() - prj = Project.objects.get(pk=TestProjectPage.project_id) + prj = Project.objects.get(pk=TestProjectPageBase.project_id) recipe_id = prj.get_all_compatible_recipes().get(name="xen-image-minimal").pk - url = reverse("recipedetails", args=(TestProjectPage.project_id, recipe_id)) + url = reverse("recipedetails", args=(TestProjectPageBase.project_id, recipe_id)) self.get(url) self.wait_until_visible('.page-header') # check title is displayed @@ -802,3 +746,25 @@ class TestProjectPage(SeleniumFunctionalTestCase): self.assertIn("Approx. packages included", section.text) self.assertIn("Approx. package size", section.text) self.assertIn("Recipe file", section.text) + + def test_image_recipe_editColumn(self): + """ Test the edit column feature in image recipe table on project page """ + self._get_create_builds(success=10, failure=10) + + url = reverse('projectimagerecipes', args=(TestProjectPageBase.project_id,)) + self.get(url) + self.wait_until_present('#imagerecipestable tbody tr') + + column_list = [ + 'get_description_or_summary', 'layer_version__get_vcs_reference', + 'layer_version__layer__name', 'license', 'recipe-file', 'section', + 'version' + ] + + # Check that we can hide the edit column + self._mixin_test_table_edit_column( + 'imagerecipestable', + 'edit-columns-button', + [f'checkbox-{column}' for column in column_list] + ) + From patchwork Wed Oct 23 09:59:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51105 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 DD448CDDE4D for ; Wed, 23 Oct 2024 10:00:09 +0000 (UTC) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by mx.groups.io with SMTP id smtpd.web11.5151.1729677606218820841 for ; Wed, 23 Oct 2024 03:00:06 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=ijGnuRee; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.42, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-43167ff0f91so46832585e9.1 for ; Wed, 23 Oct 2024 03:00:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677604; x=1730282404; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=b5vqNGYk03XSukKM0jAFxT3G9NXwuCbSiQcvJRD7XO8=; b=ijGnuRee12bGgotpDL9IzXCPL/31nkl5lWRS0+zcIbHfQRd8k/ioJRyfyq2Mt5SiSM r9H1Hz+QPsYYCxR20IatIg0BxNhtUmZD6S8XtlbxX6NjyepHavLul2mPsJi0fJydUJXe W2fI02nLLIb2PnB4QEV5iuY9QzM8m77Gr+i4s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677604; x=1730282404; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b5vqNGYk03XSukKM0jAFxT3G9NXwuCbSiQcvJRD7XO8=; b=xSxOstaEJitKwxUPfZe3428zYhvDUrx7K79GxxWzBRSID1jVt5AfJcCWNF2UQLkci9 HE0nQ7auN20HP8jfy8GZ+9eUeiiieb1LLuV7KboGT7mtiaNGpS3UpSqfDSKT3lbmmG/E IHgnojHv7z4HwBZovmOMMYo+XSp7QNp7bK4I/GwuPnX+Bn4V0tybNWq9XNn33EZvuBwu qKsreedJ600scPwaPal6i+bwVq0pBHdMz0XTdOPrP+qHrwfoI3DVB5l3p1PmPM6ruVMY zaGatFzxbVQGcXeGaL1s0l8X8uJEmr2KvP2iTbnppuKKYy7HGtvY/H7XQCD59jaqBqzB Vi6g== X-Gm-Message-State: AOJu0YyJv5Lm+VRcH3rQROlaVLTdq518ZECCO3AX5c6glnxwKvhKp00a bGLCVZPUlrbnbI5gEtLa+Y7ccg/aruItjZ7w/bRKAjE+XiGwofci8S2Zv+n2nj7w/93+0QclLdp 7 X-Google-Smtp-Source: AGHT+IFIdqo6WHxmAqlXliFbXAcXadyOTPEKnm1AnL/f0BOmkDpdrAxEI9J8XcdIwZZXl+njn4WHxA== X-Received: by 2002:a05:600c:4f48:b0:431:5ecf:2a39 with SMTP id 5b1f17b1804b1-431841b2ef1mr13000005e9.35.1729677604395; Wed, 23 Oct 2024 03:00:04 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.03.00.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 03:00:04 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 13/28] toaster/tests/functiona/project_page: Drop pointless test covered elsewhere Date: Wed, 23 Oct 2024 10:59:34 +0100 Message-ID: <20241023095949.3351980-13-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 10:00:09 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16704 The project creation test is well covered in another module so just drop this one as there isn't any extra value added here. Signed-off-by: Richard Purdie --- lib/toaster/tests/functional/test_project_page.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lib/toaster/tests/functional/test_project_page.py b/lib/toaster/tests/functional/test_project_page.py index 40ef5f486a..7e73cac438 100644 --- a/lib/toaster/tests/functional/test_project_page.py +++ b/lib/toaster/tests/functional/test_project_page.py @@ -182,15 +182,6 @@ class TestProjectPageBase(SeleniumFunctionalTestCase): class TestProjectPage(TestProjectPageBase): - def test_create_project(self): - """ Create/Test new project using: - - Project Name: Any string - - Release: Any string - - Merge Toaster settings: True or False - """ - self._create_project(project_name=self.PROJECT_NAME) - - def test_page_header_on_project_page(self): """ Check page header in project page: - AT LEFT -> Logo of Yocto project, displayed, clickable From patchwork Wed Oct 23 09:59:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51111 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 EA334CDDE51 for ; Wed, 23 Oct 2024 10:00:09 +0000 (UTC) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by mx.groups.io with SMTP id smtpd.web11.5154.1729677607573380721 for ; Wed, 23 Oct 2024 03:00:07 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=h+hUZZJ4; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.48, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4316f3d3c21so36538975e9.3 for ; Wed, 23 Oct 2024 03:00:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677606; x=1730282406; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=KsbDpOSGDFITqHfH1ALwhAh/bpByCPlZ8Oya81VEGT8=; b=h+hUZZJ4BSL4gFn7bJh9fo/6MJqm/vSWRlVAqeWeUvOU1KG+04Mtwf4VO25JAvsqVj jttGZRx2E4/NmC9i1siT0+xdI11A+X8sT1FEa1oi3BGMpI1fJ5hiXypN9Nwt43rEz+ry oPS0ec6t5kWpd3QUK1VzpKe8jjIGWcr7VrmMk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677606; x=1730282406; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KsbDpOSGDFITqHfH1ALwhAh/bpByCPlZ8Oya81VEGT8=; b=OmFQOp4LCl7/7uva8/sKEVXYD2h/467vmaT2Fnq1HT3RrzpR5cxOBjmwBaIx5Do5F/ htjZpZkujkiNzp+BWORM9/XSJsVR6+kKh5LRT7kj1yd4U3B/XuOY2ztN8pgZj9gVu6kF +TUoQSVs5WjLSWqfGDADAvBWoKJv7KLFfVb4OWF8jbvvIzSK9mKQDAj2LWEtsMDvJHRt P6anb02C5yOeE+2fUT78it1AcdAsW0BgDgjca8EjFBteNEFUEQmLDgqvtqPBqXrQZcEH aTe41LnmbjqGUms9umncKjx/wYKqbPQloRwOl3gHak8LGJAXsfDVlgGquOI2NDnSQDH0 IMXw== X-Gm-Message-State: AOJu0Yw5kOTM+mZ3xsxp0mm8eHC5M2orA2++M44ySa8ShoL7XSKBBV0l /vILQa1t7rTUIZsIGfi/XqyOHC4VrVvEpwJbBkAa7ykyCqEpEPkQyB9xo2f/11XS9djf1gusbUY 8 X-Google-Smtp-Source: AGHT+IHerE9+U9znRniYzr7kG3SCgZ6afzmNPu9A6r7BIX/NTOWMDrrSu+dOvOgM9imZfThSLsv4lg== X-Received: by 2002:a05:6000:4598:b0:37d:46f4:35 with SMTP id ffacd0b85a97d-37efcf84a6bmr1227873f8f.45.1729677605660; Wed, 23 Oct 2024 03:00:05 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.03.00.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 03:00:04 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 14/28] toaster/tests/functiona/project_page: Improve waits and drop polling Date: Wed, 23 Oct 2024 10:59:35 +0100 Message-ID: <20241023095949.3351980-14-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 10:00:09 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16705 These changes: * Drop the poll parameters * Add waits where needed or make them more specific * Add calls to close notification boxes since they can obscure other page elements * In one case wait for a "Loading" message to be replaced Signed-off-by: Richard Purdie --- .../tests/functional/test_project_page.py | 53 ++++++++++++++----- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/lib/toaster/tests/functional/test_project_page.py b/lib/toaster/tests/functional/test_project_page.py index 7e73cac438..f34ccf5e8e 100644 --- a/lib/toaster/tests/functional/test_project_page.py +++ b/lib/toaster/tests/functional/test_project_page.py @@ -8,6 +8,7 @@ import os import string +import time from unittest import skip import pytest from django.urls import reverse @@ -150,7 +151,7 @@ class TestProjectPageBase(SeleniumFunctionalTestCase): def test_show_rows(row_to_show, show_row_link): # Check that we can show rows == row_to_show show_row_link.select_by_value(str(row_to_show)) - self.wait_until_visible(f'#{table_selector} tbody tr', poll=3) + self.wait_until_visible(f'#{table_selector} tbody tr') # check at least some rows are visible self.assertTrue( len(self.find_all(f'#{table_selector} tbody tr')) > 0 @@ -359,11 +360,15 @@ class TestProjectPage(TestProjectPageBase): search_box.send_keys('core-image-minimal') self.find('#build-button').click() self.wait_until_visible('#latest-builds') - lastest_builds = self.driver.find_elements( - By.XPATH, - '//div[@id="latest-builds"]', - ) - last_build = lastest_builds[0] + buildtext = "Loading" + while "Loading" in buildtext: + time.sleep(1) + lastest_builds = self.driver.find_elements( + By.XPATH, + '//div[@id="latest-builds"]', + ) + last_build = lastest_builds[0] + buildtext = last_build.text self.assertIn( 'core-image-minimal', str(last_build.text) ) @@ -471,7 +476,8 @@ class TestProjectPage(TestProjectPageBase): searchBtn_selector='search-submit-machinestable', table_selector='machinestable' ) - self.wait_until_visible('#machinestable tbody tr', poll=3) + + self.wait_until_visible('#machinestable tbody tr') rows = self.find_all('#machinestable tbody tr') machine_to_add = rows[0] add_btn = machine_to_add.find_element(By.XPATH, '//td[@class="add-del-layers"]') @@ -481,6 +487,11 @@ class TestProjectPage(TestProjectPageBase): self.assertIn( f'You have added 1 layer to your project', str(change_notification.text) ) + + hide_button = self.find('#hide-alert') + hide_button.click() + self.wait_until_not_visible('#change-notification') + # check Machine table feature(show/hide column, pagination) self._navigate_to_config_nav('machinestable', 5) column_list = [ @@ -521,7 +532,7 @@ class TestProjectPage(TestProjectPageBase): table_selector='layerstable' ) # check "Add layer" button works - self.wait_until_visible('#layerstable tbody tr', poll=3) + self.wait_until_visible('#layerstable tbody tr') rows = self.find_all('#layerstable tbody tr') layer_to_add = rows[0] add_btn = layer_to_add.find_element( @@ -530,7 +541,7 @@ class TestProjectPage(TestProjectPageBase): ) add_btn.click() # check modal is displayed - self.wait_until_visible('#dependencies-modal', poll=3) + self.wait_until_visible('#dependencies-modal') list_dependencies = self.find_all('#dependencies-list li') # click on add-layers button add_layers_btn = self.driver.find_element( @@ -543,8 +554,13 @@ class TestProjectPage(TestProjectPageBase): self.assertIn( f'You have added {len(list_dependencies)+1} layers to your project: {input_text} and its dependencies', str(change_notification.text) ) + + hide_button = self.find('#hide-alert') + hide_button.click() + self.wait_until_not_visible('#change-notification') + # check "Remove layer" button works - self.wait_until_visible('#layerstable tbody tr', poll=3) + self.wait_until_visible('#layerstable tbody tr') rows = self.find_all('#layerstable tbody tr') layer_to_remove = rows[0] remove_btn = layer_to_remove.find_element( @@ -552,11 +568,16 @@ class TestProjectPage(TestProjectPageBase): '//td[@class="add-del-layers"]' ) remove_btn.click() - self.wait_until_visible('#change-notification', poll=2) + self.wait_until_visible('#change-notification') change_notification = self.find('#change-notification') self.assertIn( f'You have removed 1 layer from your project: {input_text}', str(change_notification.text) ) + + hide_button = self.find('#hide-alert') + hide_button.click() + self.wait_until_not_visible('#change-notification') + # check layers table feature(show/hide column, pagination) self._navigate_to_config_nav('layerstable', 6) column_list = [ @@ -604,7 +625,7 @@ class TestProjectPage(TestProjectPageBase): '//td[@class="add-del-layers"]//a[1]' ) add_btn.click() - self.wait_until_visible('#change-notification', poll=2) + self.wait_until_visible('#change-notification') change_notification = self.find('#change-notification') self.assertIn( f'You have changed the distro to: {input_text}', str(change_notification.text) @@ -649,12 +670,15 @@ class TestProjectPage(TestProjectPageBase): # check remove layer button works remove_layer_btn = self.find('#add-remove-layer-btn') remove_layer_btn.click() - self.wait_until_visible('#change-notification', poll=2) + self.wait_until_visible('#change-notification') change_notification = self.find('#change-notification') self.assertIn( f'You have removed 1 layer from your project', str(change_notification.text) ) + hide_button = self.find('#hide-alert') + hide_button.click() # check add layer button works + self.wait_until_not_visible('#change-notification') add_layer_btn = self.find('#add-remove-layer-btn') add_layer_btn.click() self.wait_until_visible('#change-notification') @@ -662,6 +686,9 @@ class TestProjectPage(TestProjectPageBase): self.assertIn( f'You have added 1 layer to your project', str(change_notification.text) ) + hide_button = self.find('#hide-alert') + hide_button.click() + self.wait_until_not_visible('#change-notification') # check tabs(layers, recipes, machines) are displayed tabs = self.find_all('.nav-tabs li') self.assertEqual(len(tabs), 3) From patchwork Wed Oct 23 09:59:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51109 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 EEEF8CDDE4E for ; Wed, 23 Oct 2024 10:00:09 +0000 (UTC) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by mx.groups.io with SMTP id smtpd.web11.5155.1729677608769940370 for ; Wed, 23 Oct 2024 03:00:09 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=RodZvtR9; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.44, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-43158625112so65540875e9.3 for ; Wed, 23 Oct 2024 03:00:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677607; x=1730282407; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=69jt7TcI06O6MGFJRh3cIVWgbv7OafvGIxjR78kPpM0=; b=RodZvtR94xpzGAJEY8s5IJKW6VMzUso8uzTHZAdS6/d5Ch+NZKmsndtRoYcJxCm3/k 6D6SVvwETYqcpoQyJDaerFmlCQqJ5kEp7WiHhP3my0jDX7a5uqipvziajOC/kIRKm9pF iCOBVO/2Wjiy3AQVhQ4dLQ78cr4ClODk7bhq8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677607; x=1730282407; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=69jt7TcI06O6MGFJRh3cIVWgbv7OafvGIxjR78kPpM0=; b=pbfRxSXnDxgBQeJ6G8Zj66dTAM/I2RFB/sh3O2N6IaGvhYF22OKyZEDx0RgZMxlh81 4VsN+j+kjAyjelGmlluEaDBQTkr+ll/Y9scaqvmTu/R7o3fAFYkWR4hs81uFdAz2jYxE c0btl6RzZsjH4cP1gujlQ5qEWr6McF0rPYu+I2ufXMKaMX0+b4mJzFGnsH/HMXqKfFht BBp3RyYUb57dPw5WyxY/+IWTQYhb/WXpGn282U+R5yH4an4J6LELwXxKZVJt9F3a7Phx 2ID1TOnB9Lv5KnBDGCoRQpPAVcCt5/16JBf4ZZAzJ82qHdXMAgMxX+uoqRnME6QTvvHA G2pA== X-Gm-Message-State: AOJu0Yw3isI6rwqiL/WC4zm9SYVm16vDtjAn/XYHvDgUexiHkuGwzbOa njXSngLdK9PLUMJGjgJS6G2243OTRlvBNS6FrVsUSN4+z/MWLmHsxvhCQa1rzegKN0GAwRZIhiz 1 X-Google-Smtp-Source: AGHT+IEx0+hEReGLZ4BPCCug7u2Yt642cBKIewmg5stdfN0k54y2DRqxHn5Q696oQZcTgOj9eFaX8A== X-Received: by 2002:a05:600c:500a:b0:431:537d:b3b4 with SMTP id 5b1f17b1804b1-43184206669mr15055655e9.11.1729677606724; Wed, 23 Oct 2024 03:00:06 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.03.00.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 03:00:06 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 15/28] toaster/tests/browser/helpers: Add not visible wait function Date: Wed, 23 Oct 2024 10:59:36 +0100 Message-ID: <20241023095949.3351980-15-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 10:00:09 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16706 In some cases we want to wait until some element is not visible. Add such a function helper. Signed-off-by: Richard Purdie --- lib/toaster/tests/browser/selenium_helpers_base.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/toaster/tests/browser/selenium_helpers_base.py b/lib/toaster/tests/browser/selenium_helpers_base.py index 5a4a4ef8b4..b664166055 100644 --- a/lib/toaster/tests/browser/selenium_helpers_base.py +++ b/lib/toaster/tests/browser/selenium_helpers_base.py @@ -227,6 +227,13 @@ class SeleniumTestCaseBase(unittest.TestCase): Wait(self.driver, poll=poll).until(is_visible, msg) return self.find(selector) + def wait_until_not_visible(self, selector, timeout=Wait._TIMEOUT): + """ Wait until element matching CSS selector is not visible on the page """ + is_visible = lambda driver: self.find(selector).is_displayed() + msg = 'An element matching "%s" should be visible' % selector + Wait(self.driver, timeout=timeout).until_not(is_visible, msg) + return self.find(selector) + def wait_until_clickable(self, selector, poll=1): """ Wait until element matching CSS selector is visible on the page """ sel = selector From patchwork Wed Oct 23 09:59:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51115 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 ECCCCCDDE4E for ; Wed, 23 Oct 2024 10:00:19 +0000 (UTC) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by mx.groups.io with SMTP id smtpd.web11.5156.1729677611608054094 for ; Wed, 23 Oct 2024 03:00:11 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=ULMpXZ/Z; spf=pass (domain: linuxfoundation.org, ip: 209.85.221.44, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-37d41894a32so480746f8f.1 for ; Wed, 23 Oct 2024 03:00:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677610; x=1730282410; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=5gd7q7v6mWZ2pUeq5uL4WLCd2K413Gi1rq9ETR0SeQo=; b=ULMpXZ/ZsW2rc7qkqg40LwRE4aCBKnHuhVdOzgbu95a1JEEJmK1bZ+tmMs8LDj10rL 6IfWenA++7HvCIcaHZt1cftVVIVQwlyRUK2cIJ6IyDiPicPjVQTHgfIjfmqXyj3WMDVY XXmespFCx5bGGRvitmWQqKmQZP0exX8dPKh3I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677610; x=1730282410; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5gd7q7v6mWZ2pUeq5uL4WLCd2K413Gi1rq9ETR0SeQo=; b=BzunCHPCpsLq3ie91xQQ5HnQQvuK0UZ7cu+zFLuKkebbZC/JtagNWhQgUO8uJzoePy MIvLvua0gu8/qibiTAoAXMBSPOcTvWAwddCQEFglTBBx/fkuapq3qZA3ZfXQgguB+d2a AXZLHCL+fohx1mO/kiIxsDsHJ25rQXkdSvv/BFds+4Z861O25fHK4P0NuMajbZX3i0Gg FfvYrcxGmIJCMMS8HOtTeZlwOmkU5eKErf5F+niqGXSf1BA5yyiVMswjRpnw+3++6Adt IBjYc0I424sqD5HiWaI2on2MrhzsW3w/RWKT/+jiibZqZiCR4Pf6sprFFQCv6lKIJObP UQRA== X-Gm-Message-State: AOJu0YxquTHK+TaINvaYzzotyR6AFn9o41PL3R4E/vbcQXBidIxT6rlO 4klbCbIEnhH+/meFcOXGHQQREt41bsZNLFRsNcrHA78PYLnB9vw7tdHdkPEZqNJfNcJtBrhgvUn y X-Google-Smtp-Source: AGHT+IFE2TnmU8jejZf3q/4SH/WPiJbO0Hb1MeiSwBJx4aLomfaekqTeG7yZkDvEjcIaa7LfMtMF+w== X-Received: by 2002:a5d:6612:0:b0:374:b9ca:f1e8 with SMTP id ffacd0b85a97d-37ef14da769mr4274051f8f.20.1729677608030; Wed, 23 Oct 2024 03:00:08 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.03.00.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 03:00:07 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 16/28] toaster/tests/functiona/project_page_tab_config: Switch to using library create_project function Date: Wed, 23 Oct 2024 10:59:37 +0100 Message-ID: <20241023095949.3351980-16-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 10:00:19 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16708 Switch this test module to use the common project creation code which contains race fixes. That code requires the database access wrapper be dropped and we no longer have ordering constraints. There is one test that does require database access. Move this to a separate class and allow database access there. Use ordering constraints to allow them to run after the main code. They depend on the project creation from the other class which isn't ideal but good enough for now. Signed-off-by: Richard Purdie --- .../test_project_page_tab_config.py | 213 ++++++++---------- 1 file changed, 90 insertions(+), 123 deletions(-) diff --git a/lib/toaster/tests/functional/test_project_page_tab_config.py b/lib/toaster/tests/functional/test_project_page_tab_config.py index 5da9706b29..daf00d8f1d 100644 --- a/lib/toaster/tests/functional/test_project_page_tab_config.py +++ b/lib/toaster/tests/functional/test_project_page_tab_config.py @@ -7,7 +7,6 @@ # import string -import random import pytest from django.urls import reverse from selenium.webdriver import Keys @@ -19,60 +18,16 @@ from selenium.webdriver.common.by import By from .utils import get_projectId_from_url, wait_until_build, wait_until_build_cancelled - -@pytest.mark.django_db -@pytest.mark.order("last") -class TestProjectConfigTab(SeleniumFunctionalTestCase): +class TestProjectConfigTabBase(SeleniumFunctionalTestCase): PROJECT_NAME = 'TestProjectConfigTab' project_id = None - def _create_project(self, project_name, **kwargs): - """ Create/Test new project using: - - Project Name: Any string - - Release: Any string - - Merge Toaster settings: True or False - """ - release = kwargs.get('release', '3') - self.get(reverse('newproject')) - self.wait_until_visible('#new-project-name') - self.find("#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 not checkbox.is_selected(): - checkbox.click() - - if self.PROJECT_NAME != 'TestProjectConfigTab': - # Reset project name if it's not the default one - self.PROJECT_NAME = 'TestProjectConfigTab' - - self.find("#create-project-button").click() - - try: - self.wait_until_visible('#hint-error-project-name', poll=3) - url = reverse('project', args=(TestProjectConfigTab.project_id, )) - self.get(url) - self.wait_until_visible('#config-nav', poll=3) - except TimeoutException: - self.wait_until_visible('#config-nav', poll=3) - - def _random_string(self, length): - return ''.join( - random.choice(string.ascii_letters) for _ in range(length) - ) - def _navigate_to_project_page(self): # Navigate to project page - if TestProjectConfigTab.project_id is None: - self._create_project(project_name=self._random_string(10)) - current_url = self.driver.current_url - TestProjectConfigTab.project_id = get_projectId_from_url( - current_url) - else: - url = reverse('project', args=(TestProjectConfigTab.project_id,)) - self.get(url) + if TestProjectConfigTabBase.project_id is None: + TestProjectConfigTabBase.project_id = self.create_new_project(self.PROJECT_NAME, '3', None, True) + url = reverse('project', args=(TestProjectConfigTabBase.project_id,)) + self.get(url) self.wait_until_visible('#config-nav') def _create_builds(self): @@ -114,6 +69,8 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase): config_nav = self.find('#config-nav') return config_nav.find_elements(By.TAG_NAME, 'li')[index] +class TestProjectConfigTab(TestProjectConfigTabBase): + def test_project_config_nav(self): """ Test project config tab navigation: - Check if the menu is displayed and contains the right elements: @@ -160,26 +117,26 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase): conf_nav_list = [ # config [0, 'Configuration', - f"/toastergui/project/{TestProjectConfigTab.project_id}"], + f"/toastergui/project/{TestProjectConfigTabBase.project_id}"], # custom images [2, 'Custom images', - f"/toastergui/project/{TestProjectConfigTab.project_id}/customimages"], + f"/toastergui/project/{TestProjectConfigTabBase.project_id}/customimages"], # image recipes [3, 'Image recipes', - f"/toastergui/project/{TestProjectConfigTab.project_id}/images"], + f"/toastergui/project/{TestProjectConfigTabBase.project_id}/images"], # software recipes [4, 'Software recipes', - f"/toastergui/project/{TestProjectConfigTab.project_id}/softwarerecipes"], + f"/toastergui/project/{TestProjectConfigTabBase.project_id}/softwarerecipes"], # machines [5, 'Machines', - f"/toastergui/project/{TestProjectConfigTab.project_id}/machines"], + f"/toastergui/project/{TestProjectConfigTabBase.project_id}/machines"], # layers [6, 'Layers', - f"/toastergui/project/{TestProjectConfigTab.project_id}/layers"], + f"/toastergui/project/{TestProjectConfigTabBase.project_id}/layers"], # distro [7, 'Distros', - f"/toastergui/project/{TestProjectConfigTab.project_id}/distros"], - # [9, 'BitBake variables', f"/toastergui/project/{TestProjectConfigTab.project_id}/configuration"], # bitbake variables + f"/toastergui/project/{TestProjectConfigTabBase.project_id}/distros"], + # [9, 'BitBake variables', f"/toastergui/project/{TestProjectConfigTabBase.project_id}/configuration"], # bitbake variables ] for index, item_name, url in conf_nav_list: item = _get_config_nav_item(index) @@ -299,9 +256,11 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase): - meta-poky - meta-yocto-bsp """ - # Create a new project for this test - project_name = self._random_string(10) - self._create_project(project_name=project_name) + project_id = self.create_new_project(self.PROJECT_NAME + "-ST", '3', None, True) + url = reverse('project', args=(project_id,)) + self.get(url) + self.wait_until_visible('#config-nav') + # check if the menu is displayed self.wait_until_visible('#project-page') block_l = self.driver.find_element( @@ -374,61 +333,6 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase): layers_list_items = layers_list.find_elements(By.TAG_NAME, 'li') self.assertEqual(len(layers_list_items), 4) - def test_most_build_recipes(self): - """ Test most build recipes block contains""" - def rebuild_from_most_build_recipes(recipe_list_items): - checkbox = recipe_list_items[0].find_element(By.TAG_NAME, 'input') - checkbox.click() - build_btn = self.find('#freq-build-btn') - build_btn.click() - self.wait_until_visible('#latest-builds') - wait_until_build(self, 'queued cloning starting parsing failed') - lastest_builds = self.driver.find_elements( - By.XPATH, - '//div[@id="latest-builds"]/div' - ) - self.assertTrue(len(lastest_builds) >= 2) - last_build = lastest_builds[0] - try: - cancel_button = last_build.find_element( - By.XPATH, - '//span[@class="cancel-build-btn pull-right alert-link"]', - ) - cancel_button.click() - except NoSuchElementException: - # Skip if the build is already cancelled - pass - wait_until_build_cancelled(self) - # Create a new project for remaining asserts - project_name = self._random_string(10) - self._create_project(project_name=project_name, release='2') - current_url = self.driver.current_url - TestProjectConfigTab.project_id = get_projectId_from_url(current_url) - url = current_url.split('?')[0] - - # Create a new builds - self._create_builds() - - # back to project page - self.driver.get(url) - - self.wait_until_visible('#project-page', poll=3) - - # Most built recipes - most_built_recipes = self.driver.find_element( - By.XPATH, '//*[@id="project-page"]/div[1]/div[3]') - title = most_built_recipes.find_element(By.TAG_NAME, 'h3') - self.assertIn("Most built recipes", title.text) - # check can select a recipe and build it - self.wait_until_visible('#freq-build-list', poll=3) - recipe_list = self.find('#freq-build-list') - recipe_list_items = recipe_list.find_elements(By.TAG_NAME, 'li') - self.assertTrue( - len(recipe_list_items) > 0, - msg="No recipes found in the most built recipes list", - ) - rebuild_from_most_build_recipes(recipe_list_items) - TestProjectConfigTab.project_id = None # reset project id def test_project_page_tab_importlayer(self): """ Test project page tab import layer """ @@ -472,10 +376,11 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase): def test_project_page_custom_image_no_image(self): """ Test project page tab "New custom image" when no custom image """ - project_name = self._random_string(10) - self._create_project(project_name=project_name) - current_url = self.driver.current_url - TestProjectConfigTab.project_id = get_projectId_from_url(current_url) + project_id = self.create_new_project(self.PROJECT_NAME + "-CustomImage", '3', None, True) + url = reverse('project', args=(project_id,)) + self.get(url) + self.wait_until_visible('#config-nav') + # navigate to "Custom image" tab custom_image_section = self._get_config_nav_item(2) custom_image_section.click() @@ -490,9 +395,9 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase): div_empty_msg = self.find('#empty-state-customimagestable') link_create_custom_image = div_empty_msg.find_element( By.TAG_NAME, 'a') - self.assertTrue(TestProjectConfigTab.project_id is not None) + self.assertTrue(TestProjectConfigTabBase.project_id is not None) self.assertIn( - f"/toastergui/project/{TestProjectConfigTab.project_id}/newcustomimage", str( + f"/toastergui/project/{project_id}/newcustomimage", str( link_create_custom_image.get_attribute('href') ) ) @@ -501,7 +406,6 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase): link_create_custom_image.text ) ) - TestProjectConfigTab.project_id = None # reset project id def test_project_page_image_recipe(self): """ Test project page section images @@ -526,3 +430,66 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase): self.wait_until_visible('#imagerecipestable tbody tr') rows = self.find_all('#imagerecipestable tbody tr') self.assertTrue(len(rows) > 0) + +@pytest.mark.django_db +@pytest.mark.order("last") +class TestProjectConfigTabDB(TestProjectConfigTabBase): + + def test_most_build_recipes(self): + """ Test most build recipes block contains""" + def rebuild_from_most_build_recipes(recipe_list_items): + checkbox = recipe_list_items[0].find_element(By.TAG_NAME, 'input') + checkbox.click() + build_btn = self.find('#freq-build-btn') + build_btn.click() + self.wait_until_visible('#latest-builds') + wait_until_build(self, 'queued cloning starting parsing failed') + lastest_builds = self.driver.find_elements( + By.XPATH, + '//div[@id="latest-builds"]/div' + ) + self.assertTrue(len(lastest_builds) >= 2) + last_build = lastest_builds[0] + try: + cancel_button = last_build.find_element( + By.XPATH, + '//span[@class="cancel-build-btn pull-right alert-link"]', + ) + cancel_button.click() + except NoSuchElementException: + # Skip if the build is already cancelled + pass + wait_until_build_cancelled(self) + + # Create a new project for remaining asserts + project_id = self.create_new_project(self.PROJECT_NAME + "-MostBuilt", '2', None, True) + url = reverse('project', args=(project_id,)) + self.get(url) + self.wait_until_visible('#config-nav') + + current_url = self.driver.current_url + url = current_url.split('?')[0] + + # Create a new builds + self._create_builds() + + # back to project page + self.driver.get(url) + + self.wait_until_visible('#project-page', poll=3) + + # Most built recipes + most_built_recipes = self.driver.find_element( + By.XPATH, '//*[@id="project-page"]/div[1]/div[3]') + title = most_built_recipes.find_element(By.TAG_NAME, 'h3') + self.assertIn("Most built recipes", title.text) + # check can select a recipe and build it + self.wait_until_visible('#freq-build-list', poll=3) + recipe_list = self.find('#freq-build-list') + recipe_list_items = recipe_list.find_elements(By.TAG_NAME, 'li') + self.assertTrue( + len(recipe_list_items) > 0, + msg="No recipes found in the most built recipes list", + ) + rebuild_from_most_build_recipes(recipe_list_items) + From patchwork Wed Oct 23 09:59:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51112 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 E6191CDDE49 for ; Wed, 23 Oct 2024 10:00:19 +0000 (UTC) Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by mx.groups.io with SMTP id smtpd.web10.5151.1729677610760224897 for ; Wed, 23 Oct 2024 03:00:11 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=bWkM7bGY; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.43, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4315eac969aso4821185e9.1 for ; Wed, 23 Oct 2024 03:00:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677609; x=1730282409; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=tWE9EpkyPY6jCqvll7xAm29ieg9iu30x3cPV4PHlkNA=; b=bWkM7bGYrPqsgPMAtoI8vXIDH+ATgHCp9TQAB5q5uZjPNrRCs299ZaCdj6TRZNDWCP ZHtO0HnUpr97KHnFhx0N7CirfnzLfQfZZsWuCEHM+oOzqE1VU2+F9fP9WHxvia93kZJf ekzfvA9RVnea2qdZY4denLfpWQutnnDsYHZ8k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677609; x=1730282409; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tWE9EpkyPY6jCqvll7xAm29ieg9iu30x3cPV4PHlkNA=; b=PHoOjxLEvt8pbPnhC8CkRI4cXdpYtvFMfzm9597Nk3YOxPxxSHoZ2QvKhkddoj6Idg HWmKPe4zxTHJPtx/sX88+f4TheYxivR0xx6qBYROQhS0/2CqWNqrdYIWOi5CGbETatJv jLYgaF1ZCTZ4aKZektP1vN3/HPMCsCjxN2LIwy39jga4l+lBFSI17zJt4KT+ynrxDA+I aogEpEycEKAdORhuLu7UBucrf78hMNZv9zUTJYLmdIGg40e49n9ehHb5UxZNMwrQWkcK Hema9j6YkKdYociC236nr96HaX1T4D1eOgoPFLEmGK8SrNXEcYTlKmn99H8gpfvak1FY GtqA== X-Gm-Message-State: AOJu0YxTvlxV9p/qUuFlmlmDGQ1EwWjff1S0CnLFDWxAYLuECxYEvtm1 x8wegPXHjDt7HNpyGCPKFbjjD1rq+NNwWMfi0xDDU+Ta+alkNk+Z2vJYpWYWJkYJ1C3h3umYBmr r X-Google-Smtp-Source: AGHT+IHCRGQwWYDjgn3AA17113z5hjJtDMbmxTv4gMhOJlkzw1kRHtufK19cKApGQLwCBmOJDMVqew== X-Received: by 2002:a05:600c:3590:b0:431:4a82:97f2 with SMTP id 5b1f17b1804b1-4317bd7f68fmr41312245e9.6.1729677608769; Wed, 23 Oct 2024 03:00:08 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.03.00.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 03:00:08 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 17/28] toaster/tests/functiona/project_page_tab_config: Improve waits and drop polling Date: Wed, 23 Oct 2024 10:59:38 +0100 Message-ID: <20241023095949.3351980-17-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 10:00:19 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16707 Drop the poll parameters and make the waits much more specific for the requirements of the tests. This includes looping waiting for a list of layer elements as that code was previously particularly fragile. Signed-off-by: Richard Purdie --- .../test_project_page_tab_config.py | 52 ++++++++++++------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/lib/toaster/tests/functional/test_project_page_tab_config.py b/lib/toaster/tests/functional/test_project_page_tab_config.py index daf00d8f1d..80c53e1544 100644 --- a/lib/toaster/tests/functional/test_project_page_tab_config.py +++ b/lib/toaster/tests/functional/test_project_page_tab_config.py @@ -7,12 +7,12 @@ # import string +import time import pytest from django.urls import reverse from selenium.webdriver import Keys from selenium.webdriver.support.select import Select from selenium.common.exceptions import ElementClickInterceptedException, NoSuchElementException, TimeoutException -from orm.models import Project from tests.functional.functional_helpers import SeleniumFunctionalTestCase from selenium.webdriver.common.by import By @@ -210,7 +210,7 @@ class TestProjectConfigTab(TestProjectConfigTabBase): def test_show_rows(row_to_show, show_row_link): # Check that we can show rows == row_to_show show_row_link.select_by_value(str(row_to_show)) - self.wait_until_visible('#imagerecipestable tbody tr', poll=3) + self.wait_until_visible('#imagerecipestable tbody tr') # check at least some rows are visible self.assertTrue( len(self.find_all('#imagerecipestable tbody tr')) > 0 @@ -289,6 +289,9 @@ class TestProjectConfigTab(TestProjectConfigTabBase): self.assertIn( f'You have changed the {item_name} to: {new_item_name}', change_notification.text ) + hide_button = self.find('#hide-alert') + hide_button.click() + self.wait_until_not_visible('#change-notification') # Machine check_machine_distro(self, 'machine', 'qemux86-64', 'machine-section') @@ -304,35 +307,44 @@ class TestProjectConfigTab(TestProjectConfigTabBase): # Layers title = layers.find_element(By.TAG_NAME, 'h3') self.assertIn("Layers", title.text) + self.wait_until_clickable('#layer-add-input') # check at least three layers are displayed # openembedded-core # meta-poky # meta-yocto-bsp - layers_list = layers.find_element(By.ID, 'layers-in-project-list') - layers_list_items = layers_list.find_elements(By.TAG_NAME, 'li') + layer_list_items = [] + starttime = time.time() + while len(layer_list_items) < 3: + layers_list = self.driver.find_element(By.ID, 'layers-in-project-list') + layer_list_items = layers_list.find_elements(By.TAG_NAME, 'li') + if time.time() > (starttime + 30): + self.fail("Layer list didn't contain at least 3 items within 30s (contained %d)" % len(layer_list_items)) + # remove all layers except the first three layers - for i in range(3, len(layers_list_items)): - layers_list_items[i].find_element(By.TAG_NAME, 'span').click() + for i in range(3, len(layer_list_items)): + layer_list_items[i].find_element(By.TAG_NAME, 'span').click() + # check can add a layer if exists add_layer_input = layers.find_element(By.ID, 'layer-add-input') add_layer_input.send_keys('meta-oe') self.wait_until_visible('#layer-container > form > div > span > div') - dropdown_item = self.driver.find_element( - By.XPATH, - '//*[@id="layer-container"]/form/div/span/div' - ) - try: - dropdown_item.click() - except ElementClickInterceptedException: - self.skipTest( - "layer-container dropdown item click intercepted. Element not properly visible.") + self.wait_until_visible('.dropdown-menu') + finder = lambda driver: driver.find_element(By.XPATH, '//*[@id="layer-container"]/form/div/span/div/div/div') + dropdown_item = self.wait_until_element_clickable(finder) + dropdown_item.click() + self.wait_until_clickable('#add-layer-btn') add_layer_btn = layers.find_element(By.ID, 'add-layer-btn') add_layer_btn.click() self.wait_until_visible('#layers-in-project-list') - # check layer is added - layers_list_items = layers_list.find_elements(By.TAG_NAME, 'li') - self.assertEqual(len(layers_list_items), 4) + # check layer is added + layer_list_items = [] + starttime = time.time() + while len(layer_list_items) < 4: + layers_list = self.driver.find_element(By.ID, 'layers-in-project-list') + layer_list_items = layers_list.find_elements(By.TAG_NAME, 'li') + if time.time() > (starttime + 30): + self.fail("Layer list didn't contain at least 4 items within 30s (contained %d)" % len(layer_list_items)) def test_project_page_tab_importlayer(self): """ Test project page tab import layer """ @@ -476,7 +488,7 @@ class TestProjectConfigTabDB(TestProjectConfigTabBase): # back to project page self.driver.get(url) - self.wait_until_visible('#project-page', poll=3) + self.wait_until_visible('#project-page') # Most built recipes most_built_recipes = self.driver.find_element( @@ -484,7 +496,7 @@ class TestProjectConfigTabDB(TestProjectConfigTabBase): title = most_built_recipes.find_element(By.TAG_NAME, 'h3') self.assertIn("Most built recipes", title.text) # check can select a recipe and build it - self.wait_until_visible('#freq-build-list', poll=3) + self.wait_until_visible('#freq-build-list') recipe_list = self.find('#freq-build-list') recipe_list_items = recipe_list.find_elements(By.TAG_NAME, 'li') self.assertTrue( From patchwork Wed Oct 23 09:59:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51117 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 0E96FCDDE51 for ; Wed, 23 Oct 2024 10:00:20 +0000 (UTC) Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by mx.groups.io with SMTP id smtpd.web11.5158.1729677612138175212 for ; Wed, 23 Oct 2024 03:00:12 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=Kr7teBdl; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.50, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-43161e7bb25so53294255e9.2 for ; Wed, 23 Oct 2024 03:00:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677610; x=1730282410; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=jv4xsGBB2jiSVmDLqiEaC6vVRq/BLs0Tmoem7ZFLu9k=; b=Kr7teBdlRc/YavNgzV46969zUtciJP1Gk/ewz2j4qvrN1vuxL0cfpqM9d60Q3roih7 Eo8eZZFnAf8XPj0fUDzZogtFOUgq5NxII3XuZtsqWxAWZo/kNdx6JFYzdCrhtRR059hJ hd6qD+V5eKmmGmystOcUSk1dMfADnjNiy/WP8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677610; x=1730282410; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jv4xsGBB2jiSVmDLqiEaC6vVRq/BLs0Tmoem7ZFLu9k=; b=NE5ljpA0Fsb3LVu+C60hM7VsJWS3x0Tj5I/ktyDtiqOJc0cE7eum6n7Vj+hCCnPHwb 1r0/X5dP2NT7EnWSjhZfclBsHFdyBn0TNIte0MNe5TfaNZ9YzBJRru1W07+f3sAwxtO9 OwpXPrgdRTTAiwDktW64PvPyZTr8UeeZhe+NRSHEviTKkA1nS8tUlrh6kM01w1AdaWoF NPdURiaJIgTzah/ubGw1IRou56RdIhYNmUsjF7SW8q0wgxvfG8XKZFwJ4ZUuuA8lx9xO GSjOSRGvWGzF/eEoZYXs1f5BWWIBkMBZNV2QJ8wrVQzE/tYHuYxqgxYh4wfGvp3mIe2f GtTg== X-Gm-Message-State: AOJu0YysuHcyIUTdWMV/N6yNIpSAoAeBoGQfTfBZFZPBQKeDxSd7LCVX VHXdQP3tRS8P5EGdB2I4fyh1rfu4ldPXHk1xoEIkJvfPRkhg2YIkwinmCJJ/Mwnku6xJbvvoaC6 M X-Google-Smtp-Source: AGHT+IGt0HOy171bVjESY2q9BWKUlZ4lrfiUmtVJLyC91973kWh0599vUi9ooyabfnVzAFdtDAKXCg== X-Received: by 2002:a5d:6487:0:b0:37d:3964:e0f1 with SMTP id ffacd0b85a97d-37efcef0c90mr1529259f8f.4.1729677610158; Wed, 23 Oct 2024 03:00:10 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.03.00.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 03:00:09 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 18/28] toaster/tests/browser/helpers: Drop remains of polling/sleep calls Date: Wed, 23 Oct 2024 10:59:39 +0100 Message-ID: <20241023095949.3351980-18-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 10:00:20 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16709 Drop the remaining poll parameters from the helpers code along with the remaining sleep call since the tests no longer depend on this. This has the nice benefit of significantly speeding up the toaster test runs (45 minutes down to 12 minutes overall). If a parameter is needed, it should be the timeout, not the polling frequency. Signed-off-by: Richard Purdie --- .../tests/browser/selenium_helpers_base.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/toaster/tests/browser/selenium_helpers_base.py b/lib/toaster/tests/browser/selenium_helpers_base.py index b664166055..45eabaf1ce 100644 --- a/lib/toaster/tests/browser/selenium_helpers_base.py +++ b/lib/toaster/tests/browser/selenium_helpers_base.py @@ -186,7 +186,7 @@ class SeleniumTestCaseBase(unittest.TestCase): self.driver.get(abs_url) try: # Ensure page is loaded before proceeding - self.wait_until_visible("#global-nav", poll=3) + self.wait_until_visible("#global-nav") except NoSuchElementException: self.driver.implicitly_wait(3) except TimeoutException: @@ -211,20 +211,18 @@ class SeleniumTestCaseBase(unittest.TestCase): """ Return the element which currently has focus on the page """ return self.driver.switch_to.active_element - def wait_until_present(self, selector, poll=0.5): + def wait_until_present(self, selector, timeout=Wait._TIMEOUT): """ Wait until element matching CSS selector is on the page """ is_present = lambda driver: self.find(selector) msg = 'An element matching "%s" should be on the page' % selector - element = Wait(self.driver, poll=poll).until(is_present, msg) - if poll > 2: - time.sleep(poll) # element need more delay to be present + element = Wait(self.driver, timeout=timeout).until(is_present, msg) return element - def wait_until_visible(self, selector, poll=1): + def wait_until_visible(self, selector, timeout=Wait._TIMEOUT): """ Wait until element matching CSS selector is visible on the page """ is_visible = lambda driver: self.find(selector).is_displayed() msg = 'An element matching "%s" should be visible' % selector - Wait(self.driver, poll=poll).until(is_visible, msg) + Wait(self.driver, timeout=timeout).until(is_visible, msg) return self.find(selector) def wait_until_not_visible(self, selector, timeout=Wait._TIMEOUT): @@ -234,15 +232,14 @@ class SeleniumTestCaseBase(unittest.TestCase): Wait(self.driver, timeout=timeout).until_not(is_visible, msg) return self.find(selector) - def wait_until_clickable(self, selector, poll=1): + def wait_until_clickable(self, selector, timeout=Wait._TIMEOUT): """ Wait until element matching CSS selector is visible on the page """ sel = selector if sel.startswith('#'): sel = selector[1:] WebDriverWait( self.driver, - Wait._TIMEOUT, - poll_frequency=poll + timeout=timeout, ).until( EC.element_to_be_clickable((By.ID, sel ) From patchwork Wed Oct 23 09:59:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51116 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 15B65CDDE54 for ; Wed, 23 Oct 2024 10:00:20 +0000 (UTC) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by mx.groups.io with SMTP id smtpd.web10.5152.1729677613331943733 for ; Wed, 23 Oct 2024 03:00:13 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=JPN+MJPK; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.41, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-43163667f0eso50974695e9.0 for ; Wed, 23 Oct 2024 03:00:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677611; x=1730282411; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=nVyW7ugoMg9S14L8pvKIO+VjclJYvy1k0Oqvvi2qSAg=; b=JPN+MJPKogpgQYOUJ5v7Wb1aA3y3ZZUeweMsdhz93llCx0EqKDHVATViZ1y2+WM1h6 Meb2vg5gvh/JNlk1wnEpvknZjWJGkh6XxTgBbMxrtc974zJWdmvzyF1QAVyqNPR0kLW7 FIkjsZYhkRWxQB1f0XxFsk9wdPw+90c368ff0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677611; x=1730282411; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nVyW7ugoMg9S14L8pvKIO+VjclJYvy1k0Oqvvi2qSAg=; b=Ckm8Y9UsbgoMiW9ddkanpsyhbLu6BhUSbkD3rETpkjY62UrcD/ivbvk6heP5RG3ig+ IkdbjrUgVFHa0WYZ+4lbzGsKoDk5W6efxAemYXnfYpA9A0XSt2G5QVBK1+GVKw/76lTQ 4d/lYkikLyzy+1dvbiT5qH1VcwOCDrNW6TJfcd+9Ei2t/MXQk4BTsmBEcWCfcyee2qvz MhAn+zSWlImy8pIA+TWg6o0T7W1JdVkmsKwvZvgvy/e0wTfnm0a5hPZi8gxkX0z3iGwX +4scYLikcXiYnNLZNYafoiOu3qTp8a90lBBwYNIaTHAPbDF1Xk8RlRJRJGLDpF2Zx4ld PYmw== X-Gm-Message-State: AOJu0Yw63X0eBO8gdCMdVZmEFYqNl5Aq8+rHN7HewcwLH65SUmha53YM PI+0lpta0XcJne2q8YH43dT1V+kqUKJbJit07ZsduYSblGFmeQIs97on3aRibyZt8qxMPWEBDjG s X-Google-Smtp-Source: AGHT+IEd6QrceQHNCWlTeRn6fPU9U6ubA7QNcBXVYIfaVIxWEPbAuNCYoNmtcX+qyebEIFiYVGRXsQ== X-Received: by 2002:a05:600c:3b05:b0:431:54f3:11b1 with SMTP id 5b1f17b1804b1-4318424d1f6mr15455405e9.34.1729677611318; Wed, 23 Oct 2024 03:00:11 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.03.00.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 03:00:10 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 19/28] functional/utils: Drop unused code from wait_until_build_cancelled Date: Wed, 23 Oct 2024 10:59:40 +0100 Message-ID: <20241023095949.3351980-19-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 10:00:20 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16710 The code modifying the build object requires direct database access which is potentially problematic. It was being run on a database which was being reset after changes anyway so the code effectively did nothing. Remove it as it is unneeded. Signed-off-by: Richard Purdie --- lib/toaster/tests/functional/utils.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/toaster/tests/functional/utils.py b/lib/toaster/tests/functional/utils.py index 7269fa1805..8e81c29984 100644 --- a/lib/toaster/tests/functional/utils.py +++ b/lib/toaster/tests/functional/utils.py @@ -48,7 +48,6 @@ def wait_until_build_cancelled(test_instance): """ timeout = 30 start_time = 0 - build = None while True: try: if start_time > timeout: @@ -64,11 +63,7 @@ def wait_until_build_cancelled(test_instance): if 'failed' in str(build_state).lower(): break if 'cancelling' in str(build_state).lower(): - # Change build state to cancelled - if not build: # get build object only once - build = Build.objects.last() - build.outcome = Build.CANCELLED - build.save() + pass if 'cancelled' in str(build_state).lower(): break except NoSuchElementException: From patchwork Wed Oct 23 09:59:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51119 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 28CE7CDDE58 for ; Wed, 23 Oct 2024 10:00:20 +0000 (UTC) Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by mx.groups.io with SMTP id smtpd.web11.5160.1729677614261051786 for ; Wed, 23 Oct 2024 03:00:14 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=AfLAzlB3; spf=pass (domain: linuxfoundation.org, ip: 209.85.221.50, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-37d41894a32so480828f8f.1 for ; Wed, 23 Oct 2024 03:00:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677612; x=1730282412; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=BqdAvMFjWfcaCRCe98kgUS6AG9Tg/vi9MC+kS3yohTw=; b=AfLAzlB3ujlhArEixzeaM8z8oQloxE/cB/aoKksYflg1E8ZU/LYJ9tEwCQXZEFsY99 WoxO8+RZATbe82kj1RgVM7eLp/XI5BEJsmpkOf+TJTITQK8xRag4chA2cVGJROV2PZf3 b+7LvzbPpCyh2IOu2DtLn/E/Skbu5IQV9U8SQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677612; x=1730282412; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BqdAvMFjWfcaCRCe98kgUS6AG9Tg/vi9MC+kS3yohTw=; b=II4sktd9dHm2KkHMw14amR3bDWTsjwvsn2IUvzi30VnNR2262EfFfwEZbIFdxRYwD0 xduP2on1iIrbVl9d3LE0V8D17l/dpImirZ2DWej6E/hZTUKXik50B4hsFcg3+aUNSFvv XrT8arRt39929rPVje2/qjbDSpAIK7FyNPx1HFThfJgFx6ZuDq29QL74e4T98n3bnnBv 8csVuritWvEsvIFVaBJyVvEn/b2BO9JPQh77KfEiQAWZSbzCnoK5uPnlVxBaGKitfYWA mOzvjOfGxKoR/WP3QF5+MFVcrcWd6l+9NE1BfxqDS8mUMjHJfCFOZKf7M0hRHAQ58+JQ CW+Q== X-Gm-Message-State: AOJu0YyJZALkivxDT8FnjFKYLH8Of4I6p++ALAFLQ796MFGThgui9OSr Vy1yfjPnrZLIp+cS2EQb9LPbszQjU4fkrdxXurxTTaj8xZUCe9KeZfvXXRvlWcYczm1Qq60fsIs t X-Google-Smtp-Source: AGHT+IFccLiQOUn0M6XmrE28Ti1sCc73BPMCOowFxH0BxRcnQQ3zYqBjjbBvP11BG2j42xmWExG3IA== X-Received: by 2002:adf:ea43:0:b0:374:cee6:c298 with SMTP id ffacd0b85a97d-37ef14da61emr4183483f8f.21.1729677612214; Wed, 23 Oct 2024 03:00:12 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.03.00.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 03:00:11 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 20/28] toaster/tests/browser/helper: Improve wait_until_clickable exception handling Date: Wed, 23 Oct 2024 10:59:41 +0100 Message-ID: <20241023095949.3351980-20-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 10:00:20 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16711 Our own Wait() class allows exception handling which this form of wrapper does not. Switch the code to use our Wait() class to allow retrying upon encountering those exceptions (such as an element not being present yet). The displayed and visible test is what Selenium would be doing internally, there is no JS reprensetation of clickable directly. Signed-off-by: Richard Purdie --- lib/toaster/tests/browser/selenium_helpers_base.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/toaster/tests/browser/selenium_helpers_base.py b/lib/toaster/tests/browser/selenium_helpers_base.py index 45eabaf1ce..82defea0f2 100644 --- a/lib/toaster/tests/browser/selenium_helpers_base.py +++ b/lib/toaster/tests/browser/selenium_helpers_base.py @@ -234,17 +234,9 @@ class SeleniumTestCaseBase(unittest.TestCase): def wait_until_clickable(self, selector, timeout=Wait._TIMEOUT): """ Wait until element matching CSS selector is visible on the page """ - sel = selector - if sel.startswith('#'): - sel = selector[1:] - WebDriverWait( - self.driver, - timeout=timeout, - ).until( - EC.element_to_be_clickable((By.ID, sel - ) - ) - ) + is_clickable = lambda driver: (self.find(selector).is_displayed() and self.find(selector).is_enabled()) + msg = 'An element matching "%s" should be clickable' % selector + Wait(self.driver, timeout=timeout).until(is_clickable, msg) return self.find(selector) def wait_until_focused(self, selector): From patchwork Wed Oct 23 09:59:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51118 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 30881CDDE5B for ; Wed, 23 Oct 2024 10:00:20 +0000 (UTC) Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by mx.groups.io with SMTP id smtpd.web11.5161.1729677615380179801 for ; Wed, 23 Oct 2024 03:00:15 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=Z2XbNkMd; spf=pass (domain: linuxfoundation.org, ip: 209.85.221.42, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-37d5689eea8so4389116f8f.1 for ; Wed, 23 Oct 2024 03:00:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677613; x=1730282413; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=gACg8tOh5BPuFPM/aY7snTNPj+82Y3ab0JtJdPY1SOo=; b=Z2XbNkMdy/iDN/I+HdRxNNGKFhn0+IgQMwk2bmxW7BEuQBqjBnaFxyoQUlcZQhZzLM BQpfKSf/WNlW+xpx8rOBan9zEIZgwcGdMHYeVMXIJgoKrLXFxvW/2hpq5EMC/RZjrmSk kI4i2binCRLn3Jwuj9GjWbV5eAJK7PnLrOIck= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677613; x=1730282413; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gACg8tOh5BPuFPM/aY7snTNPj+82Y3ab0JtJdPY1SOo=; b=hEgmmeXLB0WRospGai3asGMiWwFgH6+PRrLmR0YXPthzKi5TiFLNCIVJdwD+seiMht PSyE5ffTw4MyBrOjaTvOgErir3UHBlVawuhDTtOnkGRCxPl+6kCoypjMWwhoPHC/nmUq zPBH/fBTOIC7qBlfIHIyPeReALkPaKvg45/Qu8vCS0Uo2AZogtocmQsNWwqrATUEo+QI hHZ2en/muR+qXIP1SQmM1TCDgjJS6zCoa5R1OhsdZPAc7x2rtEkV8iRd74zVQpHbK/gR ywDHM7IQ8uzkLW/wlKeRbC+2JjSs6IZdKFzrrfVGnYyT055ufnOSL1o0Plr8NZlO0dXh i2nw== X-Gm-Message-State: AOJu0YzgdWSp6QTiqw2ibl4FR3UJUJT2Nf5OO4k57FfQT5De/Vn4im0R PImZ9z/li2KDK78ItmIDcEbLsg3F5sOo6wvVgfroicMsIK4yrm235GNDcEbcXNWSrpkOPcq1bLi p X-Google-Smtp-Source: AGHT+IEPfamYXY38mq0bv8yIOSlipfKnHoRjam2dYggYwqOJZr8aHk4e8B9r1glvD3NQNGzE0pbABg== X-Received: by 2002:a05:6000:1865:b0:37d:481e:fd3 with SMTP id ffacd0b85a97d-37efcf1111amr1629818f8f.26.1729677613482; Wed, 23 Oct 2024 03:00:13 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.03.00.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 03:00:12 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 21/28] toaster/tests/browser/helper: Add wait_until_element_clickable funciton Date: Wed, 23 Oct 2024 10:59:42 +0100 Message-ID: <20241023095949.3351980-21-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 10:00:20 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16712 Add a variant of the clickable function that accepts an element parameter. Signed-off-by: Richard Purdie --- lib/toaster/tests/browser/selenium_helpers_base.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/toaster/tests/browser/selenium_helpers_base.py b/lib/toaster/tests/browser/selenium_helpers_base.py index 82defea0f2..4eea2267cc 100644 --- a/lib/toaster/tests/browser/selenium_helpers_base.py +++ b/lib/toaster/tests/browser/selenium_helpers_base.py @@ -239,6 +239,13 @@ class SeleniumTestCaseBase(unittest.TestCase): Wait(self.driver, timeout=timeout).until(is_clickable, msg) return self.find(selector) + def wait_until_element_clickable(self, finder, timeout=Wait._TIMEOUT): + """ Wait until element is clickable """ + is_clickable = lambda driver: (finder(driver).is_displayed() and finder(driver).is_enabled()) + msg = 'A matching element never became be clickable' + Wait(self.driver, timeout=timeout).until(is_clickable, msg) + return finder(self.driver) + def wait_until_focused(self, selector): """ Wait until element matching CSS selector has focus """ is_focused = \ From patchwork Wed Oct 23 09:59:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51121 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 363C9CDDE5D for ; Wed, 23 Oct 2024 10:00:20 +0000 (UTC) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by mx.groups.io with SMTP id smtpd.web10.5153.1729677616442897517 for ; Wed, 23 Oct 2024 03:00:16 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=H1FC9pTf; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.53, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4316f3d3c21so36540975e9.3 for ; Wed, 23 Oct 2024 03:00:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677614; x=1730282414; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=lLT/65MIunZFV7t6u2EW/stQsJTX08BL4Fduvxyy7po=; b=H1FC9pTfOfUnhXX89xifice8EBU4pnjw5HpnHF6faR1xWJv3ZYtivVlDxTCXM0F6Bj YsTJQq/jikIeaEo3ErgEZa4lWnStCF1HufftoCDi1Uou6eWuyS8PTGqJ5LN8z9LnbPu5 3GK7/iH4A43hb/uj66VRBflqx8MbJpcusVtKA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677614; x=1730282414; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lLT/65MIunZFV7t6u2EW/stQsJTX08BL4Fduvxyy7po=; b=Qpyy1p6P8iRk0QzuzrMx899AdK0JcUdtH3kcXJDyDK43tSYjVu8OgkjL9KoAvRHR4/ FcXXd3fn2HCMW7Y7St9KjZhl9V9vtMtB2AkDKvNMx4UEfwSuOUQe280ipxAJkJfv6lIg rcU+Ewp3Ek4Q6wDXQw+VK9Cx14lXpR1t90+ZYO8yEJCFIcwICttT8twKtZ8tzlbB67Zw jFdYwS+fP4rt7XKUY6dEW43Vk2gCuqQXZXPf6uV8la/B558Qt8SZIUQtaHxl0hkN3o2a ojw1ZimDHA7WmcmM4i2+TBAxIt1gvAW4KZQy+fPcnFgSkF1z4Qdfyfv7Q7NnVu7M6JWi aveg== X-Gm-Message-State: AOJu0Yy6KF/F2xeKS64X8aOjO2QA1yLzv+oGXarw2d22NxCcG3t8mufn d/un00jTqfduHA8v8EAMdy0i+9zKbDgAO5MhISNIkimjMO48Wu7/6acv/Sh10D2keibAn/kcwe8 N X-Google-Smtp-Source: AGHT+IEOymmv1bkVf8qNqxDe5qXogKzLi0gQAUqbhEj1FSb90GKWou+9ma+JrxPgRPywHDM+ykaYXA== X-Received: by 2002:a05:600c:4750:b0:431:60ec:7a91 with SMTP id 5b1f17b1804b1-43184130160mr15415035e9.2.1729677614442; Wed, 23 Oct 2024 03:00:14 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.03.00.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 03:00:13 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 22/28] toaster/tests/browser: Add various fixes for test failures encountered Date: Wed, 23 Oct 2024 10:59:43 +0100 Message-ID: <20241023095949.3351980-22-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 10:00:20 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16713 Fixes for the browser tests which: * Add/improve waiting for specific elements * Waiting for elements to be interactable, not just visible * Hiding notification windows * Using more specific asserts to obtain improved error messages Signed-off-by: Richard Purdie --- lib/toaster/tests/browser/test_all_builds_page.py | 1 + lib/toaster/tests/browser/test_landing_page.py | 1 + lib/toaster/tests/browser/test_layerdetails_page.py | 12 +++++++++--- lib/toaster/tests/browser/test_new_project_page.py | 6 ++---- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/toaster/tests/browser/test_all_builds_page.py b/lib/toaster/tests/browser/test_all_builds_page.py index a1f8057113..9ab81fb11b 100644 --- a/lib/toaster/tests/browser/test_all_builds_page.py +++ b/lib/toaster/tests/browser/test_all_builds_page.py @@ -200,6 +200,7 @@ class TestAllBuildsPage(SeleniumTestCase): # should see a rebuild button for non-command-line builds self.wait_until_visible('#allbuildstable tbody tr') + self.wait_until_visible('.rebuild-btn') selector = 'div[data-latest-build-result="%s"] .rebuild-btn' % build1.id run_again_button = self.find_all(selector) self.assertEqual(len(run_again_button), 1, diff --git a/lib/toaster/tests/browser/test_landing_page.py b/lib/toaster/tests/browser/test_landing_page.py index f3300430ba..210359d561 100644 --- a/lib/toaster/tests/browser/test_landing_page.py +++ b/lib/toaster/tests/browser/test_landing_page.py @@ -44,6 +44,7 @@ class TestLandingPage(SeleniumTestCase): # 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') + self.wait_until_visible(f'#{info_model_id}') info_modal = self.find(f'#{info_model_id}') self.assertTrue(info_modal.is_displayed()) self.assertTrue("Toaster version information" in info_modal.text) diff --git a/lib/toaster/tests/browser/test_layerdetails_page.py b/lib/toaster/tests/browser/test_layerdetails_page.py index c4f3f79d34..a6d1bc46c2 100644 --- a/lib/toaster/tests/browser/test_layerdetails_page.py +++ b/lib/toaster/tests/browser/test_layerdetails_page.py @@ -100,7 +100,7 @@ class TestLayerDetailsPage(SeleniumTestCase): (self.initial_values, value)) # Make sure the input visible beofre sending keys - self.wait_until_visible("#layer-git input[type=text]") + self.wait_until_clickable("#layer-git input[type=text]") inputs.send_keys("-edited") # Save the new values @@ -211,6 +211,7 @@ class TestLayerDetailsPage(SeleniumTestCase): self.get(self.url) # Add the layer + self.wait_until_clickable("#add-remove-layer-btn") self.click("#add-remove-layer-btn") notification = self.wait_until_visible("#change-notification-msg") @@ -218,12 +219,17 @@ class TestLayerDetailsPage(SeleniumTestCase): expected_text = "You have added 1 layer to your project: %s" % \ self.imported_layer_version.layer.name - self.assertTrue(expected_text in notification.text, + self.assertIn(expected_text, notification.text, "Expected notification text %s not found was " " \"%s\" instead" % (expected_text, notification.text)) + hide_button = self.find('#hide-alert') + hide_button.click() + self.wait_until_not_visible('#change-notification') + # Remove the layer + self.wait_until_clickable("#add-remove-layer-btn") self.click("#add-remove-layer-btn") notification = self.wait_until_visible("#change-notification-msg") @@ -231,7 +237,7 @@ class TestLayerDetailsPage(SeleniumTestCase): expected_text = "You have removed 1 layer from your project: %s" % \ self.imported_layer_version.layer.name - self.assertTrue(expected_text in notification.text, + self.assertIn(expected_text, notification.text, "Expected notification text %s not found was " " \"%s\" instead" % (expected_text, notification.text)) diff --git a/lib/toaster/tests/browser/test_new_project_page.py b/lib/toaster/tests/browser/test_new_project_page.py index b6187db105..e50f236c32 100644 --- a/lib/toaster/tests/browser/test_new_project_page.py +++ b/lib/toaster/tests/browser/test_new_project_page.py @@ -89,12 +89,10 @@ class TestNewProjectPage(SeleniumTestCase): radio = self.driver.find_element(By.ID, 'type-new') radio.click() - self.click("#create-project-button") - - self.wait_until_present('#hint-error-project-name') + self.wait_until_visible('#hint-error-project-name') element = self.find('#hint-error-project-name') - self.assertTrue(("Project names must be unique" in element.text), + self.assertIn("Project names must be unique", element.text, "Did not find unique project name error message") # Try and click it anyway, if it submits we'll have a new project in From patchwork Wed Oct 23 09:59:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51120 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 3BE72CDDE5E for ; Wed, 23 Oct 2024 10:00:20 +0000 (UTC) Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by mx.groups.io with SMTP id smtpd.web10.5154.1729677617213458339 for ; Wed, 23 Oct 2024 03:00:17 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=P86FwB6I; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.50, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4315baa51d8so66131805e9.0 for ; Wed, 23 Oct 2024 03:00:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677615; x=1730282415; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=S/MXpi+yDHIgl/Il3shp5cVCqoupFl6+bjb8mY3u6mQ=; b=P86FwB6I4rjsflaWxHtPJ80kIrCl0VmLs9KowHswOqxhMs8soxIoQs7FfB2ZzMt6NG SATAFknBJM9RrO+kOYVxiffebeXdmX/jcZSfEmehPnKmhOy8So9u2FFB1v/6/NlWRXbW TZ3+4W6Mucihm0n5JGcAaTgoFeskCaDvUZdCg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677615; x=1730282415; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S/MXpi+yDHIgl/Il3shp5cVCqoupFl6+bjb8mY3u6mQ=; b=k9JL1MlQgVcxi7og/8yTpIygjjBxFuAJaw24hmsoVdv9ySwsKSppIoATp4FZ6BUKpA OpJWxE4n5PQe3RBkqLsSetRXsWrryjt9txPmDKU+JcfqX5/LONr4O9AHdohUBgeDNpBT yLJzHz7dbZRQg+4Suj6GLcEqKkyv9cN82NuRDQ+ZdlMbURP07HCF/KeZuyTNUA2SMa/O sZq7Glne1emVUbOxWY3nQdZI12KZdOKpFW8Q8L54BLd8qgaY9IaHUJWnfdWaainyYx3P FvOsSgD4lJR5p6IMLU3La6KbvwITMCORCGP4vUj/lzaYayOAUe/9bHaNQm0Cn2AMCw54 QUsQ== X-Gm-Message-State: AOJu0YzzvQDFLzUAc0Jo/7ib6iz5E7SJiKTTR0q05lxZ4GkxVtiefahV zDWY06fknKRqW/z5t5HVZZkBV1MfjTYvnDJ/v6kJ1HyfgPyzb5Onyln4zNjEokLfHIQ+Z5mOKjn 2 X-Google-Smtp-Source: AGHT+IF52SHqZqdN0xcJywvWSPLrrGMtNFiADK7FmYnSRFqXbEurxK4parqXuzJ7nMH46GFc2YgKig== X-Received: by 2002:a05:600c:4ec7:b0:430:5887:c238 with SMTP id 5b1f17b1804b1-4318414a117mr14747815e9.11.1729677615165; Wed, 23 Oct 2024 03:00:15 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.03.00.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 03:00:14 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 23/28] toaster/tests/functional/util: Avoid test hangs Date: Wed, 23 Oct 2024 10:59:44 +0100 Message-ID: <20241023095949.3351980-23-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 10:00:20 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16714 If the element never exists, the timeout is never incremented and the test hangs indefinitely. Fix the exception handling to avoid that and allow the timeout to happen. Signed-off-by: Richard Purdie --- lib/toaster/tests/functional/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/toaster/tests/functional/utils.py b/lib/toaster/tests/functional/utils.py index 8e81c29984..d8394708e8 100644 --- a/lib/toaster/tests/functional/utils.py +++ b/lib/toaster/tests/functional/utils.py @@ -36,7 +36,7 @@ def wait_until_build(test_instance, state): if 'failed' in str(build_state).lower(): break except NoSuchElementException: - continue + pass except TimeoutException: break start_time += 1 From patchwork Wed Oct 23 09:59:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51122 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 4E507CDDE60 for ; Wed, 23 Oct 2024 10:00:20 +0000 (UTC) Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by mx.groups.io with SMTP id smtpd.web10.5155.1729677618078588336 for ; Wed, 23 Oct 2024 03:00:18 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=Us0rHSR4; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.51, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-431688d5127so43005285e9.0 for ; Wed, 23 Oct 2024 03:00:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677616; x=1730282416; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=QHK/CvLBJcxnzPT/eL7NMrXh3OO2AcEuQNYyhXMeXOQ=; b=Us0rHSR4dDf7gh6MT92jHG726Q2W3SMW8Cbz6qFSUOCbdVHwDSE/uTtIna+K4fu6rm cisf6esLoUDwBki5u06FWVAPqXHNkRVApCFdWStRlaIg/1taLDeNyAxY1H9RNXVZW2r3 /R1w+HXA1kSnyIEmCOY4ykjeEXqg8uZ4ixLek= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677616; x=1730282416; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QHK/CvLBJcxnzPT/eL7NMrXh3OO2AcEuQNYyhXMeXOQ=; b=nQ/nv1fQjgu09wPenq5h2a5TUSDVBtD9xj9QdGhcm/ClL+9X396YWtUlD/Qks3sK1n oH8G/lIWj8JXZ4SIMltRYM98AZg0ORdwgrMVV8nOtIcXOwEdvW7l7rC0KGKjPAZbnCYC qjIZin4H0Q9VIudyeM96vuMDRQjWb24ZH5Lvf35+ACFaptSwBDw156sVUEMV0hj2CVQX vP4GhD3w9GympZur67AOvLxBgKs/ZugsTv4otlrji5PnqV2V+J4/h8JyjfNau1MBVwwq kg0pl20ER/+QgFeGVfE9ZRtHGMvuqqDkil/5WolHT1LXoovjRIICKs0euK1lqGryZCgB YiYQ== X-Gm-Message-State: AOJu0Yylv0QLpdB3iW8smfZfAeuv7QGol6vRnisGmce/8Dedru+QXLYm 5+hXZpsav74pkUg52Xt3Lyyjg9ix0yPUBp2cDoWreP6t/73B1Scg5pHGgDBcKtpaGEAArW04C/J n X-Google-Smtp-Source: AGHT+IEusAGzyQhavpeLvg1+D82wIuFtovI8t86W0+NoZq/Rm9ZA0AnCLu0ssAmgKzCAZ4xcEQ9Y4Q== X-Received: by 2002:a05:600c:524a:b0:431:12d0:746b with SMTP id 5b1f17b1804b1-431841af63amr13313245e9.35.1729677615886; Wed, 23 Oct 2024 03:00:15 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.03.00.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 03:00:15 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 24/28] toaster/tests/functional/project_page: Use wait_until_element_clickable before click calls Date: Wed, 23 Oct 2024 10:59:45 +0100 Message-ID: <20241023095949.3351980-24-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 10:00:20 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16715 Switch the clickable() calls to use the new element_clickable() function which accepts a finder labmda function. This means if the element doesn't yet exist, the code can rebuild the query and try again once a small amount of time has elapsed. There were a ton of timing related races around these element interactions and this seemed to be the most robust way to address the issues. The change also makes some of the elements slightly more specific so the code can work effectively. Signed-off-by: Richard Purdie --- .../tests/functional/test_project_page.py | 93 ++++++++----------- 1 file changed, 40 insertions(+), 53 deletions(-) diff --git a/lib/toaster/tests/functional/test_project_page.py b/lib/toaster/tests/functional/test_project_page.py index f34ccf5e8e..c6dad0eb5d 100644 --- a/lib/toaster/tests/functional/test_project_page.py +++ b/lib/toaster/tests/functional/test_project_page.py @@ -92,7 +92,8 @@ class TestProjectPageBase(SeleniumFunctionalTestCase): list_check_box_id: list ): # Check edit column - edit_column = self.find(f'#{edit_btn_id}') + finder = lambda driver: self.find(f'#{edit_btn_id}') + edit_column = self.wait_until_element_clickable(finder) self.assertTrue(edit_column.is_displayed()) edit_column.click() # Check dropdown is visible @@ -280,7 +281,8 @@ class TestProjectPage(TestProjectPageBase): # click on "Edit" icon button self.wait_until_visible('#project-name-container') - edit_button = self.find('#project-change-form-toggle') + finder = lambda driver: self.find('#project-change-form-toggle') + edit_button = self.wait_until_element_clickable(finder) edit_button.click() project_name_input = self.find('#project-name-change-input') self.assertTrue(project_name_input.is_displayed()) @@ -391,12 +393,8 @@ class TestProjectPage(TestProjectPageBase): table_selector='softwarerecipestable' ) # check "build recipe" button works - rows = self.find_all('#softwarerecipestable tbody tr') - image_to_build = rows[0] - build_btn = image_to_build.find_element( - By.XPATH, - '//td[@class="add-del-layers"]//a[1]' - ) + finder = lambda driver: self.find_all('#softwarerecipestable tbody tr')[0].find_element(By.XPATH, '//td[@class="add-del-layers"]/a') + build_btn = self.wait_until_element_clickable(finder) build_btn.click() build_state = wait_until_build(self, 'queued cloning starting parsing failed') lastest_builds = self.driver.find_elements( @@ -404,11 +402,10 @@ class TestProjectPage(TestProjectPageBase): '//div[@id="latest-builds"]/div' ) self.assertTrue(len(lastest_builds) > 0) - last_build = lastest_builds[0] - cancel_button = last_build.find_element( - By.XPATH, - '//span[@class="cancel-build-btn pull-right alert-link"]', - ) + # Find the latest builds, the last build and then the cancel button + + finder = lambda driver: driver.find_elements(By.XPATH, '//div[@id="latest-builds"]/div')[0].find_element(By.XPATH, '//span[@class="cancel-build-btn pull-right alert-link"]') + cancel_button = self.wait_until_element_clickable(finder) cancel_button.click() if 'starting' not in build_state: # change build state when cancelled in starting state wait_until_build_cancelled(self) @@ -455,14 +452,10 @@ class TestProjectPage(TestProjectPageBase): table_selector='machinestable' ) # check "Select machine" button works - rows = self.find_all('#machinestable tbody tr') - machine_to_select = rows[0] - select_btn = machine_to_select.find_element( - By.XPATH, - '//td[@class="add-del-layers"]//a[1]' - ) - select_btn.send_keys(Keys.RETURN) - self.wait_until_visible('#config-nav') + finder = lambda driver: self.find_all('#machinestable tbody tr')[0].find_element(By.XPATH, '//td[@class="add-del-layers"]') + select_btn = self.wait_until_element_clickable(finder) + select_btn.click() + self.wait_until_visible('#project-machine-name') project_machine_name = self.find('#project-machine-name') self.assertIn( 'qemux86-64', project_machine_name.text @@ -478,9 +471,9 @@ class TestProjectPage(TestProjectPageBase): ) self.wait_until_visible('#machinestable tbody tr') - rows = self.find_all('#machinestable tbody tr') - machine_to_add = rows[0] - add_btn = machine_to_add.find_element(By.XPATH, '//td[@class="add-del-layers"]') + # Locate a machine to add button + finder = lambda driver: self.find_all('#machinestable tbody tr')[0].find_element(By.XPATH, '//td[@class="add-del-layers"]') + add_btn = self.wait_until_element_clickable(finder) add_btn.click() self.wait_until_visible('#change-notification') change_notification = self.find('#change-notification') @@ -488,7 +481,8 @@ class TestProjectPage(TestProjectPageBase): f'You have added 1 layer to your project', str(change_notification.text) ) - hide_button = self.find('#hide-alert') + finder = lambda driver: self.find('#hide-alert') + hide_button = self.wait_until_element_clickable(finder) hide_button.click() self.wait_until_not_visible('#change-notification') @@ -533,21 +527,15 @@ class TestProjectPage(TestProjectPageBase): ) # check "Add layer" button works self.wait_until_visible('#layerstable tbody tr') - rows = self.find_all('#layerstable tbody tr') - layer_to_add = rows[0] - add_btn = layer_to_add.find_element( - By.XPATH, - '//td[@class="add-del-layers"]' - ) + finder = lambda driver: self.find_all('#layerstable tbody tr')[0].find_element(By.XPATH, '//td[@class="add-del-layers"]/a[@data-directive="add"]') + add_btn = self.wait_until_element_clickable(finder) add_btn.click() # check modal is displayed self.wait_until_visible('#dependencies-modal') list_dependencies = self.find_all('#dependencies-list li') # click on add-layers button - add_layers_btn = self.driver.find_element( - By.XPATH, - '//form[@id="dependencies-modal-form"]//button[@class="btn btn-primary"]' - ) + finder = lambda driver: self.driver.find_element(By.XPATH, '//form[@id="dependencies-modal-form"]//button[@class="btn btn-primary"]') + add_layers_btn = self.wait_until_element_clickable(finder) add_layers_btn.click() self.wait_until_visible('#change-notification') change_notification = self.find('#change-notification') @@ -555,18 +543,15 @@ class TestProjectPage(TestProjectPageBase): f'You have added {len(list_dependencies)+1} layers to your project: {input_text} and its dependencies', str(change_notification.text) ) - hide_button = self.find('#hide-alert') + finder = lambda driver: self.find('#hide-alert') + hide_button = self.wait_until_element_clickable(finder) hide_button.click() self.wait_until_not_visible('#change-notification') # check "Remove layer" button works self.wait_until_visible('#layerstable tbody tr') - rows = self.find_all('#layerstable tbody tr') - layer_to_remove = rows[0] - remove_btn = layer_to_remove.find_element( - By.XPATH, - '//td[@class="add-del-layers"]' - ) + finder = lambda driver: self.find_all('#layerstable tbody tr')[0].find_element(By.XPATH, '//td[@class="add-del-layers"]/a[@data-directive="remove"]') + remove_btn = self.wait_until_element_clickable(finder) remove_btn.click() self.wait_until_visible('#change-notification') change_notification = self.find('#change-notification') @@ -574,7 +559,8 @@ class TestProjectPage(TestProjectPageBase): f'You have removed 1 layer from your project: {input_text}', str(change_notification.text) ) - hide_button = self.find('#hide-alert') + finder = lambda driver: self.find('#hide-alert') + hide_button = self.wait_until_element_clickable(finder) hide_button.click() self.wait_until_not_visible('#change-notification') @@ -618,12 +604,9 @@ class TestProjectPage(TestProjectPageBase): table_selector='distrostable' ) # check "Add distro" button works - rows = self.find_all('#distrostable tbody tr') - distro_to_add = rows[0] - add_btn = distro_to_add.find_element( - By.XPATH, - '//td[@class="add-del-layers"]//a[1]' - ) + self.wait_until_visible(".add-del-layers") + finder = lambda driver: self.find_all('#distrostable tbody tr')[0].find_element(By.XPATH, '//td[@class="add-del-layers"]') + add_btn = self.wait_until_element_clickable(finder) add_btn.click() self.wait_until_visible('#change-notification') change_notification = self.find('#change-notification') @@ -668,25 +651,29 @@ class TestProjectPage(TestProjectPageBase): self.assertTrue(self.find('.page-header h1').is_displayed()) # check remove layer button works - remove_layer_btn = self.find('#add-remove-layer-btn') + finder = lambda driver: self.find('#add-remove-layer-btn') + remove_layer_btn = self.wait_until_element_clickable(finder) remove_layer_btn.click() self.wait_until_visible('#change-notification') change_notification = self.find('#change-notification') self.assertIn( f'You have removed 1 layer from your project', str(change_notification.text) ) - hide_button = self.find('#hide-alert') + finder = lambda driver: self.find('#hide-alert') + hide_button = self.wait_until_element_clickable(finder) hide_button.click() # check add layer button works self.wait_until_not_visible('#change-notification') - add_layer_btn = self.find('#add-remove-layer-btn') + finder = lambda driver: self.find('#add-remove-layer-btn') + add_layer_btn = self.wait_until_element_clickable(finder) add_layer_btn.click() self.wait_until_visible('#change-notification') change_notification = self.find('#change-notification') self.assertIn( f'You have added 1 layer to your project', str(change_notification.text) ) - hide_button = self.find('#hide-alert') + finder = lambda driver: self.find('#hide-alert') + hide_button = self.wait_until_element_clickable(finder) hide_button.click() self.wait_until_not_visible('#change-notification') # check tabs(layers, recipes, machines) are displayed From patchwork Wed Oct 23 09:59:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51114 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 EB9C2CDDE4D for ; Wed, 23 Oct 2024 10:00:19 +0000 (UTC) Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by mx.groups.io with SMTP id smtpd.web11.5163.1729677618663391337 for ; Wed, 23 Oct 2024 03:00:18 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=bhfI6Bij; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.46, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-431688d5127so43005375e9.0 for ; Wed, 23 Oct 2024 03:00:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677617; x=1730282417; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=RQyOznY/TigTPBoBdiooBbSy6xTCV0W3QIVBq7uC3FQ=; b=bhfI6BijnWOfNTdU/Pq7WD6Kz9r2uHIzeIOPmSj8ohhFsCv5Jg4TZRAAiZDp99Dn54 CRLzDJT9sgZu3xMM22khsbsoQfmj8V2hYZJLZrNzFYcAM7UUJYduzzIgvaPujmQM9Bvw LCJHepSX9n+BAyVm31sMVRox7ThNv/tw7fnQQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677617; x=1730282417; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RQyOznY/TigTPBoBdiooBbSy6xTCV0W3QIVBq7uC3FQ=; b=T9/6aCZY19vntDYgXYQTMm2TTbKsBVmDAjgM/qRn8Hn/4c2tLJMWWm/Gvmo/zsFpwu 8n5QfoHIA8dWD99xSpJTpEDX/WAjUu2jm0uLByQmPHIg0zseYXPIr/ARH29+4iWgSWfz /zqAqE34ElW47C/ia5KvBG5mVEfY5P7aUXKHb4J9OR1ZGxXS2TyHeBLq/jvIJAV4iiql Y9Z1q6yR4cE1kWH8Y2m2TSQr2A0yMa69QuwQuJa+ywx5OBAO5iteahJ440SCaDpbzcnL nbqDIAcuU2lAbVvHXnvp2HTMTE+lezIeTZD/pIM2EuWn1JtA1qp3TYsfKW216BUVcJFO QEGg== X-Gm-Message-State: AOJu0Yzd+9re93z0w9oJQgKEvmZ5FU8yHbBER/KM5rCsne0BJHzJJocf 2AVnd9b8SpoAvmJr/iRsHPqD3nYsW7fB0DyldkwRPNMWyEqcMK6I2IVeQDpUehkqmdVnJ3ZFqeq Q X-Google-Smtp-Source: AGHT+IFEYtxamF3IRYRv55CXVXFPhDA+rcFPgfsFTY9xrwcfTjyfiBSTn+KxNFhdN27LiWthFFwq3Q== X-Received: by 2002:a05:600c:35cd:b0:431:4c14:abf4 with SMTP id 5b1f17b1804b1-43184150bc4mr18948055e9.14.1729677616726; Wed, 23 Oct 2024 03:00:16 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.03.00.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 03:00:16 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 25/28] toaster/tests/browser/helper: Add wait for jquery to complete Date: Wed, 23 Oct 2024 10:59:46 +0100 Message-ID: <20241023095949.3351980-25-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 10:00:19 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16716 Most of the tests that click on buttons need the DOM to stablise, including any running JQuery code before the test can proceed. Add calls to do this whenever we're about to click on an element. Signed-off-by: Richard Purdie --- lib/toaster/tests/browser/selenium_helpers_base.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/toaster/tests/browser/selenium_helpers_base.py b/lib/toaster/tests/browser/selenium_helpers_base.py index 4eea2267cc..6953541ab5 100644 --- a/lib/toaster/tests/browser/selenium_helpers_base.py +++ b/lib/toaster/tests/browser/selenium_helpers_base.py @@ -234,6 +234,7 @@ class SeleniumTestCaseBase(unittest.TestCase): def wait_until_clickable(self, selector, timeout=Wait._TIMEOUT): """ Wait until element matching CSS selector is visible on the page """ + WebDriverWait(self.driver, timeout=timeout).until(lambda driver: self.driver.execute_script("return jQuery.active == 0")) is_clickable = lambda driver: (self.find(selector).is_displayed() and self.find(selector).is_enabled()) msg = 'An element matching "%s" should be clickable' % selector Wait(self.driver, timeout=timeout).until(is_clickable, msg) @@ -241,6 +242,7 @@ class SeleniumTestCaseBase(unittest.TestCase): def wait_until_element_clickable(self, finder, timeout=Wait._TIMEOUT): """ Wait until element is clickable """ + WebDriverWait(self.driver, timeout=timeout).until(lambda driver: self.driver.execute_script("return jQuery.active == 0")) is_clickable = lambda driver: (finder(driver).is_displayed() and finder(driver).is_enabled()) msg = 'A matching element never became be clickable' Wait(self.driver, timeout=timeout).until(is_clickable, msg) From patchwork Wed Oct 23 09:59:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51113 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 04D47CDDE52 for ; Wed, 23 Oct 2024 10:00:20 +0000 (UTC) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by mx.groups.io with SMTP id smtpd.web11.5165.1729677619481071775 for ; Wed, 23 Oct 2024 03:00:19 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=VRhRCGq2; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.53, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4315df7b43fso66927935e9.0 for ; Wed, 23 Oct 2024 03:00:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677618; x=1730282418; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=/VBAi2U/sUJNhWrRjNykO3zFI4hTAlvcPSGwTaj9vYk=; b=VRhRCGq2hfVf/jgqWo/KkP3e0XciQsshQE64ftyFUk1BJ93Oxte0/GNJO3lcc2k6OP j/w+nkCk/YbAxD/y844eAMAt8xobAd1Hig0LF7FdpWzw+31qBuZLLnZjefdhV9MkhU9p 4u+ozkoxL4F4r/UK6M5kxi3gaLeRC4TMqBeqo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677618; x=1730282418; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/VBAi2U/sUJNhWrRjNykO3zFI4hTAlvcPSGwTaj9vYk=; b=WRt6qjssktKntEwlaPQwipS3/h7Ujabp3CDh6fU69jVTxBz4VICIO4+l3hNk+VffBN jp8nDGlZFESL3Ph4IsDsG/mheeig51vjMvrY54jvOY+ynLxnAm08FxhSL24eb/vrgVdn 9zCJG4sqfpsNL/SwNv/ZFPO9No+sTNQKgzLsEE6mQnnR2eNKmnk/j7X5ijMAsCjQoUGr WQF6ZaZOWr7nTSamI7KwpWN0huWPGGeK2Pg6jX+t42wImzC8dp147g6glJ+0JMRoVSc1 fhN94dHHwMExg9mPDRHOtD3qK0Mggn5q06nyyfVKjCiAO3lhCsBIkFwtwHdxLmPf9unE ZNUA== X-Gm-Message-State: AOJu0Yx2rSv2eyWPT5F/2sCnvGwgdbmCA4Pca5BMhRejxKrXy2krTMoH pZQwL67yN0a6i8Lt2rO27vxIlrbdIQ4y7khTSfyLB+MtgVEF4sJdOgKYGCR1fijpovyTgu1NgDX P X-Google-Smtp-Source: AGHT+IEHzSINc7HZCFcx4LB3GGc4hSNAf2qmNJtszbuzfTz7n6sSwefXyGOiVD2iUXpVCxAZJtPnvA== X-Received: by 2002:a05:600c:1c12:b0:42f:7ed4:4c26 with SMTP id 5b1f17b1804b1-43184143ef6mr18317345e9.12.1729677617678; Wed, 23 Oct 2024 03:00:17 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.03.00.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 03:00:17 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 26/28] tests/toaster/functional/utils: Handle WebDriverException Date: Wed, 23 Oct 2024 10:59:47 +0100 Message-ID: <20241023095949.3351980-26-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 10:00:20 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16717 Fix the exception handling in the cancel builds function. This involved adding WebDriverException which sometimes occurs but also correcting the other exception handlers to continue to increment the timeout to avoid test hangs. Signed-off-by: Richard Purdie --- lib/toaster/tests/functional/utils.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/toaster/tests/functional/utils.py b/lib/toaster/tests/functional/utils.py index d8394708e8..72345aef9f 100644 --- a/lib/toaster/tests/functional/utils.py +++ b/lib/toaster/tests/functional/utils.py @@ -8,7 +8,7 @@ from time import sleep -from selenium.common.exceptions import NoSuchElementException, StaleElementReferenceException, TimeoutException +from selenium.common.exceptions import NoSuchElementException, StaleElementReferenceException, TimeoutException, WebDriverException from selenium.webdriver.common.by import By from orm.models import Build @@ -66,12 +66,14 @@ def wait_until_build_cancelled(test_instance): pass if 'cancelled' in str(build_state).lower(): break - except NoSuchElementException: - continue - except StaleElementReferenceException: - continue except TimeoutException: break + except NoSuchElementException: + pass + except StaleElementReferenceException: + pass + except WebDriverException: + pass start_time += 1 sleep(1) # take a breath and try again From patchwork Wed Oct 23 09:59:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51124 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 3C76CCDDE51 for ; Wed, 23 Oct 2024 10:00:30 +0000 (UTC) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by mx.groups.io with SMTP id smtpd.web11.5166.1729677620708824449 for ; Wed, 23 Oct 2024 03:00:21 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=anERzs+P; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.41, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4315baec69eso62166545e9.2 for ; Wed, 23 Oct 2024 03:00:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677619; x=1730282419; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=tvgM7OwZ4WBVxggn+6NP+nAk5qO8MKamwxoIAQMCN8s=; b=anERzs+POKUc8CEKKO0tW2La3zWAo7oDT8RovfLiMkP0zZCXYvvSqL/WG32kiubZiB Semeyy9b/n7WkQaJtuAYX3EMnwPhpR7/1cDaJNlkSoEvcYhN7DWaeELurdJMBYfRURHu iaixcrxYmRtiqHL46i8HLon4H6GewVhWzYP1c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677619; x=1730282419; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tvgM7OwZ4WBVxggn+6NP+nAk5qO8MKamwxoIAQMCN8s=; b=s8HuQBbO7eyotxfjJ/HjN3tnjEngmVIWGOoeFhGJnPXtqAQ24gqXo9t/hTp35qaJzU 2nbN3a+Quv8TPH5HjXXurT/h98yvyTjP0CfPoZF8dRyRmk2nBVwLxmTWzWvA0EOeSMFr cGlFlgkYeQo2/aDrKva2maxEbmryfASRl40oSQFGwwFh+7yWFWoJd/IWq1amEAXwHIS9 aIhnCTCJRFLJC4jZiILhTvpQ4h0pXdTUGwLKc0rQDJ2VQfzKVV1TO6PzKdoQF83IkreV F7gTqPiJG2dUolQU/xbdjPsjYPX/Grlp0C3O/ZNYtEQJfl292pujaoRAgwYUFSyjKkfc b3IQ== X-Gm-Message-State: AOJu0YxhX2lgCNbWhs02a/N4IqhhzHvxlvh0tR2sKEiXFY8zMi9Hme8z B6cSqOPCimEjqYmLitceu1cO8Ln5nPdmI0h72qpMpAz8AsViybyZsLpECYWJFNkn/9iqIO6YhIw g X-Google-Smtp-Source: AGHT+IHNpK/SkCQCpzWRM9iMrQqYHchW2G5bJI5t8BezXQ35XygAo46qCtahUao26lMEshKlm0E5VA== X-Received: by 2002:a05:600c:6002:b0:431:5f1b:a7c4 with SMTP id 5b1f17b1804b1-431842608a3mr15517535e9.34.1729677618688; Wed, 23 Oct 2024 03:00:18 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.03.00.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 03:00:18 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 27/28] toaster/tests/browser/layerdetails: Drop unwanted test skipping/exception handling Date: Wed, 23 Oct 2024 10:59:48 +0100 Message-ID: <20241023095949.3351980-27-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 10:00:30 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16718 We really don't want to be skipping a test like this, drop the exception handling code as in my testing we thankfully no longer seem to be seeing it. If we do again we need to fix the underlying issue. Signed-off-by: Richard Purdie --- .../tests/browser/test_layerdetails_page.py | 38 +++++-------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/lib/toaster/tests/browser/test_layerdetails_page.py b/lib/toaster/tests/browser/test_layerdetails_page.py index a6d1bc46c2..69493833f4 100644 --- a/lib/toaster/tests/browser/test_layerdetails_page.py +++ b/lib/toaster/tests/browser/test_layerdetails_page.py @@ -64,7 +64,7 @@ class TestLayerDetailsPage(SeleniumTestCase): args=(self.project.pk, self.imported_layer_version.pk)) - def _edit_layerdetails(self): + def test_edit_layerdetails_page(self): """ Edit all the editable fields for the layer refresh the page and check that the new values exist""" @@ -107,17 +107,10 @@ class TestLayerDetailsPage(SeleniumTestCase): for save_btn in self.find_all(".change-btn"): save_btn.click() - try: - self.wait_until_visible("#save-changes-for-switch") - btn_save_chg_for_switch = self.wait_until_clickable( - "#save-changes-for-switch") - btn_save_chg_for_switch.click() - except ElementClickInterceptedException: - self.skipTest( - "save-changes-for-switch click intercepted. Element not visible or maybe covered by another element.") - except TimeoutException: - self.skipTest( - "save-changes-for-switch is not clickable within the specified timeout.") + self.wait_until_visible("#save-changes-for-switch") + btn_save_chg_for_switch = self.wait_until_clickable( + "#save-changes-for-switch") + btn_save_chg_for_switch.click() self.wait_until_visible("#edit-layer-source") @@ -147,17 +140,10 @@ class TestLayerDetailsPage(SeleniumTestCase): new_dir = "/home/test/my-meta-dir" dir_input.send_keys(new_dir) - try: - self.wait_until_visible("#save-changes-for-switch") - btn_save_chg_for_switch = self.wait_until_clickable( - "#save-changes-for-switch") - btn_save_chg_for_switch.click() - except ElementClickInterceptedException: - self.skipTest( - "save-changes-for-switch click intercepted. Element not properly visible or maybe behind another element.") - except TimeoutException: - self.skipTest( - "save-changes-for-switch is not clickable within the specified timeout.") + self.wait_until_visible("#save-changes-for-switch") + btn_save_chg_for_switch = self.wait_until_clickable( + "#save-changes-for-switch") + btn_save_chg_for_switch.click() self.wait_until_visible("#edit-layer-source") @@ -168,12 +154,6 @@ class TestLayerDetailsPage(SeleniumTestCase): "Expected %s in the dir value for layer directory" % new_dir) - def test_edit_layerdetails_page(self): - try: - self._edit_layerdetails() - except ElementClickInterceptedException: - self.skipTest( - "ElementClickInterceptedException occured. Element not visible or maybe covered by another element.") def test_delete_layer(self): """ Delete the layer """ From patchwork Wed Oct 23 09:59:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 51123 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 3C7FBCDDE52 for ; Wed, 23 Oct 2024 10:00:30 +0000 (UTC) Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by mx.groups.io with SMTP id smtpd.web10.5157.1729677621765799374 for ; Wed, 23 Oct 2024 03:00:22 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=HxLkHRN3; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.52, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-43167ff0f91so46835325e9.1 for ; Wed, 23 Oct 2024 03:00:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729677620; x=1730282420; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=WOWYG90B39N1cdeq8H1D0gItqrifO4IYIeb2WImPEhs=; b=HxLkHRN35+584dtPTknNpWYnGXLqx5vPEQRGcse9AN1UXib8RJxqeQpCqPix+CzAic Cf28i9bHZ/b+7zHiHCR+osDfV2to5cQqh1yXWftWRsnnN3wEfq7ByWvftJiXw5E164Dt njRCa0bsbKXxAzbg7M6w5N/vn8l+wxRVUn+GE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729677620; x=1730282420; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WOWYG90B39N1cdeq8H1D0gItqrifO4IYIeb2WImPEhs=; b=TYowGTSG9hpEeU8PCDvkPVlRChK+HrJ47bwAp2+LVHyXi7rs0NhlRHL/3CdFAmMvNg rvwn/fcJMD3lYvODEMQJYzKAgGGPYtOP7nZvdX0abaZNQEVy4C00cn3SB7RIkcY6iXEy TDfVhDAIDboMf/4sx+AHmJyVLf8EVeLh9fqA73G3bjPyGtWh6sFUtb2QTNkVMy/zPxYi hiFKgbAAhocsqoNyH2U+/IDvoIuvROeHsHXneVuw4ffCM+vfM4GIimiURG1QbedCxhSY X6uFT3SjN8qNF5IB00kgwFk5KyXThw31WcbkafPhTsNpOdHuD6/aJPbv9C7Bt5UXUpCA RrxQ== X-Gm-Message-State: AOJu0YwZr4kAPzQapwaCkDABvEiPTbL64o24XHrOv7yqJiZhAUt0EEE4 W/INtmJXUrogpFw0VYi7hv2aSj8Nn46xfvQbQUJIp6x3ItI2g2qBu3fWJheRyHrmetRrwNud3X9 y X-Google-Smtp-Source: AGHT+IHxaMGzFcfGThVZfQFOl4ExocohUV+Gk06XTYsSsc8geicHCDAquDJVZp2R0/fWNWKVcrLp7w== X-Received: by 2002:a05:600c:3543:b0:431:6153:a246 with SMTP id 5b1f17b1804b1-4318414a3d9mr18077355e9.13.1729677619935; Wed, 23 Oct 2024 03:00:19 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:ad34:30ba:19ab:e41f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c001c7sm11668795e9.29.2024.10.23.03.00.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 03:00:19 -0700 (PDT) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 28/28] toaster/tests/selenium_helper_base: Dump a screenshot into tmp upon failure Date: Wed, 23 Oct 2024 10:59:49 +0100 Message-ID: <20241023095949.3351980-28-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> References: <20241023095949.3351980-1-richard.purdie@linuxfoundation.org> 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, 23 Oct 2024 10:00:30 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16719 If we fail to have an element display, dump a screenshot into /tmp since debugging these issues is painful and a screenshot can help a lot. Signed-off-by: Richard Purdie --- lib/toaster/tests/browser/selenium_helpers_base.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/toaster/tests/browser/selenium_helpers_base.py b/lib/toaster/tests/browser/selenium_helpers_base.py index 6953541ab5..798aa9e448 100644 --- a/lib/toaster/tests/browser/selenium_helpers_base.py +++ b/lib/toaster/tests/browser/selenium_helpers_base.py @@ -122,6 +122,7 @@ class Wait(WebDriverWait): if time.time() > end_time: break + self._driver.get_screenshot_as_file("/tmp/toaster-failing-screenshot-%s.png" % int(time.time())) raise TimeoutException(message) def until_not(self, method, message=''):