Skip to content

fix: Fix playwright gateway action tests - #3995

Merged
crivetimihai merged 3 commits into
mainfrom
3982-fix-pw-tests
Apr 3, 2026
Merged

crivetimihai merged 3 commits into
mainfrom
3982-fix-pw-tests

Conversation

@gcgoncalves

Copy link
Copy Markdown
Collaborator

🐛 Bug-fix PR

📌 Summary

Closes #3982

🔁 Reproduction Steps

  1. Run the playwright tests

🐞 Root Cause

The playwright test updates got lost on a PR rework.

💡 Fix Description

Added a step to open the overflow menu to the gateway action tests

🧪 Verification

Check Command Status
Lint suite make lint ✅
Unit tests make test ✅
Coverage ≥ 80 % make coverage ✅
Manual regression no longer fails steps / screenshots ✅

✅ Checklist

  • [✅] Code formatted (make black isort pre-commit)
  • [✅] No secrets/credentials committed

vishu-bh
vishu-bh previously approved these changes Apr 2, 2026

@vishu-bh vishu-bh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@marekdano marekdano left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test tests/playwright/test_gateways.py::TestGatewayActions::test_gateway_row_actions_visible fails with the error

 def test_gateway_row_actions_visible(self, gateways_page: GatewaysPage):
        """Test that all gateway row action buttons are visible."""
        gateways_page.navigate_to_gateways_tab()
        gateways_page.wait_for_gateways_table_loaded()

        # Skip if no gateways exist
        if gateways_page.get_gateway_count() == 0:
            pytest.skip("No gateways available for testing")

        # Get first gateway row
        first_row = gateways_page.get_gateway_row(0)

        # Verify all action buttons exist
>       expect(first_row.locator('button:has-text("Test")')).to_be_visible()
E       AssertionError: Locator expected to be visible
E       Actual value: hidden
E       Call log:
E         - Expect "to_be_visible" with timeout 5000ms
E         - waiting for locator("#gateways-table-body").locator("tr").first.locator("button:has-text(\"Test\")")
E           9 × locator resolved to <button type="button" role="menuitem" @click="menuOpen = false; testGateway("http://fast_time_server:8080/sse")" class="w-full flex items-center px-4 py-2 text-sm text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700">Test</button>
E             - unexpected value "hidden"

tests/playwright/test_gateways.py:528: AssertionError

The test is failing because the action buttons (Test, View, Edit, etc.) are inside a dropdown menu that is hidden by default. According to PR #3802 mentioned in the page object, all action buttons were moved inside an Alpine.js-controlled dropdown with menuOpen: false by default.

To fix this error, the test_gateway_row_actions_visible test should be updated with

# Open the action dropdown (PR #3802 moved buttons inside dropdown)
gateways_page._open_action_dropdown(first_row)

# Verify all action buttons exist in the dropdown menu
expect(first_row.locator('button[role="menuitem"]:has-text("Test")')).to_be_visible()
expect(first_row.locator('button[role="menuitem"]:has-text("View")')).to_be_visible()
expect(first_row.locator('button[role="menuitem"]:has-text("Edit")')).to_be_visible()

# Either Activate or Deactivate should be visible
activate_btn = first_row.locator('button[role="menuitem"]:text-is("Activate")')
deactivate_btn = first_row.locator('button[role="menuitem"]:text-is("Deactivate")')
assert activate_btn.is_visible() or deactivate_btn.is_visible()

# Delete button should be visible (inside a form)
expect(first_row.locator('form[action*="/delete"] button[type="submit"]:has-text("Delete")')).to_be_visible()

gcgoncalves and others added 2 commits April 3, 2026 03:50
The delete_gateway_by_url method was missing the _open_action_dropdown
call added by the previous commit. Since PR #3802 moved all action
buttons (including Delete) inside an Alpine.js dropdown menu, the
delete button is not directly clickable without first opening the menu.

Closes #3982

Signed-off-by: Mihai Criveti <[email protected]>
@gcgoncalves
gcgoncalves requested a review from marekdano April 3, 2026 07:20
…ject

Three test files directly click gateway action buttons without going
through the GatewaysPage page object, so they were also broken by
PR #3802's move to the Alpine.js overflow menu:

- test_rbac_permissions.py: test_admin_delete_gateway bypassed page
  object to inspect HTTP response status directly
- test_admin_url_context.py: _get_delete_gateway_btn helper used by
  multiple URL-context tests and iframe delete tests
- test_iframe_embedding_security.py: delete and toggle tests operated
  directly on iframe FrameLocator

Each now opens the actions dropdown before clicking the menu item.

Signed-off-by: Mihai Criveti <[email protected]>

@crivetimihai crivetimihai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, nice catch on the regression from PR #3802.

I rebased onto main (clean, no conflicts) and added two follow-up commits:

Commit 2 — fix: add missing _open_action_dropdown call in delete_gateway_by_url

  • delete_gateway_by_url() was the one action method in the page object that was missed — it also clicks the Delete button which lives inside the dropdown now. Added the _open_action_dropdown call + black/isort formatting cleanup.

Commit 3 — fix: open action dropdown in remaining test files that bypass page object

  • Three other test files click gateway action buttons directly (bypassing the page object), so they were broken by the same #3802 change:
    • test_rbac_permissions.py — test_admin_delete_gateway located the delete button on the row directly
    • test_admin_url_context.py — _get_delete_gateway_btn helper used by multiple URL-context and iframe delete tests
    • test_iframe_embedding_security.py — delete and toggle iframe tests operated on FrameLocator directly
  • Each now opens the actions dropdown before clicking. Added wait_for(state="attached") guards in the iframe tests and moved the skip guard before the dropdown interaction in _get_delete_gateway_btn.

Selectors verified against gateways_partial.html — all match (button[aria-expanded], [role="menu"], button[role="menuitem"], form[action*="/delete"]).

@crivetimihai
crivetimihai merged commit d71cb5e into main Apr 3, 2026
19 checks passed
@crivetimihai
crivetimihai deleted the 3982-fix-pw-tests branch April 3, 2026 08:00
jonpspri pushed a commit that referenced this pull request Apr 10, 2026
* fix: Fix playwright gateway action tests

Signed-off-by: Gabriel Costa <[email protected]>

* fix: add missing _open_action_dropdown call in delete_gateway_by_url

The delete_gateway_by_url method was missing the _open_action_dropdown
call added by the previous commit. Since PR #3802 moved all action
buttons (including Delete) inside an Alpine.js dropdown menu, the
delete button is not directly clickable without first opening the menu.

Closes #3982

Signed-off-by: Mihai Criveti <[email protected]>

* fix: open action dropdown in remaining test files that bypass page object

Three test files directly click gateway action buttons without going
through the GatewaysPage page object, so they were also broken by
PR #3802's move to the Alpine.js overflow menu:

- test_rbac_permissions.py: test_admin_delete_gateway bypassed page
  object to inspect HTTP response status directly
- test_admin_url_context.py: _get_delete_gateway_btn helper used by
  multiple URL-context tests and iframe delete tests
- test_iframe_embedding_security.py: delete and toggle tests operated
  directly on iframe FrameLocator

Each now opens the actions dropdown before clicking the menu item.

Signed-off-by: Mihai Criveti <[email protected]>

---------

Signed-off-by: Gabriel Costa <[email protected]>
Signed-off-by: Mihai Criveti <[email protected]>
Co-authored-by: Mihai Criveti <[email protected]>
msureshkumar88 pushed a commit that referenced this pull request May 13, 2026
* fix: Fix playwright gateway action tests

Signed-off-by: Gabriel Costa <[email protected]>

* fix: add missing _open_action_dropdown call in delete_gateway_by_url

The delete_gateway_by_url method was missing the _open_action_dropdown
call added by the previous commit. Since PR #3802 moved all action
buttons (including Delete) inside an Alpine.js dropdown menu, the
delete button is not directly clickable without first opening the menu.

Closes #3982

Signed-off-by: Mihai Criveti <[email protected]>

* fix: open action dropdown in remaining test files that bypass page object

Three test files directly click gateway action buttons without going
through the GatewaysPage page object, so they were also broken by
PR #3802's move to the Alpine.js overflow menu:

- test_rbac_permissions.py: test_admin_delete_gateway bypassed page
  object to inspect HTTP response status directly
- test_admin_url_context.py: _get_delete_gateway_btn helper used by
  multiple URL-context tests and iframe delete tests
- test_iframe_embedding_security.py: delete and toggle tests operated
  directly on iframe FrameLocator

Each now opens the actions dropdown before clicking the menu item.

Signed-off-by: Mihai Criveti <[email protected]>

---------

Signed-off-by: Gabriel Costa <[email protected]>
Signed-off-by: Mihai Criveti <[email protected]>
Co-authored-by: Mihai Criveti <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Playwright gateway tests fail after dropdown menu refactor in #3802

4 participants