See #2735005: Convert all Simpletest web tests to BrowserTestBase (or UnitTestBase/KernelTestBase)
These tests depend on assertBlock(Not)Appears which lives on WebTestBase but has no equivalent on BrowserTestBase. These methods have been moved to a trait in the block module since we don't want block specific methods on BrowserTestBase and these methods are not utilised a lot in core.
Blockers:
- #2795085: Add assertNoCacheTag to assertLegacyTrait
Out of Scope:
- All update test for now:
- BlockConditionMissingSchemaUpdateTest.php
- BlockContextMappingUpdateFilledTest.php
- BlockContextMappingUpdateTest.php
- BlockRemoveDisabledRegionUpdateTest.php
Comment | File | Size | Author |
---|---|---|---|
#25 | 2863644-25.patch | 25.41 KB | Lendude |
Comments
Comment #2
jofitz CreditAttribution: jofitz at ComputerMinds commentedComment #4
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedComment #5
zviryatko CreditAttribution: zviryatko as a volunteer and at Adyax commentedComment #6
zviryatko CreditAttribution: zviryatko as a volunteer and at Adyax commentedComment #8
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commented@zviryatko, @Jo Fitzgerald:
Thanks for the start on this issue!
Aside from the CI aborting the following tests failed:
06:50:43 Drupal\Tests\block\Functional\BlockSystemBrandingTest 0 passes 1 fails
06:51:42 Drupal\Tests\block\Functional\BlockCacheTest 0 passes 1 fails
Code review:
Please add the correct documentation indicating the type of variable.
Let's wait untill #2795085: Add assertNoCacheTag to assertLegacyTrait lands and not add the method here.
It's ok to keep it here to get the tests to pass but please note it when posting a patch so everyone know's the intent is to leave it out :)
Comment #9
zviryatko CreditAttribution: zviryatko as a volunteer and at Adyax commented@michielnugter, also I met problem when I extend BrowserTestBase two another test cases fails, but when extend JavascriptTestBase it's ok. That fails is related to block cache and \Drupal::state(), since block plugins from block_test module is depend on \Drupal::state() object, but for BrowserTestBase probably entire page is cached, but still not understand why for JavascriptTestBase it's ok.
Another problem that I met related to cache context, when BlockRepository gets all block per region and check access, the Access object has own cache tags/context/max-age, so BlockCacheTest fails because blockAccess not respect the block cache settings. I can't describe more now, all data on my home pc, I can provide you more info later if needed.
Comment #10
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commented@zviryatko
Not sure either why it would work with the conversion, maybe it has something to do with JavascriptTestBase using an actual browser instead of a simulated one. Let me know which tests and I might be able to help you out.
Not sure on that one, I'm not very deeply familiar with cache tags yet. Let me know which tests are failing on this and I might be able to figure it out, always fun to dive deep into Drupal core :)
Comment #11
naveenvalechaAdding #2795085: Add assertNoCacheTag to assertLegacyTrait as a blocker for this issue.
//Naveen
Comment #12
GoZ CreditAttribution: GoZ at Barbe-Rousse commentedComment #13
dawehnerThis is in, yeah!
Comment #14
dawehnerTests aren't passing right now ...
Comment #15
nlisgo CreditAttribution: nlisgo commentedComment #16
nlisgo CreditAttribution: nlisgo commentedComment #18
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation commentedFor now just getting the patch up to speed, removing
AssertLegacyTrait::assertNoCacheTag()
from this patch, as it was already added in #2795085: Add assertNoCacheTag to assertLegacyTraitComment #20
LendudeTook care of a fail, don't know why CI times out, something in #18 is hanging it.
Deprecated/copied
\Drupal\block\Tests\BlockTestBase
instead of moving.Added a CR, https://www.drupal.org/node/2901823
Moved the Views test.
This will fail because of drupalPostWithFormat
Comment #22
LendudeFixed the fail in \Drupal\Tests\block\Functional\Views\DisplayBlockTest::testBlockContextualLinks by using mink to do the post request.
Created \Drupal\Tests\block\Functional\AssertBlockAppearsTrait to hold the block appears methods, no idea what they were doing on WebTestBase but pretty sure we don't want them on BrowserTestBase and they are used very little in core, so not worth moving to AssertLegacyTrait IMO.
Comment #23
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation commentedThanks @Lendude, I couldnt figure out #18 either...
nitpick, fixable on commit
AssertBlockAppearsTrait seems like a good idea to me, I think #22 is good to go :)
Comment #24
dawehnerWhat about avoiding format_string here and go with
FormattableMarkup instead?
While these changes are of course nice to do, I am wondering whether we should rather target a smaller patch size instead. The previous assertions still pass.
Comment #25
LendudeThanks for the feedback both!
Fixes #23 and #24
Comment #26
dawehnerThank you for reducing the patch size!
Comment #27
Mile23For completeness' sake, linking to a similar issue: #2865336: Add \Drupal\simpletest\WebTestBase::assertBlockAppears to \Drupal\FunctionalTests\AssertLegacyTrait
Comment #29
Anonymous (not verified) CreditAttribution: Anonymous commentedRandom fail #2906317: Random fail due to problems with database.
Comment #30
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedThis is good. Adding
assertBlockAppears
andassertNoBlockAppears
to a Trait in the Block module means that #2865336: Add \Drupal\simpletest\WebTestBase::assertBlockAppears to \Drupal\FunctionalTests\AssertLegacyTrait can be ditched, and #2864088: Convert web tests to browser tests for shortcut module can use the new Block trait.Comment #31
larowlanI'm not sure the word 'Ensure' adds anything here? Can be fixed on commit
Comment #34
larowlanfixed on commit
Committed as 7ba7715 and pushed to 8.5.x
Cherry picked as 4389c91 and pushed to 8.4.x
Published the change record.
Unpostponed the blocked issues.