Problem/Motivation
Because of #3083275: [meta] Update tests that rely on Classy to not rely on it anymore and Classy being deprecated in Drupal 9 + removed in Drupal 10,: Tests that aren't specifically testing Classy yet declare $defaultTheme = 'classy'; should be refactored to use Stark as the default theme instead.
Proposed resolution
Change all tests in this module to use Stark as the default theme, and refactor the tests where needed so they continue to function properly.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | core-3275807-11.patch | 28.56 KB | nod_ |
| #8 | interdiff_5-8.txt | 9.87 KB | danflanagan8 |
| #8 | 3275807-8.patch | 28.45 KB | danflanagan8 |
| #5 | interdiff_2-5.txt | 2.83 KB | danflanagan8 |
| #5 | 3275807-5.patch | 18.95 KB | danflanagan8 |
Comments
Comment #2
danflanagan8Some notes for reviewers...
1. In
MediaAccessTestI had to make a change to the.view-mediaselector. But I couldn't pass up an opportunity to make the assertions below that considerably more meaningful. In a sense this was "required" because I was no longer able to select the view in a very convincing way.2. In
MediaJavascriptTestBasethere's a helper method to assert links in a status message. This cannot useJsWebAssert::statusMessageContainsAfterWaitbecause that method just checks text, not markup.3. I put a @todo in
CKEditorIntegrationTestand left it with Classy until Starterkit is ready. This one has tons of apparently important selection of classes.4. In
MediaSourceOEmbedVideoTestI remove a hunk of code that was added in #2982307: Misnamed template can cause fatal error in themes that do not extend Stable. No that the default theme is Stark, I believe that the hunk of code is no longer needed. It only makes sense if the test begins by running something that extends stable. This test also has one of those sneaky negative assertions with no positive counterpart that needed to be updated even though there wasn't a failure triggered moving from classy to stark.5.
MediaStandardProfileTestuses the standard profile, so it doesn't even need to declare a default theme.6. This module has a ton of changes so I did not make any nice-to-have changes such as changing pageTextContains to statusMessageContains.
Comment #3
danflanagan8Another note. In MediaDisplayTest, the following hunk is improved in addition to being refactored for stark. The final assertion was originally added in #2934850: Media Images should be rendered at a reasonable size by default. But that assertion doesn't actually test that at all. It just tested if there was an img tag, with no regard for the image style. That's why the assertion now checks that the image src corresponds to the appropriate image style.
Comment #4
larowlan>80 here
why was this change needed?
💪
the test comment says 'inside the media element' but it doesn't look like we're testing that anymore, just that 'a img element exists'
this feels brittle?
same here re losing some precision
Comment #5
danflanagan8Thanks for the review @larowlan. I have attached a new patch. Here are some notes.
4.1: Updated. Not sure how the patch even ran given this violation.
4.2: The presence of the label is used to assert the presence of the field since we no longer have a good css class to assert the presence of the field. I have updated a comment to perhaps clarify this slightly.
4.4: I have updated this so that an image is being found within the image field output. We're viewing a media at its "view" route, so this should be sufficient since any field on the page is a field from the media.
4.5: Very brittle! I have updated.
4.6: We are losing precision, but it's a negative assertion so I think it's ok to lose some precision. In fact, the lost precision may enhance the effectiveness of the test. We don't really care what the image style is. We just want to make sure the the oembed media is not being rendered as a media thumbnail (i.e. image). Rather, we only want it to be rendered as an oembed iframe, which is what the assertion before the img thing checks.
Let me know if I am unpersuasive about 4.6!
Or if anything else isn't quite right. Cheers!
Comment #7
danflanagan8That looks like a real failure related to the Standard profile recently being changed to use Olivero:
I'll dig in.
Comment #8
danflanagan8Here's the story. Olivero uses a
divinstead of anarticleto render media. So I made that little swap inMediaStandardProfileTest.But why didn't this fail everywhere else once standard started using Olivero? It's because elsewhere
MediaStandardProfileTeststill declares Classy to be the defaultTheme and that value is honored even when the standard profile is used. But our patch here is removing the defaultTheme declaration such that we are relying on the theme in the standard profile. Which is now Olivero.Comment #10
nod_That checks out, classy is still used in the media_library module but that's out of scope here I'd say.
The various xpath expressions/css selectors changes make sense to me.
Comment #11
nod_10.0.x version
Comment #12
danflanagan8Thanks for the review, @nod_!
And you beat me to noting the need for a reroll. That's because of this issue: #3271057: Move Media Library CKEditor 4 integrations from Media into CKEditor
That was fixed in 9.5.x, so I suspect the patch won't apply to D9.5.x either. I'll queue that up to confirm but I'm pretty sure. Adding the Need reroll tag and setting to NW.
Comment #13
danflanagan8I queued the patch in #11 up with 9.5. Back to NR. Sorry for the simul-posting confusion.
Comment #14
nod_all green :)
Comment #15
nod_Just applied the patch to the new branch, didn't touch at the logic :)
Comment #19
lauriiiCommitted 1f14841 and pushed to 10.1.x. Also cherry-picked to 10.0.x and 9.5.x. Thanks!