Problem/Motivation
The multi-checkbox category dropdown filter's markup is atrocious. It is a pile of DIVs and checkboxes that are not semantically arranged like form elements, and that means the tests are extremely flaky when interacting it because they have to do bullshit like this:
$second_category_filter_selector = '.pb-filter__multi-dropdown .pb-filter__checkbox-label:nth-child(2) input[type="checkbox"]';
Come on. This is not sustainable.
Let's change the markup so it's more like this:
<div><label for="category-ID"><input type="checkbox" id="category-ID" value="ID" />Category name (ID)</label></div>
Then we should be able to do this in tests, which is both more readable and probably (hopefully) more stable:
$assert_session->fieldExists('Category name (ID)')->check();
Issue fork project_browser-3485747
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
sourav_paulComment #5
pfrillingLooking into this at NEDCamp. Adding the issue tag.
Comment #6
chrisfromredfinComment #7
pfrillingThe markup changes have been completed and the testing is all passing. This is ready for review.
Comment #8
chrisfromredfinfail - can't find by that selector. close, though!
Comment #9
pfrillingI was able to get the tests all passing. Marking this as needs review.
Comment #10
narendrarinstall-state.gz should not be part of MR.
Comment #11
pfrillingWorking on the rebase now.
Comment #12
pfrillingI rebased the code and confirmed all tests are now passing. Marking as needs review.
Comment #13
narendrarThis MR needs re-roll.
Comment #15
shalini_jha commentedRebased and resolved conflicts. Test changes in tests/src/FunctionalJavascript/ProjectBrowserUiTestJsonApi.php are still pending and need to be moved to ProjectBrowserUiTest::testMultiplePlugins.
Comment #16
shalini_jha commentedI have moved the changes from ProjectBrowserUiTestJsonApi::testMultiplePlugins to ProjectBrowserUiTest::testMultiplePlugins. I verified the output from the old testMultiplePlugins function and added the same flow to the ProjectBrowserUiTest::testMultiplePlugins.
Marking this as "Needs Review." Please review and let me know if this approach makes sense.
Comment #17
lostcarpark commentedThis is partly my fault. I fixed up the tests to work for the drop-downs. Rather than just plow in and work out selectors for the new markup, I should have asked can we make the checkboxes easier for the tests to select. I'll know better next time.
I have reviewed the changes and everything looks good to me. The revised selecters look much cleaner. I've also carried out a manual test, and everything seems to work correctly.
I note that the eslint check is failing due to the recipe.yml file. This file has not been touched by this change, so I think it's an unrelated issue, so I think it should be fixed in a separate issue.
Comment #18
lostcarpark commentedComment #20
chrisfromredfinThis is much more semantic, and also will help with tests!