-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add TextInput Functional E2E Tests Fabric #14461
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
Add TextInput Functional E2E Tests Fabric #14461
Conversation
|
This is great! However it's a bit confusing to have passing tests for properties we don't have implemented yet (ie I would think those test shouldn't pass), can we either comment those tests out until we implement those or add comments in the test title that those properties don't work yet? |
|
nit: Let's not mark #12458 as resolved because its list of functional tests is not comprehensive. In future we'll want to add more scenarios to this issue to cover all functional behavior for TextInput. The current list of scenarios are just a starting point. Can you update #12458 with which tests you've added support for after this PR is merged? |
|
| test('TextInput input should wrap to multiple lines when multiline set to true', async () => { | ||
| const component = await app.findElementByTestID('textinput-multiline'); | ||
| await component.waitForDisplayed({timeout: 5000}); | ||
| const dump = await dumpVisualTree('textinput-multiline'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't look like this test is actually testing the functional behavior. Do we have multiple lines of text in the textinput? Is there data within the visual tree dumps that shows the textinput is now using multiple lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it's defined on line 839 of js file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea I see where the multiline prop is added but it looks like the only text in the textinput is "This TextInput supports multiple lines" which I don't think takes up two lines within the textinput. When we test the multiline prop, we'll want to make sure the textinput is filled with multiple lines of text, so we can see how the control adjusts its visuals when multiline={true}
| test('TextInput should trigger action upon onBlur', async () => { | ||
| const component = await app.findElementByTestID('textinput-onblur'); | ||
| await component.waitForDisplayed({timeout: 5000}); | ||
| const dump = await dumpVisualTree('textinput-onblur'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and many of the tests below are not actually testing the functionality of the prop. For example, for this test to be accurate the test would need to programmatically focus to the control, move focus away from the control, and then check if the console correctly logged the right statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, these are initial layouts for the tests and need refinement as some props are missing too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok! If so, let's adjust this to a draft PR until the tests are ready.
| const dump = await dumpVisualTree('textinput-onselectionchange'); | ||
| expect(dump).toMatchSnapshot(); | ||
| }); | ||
| test('TextInput placeholder text should update upon fast refresh', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the other fast refresh tests below are not actually testing the functionality of fast refresh. For these tests to be accurate we would need the test suite to somehow update the source code for the file to be different placeholder text, save the file, and then dump the visual tree for the control.
| await component.waitForDisplayed({timeout: 5000}); | ||
|
|
||
| // Simulate focusing by setting a value | ||
| await component.setValue('Focusing TextInput'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't appear like we are calling .focus() during the test. I see the focus event occurring, but this test should be using the .focus() API to focus the control and not setValue().
| const component = await app.findElementByTestID('textinput-blur'); | ||
| await component.waitForDisplayed({timeout: 5000}); | ||
|
|
||
| // Simulate focusing by setting a value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as comment above.
|
@anupriya13 My worry is that without a property implemented, there's not a way to verify that these tests are testing the right behavior and then when someone creates that property, they won't add a test because they already see a passing test for it. For example, onPressIn isn't implemented and I'm not quite sure if that snapshot test here will test that functionality (and if it's not testing any new functionality, we don't really need the cost of an extra test nor can we say it's testing onPressIn). |
| // Set a value in the TextInput | ||
| await component.setValue('Some text'); | ||
| // Simulate clearing the text by setting an empty value | ||
| await component.setValue(''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above. The .Clear() api should be called to clear the textinput and not SetValue(). Otherwise, we aren't actually testing the value of this API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me remove this one then, and will add when implemented
@TatianaKapos sure, we can comment out the ones those are not implemented then :) and improve and uncomment them when done. |
Description
Type of Change
Why
What is the motivation for this change? Add a few sentences describing the context and overall goals of the pull request's commits.
Resolves #12458 Partially
Refer https://github.com/microsoft/react-native-windows/pull/12442/files#diff-d9c04bc24954579c02d7935cd457d276cec49204a940c925cde9b147272ec746
What
What changes were made to the codebase to solve the bug, add the functionality, etc. that you specified above.
Test cases should be added to the E2E test app (Fabric) to validate the following functionality scenarios.
Screenshots
Add any relevant screen captures here from before or after your changes.



Testing
If you added tests that prove your changes are effective or that your feature works, add a few sentences here detailing the added test scenarios.

Tested in RNTester
Optional: Describe the tests that you ran locally to verify your changes.
Changelog
Should this change be included in the release notes: indicate yes or no NO
Add a brief summary of the change to use in the release notes for the next release.
Microsoft Reviewers: Open in CodeFlow