2016-03-25 01:18:05 -07:00
|
|
|
<?php
|
|
|
|
$I = new AcceptanceTester($scenario);
|
|
|
|
AcceptanceTester::test_login($I);
|
|
|
|
$I->am('logged in user');
|
|
|
|
$I->wantTo('ensure that the users listing page loads without errors');
|
|
|
|
$I->lookForwardTo('seeing it load without errors');
|
|
|
|
$I->amOnPage('/admin/users');
|
|
|
|
//$I->waitForJS("return $.active == 0;", 60);
|
|
|
|
//$I->waitForElement('.table', 5); // secs
|
|
|
|
//$I->seeNumberOfElements('tr', [1,10]);
|
|
|
|
$I->seeInTitle('Users');
|
|
|
|
$I->see('Users');
|
|
|
|
$I->seeInPageSource('admin/users/create');
|
|
|
|
$I->dontSee('Users', '.page-header');
|
|
|
|
$I->see('Users', 'h1.pull-left');
|
|
|
|
$I->seeLink('Create New','/admin/users/create'); // matches <a href="/logout">Logout</a>
|
|
|
|
|
|
|
|
|
|
|
|
/* Create form */
|
|
|
|
$I->am('logged in admin');
|
|
|
|
$I->wantTo('ensure that you get errors when you submit an incomplete form');
|
|
|
|
$I->lookForwardTo('seeing errors display');
|
|
|
|
$I->click(['link' => 'Create New']);
|
2016-05-31 21:16:30 -07:00
|
|
|
$I->amOnPage('admin/users/create');
|
2016-03-25 01:18:05 -07:00
|
|
|
$I->dontSee('Create User', '.page-header');
|
|
|
|
$I->see('Create User', 'h1.pull-left');
|
|
|
|
|
|
|
|
/* Submit form and expect errors */
|
|
|
|
$I->click(['name' => 'email']);
|
2016-05-31 21:16:30 -07:00
|
|
|
$I->submitForm('#userForm', [
|
2016-03-25 01:18:05 -07:00
|
|
|
'email' => 'me@example.com',
|
|
|
|
]);
|
|
|
|
$I->seeElement('.alert-danger');
|
|
|
|
$I->dontSeeInSource('<br><');
|
|
|
|
|
|
|
|
|
|
|
|
/* Submit form and expect errors */
|
|
|
|
$I->click(['name' => 'email']);
|
|
|
|
$I->click(['name' => 'username']);
|
2016-05-31 21:16:30 -07:00
|
|
|
$I->submitForm('#userForm', [
|
|
|
|
'email' => \App\Helpers\Helper::generateRandomString(15).'@example.com',
|
2016-03-25 01:18:05 -07:00
|
|
|
'first_name' => 'Joe',
|
|
|
|
'last_name' => 'Smith',
|
2016-05-31 21:16:30 -07:00
|
|
|
'username' => \App\Helpers\Helper::generateRandomString(15),
|
2016-03-25 01:18:05 -07:00
|
|
|
]);
|
|
|
|
|
|
|
|
$I->seeElement('.alert-danger');
|
|
|
|
$I->dontSeeInSource('<br><');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Submit form and expect success */
|
|
|
|
$I->wantTo('submit the form successfully');
|
|
|
|
$I->click(['name' => 'email']);
|
|
|
|
$I->fillField(['name' => 'email'], \App\Helpers\Helper::generateRandomString(15).'@example.com');
|
|
|
|
$I->fillField(['name' => 'first_name'], 'Joe');
|
|
|
|
$I->fillField(['name' => 'last_name'], 'Smith');
|
|
|
|
$I->click(['name' => 'username']);
|
|
|
|
$I->fillField(['name' => 'username'], \App\Helpers\Helper::generateRandomString(15));
|
|
|
|
$I->click(['name' => 'password']);
|
|
|
|
$I->fillField(['name' => 'password'], 'password');
|
|
|
|
$I->click(['name' => 'password_confirm']);
|
|
|
|
$I->fillField(['name' => 'password_confirm'], 'password');
|
|
|
|
$I->click('Save');
|
|
|
|
$I->seeElement('.alert-success');
|
|
|
|
$I->dontSeeInSource('<br><');
|