3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-08-18 03:06:23 +00:00

Fixed flappy test

Hard-coded the values, as it was failing with name of “Gene”, because it was finding that on “Generate Password”.
This commit is contained in:
snipe
2026-08-02 12:58:08 +01:00
parent 5d36aef1d2
commit d10f37c12c

View File

@ -9,7 +9,18 @@ class ShowModalsTest extends TestCase
{
public function test_user_modal_renders()
{
$admin = User::factory()->createUsers()->create();
// Force distinctive attribute values here rather than accepting the
// Faker defaults. assertDontSee does a substring check on the entire
// response body, so a Faker-generated first name of "Gene" collides
// with legitimate modal text like "Generate Password" and produces a
// false-positive failure. The strings below cannot appear inside any
// translated label, class name, or DOM attribute in the modal.
$admin = User::factory()->createUsers()->create([
'first_name' => 'ZzModalTestFirst',
'last_name' => 'ZzModalTestLast',
'email' => 'zz-modal-test@example.invalid',
]);
$response = $this->actingAs($admin)
->get('modals/user')
->assertOk();