Skip to content

fix: Add method to locate Import Content dialog and refactor related code#555

Merged
Roopan-Microsoft merged 3 commits intodevfrom
pk-dependabot-package-upgrades
Apr 21, 2026
Merged

fix: Add method to locate Import Content dialog and refactor related code#555
Roopan-Microsoft merged 3 commits intodevfrom
pk-dependabot-package-upgrades

Conversation

@Pavan-Microsoft
Copy link
Copy Markdown

Purpose

This pull request refactors the way the "Import Content" dialog is located in the HomePageV2.py end-to-end test page object. The main improvement is the introduction of a new helper method that robustly finds the dialog regardless of whether it uses the dialog or alertdialog role, addressing compatibility with different versions of Fluent UI. All dialog lookups throughout the file are updated to use this new method, improving maintainability and reliability of the tests.

Dialog lookup improvements:

  • Added a new _get_import_dialog helper method to locate the "Import Content" dialog by checking both dialog and alertdialog roles, ensuring compatibility with different Fluent UI versions.
  • Replaced all direct usages of get_by_role("alertdialog", name="Import Content") (and similar patterns) with the new _get_import_dialog method across the file, standardizing dialog access and reducing code duplication. [1] [2] [3] [4] [5] [6]

Test robustness and logging:

  • Improved error handling in select_schema_for_file by logging the dialog content when a file is not found, aiding test debugging.
  • Ensured that file labels are visible before proceeding in select_schema_for_file, making the test less flaky due to asynchronous UI updates.

Other dialog-related adjustments:

  • Updated dialog selection in validate_import_without_collection to use a combined selector for both dialog and alertdialog roles, increasing flexibility.

Does this introduce a breaking change?

  • Yes
  • No

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 21, 2026

Coverage

Coverage Report •
FileStmtsMissCoverMissing
TOTAL121016186% 
report-only-changed-files is enabled. No files were changed during this commit :)

Tests Skipped Failures Errors Time
242 0 💤 0 ❌ 0 🔥 4.764s ⏱️

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors the HomePageV2 E2E page object to locate the “Import Content” modal more robustly across Fluent UI versions by centralizing dialog lookup logic and updating call sites.

Changes:

  • Added _get_import_dialog() helper to find the “Import Content” dialog via either role="dialog" or role="alertdialog".
  • Updated multiple workflows to use _get_import_dialog() instead of directly querying alertdialog.
  • Enhanced failure logging in select_schema_for_file() when a target file row isn’t found.
Comments suppressed due to low confidence (1)

tests/e2e-test/pages/HomePageV2.py:193

  • select_schema_for_file() calls file_labels.count() immediately and iterates inner_text() without waiting for the uploaded file rows/labels to render. Because locator.count() doesn’t wait, a slow UI render can yield count==0 and trigger the 'file not found' path even though the file appears moments later. Add an explicit wait (e.g., expect(file_labels.first).to_be_visible()/to_have_count(>0) with a timeout) before counting/iterating.
        # Get all schema comboboxes and file labels in the import dialog
        schema_dropdowns = dialog.get_by_placeholder("Select Schema")
        file_labels = dialog.locator("strong")

        # Find the index of this file among all listed files
        count = file_labels.count()
        target_index = -1
        for i in range(count):
            label_text = file_labels.nth(i).inner_text().strip()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/e2e-test/pages/HomePageV2.py Outdated
Comment thread tests/e2e-test/pages/HomePageV2.py Outdated
@Roopan-Microsoft Roopan-Microsoft merged commit cd9493f into dev Apr 21, 2026
12 checks passed
Ayaz-Microsoft added a commit that referenced this pull request Apr 21, 2026
Regenerated uv.lock files for ContentProcessor and ContentProcessorAPI
to align with pydantic 2.13.3 after new commits landed on dev.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

3 participants