Currently the markup for messages in administrator looks like:
<div class="alert alert-success">
<h4 class="alert-heading">Message</h4>
<p>Configuration successfully saved.</p>
</div>
There is no easy way with Codeception and Selenium to place a locator for the message in the assertion:
$I->see('Configuration successfully saved.' );
// $I->waitForText('Configuration successfully saved.', 10, '.page-title');
// $I->see('Configuration successfully saved.','h3');
// $I->see('Configuration successfully saved.','#messages'); // with XPath
// $I->see('Configuration successfully saved.','.message'); // with XPath
We could probably add a css class to the messages because missing a xPath locator affects dramatically the performance of the test (see: https://docs.joomla.org/Testing_Joomla_Extensions_with_Codeception#Always_add_xPath_locators_to_your_tests)
Labels |
Added:
?
|
Labels |
Added:
?
|
Labels |
Added:
?
|
I'm just guessing since I know nothing about Codeception, can you use the system-message-container
div ID that the messages are wrapped in? You should have something like this for the full container:
<div id="system-message-container">
<button type="button" class="close" data-dismiss="alert">×</button>
<div class="alert alert-success">
<h4 class="alert-heading">Message</h4>
<p>Configuration successfully saved.</p>
</div>
</div>
Then you should be able to do some sort of an advanced xpath using div#system-message-container div.alert-success p
Thanks Michael. Yup! you are right. That option is always there but the idea is that with a few tweaks in the Template (for example using more IDs properly) we can make the work of creating the system test much easier.
I plan to create several issues like this so we can review all them afterwards when we consider reviewing the admin template for 3.5
Not 100% sure but it might be worth adding in an alert tag as well
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_alert_role
Category | ⇒ | Unit Tests |
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-05-30 16:52:33 |
Closed_By | ⇒ | zero-24 |
Closing as we have a RTC PR here: #7070
Status | Closed | ⇒ | New |
Closed_Date | 2015-05-30 16:52:33 | ⇒ | |
Closed_By | zero-24 | ⇒ |
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-05-30 16:58:43 |
Closed_By | ⇒ | zero-24 |