Problem/Motivation
@effulgentsia requested on #3066007-39: Roadmap to stabilize Claro to have some basic test coverage for Claro:
I think we should add at least some minimal test coverage to the must-have list. Even if it's just a single test function similar to what we have for BartikTest and ClassyTest. Or maybe a subclass of InstallUninstallTest that executes all of the same stuff but with Claro as the Admin theme.
An example of something a test like that would catch is that currently, claro.settings.yml includes a shortcut setting, but Claro does not have a dependency on shortcut module, so that's something that should fail config validation when shortcut isn't enabled.
Unfortunately, I don't think there's a way to easily test config validity outside of running a test. #2414951: Validate configuration schema before importing configuration is an issue to perform validation during import (in the UI, not only during tests), but that's not in core yet, and the latest patch on that issue isn't working correctly. But if we have an automated test, then that should catch it, since we automatically perform config validation during test runs.
Proposed resolution
Add test coverage for Claro. We can use Drupal\FunctionalTests\Theme\BartikTest
as an example for this.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#30 | 3086435-30.patch | 28.72 KB | Wim Leers |
| |||
#30 | interdiff.txt | 1.26 KB | Wim Leers |
#26 | 3086435-26.patch | 29.87 KB | Wim Leers |
#26 | interdiff.txt | 3.38 KB | Wim Leers |
#3 | claro-tests-3086435-3.patch | 4.14 KB | lauriii |
|
Comments
Comment #2
lauriiiComment #3
lauriiiI moved all the configurations to optional because the block configurations depend on block module and the claro.settings.yml depends on shortcut module. We've inherited these from Seven which means that the same problem exists there. Should we open an issue against Seven to fix this?
Comment #4
huzookaRe #3:
Well, we didn't inherit anything like this from the Seven. Actually, these configurations were asked by AND added by you :) here. And I was the one who merged the PR :)
The thing that provides these block configs for the Seven theme is the Standard install profile.
Comment #5
alexpottHere's what I'd do with the config. The problem with the shortcut third party setting is there is literally no way for a theme to put that there dynamically. So let's enable shortcut in the test and comment to that affect. It's more important that the config in claro.settings is valid rather than the schema complete when shortcut is missing. We need to open a follow-up issue about third party settings in simple config. It's really messy.
For blocks we can install the block during the test - as done in the patch.
What's neat here is that we show that Claro is triggering a deprcated code path yay!
Comment #6
alexpottThis fixes the deprecation errors by moving the prerender callbacks to a class.
Comment #7
alexpottSo the build is failing cause of PHPCS for standards...
Comment #8
lauriiiComment #9
bnjmnm@lauriii mentioned a need for a bit of FunctionalJavascript coverage, so here's a start with tests that extend existing FunctionalJavascript tests. I'm not even sure if extending tests in this way is permissible, but I suppose that's what reviews are for.
If this approach is fine, it would be good to add some views tests, but many might fail until #3067386: AJAX rebuild of Views UI form re-renders parts of the form without using Form API, so additional hooks are needed in lieu of hook_form_view_edit_form_alter() lands.
Comment #10
alexpottI think extending tests is okay - it does mean when the parents test changes Claro gets the coverage immediately - which is good. But it also could mean testing things we don't need to. I think a general rule is if we need to change the test beyond just emptying one out then we probably shouldn't be extending.
This overrides ever test in the parent... I think I'd copy the parents setUp and $modules and extend WebDriverTestBase so we don't couple the tests.
Comment #11
Wim LeersAdded test coverage that proves the Claro theme can be uninstalled, despite being experimental.
Comment #12
Wim LeersThis is a fun coincidence!
This is subclassing existing tests and changing the default theme. That happens to be exactly what #2352949: Deprecate using Classy as the default theme for the 'testing' profile simplified 🥳 So we can change this many times in the patch, like so:
BUT! This won't work if Claro also needs to work on 8.7. Fortunately, Claro
8.x-2.x
is targeting 8.8 only! 😎 So we can do this :)Comment #13
Wim LeersForgot one spot.
Comment #14
alexpott<3 :D
Comment #16
Wim Leers@alexpott just pointed out in Slack that #13 failed because of a bug in #2352949: Deprecate using Classy as the default theme for the 'testing' profile:
are the wrong way around 🤦♂️
Until that is fixed, we should revert back to #12.
Comment #17
Wim LeersI was going to open a new core issue for @alexpott's suggestion but … it also doesn't work. I made this change:
but Claro installation still fails the same way:
Comment #18
Wim LeersReverting back to #12. The #13 additional interdiff, its failure, plus #16 and #17 are out of scope for this issue anyway.
(And renamed
-12.patch
to-18.patch
.)Comment #19
alexpottI agree with #18. Here's the core issue to fix this #3087036: third_party_settings in THEME.settings.yml cannot be dependency managed
Comment #20
bnjmnmTwo patches for two different things and I acknowledge that this is probably confusing
3086435---extra-tests-written-off-9.patch is additional changes I was making working off of #9. The patches that came after #9 appeared while I was working on this and I haven't had the chance to integrate the two. There is a failure in VerticalTabsTest happening (per my burner issue) on testbot that isn't happening locally.
3086435-18-with-FunctionalJavascript-enabled.patch is just the patch from #18 but with javascript testing enabled in drupalci.yml The switch to
protected $defaultTheme = 'claro';
from enabling the theme in setup seems to bring backWhich I already confirmed in another burner issue test if this is being read before drupalci has finished running.
So
protected $defaultTheme = 'claro';
need addressing.Comment #23
alexpottThese should be addressed by enabling the theme in set up like the Functional test.
Comment #24
Wim LeersYeah just don't do that. 🙂 Just like #18 doesn't do that, and core committer and configuration system maintainer @alexpott already confirmed this approach in #19 :) And … I see that @alexpott just commented to the same effect in #23 🤓👍
Comment #25
Wim LeersI first though it was
Because
:contains
selectors technically aren't supported in CSS. But apparently they are in Chrome? :O Or our testing infrastructure maps this to XPath selectors automatically? 🤯🤷♂️Either way, that was a dead end! The real answer is much simpler: Claro tests are run without
yarn build:css
. So requests to/themes/claro/css/dist/*
result in 404s. And since this test is doing highly CSS-dependent things … the test fails on testbot, but not locally. You can make it fail locally by removingcss/dist
and not runningyarn build:css
.Comment #26
Wim LeersTo address this: including the
drupalci.yml
changes in that patch, but reverting #12's interdiff.Comment #27
Wim LeersI don't think #25 can be fixed in Claro contrib, because Claro contrib does not commit the results of
yarn build:css
to its git repository.But Drupal core does.
So #25's
VerticalTabsTest
could be committed to Drupal core when Claro is added to core. But it cannot be added to Claro in contrib.I think it's laudable that Vertical Tabs behavior is being tested here, but … the intended scope of this issue was somewhat more minimal:
The latest patch already gives far more assurances than that minimal test coverage. So I think this is adequate as-is.
Comment #28
alexpottI agree with #25. The test coverage added here is a great smoke test and we can improve it as we go. We've got evidence this will help us keep Claro up-to-date and catch errors so +1 to getting this done.
Comment #30
Wim LeersFor reasoning similar to #25 (and approved by @alexpott in #28), I'm dropping
ClaroManageDisplayTest
too, because that too suffers from config-related challenges.Comment #31
Wim LeersYay, green! 🥳
Comment #32
lauriiiIs this referencing the right issue? This is the Claro roadmap.
Comment #33
Wim Leers#32: The idea was that this should be removed when Claro becomes stable. That's the issue closest to "Claro is stable" I could find.
Comment #35
lauriiiThank you all! 🙏 Committed and pushed. 🚀