Problem/Motivation
assertOffCanvasFormAfterWait() says it "Waits for the specified form and returns it when available and visible."
What it really does is make sure that there is _any_ form on the page, and also that the off-canvas is open.
But currently it does not check to see if that form is _in_ the off-canvas.
Proposed resolution
Assert that the specific form ID matches, and also only look for the form within the off-canvas, instead of anywhere on the page.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | interdiff_13-15.txt | 670 bytes | ravi.shankar |
| #15 | 3089961-15.patch | 1.87 KB | ravi.shankar |
| #13 | interdiff.txt | 1.45 KB | Lal_ |
| #13 | 3089961-13.patch | 1.88 KB | Lal_ |
| #10 | interdiff_4-10.txt | 1.49 KB | deepak goyal |
Comments
Comment #2
tim.plunkettThe FAIL patch adds just the assert, which will only find the first form on the page, not the one being loaded in the off-canvas.
Comment #4
tim.plunkettWhile #2 will catch the failure, it will be hard to debug. Asserts within closures interfere with the display of error messages.
Here's one that moves the assert out of the closure.
Comment #6
tim.plunkettBump.
Comment #8
tedbowIt seems like it would simpler to not use
waitFor()at all.We could just use
And then change the
$form_id_elementbased off that.Comment #9
deepak goyal commentedComment #10
deepak goyal commentedHi @tedbow
Made changes please review.
Comment #12
tedbow$off_canvas is not for id element. We still need the logic from the previous patch to get that
$off_canvas->find('hidden_field_selector', ['hidden_field', 'form_id'])'
And then basically the last 3 lines from the previous patch
Comment #13
Lal_Comment #14
tedbowSince this is private function and no caller was using
$timeoutwe can remove this here 🎉Nit: needs work for the extra line at the end of the docblock
The actual wait time does not change because
\Drupal\FunctionalJavascriptTests\JSWebAssert::waitForElementVisible()defaults to 10000 milliseconds.But nothing was ever returned from this function and the callers never relied on return value.
We should update this but I guess strictly speaking it should be another issue.
I say we fix it in a follow up and don't fix in this issue but if I committer wants to say it should just be fixed here I would glad to have it done here.
Needs work for the nit in 1)
Comment #15
ravi.shankar commentedHere I have made changes as mentioned in comment #14
Comment #16
tedbowThanks everyone! Looks good 🎉
Comment #17
alexpottCommitted 700a6ab and pushed to 9.1.x. Thanks!
Comment #21
alexpottBackported to 8.9.x and 9.0.x