Fix Functional Tests.

This commit is contained in:
Daniel Meltzer 2020-04-28 11:31:30 -04:00
parent bb50828ca0
commit 05187eb27f
No known key found for this signature in database
GPG key ID: 91C5C7B09A5B1CA0
5 changed files with 12 additions and 8 deletions

View file

@ -802,4 +802,4 @@ class AssetsController extends Controller
return view('hardware/requested', compact('requestedItems'));
}
}
}

View file

@ -22,8 +22,11 @@ class AssetsCest
public function failsEmptyValidation(FunctionalTester $I)
{
$I->wantTo("Test Validation Fails with blank elements");
$I->amOnPage(route('hardware.create'));
// Settings factory can enable auto prefixes, which generate a random asset id. Lets clear it out for the sake of this test.
$I->fillField('#asset_tag', '');
$I->click('Save');
$I->see('The asset tag field is required.', '.alert-msg');
$I->see('The model id field is required.', '.alert-msg');
@ -40,7 +43,7 @@ class AssetsCest
]);
$userId = $I->getUserId();
$values = [
'asset_tag' => $asset->asset_tag,
'asset_tags[1]' => $asset->asset_tag,
'assigned_user' => $userId,
'company_id' => $asset->company_id,
'model_id' => $asset->model_id,
@ -51,7 +54,7 @@ class AssetsCest
'purchase_date' => '2016-01-01',
'requestable' => $asset->requestable,
'rtd_location_id' => $asset->rtd_location_id,
'serial' => $asset->serial,
'serials[1]' => $asset->serial,
'status_id' => $asset->status_id,
'supplier_id' => $asset->supplier_id,
'warranty_months' => $asset->warranty_months,
@ -67,7 +70,7 @@ class AssetsCest
'notes' => $asset->notes,
'order_number' => $asset->order_number,
'purchase_cost' => $asset->purchase_cost,
'purchase_date' => Carbon::parse('2016-01-01'),
'purchase_date' => '2016-01-01',
'requestable' => $asset->requestable,
'rtd_location_id' => $asset->rtd_location_id,
'serial' => $asset->serial,
@ -80,7 +83,7 @@ class AssetsCest
$I->amOnPage(route('hardware.create'));
$I->submitForm('form#create-form', $values);
$I->seeRecord('assets', $seenValues);
$I->dontSeeElement('.alert-danger'); // We should check for success, but we can't because of the stupid ajaxy way I did things. FIXME when the asset form is rewritten.
$I->seeResponseCodeIs(200);
}
public function allowsDelete(FunctionalTester $I)

View file

@ -39,10 +39,10 @@ class GroupsCest
$I->wantTo("Test Validation Fails with short name");
$I->amOnPage(route('groups.create'));
$I->seeResponseCodeIs(200);
$I->fillField('name', '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 name must be at least 2 characters', '.alert-msg');
}
public function passesCorrectValidation(FunctionalTester $I)

View file

@ -42,7 +42,7 @@ class UsersCest
$I->fillField('password', '12345');
$I->click('Save');
$I->seeElement('.alert-danger');
$I->see('The password must be at least 10 characters', '.alert-msg');
$I->see('The password must be at least 8 characters', '.alert-msg');
}
public function passesCorrectValidation(FunctionalTester $I)

View file

@ -13,6 +13,7 @@ class LocationTest extends BaseTest
protected $tester;
public function testPassesIfNotSelfParent() {
$this->createValidLocation(['id' => 10]);
$a = factory(Location::class)->make([
'name' => 'Test Location',