Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IAppResult of controls have Text set to null #62

Open
marcelwgn opened this issue Jun 5, 2021 · 6 comments
Open

IAppResult of controls have Text set to null #62

marcelwgn opened this issue Jun 5, 2021 · 6 comments

Comments

@marcelwgn
Copy link
Contributor

I'm submitting a...

  • Bug report (I searched for similar issues and did not find one) -->

Current behavior

Using the following test and XAML, the IAppResult returns null instead of the text of the control.

<TextBlock x:Name="MyTextBlock" Text="Some text" />
var result= App.WaitForElement("MyTextBlock");
Assert.IsTrue(errorMessageResult.Length > 0);
Assert.IsTrue(errorMessageResult[0].Text == "Some text"); // This line fails as Text is null.

Expected behavior

Text should report the actual text of the control if its a TextBlock.

Minimal reproduction of the problem with instructions

See code above.

Environment

Package Version(s): 

Uno.UITest.*: 1.1.0-dev11

Visual Studio
- [x] 2019 (version: 16.10.0)
- [ ] 2019 Preview (version: )
- [ ] for Mac (version: )
@jeromelaban
Copy link
Member

jeromelaban commented Jun 7, 2021

Thanks for the report. This particular feature is not supported properly, use GetDependencyPropertyValue("Text") instead.

@marcelwgn
Copy link
Contributor Author

When using the NuGet package, I am unable to use the GetDependencyPropertyValue function though...

@jeromelaban
Copy link
Member

Take a look at these samples:

Assert.IsFalse(App.Query(q => radio1(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());

@marcelwgn
Copy link
Contributor Author

Pasting that code into the UI test project, I get the following error:

Screenshot of GetDependencyPropertyValue not being found by compiler

@jeromelaban
Copy link
Member

This is an extension method:

public static T GetDependencyPropertyValue<T>(this QueryEx query, string dependencyPropertyName)

@marcelwgn
Copy link
Contributor Author

Ohhh I didn't know that, thank you, that works now!

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

No branches or pull requests

2 participants