Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Convert forum tests to be based on BTB instead of WTB
Child of #2735005: Convert all Simpletest web tests to BrowserTestBase (or UnitTestBase/KernelTestBase)
Comment | File | Size | Author |
---|---|---|---|
#54 | interdiff-52-54.txt | 375 bytes | tameeshb |
#54 | 2737805-54.patch | 6.9 KB | tameeshb |
#52 | 2737805-52.patch | 7.43 KB | jofitz |
#20 | browsertest-forum-2737805-20.patch | 8.53 KB | klausi |
Comments
Comment #2
larowlanwip
one gnarly issue seems that submitting the admin/modules page kicks the session in the test
Comment #3
larowlanStill to do - fix uninstall test (logs out user)
Finish ForumTest (only one method done so far)
More tomorrow
Comment #5
dawehnerNote: the other issue adds assertLink or something similar
This is confusing, can't phpstorm figure that out on its own?
I'm wondering the reason to change that. I agree that using APIs in tests is potentially problematic, so is that the reason to change it?
Let's ensure to add this to the webassert
Comment #6
klausi@larowlan: I can't reproduce the problems with the module install page in ForumUninstallTest. Attached is a conversion that works for me, based on #2735045: Convert StandardTest to BrowserTestBase by introducing a AssertLegacyTrait and new assertions on the WebAssert.
Comment #7
larowlanThanks @klausi - looks good to me
Comment #8
larowlanfwiw I couldn't reproduce the uninstall test issues either (nor did my patch above)
Comment #9
klausiMy patch is incomplete because it converts only the uninstall test.
Comment #10
larowlanOh, I thought you added on top of mine, will continue with this in the morning
Comment #11
klausiComment #12
klausiBorrowed some helper methods from #2750941: Additional BC assertions from WebTestBase to BrowserTestBase.
Converted 2 more forum tests, currently failing at asserting cache tags in HTTP headers.
Comment #14
klausiCacheability headers for debugging were not set in BrowserTestBase.
Still a couple of old simpletests to go.
Comment #15
klausiConverted all but one test - the Views test, which depends on #2747167: Convert first part of web tests of views_ui.
Comment #16
dawehnerJust checked, this is synching code from WebTestBase with BrowserTestBase. Perfect.
So let's skip using the casting?
Nitick: NULL :)
Comment #17
klausiWe should probably spin out the BrowserTestBase fix into its own issue: #2751875: BrowserTestBase must enable cache tags in responses
Comment #18
klausiRerolled, merged in #2750941: Additional BC assertions from WebTestBase to BrowserTestBase (see that issue for interdiff).
Comment #19
larowlanis the 6 6 right here?
Other than that, looks great - we just need the other issues to go in now
Comment #20
klausiYes, the "6 6" is right here, added a comment.
The Forum Views test is still missing, but we can skip that until #2747167: Convert first part of web tests of views_ui is done.
Comment #21
dawehnerShould we in general try to reuse existing instances of the assertSession objects?
Comment #22
klausiI think that is up to the taste of the patch author. I'm using $this->assertSession() always in this patch to have a better diff what lines have been replaced with what.
Comment #23
dawehnerFair point!
Comment #24
alexpottCommitted and pushed 57432ad42187bfce6e2f82709ee6a7e979e626fb to 8.2.x and 3e86a03 to 8.1.x. Thanks!
Comment #27
klausiThanks for this first step, this is now postponed on #2747167: Convert first part of web tests of views_ui for the remaining Views integration test.
Comment #28
alexpott@klausi we don't reuse issues because that messes up credit and reporting etc. We just can have another issue.
Comment #31
xjmUnfortunately I've had to revert this conversion. It introduced a high rate of random failures for this test group on Postgres, especially on 8.2.x and PHP 7 (although the fails also occur with Postgres on 8.1.x and on PHP 5.5 at a lower rate). See #2776269: High random fail rate in BTB forum tests on Postgres (especially, but not only, with PHP7).
The fails do not seem to occur when the test group is run by itself, only when the full test suite is run together. This suggests that the bug may not actually be introduced by these tests themselves, but that they are exposing an existing bug in the BTB test runner and/or with DrupalCI. However, the very high random fail rate will make it virtually impossible to catch any actual Postgres regression from another patch. Since this patch is not fixing any bug, we'll unfortunately need to block or postpone this conversion on resolving the underlying issue.
The test results on #2776269: High random fail rate in BTB forum tests on Postgres (especially, but not only, with PHP7) can be a starting point. Hopefully someone with more experience with BTB, Postgres, or DrupalCI can debug further to narrow down what the actual bug is.
Comment #32
xjmPostponing explicitly on that, although we should see if we can move this into larger, conceptually scoped conversions.
Comment #36
dawehnerWe figured out the reason, let's get back on track, see #2776269: High random fail rate in BTB forum tests on Postgres (especially, but not only, with PHP7)
Comment #37
dawehnerBack to RTBC
Comment #38
klausiWe need to wait for #2771547: In Browser and FunctionalJavascript tests SIMPLETEST_USER_AGENT cookie needs to be set every 5 seconds, otherwise we will get random fails on Postgres again.
Comment #39
dawehnerThat one got committed
Comment #40
alexpott#2735005: Convert all Simpletest web tests to BrowserTestBase (or UnitTestBase/KernelTestBase) has not decided the plan yet.
Comment #41
klausiunpostponing, see #2735005-131: Convert all Simpletest web tests to BrowserTestBase (or UnitTestBase/KernelTestBase)
Comment #43
klausiRandom test fail, back to needs review.
Comment #44
dawehnerThis issue should try to leverage the forward compatibility layer #2809181: Provide forward compatibility layer for BrowserTestBase::xpath
Comment #48
klausiThis needs a reroll.
Comment #49
naveenvalechaComment #50
jofitz CreditAttribution: jofitz at ComputerMinds commentedRe-roll.
Comment #51
klausiIt looks like you forgot to move the files to the tests directory.
Comment #52
jofitz CreditAttribution: jofitz at ComputerMinds commentedSorry, I'm obviously not concentrating enough today!
Here's the re-roll with the files moved.
Comment #53
klausiunrelated change that is not needed. This file has already been moved.
Otherwise looks good to me. The only remaining old test in forum module is for Views, which is blocked on #2747167: Convert first part of web tests of views_ui and we decided to convert that one later.
Comment #54
tameeshb CreditAttribution: tameeshb at Google Summer of Code commentedChange mentioned in #53 reverted.
Comment #55
claudiu.cristeaReviewed, this looks good now.
Comment #56
alexpottCommitted and pushed 7c5c3fd to 8.4.x and 9d97196 to 8.3.x. Thanks!
Let's hope we truly have fixed the random errors that this original conversion caused. Committed to 8.3.x too to keep tests inline.