Closed (fixed)
Project:
Drupal core
Version:
8.6.x-dev
Component:
quickedit.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
17 Apr 2017 at 19:21 UTC
Updated:
14 Mar 2019 at 02:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
michielnugter commentedComment #3
pazhyn commentedNeeds alternatives for getAjaxPageStatePostData() and drupalPost().
Comment #4
michielnugter commentedComment #5
rakesh.gectcrComment #7
wim leersComment #8
Anonymous (not verified) commented#2828528: Add Quick Edit Functional JS test coverage can greatly affect, because it already contains a massive js-assertions!
Comment #11
vijaycs85Initial patch... couldn't finish all test cases in
Drupal\Tests\quickedit\FunctionalJavascript\QuickEditLoadingTest. Updated IS with details.Comment #13
lendude@vijaycs85++
just a quick reroll, nothing further added
Comment #15
lendudeFun with concurrent sessions in
testConcurrentEdit! This works locally, curious to see how the bot handles it.We might need to move the getSession() version to BTB so we handle concurrent sessions out of the box better.
Green except for
testCustomPipeline, I don't get what that is doing.Comment #17
wim leersThanks for working on this! 🙏
What don’t you understand about that last failing test?
Comment #18
lendude@Wim Leers, thanks for keeping an eye on it.
If I'm reading the test right, its goal is to test the
elsein\Drupal\quickedit\QuickEditController::renderField. It usesquickedit_test_quickedit_render_fieldand a mocked URL to do so in the WebTestBase version.So, could this just be a kernel test? That won't give us coverage of the specially constructed URL that triggers this, so it feel like we might be losing some coverage then. So probably not.
If we want to test the URL handling, we would need some way to trigger this, other then a mocked URL. What I don't see, is how you can make QuickEdit use the specially crafted URL that causes the hook to trigger and not mock it. There are no implementations of this in core, so is there anywhere else that I can steal an example from?
So basically I need a fully functional test setup to use the hook for this, not the half-mock setup we have now. Any ideas?
Comment #19
lendudeLacking a proper way to test the URL, here is a straight conversion of the mocked URL coverage to BTB.
Comment #20
lendudeWell, that does the job I guess, bit of a clean up.
Comment #21
dawehnerThis is a bit weird that it waits for the same element multiple time, or is this just me?
That comment seems quite pointless
How about checking also on the page that quick edit updates the body text properly?
This documentation talks about the title field
Could we open up a follow up which moves this into a kernel test?
It's amazing that this works.
Comment #22
lendude@dawehner thanks for the review.
#21.1 fixed
#21.2 removed
#21.3 That test method is specifically for the title field 'Tests the loading of Quick Edit for the title base field.', so lets keep it specific, since this has coverage in testUserPermissions
#21.4 heh, c/p left over, fixed
#21.5 yeah, it's a pretty weak test anyway, with only a negative assertion, tried a quick conversion to a kernel test and it passed even without the $display_settings passed (the WebDriver version fails as expected), so yeah a followup makes sense #3021406: Convert \Drupal\Tests\quickedit\FunctionalJavascript\QuickEditLoadingTest::testDisplayOptions to a kernel test
#21.6 agreed!
Comment #23
jibranThanks, overall patch looks good. Just some minor observations.
We already have the local variable. Let's use that instead.
I don't see a reason to override this method. Call can get the default session name and pass it.
Comment #24
dawehnerGood point! Explicit code is nicer than implicit.
Comment #25
jibranAddressed #23.
Comment #26
dawehnerThank you @jibran
My points from #21 got addressed
Comment #27
alexpottThis test of PrivateTempStore usage has seemly gone missing. I'm not sure how we simulate what this is testing in a JS environment though.
Hmmm where has the test coverage for this gone? This security testing is important. I think we need a separate BrowserTestBase to test the security of these endpoints.
This part of the test seems to have gone missing. I guess in a JS environment we never have the separate requests that the old fake test had so maybe dropping this is okay (like point 1) but maybe we should implement a BTB to add back this test coverage and discuss whether it is worth it in a separate issue.
Missing too. Although I guess you could argue this is testing Node behaviour and not quickedit. But they way quickedit interacts with revisions is important so I would have expected this coverage to be maintained.
So the problem with doing this is that we lose the ability to debug inside the test request because the xdebug cookie is not set. Maybe there's a better way of adding the xdebug cookie than the way we currently do that would mean we don't have to think about this. Let's open a follow-up to try to address this. Because this is not the only test using getSessionCookies and then makes undebuggable requests. Like I think we can add a handler in \Drupal\Tests\BrowserTestBase::initMink() to do this.
Comment #28
alexpottI opened #3029750: Add default cookies in tests using a Guzzle handler to address #27.5
Comment #29
lendudeThis is just a reroll after #3021406: Convert \Drupal\Tests\quickedit\FunctionalJavascript\QuickEditLoadingTest::testDisplayOptions to a kernel test landed.
Comment #31
lendudeHmmm #29 is one unrelated fail, and one related fail, but the related fail passes locally. Lets keep an eye on that, make sure we don't introduce new random fails.
This addresses some of the feedback from #27
#27.1 Yeah, since we don't do partial/manual requests anymore, this is impossible to test in a real javascript scenario. I would expect this to be covered in existing kernel/unit test coverage, but a quick search didn't reveal anything
#27.2 added a dedicated test for this
#27.3 yeah, see 1
#27.4 Added it back in
#27.5 The follow up issue covers this nicely, and would work with these tests staying as they are, so no change for that now.
Comment #32
lendudeBleh, quick cleanup
Comment #33
jibranSetting it back to RTBC after #27 has been addressed.
Comment #35
lendudeUnrelated fails
Comment #36
larowlannote to self: this was moved to a new test see #31
Comment #38
larowlanFixed on commit
Committed d8c9748 and pushed to 8.7.x. Thanks!
Doesn't apply cleanly to 8.6, so putting back to needs work for a re-roll
Comment #39
wim leersI still need to spend probably two hours reviewing (and manually comparing) this in detail to ensure no test coverage gets lost — it's hard to do because there is so much change. I'm sure it's all for the better though — the existing tests are super hard to read and understand too due to them being written in a time that predates
@dataProviderand JS tests :) Thanks so much for having pushed it this far already!Here's an initial review.
s/quick edit/Quick Edit/
The description isn't reflected in the method name.
"empty as above" no longer makes sense.
We're testing 4 different cases. Let's use
@dataProviderfor this? (That didn't exist back when these tests were originally written, and they make tests so much clearer!)Let's move this to
::setUp(), which is possible now thanks to this having a test class of its own."edit" vs "payload". How about just "body"?
This should be named
assertSomething(). Wouldn'tassertAccessDeniedResponse()be more accurate?If we're converting this to use Guzzle, then let's also use the constants:
RequestOptions::BODY,RequestOptions::HEADERS, etc.@inheritdocThis comment can be removed, it's stating the obvious :)
Indentation of last line is wrong.
s/quickeditor/Quick Edit/
$this->assertCount()s/quickedit/Quick Edit/
Comment #40
lendude@Wim leers, thanks for the review, but this was already committed to 8.7.x, do we want to revert this?
Comment #41
gábor hojtsyI rolled it back since the review posted by @Wim Leers has some stuff that is better solved here than trying to piece it out to followups.
Comment #43
dawehnerIt sounds for me like the perfect usecase of a follow up. You can iterate for ages on tests :)
Comment #44
alexpott1. Fixed
2. Fixed
3. Fixed
4. BTBs are not good candidates for @dataProvider - no need to install Drupal so many times.
5. Fixed
6. Fixed
7. Fixed
8. Personally I find the strings more readable but whatevs.
9. Fixed
10. Fixed
11. Fixed
12. Fixed
13. Fixed
14. Fixed
All these changes are relatively minor in the scheme of things setting straight back to rtbc so we can be closer to being WTB free for 8.7.0.
Comment #45
jibran+1 RTBC
Comment #46
wim leersI didn't mean to trigger a revert — I reviewed this this morning with the issue I had open (flaky internet connection, they're fixing it later today), so I missed the commit.
I spotted lots of small things during a first scan, but I primarily un-RTBC'd because I wanted to verify that no test coverage was lost. Given @alexpott confidently re-RTBC'd already, I'm totally fine with not spending an hour or two manually comparing the before vs after. :)
Comment #47
alexpott@Wim Leers - I agree with the your wish to not lose test coverage. I did a line-by-line review in #27 focussing on test coverage that had been removed. I should have posted a more general comment saying that I consider the resolution of #27 to result in no loss of test coverage (that I can spot). And yes reviewing this patch for that is hard.
Comment #48
gábor hojtsyThanks all! Adjusting credits now.
Comment #50
wim leers#47: Ah, excellent, I didn't realize #27 dug that deep. Wonderful, thanks! 👏 👍
Comment #51
gábor hojtsyCommitted to 8.7.x again :) Would need a reroll for 8.6.x. (Conflicts on QuickEditLoadingTest).
Comment #52
alexpottNow that #3021406: Convert \Drupal\Tests\quickedit\FunctionalJavascript\QuickEditLoadingTest::testDisplayOptions to a kernel test is backported this applies to 8.6.x. Re-uploading to trigger a test run. If this is green we can cheery-pick to 8.6.x by doing
git cherry-pick -x a974536Comment #53
gábor hojtsyYay, thanks!
Comment #55
larowlanFor what it's worth, so did I because it was clear the permissions tests were a lot smaller than their predecessors (replaced with the stand alone test).
Comment #56
tacituseu commentedLook like it has some problems with SQLite:
- https://www.drupal.org/pift-ci-job/1212297
- https://www.drupal.org/pift-ci-job/1211477
- https://www.drupal.org/pift-ci-job/1212495
- https://www.drupal.org/pift-ci-job/1212502
Comment #59
xjmYep, reverted. I'll queue some SQLite runs again to illustrate the fail.
Comment #60
lendudeFirst requeue passed, adding some more with PHP 5.5 and 5.6 since 3 of the 4 @tacituseu pointed to were using that. Lets see...
Comment #61
alexpottI can reproduce the exact same fail by doing
sudo -u _www php ./core/scripts/run-tests.sh --verbose --concurrency 3 --repeat 30 --sqlite /tmp/coretest.sqlite --dburl sqlite://localhost/sites/default/files/db.sqlite --color --non-html --url http://drupal8alt.test/ --class 'Drupal\\Tests\\quickedit\\FunctionalJavascript\\QuickEditLoadingTest'and renaming all the tests to_testexcept testWithPendingRevision()Comment #62
alexpottHere's a fix. The database lock occurs because of quickedit's ajax request to get additional metadata.
Comment #63
wim leers#62: impressive detective work! 🕵️♂️ Makes perfect sense.
Comment #64
jibranRTBC+1, maybe third time will be a charm.
Wow!
Comment #67
larowlanCommitted cd03cd4 and pushed to 8.7.x. Thanks!
c/p as 5b4b9d51b5 and pushed to 8.6.x