You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Functional testing should only be used when directly navigating the page virtually through the testing environment. This is done in Drupal by a collection of Drupal methods and the Behat Mink web driver. Here are the resources I use when figuring out which of the multitude of methods available to me fit my needs:
Note: these links are for a development version of the Drupal api docs since the official site doesn't show all pages well.
BrowserTestBase: This is the class all our Chado functional tests are based off of. As such all of these functions can be used via $this->METHOD().
UiHelperTrait: This class helps with navigating pages and specifically forms. It is included by default in the browser base so all of these functions can be used via $this->METHOD().
WebAssert: This class provides assertions specific to the page. These methods are accessed through the UiHelperTrait::assertSession() as follows $this->assertSession()->METHOD().
FieldUiTestTrait: This class is specifically for testing fields through the UI. I have not tested this approach but want to save it here so I don't lose it. This trait would need to be added to your test class via a use statement.
Behat Mink: Traversing Pages: This documentation shows you how to use the mink browser controller directly to find specific fields. These methods are accessed by using $this->getSession() to get a MinkSession or $this->getSession()->getPage() to get a TraversableElement.
Additionally, here are some examples of functional tests in Drupal that I'm using to piece all this together.
EntityReferenceAdminTest: This is a functional test that walks through a variety of forms while testing the Drupal Entity Reference field.
MediaThumbnailFormatterTest: This is a functional test that creates a Media Reference field programatically and then tests a content edit page, I think? But is from DRUPAL 9
The text was updated successfully, but these errors were encountered:
Functional testing should only be used when directly navigating the page virtually through the testing environment. This is done in Drupal by a collection of Drupal methods and the Behat Mink web driver. Here are the resources I use when figuring out which of the multitude of methods available to me fit my needs:
Note: these links are for a development version of the Drupal api docs since the official site doesn't show all pages well.
$this->METHOD()
.$this->METHOD()
.$this->assertSession()->METHOD()
.$this->getSession()
to get a MinkSession or$this->getSession()->getPage()
to get a TraversableElement.Additionally, here are some examples of functional tests in Drupal that I'm using to piece all this together.
The text was updated successfully, but these errors were encountered: