My Behat Scenario creates new content, successfully simulating every step until the new Node is created. In doing so it navigates through every new page in the regular admin sequence as you'd expect.

But, after the Save button is pressed on /node/add/myContentType, even though the Node is correctly created, the page in the session remains at /node/add/myContentType and doesn't progress to /node/n as happens when done manually.

The scenario is tagged @javascript and I am using phantomjs

I'm baffled as to how to resolve this issue. I've tried adding waits for javascript inactivity. e.g like waiting for batch completion:

$this->getSession()->wait(180000, 'jQuery("#updateprogress").length === 0');

or like waiting for AJAX completion:

$this->getSession()->wait(1000, 'typeof(jQuery)=="undefined" ||
    jQuery("#autocomplete").length === 0');

... but I think waiting is not the issue; more likely to do with the driver?

My workaround is to split this into two Scenarios; the second Scenario navigates explicitly to the newly-created Node. But ideally, to keep things as realistic as possible, I would rather the person writing our test features can do creation and inspection in the same Scenario.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.