- 🇬🇧United Kingdom jonathan1055
Added CR link and preview/snippet to the issue summary.
While working on 📌 [meta] Update tests that rely on Classy to not rely on it anymore Fixed it has become clear that there are many assertions in Functionl/Functional JS tests related to status messages, and they are written many different ways. Most of them depend on Classy being the theme. For example:
$this->assertSession()->elementNotExists('xpath', '//div[contains(@class, "messages--error")]');
$xpath_err = '//div[contains(@class, "error")]';
$this->assertNotEmpty($this->xpath($xpath_err), 'Enabling translation only for entity bundles generates a form error.');
$this->assertSession()->elementNotExists('xpath', '//div[contains(@class, "messages--status")]');
$this->assertSession()
->elementContains('css', '.messages--warning', node_get_type_label($node) . ' content items were skipped as they are under moderation and may not be directly published.');
And a couple examples from Functional JS tests where we wait for messages.
$assert_session->assertNoElementAfterWait('css', '.messages--warning');
// Check that the 'content has been updated' message status appears to confirm we left the editor.
$assert_session->waitForElementVisible('css', 'messages messages--status');
Make assertions of Status Messages more consistent and manageable by introducing an AssertStatusMessageTrait
that can be used in Functional/Function JS tests.
The methods should be:
each accepting optional $type and $message parameters.
/**
* Whatever this method does.
*
* @param string|null $type
* The optional message type: status, error, or warning.
* @param string|null $message
* The optional message or partial message to assert.
*/
After getting the Trait into the codebase, the Trait can then be used to make 📌 [meta] Update tests that rely on Classy to not rely on it anymore Fixed much smoother.
Another possibility, brought up in #28 is to add methods to WebAssert/JsWebAssert instead of making new traits.
Etc
None
New trait for tests, but essentially none
None
WebAssert
and JsWebAssert
have new methods that can be used to assert the presence or absence of status messages during Functional and FunctionalJavascript tests. The full Change Record is
https://www.drupal.org/node/3270424 →
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Added CR link and preview/snippet to the issue summary.