Tests updated for #3066

This commit is contained in:
snipe 2016-12-15 15:14:00 -08:00
parent ad1bf86a08
commit 816affc83b
8 changed files with 27 additions and 29 deletions

View file

@ -7,3 +7,11 @@ DB_DATABASE=snipeittests
DB_USERNAME=snipeit
DB_PASSWORD=snipe
APP_KEY=base64:tu9NRh/a6+dCXBDGvg0Gv/0TcABnFsbT4AKxrr8mwQo=
# --------------------------------------------
# OPTIONAL: LOGIN THROTTLING
# (LOGIN_LOCKOUT_DURATIONin minutes)
# --------------------------------------------
LOGIN_MAX_ATTEMPTS=1000000
LOGIN_LOCKOUT_DURATION=100000000

View file

@ -6,7 +6,7 @@
class_name: FunctionalTester
modules:
enabled:
enabled:
# add framework module here
- \Helper\Functional
- Laravel5:
@ -14,8 +14,8 @@ modules:
cleanup: false
- Db:
dsn: 'mysql:host=localhost;dbname=snipeittests'
user: 'snipeit'
password: 'snipe'
user: 'snipeit_laravel'
password: ''
dump: tests/_data/dump.sql
populate: true
cleanup: false

View file

@ -16,7 +16,7 @@ class AccessoriesCest
{
$I->wantTo('ensure that the create accessories form loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->amOnPage('/admin/accessories/create');
$I->amOnPage('/accessories/create');
$I->dontSee('Create Accessory', '.page-header');
$I->see('Create Accessory', 'h1.pull-left');
}
@ -24,7 +24,7 @@ class AccessoriesCest
public function failsEmptyValidation(FunctionalTester $I)
{
$I->wantTo("Test Validation Fails with blank elements");
$I->amOnPage('/admin/accessories/create');
$I->amOnPage('/accessories/create');
$I->click('Save');
$I->seeElement('.alert-danger');
$I->see('The name field is required.', '.alert-msg');
@ -35,7 +35,7 @@ class AccessoriesCest
public function failsShortValidation(FunctionalTester $I)
{
$I->wantTo("Test Validation Fails with short name");
$I->amOnPage('/admin/accessories/create');
$I->amOnPage('/accessories/create');
$I->fillField('name', 't2');
$I->fillField('qty', '-15');
$I->fillField('min_amt', '-15');
@ -64,7 +64,7 @@ class AccessoriesCest
];
$I->wantTo("Test Validation Succeeds");
$I->amOnPage('/admin/accessories/create');
$I->amOnPage('/accessories/create');
$I->submitForm('form#create-form', $values);
$I->seeRecord('accessories', $values);

View file

@ -57,7 +57,7 @@ class AssetModelsCest
{
$I->wantTo('Ensure I can delete an asset model');
// 6 is the only one without an assigned asset. This is fragile.
$I->amOnPage(route('delete/model', $I->getEmptyModelId()));
$I->amOnPage(route('models.destroy', $I->getEmptyModelId()));
$I->seeElement('.alert-success');
}

View file

@ -15,7 +15,7 @@ class AssetsCest
{
$I->wantTo('ensure that the create assets form loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->amOnPage('/hardware/create');
$I->amOnPage(route('hardware.create'));
$I->dontSee('Create Asset', '.page-header');
$I->see('Create Asset', 'h1.pull-left');
}
@ -51,6 +51,7 @@ class AssetsCest
'rtd_location_id' => $asset->rtd_location_id,
'requestable' => $asset->requestable,
];
print_r($values);
$I->wantTo("Test Validation Succeeds");
$I->amOnPage(route('hardware.create'));
$I->submitForm('form#create-form', $values);
@ -61,8 +62,7 @@ class AssetsCest
public function allowsDelete(FunctionalTester $I)
{
$I->wantTo('Ensure I can delete an asset');
$I->amOnPage(route('delete/hardware', $I->getAssetId()));
$I->amOnPage(route('hardware.destroy', $I->getAssetId()));
$I->seeElement('.alert-success');
}
}

View file

@ -62,7 +62,7 @@ class ConsumablesCest
'min_amt' => $consumable->min_amt,
];
$I->wantTo("Test Validation Succeeds");
$I->amOnPage(route('consumables.index'));
$I->amOnPage(route('consumables.create'));
$I->submitForm('form#create-form', $values);
$I->seeRecord('consumables', $values);
$I->seeElement('.alert-success');

View file

@ -18,7 +18,7 @@ class licensesCest
{
$I->wantTo('ensure that the create licenses form loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->amOnPage(route('create/licenses'));
$I->amOnPage(route('licenses.create'));
$I->dontSee('Create License', '.page-header');
$I->see('Create License', 'h1.pull-left');
}
@ -26,25 +26,22 @@ class licensesCest
public function failsEmptyValidation(FunctionalTester $I)
{
$I->wantTo("Test Validation Fails with blank elements");
$I->amOnPage(route('create/licenses'));
$I->amOnPage(route('licenses.create'));
$I->click('Save');
$I->seeElement('.alert-danger');
$I->see('The name field is required.', '.alert-msg');
$I->see('The serial field is required.', '.alert-msg');
$I->see('The seats field is required.', '.alert-msg');
}
public function failsShortValidation(FunctionalTester $I)
{
$I->wantTo("Test Validation Fails with short name");
$I->amOnPage(route('create/licenses'));
$I->amOnPage(route('licenses.create'));
$I->fillField('name', 't2');
$I->fillField('serial', '13a-');
$I->fillField('seats', '-15');
$I->click('Save');
$I->seeElement('.alert-danger');
$I->see('The name must be at least 3 characters', '.alert-msg');
$I->see('The serial must be at least 5 characters', '.alert-msg');
$I->see('The seats must be at least 1', '.alert-msg');
}
@ -72,7 +69,7 @@ class licensesCest
];
$I->wantTo("Test Validation Succeeds");
$I->amOnPage(route('create/licenses'));
$I->amOnPage(route('licenses.create'));
$I->submitForm('form#create-form', $values);
$I->seeRecord('licenses', $values);
$I->dontSee('<span class="');
@ -82,7 +79,7 @@ class licensesCest
public function allowsDelete(FunctionalTester $I)
{
$I->wantTo('Ensure I can delete a license');
$I->amOnPage(route('delete/license', License::doesntHave('assignedUsers')->first()->id));
$I->amOnPage(route('licenses.destroy', License::doesntHave('assignedUsers')->first()->id));
$I->seeElement('.alert-success');
}

View file

@ -38,17 +38,10 @@ class LocationsCest
{
$I->wantTo("Test Validation Fails with short values");
$I->amOnPage(route('create/location'));
$I->fillField('name', 't2');
$I->fillField('address', 't2da');
$I->fillField('city', 't2');
$I->fillField('state', 't');
$I->fillField('zip', 't2');
$I->fillField('name', 't');
$I->click('Save');
$I->seeElement('.alert-danger');
$I->see('The name must be at least 3 characters', '.alert-msg');
$I->see('The address must be at least 5 characters', '.alert-msg');
$I->see('The city must be at least 3 characters', '.alert-msg');
$I->see('The zip must be at least 3 characters', '.alert-msg');
$I->see('The name must be at least 2 characters', '.alert-msg');
}
public function passesCorrectValidation(FunctionalTester $I)
{