-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
alternative method of testing forms with collections #10527
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
Conversation
That looks good, I think that you should move the text of this PR before You can remove an existing field, e.g. a tag: since the code is used to add field, not remove it. |
@@ -789,6 +789,25 @@ You can remove an existing field, e.g. a tag:: | |||
// the tag has been removed | |||
$this->assertEquals(0, $crawler->filter('ul.tags > li')->count()); | |||
|
|||
You can also manipulate the DOM before obtaining the form - this can be useful for simulating collections. For example, | |||
if you had a form which could include dynamic upload fields, you can add the extra fields to the DOM before obtaining |
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.
DOM and obtaining is named twice, the sentence is a bit confusing
@xabbuh what's your opinion about this trick? Thank you. |
This sounds like quite a fragile approach to me. IMO when your functional test requires JavaScript to be executed you should use a real browser in the background (for example using Panther) instead. |
@xabbuh You're right but in the same time, this PR uses an approach that is easy to write and maintain. Maybe we should add an info message like this:
|
Maybe we should add a more generic block hinting that you can modify the DOM if you want to simulate client-side modifications and then mention that this does work but is not recommended and one should use a tool like Panther instead. |
Hi @lordelph! Thanks for starting this PR. As it seems like the current changes of this PR will not be merged and there hasn't been any update in a year, I'll close this PR. Feel free to comment or update the PR, we can always hit the reopen button again. |
As suggested in symfony/symfony#4124 (comment)