Problem/Motivation
All the following WTB tests use getRawContent() which doesn't exist in BTB.
AddFeedTest
BigPipeTest
BlockRenderOrderTest
CommentBlockTest
CommentPreviewTest
CommentTestBase
CommentNonNodeTest
CommentTestBase
CommentRestExportTest
CommentUserNameTest
ConfigExportImportUITest
ConfigExportUITest
EditorAdminTest
EditorLoadingTest
ManageDisplayTest
FileListingTest
NumberFieldRdfaTest
StyleSerializerTest
FormTest
ThemeTest
RenderWebTest
SelectPagerDefaultTest
SelectTableSortDefaultTest
TemporaryQueryTest
LanguageSelectElementTest
DestinationTest
SessionAuthenticationTest
SessionTest
ShutdownFunctionsTest
EngineTwigTest
ThemeSuggestionsAlterTest
UpdateContribTest
UserBlocksTest
ViewsFormTest
ItemsPerPageTest
SortingTest
PreviewTest
Proposed resolution
Create getRawContent() in BTB so we can easily convert WTB to BTB as defined in #2735005: Convert all Simpletest web tests to BrowserTestBase (or UnitTestBase/KernelTestBase)
| Comment | File | Size | Author |
|---|---|---|---|
| #29 | interdiff-25-29.txt | 895 bytes | jofitz |
| #29 | wtb_to_btb_add-2795111-29.patch | 1.48 KB | jofitz |
| #25 | interdiff-23-25.txt | 1.89 KB | jofitz |
| #25 | wtb_to_btb_add-2795111-25.patch | 1.48 KB | jofitz |
| #23 | interdiff-21-23.txt | 2.2 KB | jofitz |
Comments
Comment #2
jmuzz commentedSome of these tests already have patches.
AddFeedTest - #2757023: Convert all aggregator web tests to BrowserTestBase
ManageDisplayTest - #2794347: Convert web tests to browser tests for field_ui module
I didn't check all of them.
Comment #3
dawehner@jmuzz
Given the decision which was made in #2735005: Convert all Simpletest web tests to BrowserTestBase (or UnitTestBase/KernelTestBase) we should change things on a per scope bit, not on a per module bit.
Comment #4
jmuzz commentedOk. And a scope I assume is something like "tests using getRawContent()" so the relevant parts of the other patches should be included in a patch for this issue.
Comment #5
dawehnerYeah that would be ideal. We want to not longer to individual conversions, but rather come up with some general pattern of stuff we have to fix.
Comment #6
jmuzz commentedWhat about adding the function to BTB for #2794285: [meta] Add backwards compatibility layer to browsertestbase to ease conversion from webtestcase ? xjm mentioned that before but I don't think it was ever responded to. It seems like it would be a lot faster than converting all the tests manually.
Comment #8
goz commentedComment #9
goz commentedComment #10
goz commentedComment #12
goz commentedFirst test pass. Unassign issue.
Comment #13
goz commentedComment #14
dawehnerShould we mark this method as deprecated already?
Comment #15
claudiu.cristeaPlease see @klausi's comment from #2757023-24: Convert all aggregator web tests to BrowserTestBase:
Comment #16
goz commentedComment #17
goz commentedMove getRawContent() to AssertLegacyTrait and add deprecated message.
Still have to do:
- Discuss if this stay in assertLegacyTrait
- Discuss if we should add a change record and a @trigger.error()
- Add test coverage in BrowserTestBaseTest
Comment #18
claudiu.cristeaComment #19
dawehnerWe should use
trigger_errornow, see https://www.drupal.org/core/deprecationComment #20
klausiThe first line should be "@deprecated Scheduled for removal in Drupal 9.0.0." same as on the other methods here.
Comment #21
jofitzComment #22
klausiThanks, now we need test coverage in BrowserTestBaseTest.
Comment #23
jofitzAdded a test.
Comment #24
klausiI think it is not necessary to add a whole new test method just to call getRawContent(). We can just add a line to testGoTo() like $this->assertSame($this->getSession()->getPage()->getContent(), $this->getRawContent());
That makes sure that the method exists and returns the expected thing without knowing anything about the content.
Comment #25
jofitzI have added your suggested assert to testLegacyTextAsserts() to keep legacy tests separate.
Comment #26
klausiRight, testLegacyTextAsserts() also works for me.
message is wrong, this should say the same as the doc comment.
Comment #27
jofitzThat does not seem to follow the guidelines: https://www.drupal.org/core/deprecation
Comment #28
klausiSorry, I meant that "$this->assertSession()->buildXPathQuery()" is wrong in the message. This should be "$this->getSession()->getPage()->getContent()".
Comment #29
jofitzI don't know where that came from!
copy_paste--
Comment #30
claudiu.cristeaLooks ready. We need it :)
Comment #31
alexpottCommitted and pushed 1e56b1f to 8.4.x and e425b10 to 8.3.x. Thanks!