From patchwork Tue Nov 21 13:51:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 34968 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 477FCC61D96 for ; Tue, 21 Nov 2023 13:51:40 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web10.40843.1700574697823412119 for ; Tue, 21 Nov 2023 05:51:38 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=WpgzwcuQ; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 2D80D9C3496 for ; Tue, 21 Nov 2023 08:51:37 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id q5YJ0FhZdkKT; Tue, 21 Nov 2023 08:51:36 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 5AA0B9C3373; Tue, 21 Nov 2023 08:51:36 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 5AA0B9C3373 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1700574696; bh=Y6q0/szke9Hv2egvcEYhi57k18HN1LYA/zjUDnTHL0U=; h=From:To:Date:Message-Id:MIME-Version; b=WpgzwcuQ6rCeh8KPENVy9fu73XT/5wcJ5qof/L90bCitux8cJnnCjtr6nmD66zXmf cM1e72qkyoks9xLih2TdEDoKE6hynRo7gc9CtGiQHW0ib7m1Q6drFui+LMDpan555X K6xMIs1hMCd15E02ARerf+V5/GCVn0pmOmpnoceR+6dCkvlDS0ufs5LGndqLR2j4mL 5ZnDVGKgrfuZF11/JKrexQtkMYKiE+zrK6sqqawslEs9nyXtfJ9FyF+zazw3zZ1Y35 Itc0Qi4jI5bvbZCCAZHX+GBYl2vB+oiUiMfdMxmUmSPUKKBWNCu/wh+btKi2Z7A9Nk BmbWla/yN73/Q== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id uQpBDCse_YXv; Tue, 21 Nov 2023 08:51:36 -0500 (EST) Received: from jedi.. (unknown [196.127.183.75]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 5BC1B9C2B49; Tue, 21 Nov 2023 08:51:35 -0500 (EST) From: Alassane Yattara To: bitbake-devel@lists.openembedded.org Cc: Alassane Yattara Subject: [PATCH 1/7] Toaster: Write UI TestCase -> Test project config tab navigation: Date: Tue, 21 Nov 2023 14:51:25 +0100 Message-Id: <20231121135131.107330-1-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 Nov 2023 13:51:40 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15552 - Check if the menu is displayed and contains the right elements: - Configuration - COMPATIBLE METADATA - Custom images - Image recipes - Software recipes - Machines - Layers - Distro - EXTRA CONFIGURATION - Bitbake variables - Actions - Delete project Signed-off-by: Alassane Yattara --- .../test_project_page_tab_config.py | 176 ++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 lib/toaster/tests/functional/test_project_page_tab_config.py diff --git a/lib/toaster/tests/functional/test_project_page_tab_config.py b/lib/toaster/tests/functional/test_project_page_tab_config.py new file mode 100644 index 00000000..f0c6aacf --- /dev/null +++ b/lib/toaster/tests/functional/test_project_page_tab_config.py @@ -0,0 +1,176 @@ +#! /usr/bin/env python3 # +# BitBake Toaster UI tests implementation +# +# Copyright (C) 2023 Savoir-faire Linux +# +# SPDX-License-Identifier: GPL-2.0-only +# + +from time import sleep +import pytest +from django.urls import reverse +from selenium.webdriver.support.select import Select +from selenium.common.exceptions import NoSuchElementException +from tests.functional.functional_helpers import SeleniumFunctionalTestCase +from selenium.webdriver.common.by import By + + +@pytest.mark.django_db +class TestProjectConfigTab(SeleniumFunctionalTestCase): + + def setUp(self): + self.recipe = None + super().setUp() + release = '3' + project_name = 'projectmaster' + self._create_test_new_project( + project_name, + release, + False, + ) + + def _create_test_new_project( + self, + project_name, + release, + merge_toaster_settings, + ): + """ Create/Test new project using: + - Project Name: Any string + - Release: Any string + - Merge Toaster settings: True or False + """ + self.get(reverse('newproject')) + self.driver.find_element(By.ID, + "new-project-name").send_keys(project_name) + + select = Select(self.find('#projectversion')) + select.select_by_value(release) + + # check merge toaster settings + checkbox = self.find('.checkbox-mergeattr') + if merge_toaster_settings: + if not checkbox.is_selected(): + checkbox.click() + else: + if checkbox.is_selected(): + checkbox.click() + + self.driver.find_element(By.ID, "create-project-button").click() + + @classmethod + def _wait_until_build(cls, state): + while True: + try: + last_build_state = cls.driver.find_element( + By.XPATH, + '//*[@id="latest-builds"]/div[1]//div[@class="build-state"]', + ) + build_state = last_build_state.get_attribute( + 'data-build-state') + state_text = state.lower().split() + if any(x in str(build_state).lower() for x in state_text): + break + except NoSuchElementException: + continue + sleep(1) + + def _create_builds(self): + # check search box can be use to build recipes + search_box = self.find('#build-input') + search_box.send_keys('core-image-minimal') + self.find('#build-button').click() + sleep(1) + self.wait_until_visible('#latest-builds') + # loop until reach the parsing state + self._wait_until_build('parsing starting cloning') + lastest_builds = self.driver.find_elements( + By.XPATH, + '//div[@id="latest-builds"]/div', + ) + last_build = lastest_builds[0] + self.assertTrue( + 'core-image-minimal' in str(last_build.text) + ) + cancel_button = last_build.find_element( + By.XPATH, + '//span[@class="cancel-build-btn pull-right alert-link"]', + ) + cancel_button.click() + sleep(1) + self._wait_until_build('cancelled') + + def _get_tabs(self): + # tabs links list + return self.driver.find_elements( + By.XPATH, + '//div[@id="project-topbar"]//li' + ) + + def _get_config_nav_item(self, index): + config_nav = self.find('#config-nav') + return config_nav.find_elements(By.TAG_NAME, 'li')[index] + + def test_project_config_nav(self): + """ Test project config tab navigation: + - Check if the menu is displayed and contains the right elements: + - Configuration + - COMPATIBLE METADATA + - Custom images + - Image recipes + - Software recipes + - Machines + - Layers + - Distro + - EXTRA CONFIGURATION + - Bitbake variables + - Actions + - Delete project + """ + # navigate to the project page + url = reverse("project", args=(1,)) + self.get(url) + + # check if the menu is displayed + self.wait_until_visible('#config-nav') + + def _get_config_nav_item(index): + config_nav = self.find('#config-nav') + return config_nav.find_elements(By.TAG_NAME, 'li')[index] + + def check_config_nav_item(index, item_name, url): + item = _get_config_nav_item(index) + self.assertTrue(item_name in item.text) + self.assertTrue(item.get_attribute('class') == 'active') + self.assertTrue(url in self.driver.current_url) + + # check if the menu contains the right elements + # COMPATIBLE METADATA + compatible_metadata = _get_config_nav_item(1) + self.assertTrue( + "compatible metadata" in compatible_metadata.text.lower() + ) + # EXTRA CONFIGURATION + extra_configuration = _get_config_nav_item(8) + self.assertTrue( + "extra configuration" in extra_configuration.text.lower() + ) + # Actions + actions = _get_config_nav_item(10) + self.assertTrue("actions" in str(actions.text).lower()) + + conf_nav_list = [ + [0, 'Configuration', f"/toastergui/project/1"], # config + [2, 'Custom images', f"/toastergui/project/1/customimages"], # custom images + [3, 'Image recipes', f"/toastergui/project/1/images"], # image recipes + [4, 'Software recipes', f"/toastergui/project/1/softwarerecipes"], # software recipes + [5, 'Machines', f"/toastergui/project/1/machines"], # machines + [6, 'Layers', f"/toastergui/project/1/layers"], # layers + [7, 'Distro', f"/toastergui/project/1/distro"], # distro + [9, 'BitBake variables', f"/toastergui/project/1/configuration"], # bitbake variables + ] + for index, item_name, url in conf_nav_list: + item = _get_config_nav_item(index) + if item.get_attribute('class') != 'active': + item.click() + check_config_nav_item(index, item_name, url) From patchwork Tue Nov 21 13:51:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 34969 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 477C1C61D94 for ; Tue, 21 Nov 2023 13:51:40 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web11.40878.1700574699422018670 for ; Tue, 21 Nov 2023 05:51:39 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=LmeHB7JT; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id BE6229C3496 for ; Tue, 21 Nov 2023 08:51:38 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id Dyv3bEMFDqBr; Tue, 21 Nov 2023 08:51:37 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 910089C3373; Tue, 21 Nov 2023 08:51:37 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 910089C3373 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1700574697; bh=smYsRYDmGroscLsgoB50jQXDpPzWwHjEawH7+FclPsM=; h=From:To:Date:Message-Id:MIME-Version; b=LmeHB7JTIbjw3nTg56DySnbQHw8hPRhIJV9aM30+5TkwnH9098a0jkIlYT8F3wsbs 3SN1CnFvgb+YndrMHNadGpXlnjH0uOEqoImsTSP9GBKRnT0MOIlzImph7VS3z0mEEA rWD89SIRSARVsR7QIxthQbQdcBZqZvhQeBsVan79YQEYcyJRDRIzckzRMQzDB0abLY +BQAZgZKEYM6knx2ovNeGWEWqwXtCrHIB1HryGC+G99tbhu2kBayauIFRFUk6y98j6 7yGz690QF86l/PzE8kfTmSOpMjxA3MzN7FRZdH8NpMLqjsIodQWJiIKpqrE3xNjzdy 1e/r6YOdBld9w== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id Cx0cpbtbYIBr; Tue, 21 Nov 2023 08:51:37 -0500 (EST) Received: from jedi.. (unknown [196.127.183.75]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 870609C2B49; Tue, 21 Nov 2023 08:51:36 -0500 (EST) From: Alassane Yattara To: bitbake-devel@lists.openembedded.org Cc: Alassane Yattara Subject: [PATCH 2/7] Toaster: Write UI TestCase -> Test project config tab Date: Tue, 21 Nov 2023 14:51:26 +0100 Message-Id: <20231121135131.107330-2-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231121135131.107330-1-alassane.yattara@savoirfairelinux.com> References: <20231121135131.107330-1-alassane.yattara@savoirfairelinux.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 Nov 2023 13:51:40 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15553 Check if project config tab right section contains five blocks: - Machine: - check 'Machine' is displayed - check can change Machine - Distro: - check 'Distro' is displayed - check can change Distro - Most built recipes: - check 'Most built recipes' is displayed - check can select a recipe and build it - Project release: - check 'Project release' is displayed - check project has right release displayed - Layers: - check can add a layer if exists - check at least three layers are displayed - openembedded-core - meta-poky - meta-yocto-bsp Signed-off-by: Alassane Yattara --- .../test_project_page_tab_config.py | 132 ++++++++++++++++++ .../toastergui/templates/mrb_section.html | 2 +- 2 files changed, 133 insertions(+), 1 deletion(-) 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 f0c6aacf..ca3b88d2 100644 --- a/lib/toaster/tests/functional/test_project_page_tab_config.py +++ b/lib/toaster/tests/functional/test_project_page_tab_config.py @@ -9,6 +9,7 @@ from time import sleep import pytest from django.urls import reverse +from selenium.webdriver import Keys from selenium.webdriver.support.select import Select from selenium.common.exceptions import NoSuchElementException from tests.functional.functional_helpers import SeleniumFunctionalTestCase @@ -174,3 +175,134 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase): if item.get_attribute('class') != 'active': item.click() check_config_nav_item(index, item_name, url) + + def test_project_config_tab_right_section(self): + """ Test project config tab right section contains five blocks: + - Machine: + - check 'Machine' is displayed + - check can change Machine + - Distro: + - check 'Distro' is displayed + - check can change Distro + - Most built recipes: + - check 'Most built recipes' is displayed + - check can select a recipe and build it + - Project release: + - check 'Project release' is displayed + - check project has right release displayed + - Layers: + - check can add a layer if exists + - check at least three layers are displayed + - openembedded-core + - meta-poky + - meta-yocto-bsp + """ + # navigate to the project page + url = reverse("project", args=(1,)) + self.get(url) + + # check if the menu is displayed + self.wait_until_visible('#project-page') + block_l = self.driver.find_element( + By.XPATH, '//*[@id="project-page"]/div[2]') + machine = self.find('#machine-section') + distro = self.find('#distro-section') + most_built_recipes = self.driver.find_element( + By.XPATH, '//*[@id="project-page"]/div[1]/div[3]') + project_release = self.driver.find_element( + By.XPATH, '//*[@id="project-page"]/div[1]/div[4]') + layers = block_l.find_element(By.ID, 'layer-container') + + def check_machine_distro(self, item_name, new_item_name, block): + title = block.find_element(By.TAG_NAME, 'h3') + self.assertTrue(item_name.capitalize() in title.text) + edit_btn = block.find_element(By.ID, f'change-{item_name}-toggle') + edit_btn.click() + sleep(1) + name_input = block.find_element(By.ID, f'{item_name}-change-input') + name_input.clear() + name_input.send_keys(new_item_name) + change_btn = block.find_element(By.ID, f'{item_name}-change-btn') + change_btn.click() + sleep(1) + project_name = block.find_element(By.ID, f'project-{item_name}-name') + self.assertTrue(new_item_name in project_name.text) + # check change notificaiton is displayed + change_notification = self.find('#change-notification') + self.assertTrue( + f'You have changed the {item_name} to: {new_item_name}' in change_notification.text + ) + + # Machine + check_machine_distro(self, 'machine', 'qemux86-64', machine) + # Distro + check_machine_distro(self, 'distro', 'poky-altcfg', distro) + + # Project release + title = project_release.find_element(By.TAG_NAME, 'h3') + self.assertTrue("Project release" in title.text) + self.assertTrue( + "Yocto Project master" in self.find('#project-release-title').text + ) + + # Layers + title = layers.find_element(By.TAG_NAME, 'h3') + self.assertTrue("Layers" in title.text) + # 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') + self.assertTrue(len(layers_list_items) == 3) + # 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' + ) + dropdown_item.click() + add_layer_btn = layers.find_element(By.ID, 'add-layer-btn') + add_layer_btn.click() + sleep(1) + # check layer is added + layers_list_items = layers_list.find_elements(By.TAG_NAME, 'li') + self.assertTrue(len(layers_list_items) == 4) + + # Most built recipes + title = most_built_recipes.find_element(By.TAG_NAME, 'h3') + self.assertTrue("Most built recipes" in title.text) + # Create a new builds 5 + self._create_builds() + + # Refresh the page + self.get(url) + + sleep(1) # wait for page to load + self.wait_until_visible('#project-page') + # check can select a recipe and build it + most_built_recipes = self.driver.find_element( + By.XPATH, '//*[@id="project-page"]/div[1]/div[3]') + recipe_list = most_built_recipes.find_element(By.ID, 'freq-build-list') + recipe_list_items = recipe_list.find_elements(By.TAG_NAME, 'li') + self.assertTrue(len(recipe_list_items) > 0) + checkbox = recipe_list_items[0].find_element(By.TAG_NAME, 'input') + checkbox.click() + build_btn = self.find('#freq-build-btn') + build_btn.click() + sleep(1) # wait for page to load + self.wait_until_visible('#latest-builds') + self._wait_until_build('parsing starting cloning queueing') + lastest_builds = self.driver.find_elements( + By.XPATH, + '//div[@id="latest-builds"]/div' + ) + last_build = lastest_builds[0] + cancel_button = last_build.find_element( + By.XPATH, + '//span[@class="cancel-build-btn pull-right alert-link"]', + ) + cancel_button.click() + self.assertTrue(len(lastest_builds) == 2) diff --git a/lib/toaster/toastergui/templates/mrb_section.html b/lib/toaster/toastergui/templates/mrb_section.html index 98d9fac8..9fc7dfae 100644 --- a/lib/toaster/toastergui/templates/mrb_section.html +++ b/lib/toaster/toastergui/templates/mrb_section.html @@ -63,7 +63,7 @@ <%/if%> -
+
<%if state == 'Cloning'%> <%include tmpl='#cloning-repos-build-template'/%> <%else state == 'Parsing'%> From patchwork Tue Nov 21 13:51:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 34970 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 53D5DC61D92 for ; Tue, 21 Nov 2023 13:51:40 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web10.40846.1700574700016725226 for ; Tue, 21 Nov 2023 05:51:40 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=YPWRQ3Mu; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 5A2169C34C8 for ; Tue, 21 Nov 2023 08:51:39 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id IoHGmyISSTLU; Tue, 21 Nov 2023 08:51:38 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id CB95A9C3373; Tue, 21 Nov 2023 08:51:38 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com CB95A9C3373 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1700574698; bh=IbzO8ajXGLqcGJ3WeOF9EixSDD53qzKB/Ky1aD8zz5A=; h=From:To:Date:Message-Id:MIME-Version; b=YPWRQ3MuS4Rwge8BTg9J8iiEmfz761nB5U69ltfmcUZJp+6FkcrPZC9+yDt1C3IYN LDAFLhs9C00R1t7J4raDUDj0Drsekt4VleUXhrS+2EpFa6u7oLk0xYPtS7FvzmmcWz iCUBndH5q5+HQhOmsqrQrjiGHiQWhpquuphe+ifjCXpZ/MQORJ/xxeywO8VxJjk3vZ QTM0rzySL38GQ+8KgB7mjBlnihnMEjenAxF7mW+flhqU9GBuADv26N3A/eF8Q6IhWD yvuHmxmmHnhPb9QnoJg488gV7rMj/fgFbw0P4PDytTaLFYMAFK8sye0llJczoURzVy uSsx4lNnGsCuA== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id x3XIR0NtjjEE; Tue, 21 Nov 2023 08:51:38 -0500 (EST) Received: from jedi.. (unknown [196.127.183.75]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id E86CD9C349D; Tue, 21 Nov 2023 08:51:37 -0500 (EST) From: Alassane Yattara To: bitbake-devel@lists.openembedded.org Cc: Alassane Yattara Subject: [PATCH 3/7] Toaster: Write UI TestCase -> Test project page tab import layer Date: Tue, 21 Nov 2023 14:51:27 +0100 Message-Id: <20231121135131.107330-3-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231121135131.107330-1-alassane.yattara@savoirfairelinux.com> References: <20231121135131.107330-1-alassane.yattara@savoirfairelinux.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 Nov 2023 13:51:40 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15554 Signed-off-by: Alassane Yattara --- .../test_project_page_tab_config.py | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) 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 ca3b88d2..14a859a1 100644 --- a/lib/toaster/tests/functional/test_project_page_tab_config.py +++ b/lib/toaster/tests/functional/test_project_page_tab_config.py @@ -306,3 +306,46 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase): ) cancel_button.click() self.assertTrue(len(lastest_builds) == 2) + + def test_project_page_tab_importlayer(self): + """ Test project page tab import layer """ + # navigate to the project page + url = reverse("project", args=(1,)) + self.get(url) + + # navigate to "Import layers" tab + import_layers_tab = self._get_tabs()[2] + import_layers_tab.find_element(By.TAG_NAME, 'a').click() + self.wait_until_visible('#layer-git-repo-url') + + # Check git repo radio button + git_repo_radio = self.find('#git-repo-radio') + git_repo_radio.click() + + # Set git repo url + input_repo_url = self.find('#layer-git-repo-url') + input_repo_url.send_keys('git://git.yoctoproject.org/meta-fake') + # Blur the input to trigger the validation + input_repo_url.send_keys(Keys.TAB) + + # Check name is set + input_layer_name = self.find('#import-layer-name') + self.assertTrue(input_layer_name.get_attribute('value') == 'meta-fake') + + # Set branch + input_branch = self.find('#layer-git-ref') + input_branch.send_keys('master') + + # Import layer + self.find('#import-and-add-btn').click() + + # Check layer is added + self.wait_until_visible('#layer-container') + block_l = self.driver.find_element( + By.XPATH, '//*[@id="project-page"]/div[2]') + layers = block_l.find_element(By.ID, 'layer-container') + layers_list = layers.find_element(By.ID, 'layers-in-project-list') + layers_list_items = layers_list.find_elements(By.TAG_NAME, 'li') + self.assertTrue( + 'meta-fake' in str(layers_list_items[-1].text) + ) From patchwork Tue Nov 21 13:51:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 34971 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 4E98CC61D96 for ; Tue, 21 Nov 2023 13:51:50 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web11.40881.1700574701574166563 for ; Tue, 21 Nov 2023 05:51:41 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=lHlp7j4N; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id E144A9C366C for ; Tue, 21 Nov 2023 08:51:40 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id gqcXY6EXk6WY; Tue, 21 Nov 2023 08:51:40 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 345C19C36BA; Tue, 21 Nov 2023 08:51:40 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 345C19C36BA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1700574700; bh=Q3OYKsHc/2r4EYcWZ0ZtKDtExz84bdQgHnQwLANsz1I=; h=From:To:Date:Message-Id:MIME-Version; b=lHlp7j4NLD+rnQqvz0xGE56Inp++Oia4tneMXd8sZrvPwBW72vV+17vWwBrnHXpP+ T1YyGjI8gu1/2J+CncLGY74J936DLEjMVJGhWF4+hCNGSW5qHoXFkmdRfGGF2fVcRP oxBxu3dFDXOGnIEWhCQhCzAkl82M021O+bR8U4msZW+g5A9Dm3pQVwwNC8nj0WPuF3 /7kDw5Lre2kjXZOCxGoLkhjDNbnvHKJodF1qCoOdpj7m0T809LWNrB+kxkagohbyFI sV4lzODhBxCBBufXO1uFp5+10ySt05J0Y3IpP/YWBIAS6iR3mQ74DXwZeDWA1YgDZ3 SEQJj1gx9tLSw== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id 9CLSdynzPlRv; Tue, 21 Nov 2023 08:51:40 -0500 (EST) Received: from jedi.. (unknown [196.127.183.75]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 2C1379C33E8; Tue, 21 Nov 2023 08:51:38 -0500 (EST) From: Alassane Yattara To: bitbake-devel@lists.openembedded.org Cc: Alassane Yattara Subject: [PATCH 4/7] Toaster: Write UI TestCase -> Test project page tab "New custom image" Date: Tue, 21 Nov 2023 14:51:28 +0100 Message-Id: <20231121135131.107330-4-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231121135131.107330-1-alassane.yattara@savoirfairelinux.com> References: <20231121135131.107330-1-alassane.yattara@savoirfairelinux.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 Nov 2023 13:51:50 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15555 Test project page tab "New custom image" when no custom image Signed-off-by: Alassane Yattara --- .../test_project_page_tab_config.py | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) 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 14a859a1..c6d952fd 100644 --- a/lib/toaster/tests/functional/test_project_page_tab_config.py +++ b/lib/toaster/tests/functional/test_project_page_tab_config.py @@ -349,3 +349,34 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase): self.assertTrue( 'meta-fake' in str(layers_list_items[-1].text) ) + + def test_project_page_custom_image_no_image(self): + """ Test project page tab "New custom image" when no custom image """ + # navigate to the project page + url = reverse("project", args=(1,)) + self.get(url) + + # navigate to "Custom image" tab + custom_image_section = self._get_config_nav_item(2) + custom_image_section.click() + self.wait_until_visible('#empty-state-customimagestable') + + # Check message when no custom image + self.assertTrue( + "You have not created any custom images yet." in str( + self.find('#empty-state-customimagestable').text + ) + ) + div_empty_msg = self.find('#empty-state-customimagestable') + link_create_custom_image = div_empty_msg.find_element( + By.TAG_NAME, 'a') + self.assertTrue( + f"/toastergui/project/1/newcustomimage" in str( + link_create_custom_image.get_attribute('href') + ) + ) + self.assertTrue( + "Create your first custom image" in str( + link_create_custom_image.text + ) + ) From patchwork Tue Nov 21 13:51:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 34972 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 4E952C61D94 for ; Tue, 21 Nov 2023 13:51:50 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web11.40882.1700574702451664132 for ; Tue, 21 Nov 2023 05:51:42 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=syLdapmm; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id C14899C3752 for ; Tue, 21 Nov 2023 08:51:41 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id thQE6N3gmWVY; Tue, 21 Nov 2023 08:51:41 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 3CC3D9C3676; Tue, 21 Nov 2023 08:51:41 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 3CC3D9C3676 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1700574701; bh=BO8FHi+Vs2rnZMyhZTz1/TT9VaYCIEBWFW+FRXpULF8=; h=From:To:Date:Message-Id:MIME-Version; b=syLdapmm73VbYPhsAFTbD+vGqlsWXHXW0B35n0yWqaiDmCBbbGZFsKMlbRTqJo/c7 OQDchEAfHsJSUJc9Nxl2797Wf8W3aIzalNHcP7Sg5zPqayFZfkx4fD82O9WunBhdpV f4uWqZhwbAk6dyzD4do/1pTK/58WvunRx/5D2rLK8CaxmFhDTgV2OcfABtXCFMfsmp j4Zw3pz0UPd+smijbY/IKsSVXRin8up+3NVmxwTAGr/Yk7wA6erWXnROekrjhRKej1 /gbMID+IgguIZjeM/ZAjPUirwjYf7DFw/XwvdHrFp2Df7+am+LKXAiK9f3unNzkWeV zmUDn1Wynks0g== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id 6fhBUkPLXuCp; Tue, 21 Nov 2023 08:51:41 -0500 (EST) Received: from jedi.. (unknown [196.127.183.75]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 63D459C3753; Tue, 21 Nov 2023 08:51:40 -0500 (EST) From: Alassane Yattara To: bitbake-devel@lists.openembedded.org Cc: Alassane Yattara Subject: [PATCH 5/7] Toaster: Write UI TestCase -> Test project page section images Date: Tue, 21 Nov 2023 14:51:29 +0100 Message-Id: <20231121135131.107330-5-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231121135131.107330-1-alassane.yattara@savoirfairelinux.com> References: <20231121135131.107330-1-alassane.yattara@savoirfairelinux.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 Nov 2023 13:51:50 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15556 BUILD IMAGE RECIPES: toastergui/project/{id}/images/ Test project page section images - Check image recipes are displayed - Check search input - Check image recipe build button works - Check image recipe table features(show/hide column, pagination) Signed-off-by: Alassane Yattara --- .../test_project_page_tab_config.py | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) 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 c6d952fd..598a8055 100644 --- a/lib/toaster/tests/functional/test_project_page_tab_config.py +++ b/lib/toaster/tests/functional/test_project_page_tab_config.py @@ -380,3 +380,44 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase): link_create_custom_image.text ) ) + + def test_project_page_image_recipe(self): + """ Test project page section images + - Check image recipes are displayed + - Check search input + - Check image recipe build button works + - Check image recipe table features(show/hide column, pagination) + """ + # navigate to the project page + url = reverse("project", args=(1,)) + self.get(url) + self.wait_until_visible('#config-nav') + + # navigate to "Images section" + images_section = self._get_config_nav_item(3) + images_section.click() + self.wait_until_visible('#imagerecipestable') + rows = self.find_all('#imagerecipestable tbody tr') + self.assertTrue(len(rows) > 0) + + # Test search input + self.wait_until_visible('#search-input-imagerecipestable') + recipe_input = self.find('#search-input-imagerecipestable') + recipe_input.send_keys('core-image-minimal') + self.find('#search-submit-imagerecipestable').click() + rows = self.find_all('#imagerecipestable tbody tr') + self.assertTrue(len(rows) > 0) + + # Test build button + image_to_build = rows[0] + build_btn = image_to_build.find_element( + By.XPATH, + '//td[@class="add-del-layers"]' + ) + build_btn.click() + self._wait_until_build('parsing starting cloning') + lastest_builds = self.driver.find_elements( + By.XPATH, + '//div[@id="latest-builds"]/div' + ) + self.assertTrue(len(lastest_builds) > 0) From patchwork Tue Nov 21 13:51:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 34974 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 5A09EC61D92 for ; Tue, 21 Nov 2023 13:51:50 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web11.40883.1700574703874305353 for ; Tue, 21 Nov 2023 05:51:44 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=s8v9/AhG; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 325729C36BA for ; Tue, 21 Nov 2023 08:51:43 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id qNV0aPry82I9; Tue, 21 Nov 2023 08:51:42 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 5C56C9C3756; Tue, 21 Nov 2023 08:51:42 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 5C56C9C3756 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1700574702; bh=XFp2Aw4VEZK5wuJU830kvVCbytU6doqvSFaKcSnUNrY=; h=From:To:Date:Message-Id:MIME-Version; b=s8v9/AhGQTH6Ts27HSaH4lZM5xay6m33MRo8pHghpLmEFEukLWqyl3LDrnHS613WH mwBYPUkhymVlHjLAkacLAlV/xryJDRA4lle0Gq2frOPS+VeR18JBy4XKAQLxGIT4H/ X1jklAK7nAS///0xhtFavyKTvFs3dov59+SdwWit/uqbyzfus6yFvudRCU3Oe2ZPSy JeNoQOPviLfdH14TNSGaNB1sBG5q08XIO9pBKQlO9rqUHi/jY3Tpwso6yD3SsRGGbf 7zfkJFlGnuWM8Q1Fx2nCXdY0Py6N8AsOYc0xOtxcHaEXKO6YwHrc5b0pm67Xhs63o2 p4FK/Af3PEDZA== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id 0QRi6-swYRuk; Tue, 21 Nov 2023 08:51:42 -0500 (EST) Received: from jedi.. (unknown [196.127.183.75]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 966409C36B9; Tue, 21 Nov 2023 08:51:41 -0500 (EST) From: Alassane Yattara To: bitbake-devel@lists.openembedded.org Cc: Alassane Yattara Subject: [PATCH 6/7] Toaster: Write UI TestCase -> the edit column feature in image recipe Date: Tue, 21 Nov 2023 14:51:30 +0100 Message-Id: <20231121135131.107330-6-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231121135131.107330-1-alassane.yattara@savoirfairelinux.com> References: <20231121135131.107330-1-alassane.yattara@savoirfairelinux.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 Nov 2023 13:51:50 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15557 BUILD IMAGE RECIPES: toastergui/project/{id}/images/ Test the edit column feature in image recipe table on project page Signed-off-by: Alassane Yattara --- .../test_project_page_tab_config.py | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) 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 598a8055..2dfc120d 100644 --- a/lib/toaster/tests/functional/test_project_page_tab_config.py +++ b/lib/toaster/tests/functional/test_project_page_tab_config.py @@ -8,10 +8,12 @@ from time import sleep import pytest +from django.utils import timezone from django.urls import reverse from selenium.webdriver import Keys from selenium.webdriver.support.select import Select from selenium.common.exceptions import NoSuchElementException +from orm.models import Build, Project, Target from tests.functional.functional_helpers import SeleniumFunctionalTestCase from selenium.webdriver.common.by import By @@ -112,6 +114,64 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase): config_nav = self.find('#config-nav') return config_nav.find_elements(By.TAG_NAME, 'li')[index] + def _get_create_builds(self, **kwargs): + """ Create a build and return the build object """ + # parameters for builds to associate with the projects + now = timezone.now() + release = '3' + project_name = 'projectmaster' + self._create_test_new_project( + project_name+"2", + release, + False, + ) + + self.project1_build_success = { + 'project': Project.objects.get(id=1), + 'started_on': now, + 'completed_on': now, + 'outcome': Build.SUCCEEDED + } + + self.project1_build_failure = { + 'project': Project.objects.get(id=1), + 'started_on': now, + 'completed_on': now, + 'outcome': Build.FAILED + } + build1 = Build.objects.create(**self.project1_build_success) + build2 = Build.objects.create(**self.project1_build_failure) + + # add some targets to these builds so they have recipe links + # (and so we can find the row in the ToasterTable corresponding to + # a particular build) + Target.objects.create(build=build1, target='foo') + Target.objects.create(build=build2, target='bar') + + if kwargs: + # Create kwargs.get('success') builds with success status with target + # and kwargs.get('failure') builds with failure status with target + for i in range(kwargs.get('success', 0)): + now = timezone.now() + self.project1_build_success['started_on'] = now + self.project1_build_success[ + 'completed_on'] = now - timezone.timedelta(days=i) + build = Build.objects.create(**self.project1_build_success) + Target.objects.create(build=build, + target=f'{i}_success_recipe', + task=f'{i}_success_task') + + for i in range(kwargs.get('failure', 0)): + now = timezone.now() + self.project1_build_failure['started_on'] = now + self.project1_build_failure[ + 'completed_on'] = now - timezone.timedelta(days=i) + build = Build.objects.create(**self.project1_build_failure) + Target.objects.create(build=build, + target=f'{i}_fail_recipe', + task=f'{i}_fail_task') + return build1, build2 + def test_project_config_nav(self): """ Test project config tab navigation: - Check if the menu is displayed and contains the right elements: @@ -421,3 +481,64 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase): '//div[@id="latest-builds"]/div' ) self.assertTrue(len(lastest_builds) > 0) + + 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) + + def test_edit_column(check_box_id): + # Check that we can hide/show table column + check_box = self.find(f'#{check_box_id}') + th_class = str(check_box_id).replace('checkbox-', '') + if check_box.is_selected(): + # check if column is visible in table + self.assertTrue( + self.find( + f'#imagerecipestable thead th.{th_class}' + ).is_displayed(), + f"The {th_class} column is checked in EditColumn dropdown, but it's not visible in table" + ) + check_box.click() + # check if column is hidden in table + self.assertFalse( + self.find( + f'#imagerecipestable thead th.{th_class}' + ).is_displayed(), + f"The {th_class} column is unchecked in EditColumn dropdown, but it's visible in table" + ) + else: + # check if column is hidden in table + self.assertFalse( + self.find( + f'#imagerecipestable thead th.{th_class}' + ).is_displayed(), + f"The {th_class} column is unchecked in EditColumn dropdown, but it's visible in table" + ) + check_box.click() + # check if column is visible in table + self.assertTrue( + self.find( + f'#imagerecipestable thead th.{th_class}' + ).is_displayed(), + f"The {th_class} column is checked in EditColumn dropdown, but it's not visible in table" + ) + + url = reverse('projectimagerecipes', args=(1,)) + self.get(url) + self.wait_until_present('#imagerecipestable tbody tr') + + # Check edit column + edit_column = self.find('#edit-columns-button') + self.assertTrue(edit_column.is_displayed()) + edit_column.click() + # Check dropdown is visible + self.wait_until_visible('ul.dropdown-menu.editcol') + + # Check that we can hide the edit column + test_edit_column('checkbox-get_description_or_summary') + test_edit_column('checkbox-layer_version__get_vcs_reference') + test_edit_column('checkbox-layer_version__layer__name') + test_edit_column('checkbox-license') + test_edit_column('checkbox-recipe-file') + test_edit_column('checkbox-section') + test_edit_column('checkbox-version') From patchwork Tue Nov 21 13:51:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 34973 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 6160CC61D97 for ; Tue, 21 Nov 2023 13:51:50 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web10.40853.1700574704768404257 for ; Tue, 21 Nov 2023 05:51:44 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=nlurBQdh; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 1BEF39C36A3 for ; Tue, 21 Nov 2023 08:51:44 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id t72skQL_SxTe; Tue, 21 Nov 2023 08:51:43 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 937F49C3673; Tue, 21 Nov 2023 08:51:43 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 937F49C3673 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1700574703; bh=A8MHLGVnvqtQ9Zx2XwD5LNYAiQhk68G8NOHXHI5pMDI=; h=From:To:Date:Message-Id:MIME-Version; b=nlurBQdhagQqabh550lrMC3G7mLIWDzDwzjlVcPHkBOyQVptu1hJY3skywwPEAdmF Gm9TDLpI3LiboZSrcNJ2dezQS/1M5xmX3H9ouYUFqMKNMc1SBdP1+3RRDxsDMZ/zyx /l9M4MCq7GWIr2qQhBV/TDkZlm9n8ELzs21xQBvm7QIxQsjBRVNZRS6iwTcLoBMFuT NoWdrXhjhA5+whS/r2kPyvoqfYaYtSYJYVgtb+OEKszz7fKkiMAdjXBYDY4bhblGdj DdvIy/9D+SYsc5pcEavXG3CMpB2+Sy8HQutNTNluFZkpSlavZBDxRGS4ZzHEOQ2yW3 8+TYj2SkHP+Eg== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id 2jn8mDhaOkfK; Tue, 21 Nov 2023 08:51:43 -0500 (EST) Received: from jedi.. (unknown [196.127.183.75]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id B4F0F9C3752; Tue, 21 Nov 2023 08:51:42 -0500 (EST) From: Alassane Yattara To: bitbake-devel@lists.openembedded.org Cc: Alassane Yattara Subject: [PATCH 7/7] Toaster: Write UI TestCase -> Test the show rows feature in image recipe Date: Tue, 21 Nov 2023 14:51:31 +0100 Message-Id: <20231121135131.107330-7-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231121135131.107330-1-alassane.yattara@savoirfairelinux.com> References: <20231121135131.107330-1-alassane.yattara@savoirfairelinux.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 Nov 2023 13:51:50 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15558 Test the show rows feature in image recipe table on project page Signed-off-by: Alassane Yattara --- .../test_project_page_tab_config.py | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) 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 2dfc120d..23012d78 100644 --- a/lib/toaster/tests/functional/test_project_page_tab_config.py +++ b/lib/toaster/tests/functional/test_project_page_tab_config.py @@ -347,7 +347,10 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase): By.XPATH, '//*[@id="project-page"]/div[1]/div[3]') recipe_list = most_built_recipes.find_element(By.ID, 'freq-build-list') recipe_list_items = recipe_list.find_elements(By.TAG_NAME, 'li') - self.assertTrue(len(recipe_list_items) > 0) + self.assertTrue( + len(recipe_list_items) > 0, + msg="No recipes found in the most built recipes list", + ) checkbox = recipe_list_items[0].find_element(By.TAG_NAME, 'input') checkbox.click() build_btn = self.find('#freq-build-btn') @@ -465,6 +468,7 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase): recipe_input = self.find('#search-input-imagerecipestable') recipe_input.send_keys('core-image-minimal') self.find('#search-submit-imagerecipestable').click() + self.wait_until_visible('#imagerecipestable tbody tr') rows = self.find_all('#imagerecipestable tbody tr') self.assertTrue(len(rows) > 0) @@ -542,3 +546,33 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase): test_edit_column('checkbox-recipe-file') test_edit_column('checkbox-section') test_edit_column('checkbox-version') + + def test_image_recipe_show_rows(self): + """ Test the show rows feature in image recipe table on project page """ + self._get_create_builds(success=100, failure=100) + + 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_present('#imagerecipestable tbody tr') + sleep(1) + self.assertTrue( + len(self.find_all('#imagerecipestable tbody tr')) == row_to_show + ) + + url = reverse('projectimagerecipes', args=(2,)) + self.get(url) + self.wait_until_present('#imagerecipestable tbody tr') + + show_rows = self.driver.find_elements( + By.XPATH, + '//select[@class="form-control pagesize-imagerecipestable"]' + ) + # Check show rows + for show_row_link in show_rows: + show_row_link = Select(show_row_link) + test_show_rows(10, show_row_link) + test_show_rows(25, show_row_link) + test_show_rows(50, show_row_link) + test_show_rows(100, show_row_link) + test_show_rows(150, show_row_link)