From d69daf4a50e8535d14f0469a2b61595ed6db48f3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 22 Aug 2022 14:41:26 +0530 Subject: [PATCH 01/18] Fixing locator for login page footer (#738) (#739) Co-authored-by: Adarsh dubey --- airgun/views/login.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/airgun/views/login.py b/airgun/views/login.py index a5bc341ff..1422f6780 100644 --- a/airgun/views/login.py +++ b/airgun/views/login.py @@ -7,10 +7,9 @@ class LoginView(View, ClickableMixin): username = TextInput(id="login_login") password = TextInput(id="login_password") - login_text = Text('//*[@id="login-footer-text"]') + login_text = Text(".//footer[contains(@class,'login-pf-page-footer')]") logo = Text('//img[@alt="logo"]') submit = Text('//button[@type="submit"]') - version = Text('//*[@id="version"]') @property def is_displayed(self): From 8e9b4563d816064baca48d454348d9ef231c538f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 7 Sep 2022 12:08:25 +0530 Subject: [PATCH 02/18] replace find_element_by_xpath with find_element (#744) (#747) Co-authored-by: Peter Dragun <43444182+peterdragun@users.noreply.github.com> --- airgun/widgets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airgun/widgets.py b/airgun/widgets.py index 7468eab33..ed43d9bc6 100644 --- a/airgun/widgets.py +++ b/airgun/widgets.py @@ -2347,7 +2347,7 @@ def item_select(self, items, close=True): try: for item in items: element = self.item_element(item, close=False) - if not element.find_element_by_xpath("./..").get_attribute('aria-selected'): + if not element.find_element("xpath", "./..").get_attribute('aria-selected'): element.click() finally: self.browser.click(self.BUTTON_LOCATOR) From 98e3d834de92966aa92f4565d72b3eeddd0b8054 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 14 Sep 2022 17:11:11 +0530 Subject: [PATCH 03/18] Ensure cockpit page is safe before locating elements (#743) (#750) * ensure cockpit page is safe before locating elements * find_elements fix Co-authored-by: Peter Dragun <43444182+peterdragun@users.noreply.github.com> --- airgun/entities/host.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/airgun/entities/host.py b/airgun/entities/host.py index 44dde66c3..84f7f982b 100644 --- a/airgun/entities/host.py +++ b/airgun/entities/host.py @@ -258,6 +258,7 @@ def get_webconsole_content(self, entity_name, rhel_version=7): # switch to the last opened tab, self.browser.switch_to_window(self.browser.window_handles[-1]) + self.browser.plugin.ensure_page_safe() self.browser.wait_for_element(locator='//div[@id="content"]/iframe', exception=True) # the remote host content is loaded in an iframe, let's switch to it self.browser.switch_to_frame(locator='//div[@id="content"]/iframe') @@ -265,8 +266,8 @@ def get_webconsole_content(self, entity_name, rhel_version=7): self.browser.wait_for_element( locator=f'//{hostname_element}[@id="{hostname_id}"]', exception=True, visible=True ) - hostname_button_view = self.browser.selenium.find_elements_by_id(hostname_id) - hostname = hostname_button_view[0].text + hostname_button = self.browser.selenium.find_elements("id", hostname_id) + hostname = hostname_button[0].text self.browser.switch_to_main_frame() self.browser.switch_to_window(self.browser.window_handles[0]) self.browser.close_window(self.browser.window_handles[-1]) From 57fce1cfdc5dd83d382695f8054b7ff1c243e0e1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 20 Sep 2022 13:39:10 +0100 Subject: [PATCH 04/18] fixing the locator for logout page rhsso (#757) (#759) Co-authored-by: Omkar Khatavkar --- airgun/views/rhsso_login.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airgun/views/rhsso_login.py b/airgun/views/rhsso_login.py index 7b56ef4e9..be1fbb67a 100644 --- a/airgun/views/rhsso_login.py +++ b/airgun/views/rhsso_login.py @@ -16,7 +16,7 @@ def is_displayed(self): class RhssoExternalLogoutView(View, ClickableMixin): login_again = Text('//a[@href="/users/extlogin"]') - logo = Text('//img[@alt="logo') + logo = Text('//img[@alt="logo"]') @property def is_displayed(self): From d6b67e0b2cc93f3f85964332a7bebe562788f314 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 23 Sep 2022 10:06:21 +0530 Subject: [PATCH 05/18] Remove publish via http field since it's not longer valid (#762) (#764) Co-authored-by: Lai Tran --- airgun/views/repository.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/airgun/views/repository.py b/airgun/views/repository.py index 758253bc2..a23f25313 100644 --- a/airgun/views/repository.py +++ b/airgun/views/repository.py @@ -202,7 +202,6 @@ class DockerRepository(View): repo_name = ReadOnlyEntry(name='Name') verify_ssl = EditableEntryCheckbox(name='Verify SSL') upstream_authorization = AuthorizationEntry(name='Upstream Authorization') - publish_via_http = EditableEntryCheckbox(name='Publish via HTTP') http_proxy_policy = EditableEntrySelect(name='HTTP Proxy') proxy_policy = ConditionalSwitchableView(reference='http_proxy_policy') mirroring_policy = EditableEntrySelect(name='Mirroring Policy') @@ -224,7 +223,6 @@ class YumRepository(View): retain_package_versions = EditableEntry(name='Retain package versions') http_proxy_policy = EditableEntrySelect(name='HTTP Proxy') ignore_srpms = EditableEntryCheckbox(name='Ignore SRPMs') - publish_via_http = EditableEntryCheckbox(name='Publish via HTTP') unprotected = EditableEntryCheckbox(name='Unprotected') gpg_key = EditableEntrySelect(name='GPG Key') download_policy = EditableEntrySelect(name='Download Policy') @@ -244,7 +242,6 @@ class AnsibleCollectionRepository(View): requirements = EditableEntry(name='Requirements') verify_ssl = EditableEntryCheckbox(name='Verify SSL') upstream_authorization = AuthorizationEntry(name='Upstream Authorization') - publish_via_http = EditableEntryCheckbox(name='Publish via HTTP') upload_content = FileInput(name='content[]') upload = Text("//button[contains(., 'Upload')]") http_proxy_policy = EditableEntrySelect(name='HTTP Proxy') @@ -260,7 +257,6 @@ class OstreeRepository(View): upstream_url = EditableEntry(name='Upstream URL') verify_ssl = EditableEntryCheckbox(name='Verify SSL') upstream_authorization = AuthorizationEntry(name='Upstream Authorization') - publish_via_https = ReadOnlyEntry(name='Publish via HTTPS') published_at = ReadOnlyEntry(name='Published At') http_proxy_policy = EditableEntrySelect(name='HTTP Proxy') proxy_policy = ConditionalSwitchableView(reference='http_proxy_policy') @@ -274,7 +270,6 @@ class FileRepository(View): upstream_url = EditableEntry(name='Upstream URL') verify_ssl = EditableEntryCheckbox(name='Verify SSL') upstream_authorization = AuthorizationEntry(name='Upstream Authorization') - publish_via_http = EditableEntryCheckbox(name='Publish via HTTP') unprotected = EditableEntryCheckbox(name='Unprotected') mirroring_policy = EditableEntrySelect(name='Mirroring Policy') From 9ce054436df953728aaacb31177c8a35a1e16f43 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 3 Oct 2022 12:34:14 +0530 Subject: [PATCH 06/18] Locator fix for errata (#754) (#760) Co-authored-by: Adarsh dubey --- airgun/views/contenthost.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/airgun/views/contenthost.py b/airgun/views/contenthost.py index 43b2b184a..9dc2a298a 100644 --- a/airgun/views/contenthost.py +++ b/airgun/views/contenthost.py @@ -89,8 +89,6 @@ class errata(View): bug_fix = Text(".//span[contains(@ng-class, 'errataCounts.bugfix')]") enhancement = Text(".//span[contains(@ng-class, 'errataCounts.enhancement')]") - packages = Text("./a[contains(@ui-sref, 'packages.applicable')]") - class ContentHostsView(BaseLoggedInView, SearchableViewMixin): title = Text("//h2[contains(., 'Content Hosts')]") @@ -236,7 +234,7 @@ class packages_applicable(SatTabWithDropdown, SearchableViewMixin): class errata(SatTab): lce_filter = Select(locator='.//select[@ng-model="selectedErrataOption"]') searchbox = Search() - apply_selected = ActionsDropdown(".//span[contains(@class, 'btn-group')]") + apply_selected = ActionsDropdown(".//span[contains(@class, 'btn-group dropdown')]") recalculate = Button('Recalculate') table = SatTable( './/table', From c4536387ef0df21eebd601e432b36e93210419e1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 7 Oct 2022 12:27:34 +0530 Subject: [PATCH 07/18] updating the airgun autocherrypick n-1 version as robottelo (#753) Co-authored-by: omkarkhatavkar --- .github/workflows/auto_cherry_pick.yml | 27 ++++++++++++-------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/.github/workflows/auto_cherry_pick.yml b/.github/workflows/auto_cherry_pick.yml index a5de439ce..b173f675c 100644 --- a/.github/workflows/auto_cherry_pick.yml +++ b/.github/workflows/auto_cherry_pick.yml @@ -7,37 +7,34 @@ on: - closed jobs: - branch-matrix: + previous-branch: if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'CherryPick') - name: Generate a branch matrix to apply cherrypicks + name: Calculate previous branch name runs-on: ubuntu-latest outputs: - branches: ${{ steps.set-matrix.outputs.branches }} + previous_branch: ${{ steps.set-branch.outputs.previous_branch }} steps: - uses: actions/checkout@v3 with: fetch-depth: 0 - - id: set-matrix - run: echo "::set-output name=branches::$(git branch -rl --sort=-authordate 'origin/6.*.z' --format='%(refname:lstrip=-1)' | head -n2 | jq -cnR '[inputs | select(length>0)]')" - auto_cherry_picking: + - id: set-branch + run: echo "::set-output name=previous_branch::$(if [ $GITHUB_BASE_REF == 'master' ]; then echo $(git branch -rl 'origin/6.*.z' --format='%(refname:lstrip=-1)' | sort --version-sort | tail -n1 | jq -cnR '[inputs | select(length>0)]'); else echo ['"6.'$(($(echo $GITHUB_BASE_REF | cut -d. -f2) - 1))'.z"']; fi)" + + auto-cherry-pick: + name: Auto Cherry Pick to previous branch if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'CherryPick') - name: Auto Cherry picking - needs: branch-matrix + needs: previous-branch runs-on: ubuntu-latest strategy: matrix: - to_branch: ${{ fromJson(needs.branch-matrix.outputs.branches) }} + to_branch: ${{ fromJson(needs.previous-branch.outputs.previous_branch) }} steps: - - name: Checkout Airgun - uses: actions/checkout@v3 + - uses: actions/checkout@v3 with: fetch-depth: 0 - if: matrix.to_branch != github.base_ref - name: Cherry pick into ${{ matrix.to_branch }} - uses: carloscastrojumo/github-cherry-pick-action@v1.0.2 + uses: jyejare/github-cherry-pick-action@main with: branch: ${{ matrix.to_branch }} labels: | Auto_Cherry_Picked - # skipping PRs remote target_branch from cherrypicking into itself - if: matrix.to_branch != github.base_ref From a64596ef489dfc923687df0cc7985a9b2a2e8f5b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 31 Oct 2022 16:17:55 +0530 Subject: [PATCH 08/18] added the support for the clone hostgroup (#773) (#777) Co-authored-by: Omkar Khatavkar --- airgun/entities/hostgroup.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/airgun/entities/hostgroup.py b/airgun/entities/hostgroup.py index a8bd384a6..6bbcef9fd 100644 --- a/airgun/entities/hostgroup.py +++ b/airgun/entities/hostgroup.py @@ -21,6 +21,17 @@ def create(self, values): view.flash.assert_no_error() view.flash.dismiss() + def clone(self, entity_name, values): + """Clone an existing host group entity""" + view = self.navigate_to(self, 'All') + view.search(entity_name) + view.table.row(name=entity_name)['Actions'].widget.fill('Clone') + view = HostGroupCreateView(self.browser) + view.fill(values) + view.submit.click() + view.flash.assert_no_error() + view.flash.dismiss() + def search(self, value): """Search for existing host group entity""" view = self.navigate_to(self, 'All') From b07cea2265ec0bdb0f6dab669312096da8595212 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 31 Oct 2022 18:28:15 +0530 Subject: [PATCH 09/18] Remove environment locator (#776) Fix Typo Co-authored-by: Shubham Ganar --- airgun/views/provisioning_template.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/airgun/views/provisioning_template.py b/airgun/views/provisioning_template.py index c66d9abdf..b368138d1 100644 --- a/airgun/views/provisioning_template.py +++ b/airgun/views/provisioning_template.py @@ -24,7 +24,6 @@ class TemplateHostEnvironmentAssociation(GenericRemovableWidgetItem): remove_button = Text(".//a[@title='Remove Combination']") host_group = Select(locator=".//select[contains(@name, '[hostgroup_id]')]") - environment = Select(locator=".//select[contains(@name, '[environment_id]')]") class ProvisioningTemplatesView(BaseLoggedInView, SearchableViewMixin): @@ -81,7 +80,7 @@ class association(SatTab): applicable_os = MultiSelect(id='ms-provisioning_template_operatingsystem_ids') @View.nested - class hg_environment_combination(RemovableWidgetsItemsListView): + class valid_hostgroups(RemovableWidgetsItemsListView): ROOT = "//div[@id='association']" ITEMS = ".//fieldset[@id='template_combination']/div" ITEM_WIDGET_CLASS = TemplateHostEnvironmentAssociation From 4cf261418a6abd9909217760448c581ed6832f29 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 4 Nov 2022 12:42:29 +0530 Subject: [PATCH 10/18] Uncommenting select_all_hits (#771) (#779) Signed-off-by: Adarsh Dubey Signed-off-by: Adarsh Dubey Signed-off-by: Adarsh Dubey Co-authored-by: Adarsh dubey --- airgun/entities/cloud_insights.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airgun/entities/cloud_insights.py b/airgun/entities/cloud_insights.py index a0e6785da..d997da3be 100644 --- a/airgun/entities/cloud_insights.py +++ b/airgun/entities/cloud_insights.py @@ -23,7 +23,7 @@ def remediate(self, entity_name): view = self.navigate_to(self, 'All') view.search(entity_name) view.select_all.fill(True) - # view.select_all_hits.click() skip till BZ#1975321 is fixed. + view.select_all_hits.click() view.remediate.click() view.remediation_window.remediate.click() self.run_job() From 4fec8154680a6782356391642b97777510a35b51 Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Wed, 16 Nov 2022 06:01:07 -0500 Subject: [PATCH 11/18] Alligning ACP GHA with Robottelo (#780) (#782) Co-authored-by: Jitendra Yejare --- .github/auto_assign.yml | 1 + .github/workflows/auto_assignment.yaml | 21 ++++++++++++ .github/workflows/auto_cherry_pick.yml | 46 ++++++++++++++++++++++---- 3 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 .github/auto_assign.yml create mode 100644 .github/workflows/auto_assignment.yaml diff --git a/.github/auto_assign.yml b/.github/auto_assign.yml new file mode 100644 index 000000000..717af2a0c --- /dev/null +++ b/.github/auto_assign.yml @@ -0,0 +1 @@ +addAssignees: author diff --git a/.github/workflows/auto_assignment.yaml b/.github/workflows/auto_assignment.yaml new file mode 100644 index 000000000..328e4bf6f --- /dev/null +++ b/.github/workflows/auto_assignment.yaml @@ -0,0 +1,21 @@ +name: 'Auto Assign' + +on: + pull_request_target: + types: + - opened + - ready_for_review + - reopened + - synchronize + + +jobs: + add-assignees: # This needed to create the gh issue in case of failed auto-cherry-pick + name: Add author to assignee + if: "!contains(github.event.pull_request.labels.*.name, 'Auto_Cherry_Picked')" + runs-on: ubuntu-latest + steps: + - uses: kentaro-m/auto-assign-action@v1.2.4 + with: + repo-token: "${{ secrets.CHERRYPICK_PAT || github.token }}" + configuration-path: ".github/auto_assign.yml" diff --git a/.github/workflows/auto_cherry_pick.yml b/.github/workflows/auto_cherry_pick.yml index b173f675c..cdb3ecbe7 100644 --- a/.github/workflows/auto_cherry_pick.yml +++ b/.github/workflows/auto_cherry_pick.yml @@ -18,23 +18,57 @@ jobs: with: fetch-depth: 0 - id: set-branch - run: echo "::set-output name=previous_branch::$(if [ $GITHUB_BASE_REF == 'master' ]; then echo $(git branch -rl 'origin/6.*.z' --format='%(refname:lstrip=-1)' | sort --version-sort | tail -n1 | jq -cnR '[inputs | select(length>0)]'); else echo ['"6.'$(($(echo $GITHUB_BASE_REF | cut -d. -f2) - 1))'.z"']; fi)" + run: echo "previous_branch=$(if [ $GITHUB_BASE_REF == 'master' ]; then echo $(git branch -rl 'origin/6.*.z' --format='%(refname:lstrip=-1)' | sort --version-sort | tail -n1); else echo '6.'$(($(echo $GITHUB_BASE_REF | cut -d. -f2) - 1))'.z'; fi)" >> $GITHUB_OUTPUT auto-cherry-pick: name: Auto Cherry Pick to previous branch if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'CherryPick') needs: previous-branch runs-on: ubuntu-latest - strategy: - matrix: - to_branch: ${{ fromJson(needs.previous-branch.outputs.previous_branch) }} + env: + TO_BRANCH: ${{ needs.previous-branch.outputs.previous_branch }} steps: - uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Cherry pick into ${{ matrix.to_branch }} + - name: Cherry pick into ${{ env.TO_BRANCH }} uses: jyejare/github-cherry-pick-action@main with: - branch: ${{ matrix.to_branch }} + token: ${{ secrets.CHERRYPICK_PAT }} + branch: ${{ env.TO_BRANCH }} labels: | Auto_Cherry_Picked + ${{ env.TO_BRANCH }} + assignees: "${{ github.event.pull_request.assignee.login }}" + + create-issue: + runs-on: ubuntu-latest + if: ${{ always() && contains(join(needs.*.result, ','), 'failure') }} + needs: [previous-branch, auto-cherry-pick] + env: + TO_BRANCH: ${{ needs.previous-branch.outputs.previous_branch }} + steps: + - name: Create Issue on Failed Auto Cherrypick + uses: dacbd/create-issue-action@main + with: + token: ${{ secrets.CHERRYPICK_PAT }} + title: "[Failed-AutoCherryPick] - ${{ github.event.pull_request.title }}" + body: | + #### Auto-Cherry-Pick WorkFlow Failure: + - To Branch: ${{ env.TO_BRANCH }} + - [Failed Cherrypick Action](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) + - [Parent Pull Request](https://github.com/${{ github.repository }}/pull/${{ github.event.number }}) + labels: Failed_AutoCherryPick,${{ env.TO_BRANCH }} + assignees: "${{ github.event.pull_request.assignee.login }}" + + google-chat-notification: + runs-on: ubuntu-latest + if: ${{ always() && contains(join(needs.*.result, ','), 'failure') }} + needs: auto-cherry-pick + steps: + - name: Google Chat Notification - Airgun + uses: Co-qn/google-chat-notification@releases/v1 + with: + name: "${{ github.event.pull_request.title }}" + url: ${{ secrets.GCHAT_REVIEWERS_WEBHOOK }} + status: failure From 9995d7a5e5cadf99ae5176e6750b8e04d5733fd3 Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Thu, 24 Nov 2022 03:58:11 -0500 Subject: [PATCH 12/18] Switch classifiers from a tuple to a list (#784) (#785) * Switch classifiers from a tuple to a list Recommended by @abravalheri in https://github.com/pypa/setuptools/issues/3707#issuecomment-1325605870 * Fix github URL for pycqa/flake8 precommit hook Co-authored-by: jyejare (cherry picked from commit 8012321f79955301f6cf42d4cb8c3d4617f0e215) Co-authored-by: Jake Callahan --- .pre-commit-config.yaml | 2 +- setup.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c482f053e..ed9dbb968 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,7 @@ repos: rev: 22.3.0 hooks: - id: black -- repo: https://gitlab.com/pycqa/flake8 +- repo: https://github.com/pycqa/flake8 rev: 3.9.2 hooks: - id: flake8 diff --git a/setup.py b/setup.py index 5d2e147db..51995ecb1 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ include_package_data=True, license='GNU GPL v3.0', # See https://pypi.python.org/pypi?%3Aaction=list_classifiers - classifiers=( + classifiers=[ 'Development Status :: 1 - Planning', 'Intended Audience :: Developers', 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', @@ -42,5 +42,5 @@ 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', - ), + ], ) From a801fae4dc488b358d6e8d905238283271cf55a2 Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Mon, 5 Dec 2022 09:18:42 -0500 Subject: [PATCH 13/18] Fixes for Robottelo Role/Variable UI tests (#775) (#786) * Fixes for Robottelo Role/Variable UI tests * Fix pagination widget to be visible to is_displayed again * Fix more locators for Pagination widget * Update airgun/widgets.py Co-authored-by: synkd <48261305+synkd@users.noreply.github.com> * Update airgun/widgets.py Co-authored-by: synkd <48261305+synkd@users.noreply.github.com> Co-authored-by: synkd <48261305+synkd@users.noreply.github.com> (cherry picked from commit da1343154d0080db926e07db8ba93db4afac9d70) Co-authored-by: Samuel Bible --- airgun/views/ansible_role.py | 6 +++--- airgun/views/ansible_variable.py | 2 +- airgun/widgets.py | 18 +++++++++--------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/airgun/views/ansible_role.py b/airgun/views/ansible_role.py index 0f281fee2..e5d240bac 100644 --- a/airgun/views/ansible_role.py +++ b/airgun/views/ansible_role.py @@ -21,10 +21,10 @@ class AnsibleRolesView(BaseLoggedInView, SearchableViewMixin): is present, without the search widget or table. """ - title = Text("//h1[contains(., text()='Ansible Roles')") + title = Text("//h1") import_button = Text("//a[contains(@href, '/ansible_roles/import')]") submit = Button('Submit') - total_imported_roles = Text(".//span[contains(@class, 'pagination-pf-items-total')]") + total_imported_roles = Text("//span[@class='pf-c-options-menu__toggle-text']/b[2]") table = Table( './/table', column_widgets={ @@ -42,7 +42,7 @@ class AnsibleRolesImportView(BaseLoggedInView): """View while selecting Ansible roles to import.""" breadcrumb = BreadCrumb() - total_available_roles = Text("//div[@class='pf-c-pagination__total-items']/b[2]") + total_available_roles = Text("//span[@class='pf-c-options-menu__toggle-text']/b[2]") select_all = Checkbox(locator="//input[@id='select-all']") table = PatternflyTable( component_id='OUIA-Generated-Table-2', diff --git a/airgun/views/ansible_variable.py b/airgun/views/ansible_variable.py index 73dfdb4cc..dd0100f44 100644 --- a/airgun/views/ansible_variable.py +++ b/airgun/views/ansible_variable.py @@ -19,7 +19,7 @@ class AnsibleVariablesView(BaseLoggedInView, SearchableViewMixin): title = Text("//h1[contains(., text()='Ansible Variables')") new_variable = Text("//a[contains(@href, '/ansible/ansible_variables/new')]") - total_variables = Text(".//span[@class='pagination-pf-items-total']") + total_variables = Text("//span[@class='pf-c-options-menu__toggle-text']/b[2]") table = SatTable( './/table', column_widgets={ diff --git a/airgun/widgets.py b/airgun/widgets.py index ed43d9bc6..3ca0c2773 100644 --- a/airgun/widgets.py +++ b/airgun/widgets.py @@ -1517,17 +1517,17 @@ class Pagination(Widget): and current page index/overall amount of pages. Mainly used with Table widget. """ - ROOT = ".//form[contains(@class, 'content-view-pf-pagination')]" + ROOT = ".//foreman-react-component[contains(@name, 'Pagination')]" # Kattelo views use per_page with select, foreman use a per_page with Button DropDown. - PER_PAGE_BUTTON_DROPDOWN = ".//div[button[@id='pagination-row-dropdown']]" + PER_PAGE_BUTTON_DROPDOWN = ".//div[button[@id='paginationoptions-menu-toggle-3']]" PER_PAGE_SELECT = ".//select[contains(@ng-model, 'per_page')]" - first_page_button = Text(".//li[a[span[contains(@class, 'angle-double-left')]]]") - previous_page_button = Text(".//li[a[span[contains(@class, 'angle-left')]]]") - next_page_button = Text(".//li[a[span[contains(@class, 'angle-right')]]]") - last_page_button = Text(".//li[a[span[contains(@class, 'angle-double-right')]]]") - page = TextInput(locator=".//input[contains(@class, 'pagination-pf-page')]") - pages = Text(".//span[contains(@class, 'pagination-pf-pages')]") - total_items = Text(".//span[contains(@class, 'pagination-pf-items-total')]") + first_page_button = Button(".//div[button[@data-action='first']]") + previous_page_button = Button(".//div[button[@data-action='previous']]") + next_page_button = Button(".//div[button[@data-action='next']]") + last_page_button = Button(".//div[button[@data-action='last']]") + page = TextInput(locator=".//input[contains(@class, 'pf-c-form-control')]") + pages = Text("//div[contains(@class, 'pf-c-pagination__nav-page-select')]//span") + total_items = Text(".//span[contains(@class, 'pf-c-options-menu__toggle-text')]/b[2]") @cached_property def per_page(self): From b0e61278c94be84aadf5a10e944662be1e7857fd Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Mon, 19 Dec 2022 01:50:17 -0500 Subject: [PATCH 14/18] Cherrypicking based on branch labels added to the parent PR (#788) (#793) (cherry picked from commit 6a2e121356b9fbfca5fce89cde48548b46d2000d) Co-authored-by: Jitendra Yejare --- .github/workflows/auto_cherry_pick.yml | 80 ++++++++++++-------------- 1 file changed, 38 insertions(+), 42 deletions(-) diff --git a/.github/workflows/auto_cherry_pick.yml b/.github/workflows/auto_cherry_pick.yml index cdb3ecbe7..2eddfdda0 100644 --- a/.github/workflows/auto_cherry_pick.yml +++ b/.github/workflows/auto_cherry_pick.yml @@ -6,69 +6,65 @@ on: types: - closed +# Github & Parent PR Env vars +env: + assignee: ${{ github.event.pull_request.assignee.login }} + title: ${{ github.event.pull_request.title }} + number: ${{ github.event.number }} + jobs: - previous-branch: - if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'CherryPick') - name: Calculate previous branch name - runs-on: ubuntu-latest - outputs: - previous_branch: ${{ steps.set-branch.outputs.previous_branch }} - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - id: set-branch - run: echo "previous_branch=$(if [ $GITHUB_BASE_REF == 'master' ]; then echo $(git branch -rl 'origin/6.*.z' --format='%(refname:lstrip=-1)' | sort --version-sort | tail -n1); else echo '6.'$(($(echo $GITHUB_BASE_REF | cut -d. -f2) - 1))'.z'; fi)" >> $GITHUB_OUTPUT + # Auto CherryPicking and Failure Recording auto-cherry-pick: - name: Auto Cherry Pick to previous branch if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'CherryPick') - needs: previous-branch + name: Auto Cherry Pick to labeled branches runs-on: ubuntu-latest - env: - TO_BRANCH: ${{ needs.previous-branch.outputs.previous_branch }} + strategy: + matrix: + label: ${{ github.event.pull_request.labels.*.name }} + steps: + ## Nailgun Repo Checkout - uses: actions/checkout@v3 + if: ${{ startsWith(matrix.label, '6.') && matrix.label != github.base_ref }} with: fetch-depth: 0 - - name: Cherry pick into ${{ env.TO_BRANCH }} + + ## CherryPicking and AutoMerging + - name: Cherrypicking to zStream branch + id: cherrypick + if: ${{ startsWith(matrix.label, '6.') && matrix.label != github.base_ref }} uses: jyejare/github-cherry-pick-action@main with: token: ${{ secrets.CHERRYPICK_PAT }} - branch: ${{ env.TO_BRANCH }} + branch: ${{ matrix.label }} labels: | Auto_Cherry_Picked - ${{ env.TO_BRANCH }} - assignees: "${{ github.event.pull_request.assignee.login }}" + ${{ matrix.label }} + assignees: ${{ env.assignee }} - create-issue: - runs-on: ubuntu-latest - if: ${{ always() && contains(join(needs.*.result, ','), 'failure') }} - needs: [previous-branch, auto-cherry-pick] - env: - TO_BRANCH: ${{ needs.previous-branch.outputs.previous_branch }} - steps: - - name: Create Issue on Failed Auto Cherrypick + ## Failure Logging to issues and GChat Group + - name: Create Github issue on cherrypick failure + id: create-issue + if: ${{ always() && steps.cherrypick.outcome == 'failure' }} uses: dacbd/create-issue-action@main with: token: ${{ secrets.CHERRYPICK_PAT }} - title: "[Failed-AutoCherryPick] - ${{ github.event.pull_request.title }}" + title: "[Failed-AutoCherryPick] - ${{ env.title }}" body: | #### Auto-Cherry-Pick WorkFlow Failure: - - To Branch: ${{ env.TO_BRANCH }} + - To Branch: ${{ matrix.label }} - [Failed Cherrypick Action](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - [Parent Pull Request](https://github.com/${{ github.repository }}/pull/${{ github.event.number }}) - labels: Failed_AutoCherryPick,${{ env.TO_BRANCH }} - assignees: "${{ github.event.pull_request.assignee.login }}" - - google-chat-notification: - runs-on: ubuntu-latest - if: ${{ always() && contains(join(needs.*.result, ','), 'failure') }} - needs: auto-cherry-pick - steps: - - name: Google Chat Notification - Airgun - uses: Co-qn/google-chat-notification@releases/v1 + - [Parent Pull Request](https://github.com/${{ github.repository }}/pull/${{ env.number }}) + labels: Failed_AutoCherryPick,${{ matrix.label }} + assignees: ${{ env.assignee }} + - name: Send Google Chat notification on cherrypick failure + id: google-chat-notification + if: ${{ always() && steps.cherrypick.outcome == 'failure' }} + uses: omkarkhatavkar/google-chat-notification@master with: - name: "${{ github.event.pull_request.title }}" + name: ${{ env.title }} url: ${{ secrets.GCHAT_REVIEWERS_WEBHOOK }} + issue_url: ${{ steps.create-issue.outputs.html_url }} + author: ${{ env.assignee }} status: failure From 4c9518b4b32495e2d3272c2643698b3196301919 Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Tue, 10 Jan 2023 08:55:54 -0500 Subject: [PATCH 15/18] No Cherrypick by default (#797) (#798) (cherry picked from commit 312131d94e4c0f8bf93242544e6e90134c674712) Co-authored-by: Jitendra Yejare --- .github/workflows/auto_cherry_pick.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/auto_cherry_pick.yml b/.github/workflows/auto_cherry_pick.yml index 2eddfdda0..e9dbfe008 100644 --- a/.github/workflows/auto_cherry_pick.yml +++ b/.github/workflows/auto_cherry_pick.yml @@ -40,6 +40,7 @@ jobs: branch: ${{ matrix.label }} labels: | Auto_Cherry_Picked + No-CherryPick ${{ matrix.label }} assignees: ${{ env.assignee }} From 6ea8098ac405b28db3f38e9408ba21d885720350 Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Tue, 7 Feb 2023 03:38:09 -0500 Subject: [PATCH 16/18] adding auto merge in airgun (#801) (#804) (cherry picked from commit 9fd8c97e7e39d2be3e4fe05cbac7d5cb3b51b242) Co-authored-by: Omkar Khatavkar --- .github/workflows/auto_cherry_pick.yml | 43 ++++++++- .github/workflows/automerge.yaml | 123 +++++++++++++++++++++++++ 2 files changed, 163 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/automerge.yaml diff --git a/.github/workflows/auto_cherry_pick.yml b/.github/workflows/auto_cherry_pick.yml index e9dbfe008..71fa08a02 100644 --- a/.github/workflows/auto_cherry_pick.yml +++ b/.github/workflows/auto_cherry_pick.yml @@ -14,17 +14,32 @@ env: jobs: + # Pre-Requisites for Auto Cherrypicking + find-the-parent-prt-comment: + name: Find & Save last PRT comment of Parent PR + runs-on: ubuntu-latest + outputs: + prt_comment: ${{steps.fc.outputs.comment-body}} + steps: + - name: Find Comment + uses: peter-evans/find-comment@v2 + id: fc + with: + issue-number: ${{ env.number }} + body-includes: "trigger: test-robottelo" + # Auto CherryPicking and Failure Recording auto-cherry-pick: if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'CherryPick') name: Auto Cherry Pick to labeled branches + needs: find-the-parent-prt-comment runs-on: ubuntu-latest strategy: matrix: label: ${{ github.event.pull_request.labels.*.name }} steps: - ## Nailgun Repo Checkout + ## Airgun Repo Checkout - uses: actions/checkout@v3 if: ${{ startsWith(matrix.label, '6.') && matrix.label != github.base_ref }} with: @@ -40,10 +55,32 @@ jobs: branch: ${{ matrix.label }} labels: | Auto_Cherry_Picked - No-CherryPick ${{ matrix.label }} + No-CherryPick assignees: ${{ env.assignee }} + - name: Add Parent PR's PRT comment to Auto_Cherry_Picked PR's + id: add-parent-prt-comment + if: ${{ always() && steps.cherrypick.outcome == 'success' }} + uses: mshick/add-pr-comment@v2 + with: + issue: ${{ steps.cherrypick.outputs.number }} + message: ${{ needs.find-the-parent-prt-comment.outputs.prt_comment }} + repo-token: ${{ secrets.CHERRYPICK_PAT }} + + - name: is autoMerging enabled for Auto CherryPicked PRs ? + if: ${{ always() && steps.cherrypick.outcome == 'success' && contains(github.event.pull_request.labels.*.name, 'AutoMerge_Cherry_Picked') }} + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.CHERRYPICK_PAT }} + script: | + github.rest.issues.addLabels({ + issue_number: ${{ steps.cherrypick.outputs.number }}, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ["AutoMerge_Cherry_Picked"] + }) + ## Failure Logging to issues and GChat Group - name: Create Github issue on cherrypick failure id: create-issue @@ -56,7 +93,7 @@ jobs: #### Auto-Cherry-Pick WorkFlow Failure: - To Branch: ${{ matrix.label }} - [Failed Cherrypick Action](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - [Parent Pull Request](https://github.com/${{ github.repository }}/pull/${{ env.number }}) + - [Parent Pull Request](https://github.com/${{ github.repository }}/pull/${{ github.event.number }}) labels: Failed_AutoCherryPick,${{ matrix.label }} assignees: ${{ env.assignee }} - name: Send Google Chat notification on cherrypick failure diff --git a/.github/workflows/automerge.yaml b/.github/workflows/automerge.yaml new file mode 100644 index 000000000..0e51739ee --- /dev/null +++ b/.github/workflows/automerge.yaml @@ -0,0 +1,123 @@ +name: automerge auto-cherry-picked pr's +on: + pull_request_target: + types: + - labeled + - unlabeled + - edited + - ready_for_review + branches-ignore: + - master + pull_request_review: + types: + - submitted + branches-ignore: + - master + check_suite: + types: + - completed + branches-ignore: + - master + + +jobs: + automerge: + name: Automerge auto-cherry-picked pr + if: contains(github.event.pull_request.labels.*.name, 'AutoMerge_Cherry_Picked') && contains(github.event.pull_request.labels.*.name, 'Auto_Cherry_Picked') + runs-on: ubuntu-latest + steps: + - id: find-prt-comment + name: Find the prt comment + uses: peter-evans/find-comment@v2 + with: + issue-number: ${{ github.event.number }} + body-includes: "trigger: test-robottelo" + direction: last + + - name: Fail automerge if PRT was not initiated + if: steps.find-prt-comment.outputs.comment-body == '' + run: | + echo "::error PRT comment not added the PR" + + - name: Wait for PRT checks to get initiated + run: | + echo "Waiting for ~ 10 mins, PRT to be initiated." && sleep 600 + + - name: Wait for other status checks to Pass + id: waitforstatuschecks + uses: lewagon/wait-on-check-action@v1.2.0 + with: + ref: ${{ github.head_ref }} + repo-token: ${{ secrets.CHERRYPICK_PAT }} + wait-interval: 60 + running-workflow-name: 'Automerge auto-cherry-picked pr' + allowed-conclusions: success,skipped + + - name: is PRT check Passed ? + run: | + api_endpoint="https://api.github.com/repos/${{github.repository}}/statuses/${{ github.head_ref }}" + + function get_status() { + curl -s "$api_endpoint" | jq '[.[] | .state] | .[0]' + } + + function get_context() { + curl -s "$api_endpoint" | jq '[.[] | .context] | .[0]' + } + + statuses_length=$(curl -s $api_endpoint | jq 'length') + if [ $statuses_length -eq 0 ]; then + echo "PRT failed to start ! Stopping." + exit 1 + fi + + status=$(get_status) + context=$(get_context) + + if [ "$context" != "Robottelo-Runner" ]; then + echo "::error Failed to get Robottelo-Runner status" + exit 1 + fi + + counter=0 + echo "Waiting for PRT to complete....." + while [ "$status" != "success" ] && [ "$status" != "failure" ]; do + if [ $counter -gt 20 ]; then + echo "PRT Timeout" + exit 1 + fi + sleep 300 + status=$(get_status) + echo "Robottelo-Runner : $status" + counter=$((counter+1)) + done + + if [ "$status" == "success" ]; then + echo "PRT Passed Successfully!" + else + echo "Robottelo-Runner : $status" + echo "::error PRT failed" + exit 1 + fi + + + - id: automerge + name: Auto merge of cherry-picked PRs. + uses: "pascalgn/automerge-action@v0.15.5" + if: steps.waitforstatuschecks.outputs.status == 'success' + env: + GITHUB_TOKEN: "${{ secrets.CHERRYPICK_PAT }}" + MERGE_LABELS: "AutoMerge_Cherry_Picked, Auto_Cherry_Picked" + MERGE_METHOD: "squash" + MERGE_RETRIES: 5 + MERGE_RETRY_SLEEP: 900000 + BASE_BRANCHES: "master" # avoid automerge branch + + - name: Auto Merge Status + run: | + if [ "${{ steps.automerge.outputs.mergeResult }}" == 'merged' ]; then + echo "Pull request ${{ steps.automerge.outputs.pullRequestNumber }} is Auto Merged !" + else + echo "::error Auto Merge for Pull request failed !" + exit 1 + fi From e21a58e6e8fbdabab566a483d4032bcfc30dccdc Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Fri, 5 May 2023 08:27:03 -0400 Subject: [PATCH 17/18] Fix Organization in Host (#835) (#840) (cherry picked from commit 8651ca4bb29275f27811e863cf9b9d18314e48fd) Co-authored-by: Shweta Singh --- airgun/views/host.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airgun/views/host.py b/airgun/views/host.py index 731fc2564..dde82b163 100644 --- a/airgun/views/host.py +++ b/airgun/views/host.py @@ -495,7 +495,7 @@ class general(Tab): ) ROOT = '//section[@id="generalSection"]' - orgnization = FormSelect('OUIA-Generated-FormSelect-default-1') + organization = FormSelect('OUIA-Generated-FormSelect-default-1') location = FormSelect('OUIA-Generated-FormSelect-default-2') host_group = FormSelect('OUIA-Generated-FormSelect-default-3') operating_system = FormSelect('OUIA-Generated-FormSelect-default-4') From 3124c388198f0d498ae3f5b3b733521782bdfc2d Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Wed, 14 Jun 2023 11:51:31 -0400 Subject: [PATCH 18/18] removing the unknown desired capability attributes (#859) (cherry picked from commit 03efaf109bc78837613bbce911fdee3986aeb905) Co-authored-by: omkarkhatavkar --- airgun/browser.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/airgun/browser.py b/airgun/browser.py index f154be5bd..127c2eba1 100644 --- a/airgun/browser.py +++ b/airgun/browser.py @@ -174,8 +174,6 @@ def _get_remote_browser(self): Note: should not be called directly, use :meth:`get_browser` instead. """ - desired_capabilities = self.web_kaifuku['webdriver_options']['desired_capabilities'] - desired_capabilities.update({'name': self.test_name}) manager = BrowserManager.from_conf(self.web_kaifuku) self._webdriver = manager.start() self._set_session_cookie()