Skip to content

[Testing] Extension for finding any element & test-7167 fix#26657

Merged
rmarinho merged 1 commit into
dotnet:mainfrom
kubaflo:test-716-fix
Dec 16, 2024
Merged

[Testing] Extension for finding any element & test-7167 fix#26657
rmarinho merged 1 commit into
dotnet:mainfrom
kubaflo:test-716-fix

Conversation

@kubaflo
Copy link
Copy Markdown
Contributor

@kubaflo kubaflo commented Dec 16, 2024

Scrolling through a list and waiting for a specific element can fail unpredictably due to varying screen sizes and swipe behavior. Instead, I recommend verifying that the list renders correctly after scrolling by checking for the presence of any new element in the array, rather than relying on a specific one.

This PR fixes the failing 7167 test

@kubaflo kubaflo requested review from a team, jfversluis and jsuarezruiz as code owners December 16, 2024 17:05
@kubaflo kubaflo requested a review from a user December 16, 2024 17:05
@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label Dec 16, 2024
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Hey there @kubaflo! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@kubaflo
Copy link
Copy Markdown
Contributor Author

kubaflo commented Dec 16, 2024

Hi, @anandhan-rajagopal the recently enabled test7167 seems to be failing. What do you think about this change?

@kubaflo kubaflo changed the title [UiTests] Extension for finding any element & test-7167 fix [Testing] Extension for finding any element & test-7167 fix Dec 16, 2024
@jfversluis
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@kubaflo kubaflo added the area-testing Unit tests, device tests label Dec 16, 2024
@samhouts samhouts requested a review from Copilot December 16, 2024 19:33
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.

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (3)

src/TestUtils/src/UITest.Appium/HelperExtensions.cs:664

  • [nitpick] The parameter marked is ambiguous. It should be renamed to elements for clarity.
public static IUIElement WaitForAnyElement(this IApp app, string[] marked, string timeoutMessage = "Timed out waiting for element...", TimeSpan? timeout = null, TimeSpan? retryFrequency = null, TimeSpan? postTimeout = null)

src/TestUtils/src/UITest.Appium/HelperExtensions.cs:666

  • [nitpick] The variable result is ambiguous. It should be renamed to queryResult for clarity.
IUIElement result() => FindAnyElement(app, marked);

src/TestUtils/src/UITest.Appium/HelperExtensions.cs:2124

  • The error message should be more descriptive. Suggestion: throw new InvalidOperationException($"None of the specified elements were found: {string.Join(", ", elements)}");
throw new InvalidOperationException($"Did not find any elements in the list: {string.Join(", ", elements)}");

@rmarinho rmarinho merged commit b615b73 into dotnet:main Dec 16, 2024
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-testing Unit tests, device tests community ✨ Community Contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants