I have written an automated test to create a node of a specific content type.
Here is the code:
class GlueTestingBuySystemTestCase extends DrupalWebTestCase {
protected $privileged_user;
public static function getInfo() {
return array(
'name' => 'Buying system',
'description' => 'Buying system test',
'group' => 'GLUE',
);
}
public function setUp() {
$this->profile = 'testing';
// Enable any modules required for the test. This should be an array of
// module names.
parent::setUp(array('glue_testing'));
// Create and log in our privileged user.
$this->privileged_user = $this->drupalCreateUser(array(
'administer nodes',
));
$this->drupalLogin($this->privileged_user);
}
public function testBuyingSystem() {
$edit = array();
$edit['title'] = $this->randomName(8);
$this->drupalPost('node/add/test', $edit, t('Save'));
$this->assertText(t('Test Node Type @title has been created.', array('@title' => $edit['title'])));
}
}
It does appear in the group "GLUE" but when I run the test it gives me the errors:
Failed to set field title to lLzjWnd0
Found the Save button
Found the requested form fields at node/add/test
"Testing Node Type lLzjWnd0 has been created." found
And does not create any node nor created the user. Any one who have idea that what is wrong in my code?