mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Basic (failing) create asset test
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
83449cc246
commit
1a57ce8280
|
@ -82,6 +82,7 @@
|
|||
"nunomaduro/phpinsights": "^2.11",
|
||||
"php-mock/php-mock-phpunit": "^2.10",
|
||||
"phpunit/phpunit": "^10.0",
|
||||
"roquie/laravel-dusk-select2": "^2.1",
|
||||
"squizlabs/php_codesniffer": "^3.5",
|
||||
"symfony/css-selector": "^4.4",
|
||||
"symfony/dom-crawler": "^4.4",
|
||||
|
|
45
composer.lock
generated
45
composer.lock
generated
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "7a5bb887aeb2368dafece0dc0da75738",
|
||||
"content-hash": "a6cc2df01ac4e971aee4100446503331",
|
||||
"packages": [
|
||||
{
|
||||
"name": "alek13/slack",
|
||||
|
@ -15075,6 +15075,49 @@
|
|||
],
|
||||
"time": "2024-06-11T12:45:25+00:00"
|
||||
},
|
||||
{
|
||||
"name": "roquie/laravel-dusk-select2",
|
||||
"version": "2.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/roquie/laravel-dusk-select2.git",
|
||||
"reference": "eb13801b753d77384948b8447ebe82beab76f5c5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/roquie/laravel-dusk-select2/zipball/eb13801b753d77384948b8447ebe82beab76f5c5",
|
||||
"reference": "eb13801b753d77384948b8447ebe82beab76f5c5",
|
||||
"shasum": ""
|
||||
},
|
||||
"require-dev": {
|
||||
"laravel/dusk": "^5 || ^6",
|
||||
"php": ">=7.1",
|
||||
"phpunit/phpunit": "^8 || ^9",
|
||||
"symfony/var-dumper": "^4 || ^5"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/macro.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "roquie",
|
||||
"email": "roquie0@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Select2.js support for the Laravel Dusk testing.",
|
||||
"support": {
|
||||
"issues": "https://github.com/roquie/laravel-dusk-select2/issues",
|
||||
"source": "https://github.com/roquie/laravel-dusk-select2/tree/2.1.0"
|
||||
},
|
||||
"time": "2020-09-03T12:55:45+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/cli-parser",
|
||||
"version": "2.0.1",
|
||||
|
|
47
tests/Browser/CreateAssetTest.php
Normal file
47
tests/Browser/CreateAssetTest.php
Normal file
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Browser;
|
||||
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Laravel\Dusk\Browser;
|
||||
use Tests\DuskTestCase;
|
||||
use App\Models\User;
|
||||
use App\Models\Asset;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class CreateAssetTest extends DuskTestCase
|
||||
{
|
||||
|
||||
public function testUserCanCreateAnAsset(): void
|
||||
{
|
||||
$asset = Asset::factory()->make([
|
||||
]);
|
||||
|
||||
$user = User::factory()->createAssets()->create([
|
||||
'password' => Hash::make('password'),
|
||||
]);
|
||||
|
||||
$this->browse(function (Browser $browser) use ($user, $asset) {
|
||||
$browser->logout();
|
||||
|
||||
$browser->visit('/login')
|
||||
->type('username', $user->username)
|
||||
->type('password', 'password')
|
||||
->press('Login')
|
||||
->visit('/hardware/create')
|
||||
->type('asset_tags[1]', $asset->asset_tag)
|
||||
->select2('#model_select_id', 'Macbook')
|
||||
->waitForText('Macbook Pro')
|
||||
->click('label:first-child') // close the previous select
|
||||
->select2('#status_select_id')
|
||||
->waitForText('Ready to Deploy')
|
||||
->click('label:first-child') // close the previous select
|
||||
->press('Save')
|
||||
->assertPresent('.alert-success')
|
||||
->assertNotPresent('.alert-msg');
|
||||
|
||||
$browser->logout();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue