Closed (fixed)
Project:
Image Widget Crop
Version:
8.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
17 Jul 2017 at 14:49 UTC
Updated:
11 Feb 2020 at 16:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
woprrr commentedThe ImageWidgetCropExamples tests are handle by #2922257: Convert ImageWidgetCropExamples Functional WebTestBase to BrowserTestBase We need to continue here...
Comment #3
idebr commentedAttached patch converts ImageWidgetCropTest from Simpletest to a FunctionalJavascript test. Since some assertions test JavaScript interactions, it is not possible to use BrowserTestBase directly.
Comment #4
phenaproximaThis looks very good to me. There are some relatively minor points I would suggest changing before commit, but none of these are essential.
Nit: There's no need for $field to be its own variable. I would suggest, for extra strength, that we use $this->getSession()->getPage()->attachFileToField() instead.
This assertion is not a direct replacement for the assertion it its replacing. Why not just use $assert_session->responseNotContains()?
Nit: There is no need for $field to be its own variable. We should probably use $this->getSession()->getPage()->attachFileToField() here instead, to prevent potentially calling methods on NULL.
Again, maybe $assert_session->responseContains($raw) would be more in keeping with how the test was previously?
This seems a little odd; why not just $assert_session->buttonExists('Remove')?
To prevent calling click() on NULL, and for clarity, I would suggest using $this->getSession()->getPage()->pressButton('Remove') here.
As before, I see no benefit to using this pattern instead of $this->getSession()->getPage()->attachFileToField().
Comment #5
katherinedthis should address the feedback in #4.
Comment #6
katherinedtrying that again
Comment #7
phenaproximaAfter doing a bit of debugging with @katherined, I realized that my request in #4.2 was mistaken. My apologies.
Using a CSS selector is smarter than looking for raw response text, because the AJAX system will randomize the ID attribute. This would not have happened in a SimpleTest test, since that used a fake AJAX simulation, rather than actually doing a real AJAX request in a real browser. That explains why the test might have passed in SimpleTest, but not PHPUnit.
So, we can either go back to what we had in #3 for that assertion, or switch to a CSS selector like
summary:contains(Crop image). Both work for me. Sorry for the disruption!Comment #8
katherinedthird time's the charm?
Comment #9
phenaproximaLooks green to me :)
Comment #10
phenaproximaAdjusting credit for commit.
Comment #12
phenaproximaRe-ran tests to confirm everything still looks good, then committed and pushed to 8.x-2.x. Thanks!