dimanche 6 novembre 2016

Codeception click not working on jQuery events

What are you trying to achieve?

click on P tag then show next div element I have P tag which has a class "inactive-action"

<p class="inactive-action item list-group-item col-xs-4 col-lg-4">Inactive...</p>
<div class="inactive-items hidden">
</div>

in jQuery

$('.inactive-action').click(function(){ 
var $elem = $(this); 
$elem.next().slideToggle('fast', function() {
  $elem.next().toggleClass('hidden'); 
if(!$elem.next().hasClass('hidden')){ 
     $elem.html('Less...');
} else{   
    $elem.html('Inactive...'); 
} 
});
});

I tried this code both inside ready and out side ready. I tried in console its working fine.

What do you get instead?

click is passing in test but not working as desire means not showing next element when I see in fail screen shot.

Provide console output if related. Use -vvv mode for more details. image

paste output here

Provide test source code if related // paste test

$I = new AcceptanceTester($scenario);
$I->login('Administrator');
$I->wantTo('Restore a problem');
$I->see('Problems');
$I->statusChangeUI(0,$id,'problem');

public function statusChangeUI($type, $id, $name) {
$I->click('p[class^="inactive-action"]');
        $I->waitForElementVisible('.inactive-items',5);
}

Details

Codeception version: ^2.2.1
PHP Version:>=5.2.4
Operating System:windows
Installation type: Composer

List of installed packages (composer show) Suite configuration:

paste suite config here

class_name: AcceptanceTester
modules:
    enabled:
        - WebDriver
        - \Helper\Acceptance
        - Asserts
        - Db
        - DbHelper
    config:
        WebDriver:
            url: 'http://localhost:8080/Unified-Core'
            browser: 'phantomjs'
            window_size: 'maximize'
            restart: true
            clear_cookies: true
            connection_timeout: 60
            request_timeout: 60
        Db:
            dsn: 'mysql:host=localhost;dbname=mydatebase'
            user: 'root'
            password: 'mypasswoer'
            reconnect: true

Aucun commentaire:

Enregistrer un commentaire