? ?
Referenced as Pull Request for: # 7070
avatar javigomez
javigomez
3 Mar 2015

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>

screen shot 2015-03-03 at 19 34 44

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)

avatar javigomez javigomez - open - 3 Mar 2015
avatar javigomez
javigomez - assign - 3 Mar 2015
Assigned to javigomez
avatar javigomez javigomez - change - 3 Mar 2015
Labels Added: ?
avatar javigomez javigomez - change - 3 Mar 2015
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 3 Mar 2015
Labels Added: ?
avatar mbabker
mbabker - comment - 3 Mar 2015

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">&times;</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

avatar javigomez
javigomez - comment - 3 Mar 2015

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

avatar javigomez
javigomez - comment - 3 Mar 2015

It will also make the logs look nicer, in the following example some elements are easily localizable and don't need XPath and some do (the XPath ones look not that cool):

screen shot 2015-03-03 at 20 26 34

avatar pbwebdev
pbwebdev - comment - 4 Mar 2015

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

avatar zero-24 zero-24 - change - 7 Mar 2015
Category Unit Tests
avatar zero-24 zero-24 - change - 30 May 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-05-30 16:52:33
Closed_By zero-24
avatar zero-24 zero-24 - close - 30 May 2015
avatar zero-24
zero-24 - comment - 30 May 2015

Closing as we have a RTC PR here: #7070


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6285.

avatar joomla-cms-bot joomla-cms-bot - change - 30 May 2015
Status Closed New
Closed_Date 2015-05-30 16:52:33
Closed_By zero-24
avatar joomla-cms-bot joomla-cms-bot - reopen - 30 May 2015
avatar zero-24 zero-24 - change - 30 May 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-05-30 16:58:43
Closed_By zero-24
avatar zero-24 zero-24 - close - 30 May 2015

Add a Comment

Login with GitHub to post a comment