1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Profile settings: Updating billing address

This commit is contained in:
Benjamin Beganović 2021-07-06 15:28:55 +02:00
parent 3ee859a258
commit a716330bcb
2 changed files with 46 additions and 5 deletions

View File

@ -6,7 +6,7 @@
</div> </div>
</div> </div>
<div class="mt-5 md:mt-0 md:col-span-2"> <div class="mt-5 md:mt-0 md:col-span-2">
<form wire:submit.prevent="submit" method="POST" id="update_contact"> <form wire:submit.prevent="submit" method="POST" id="update_billing_address">
@csrf @csrf
<div class="px-4 py-5 bg-white sm:p-6"> <div class="px-4 py-5 bg-white sm:p-6">
<div class="grid grid-cols-6 gap-6"> <div class="grid grid-cols-6 gap-6">

View File

@ -69,8 +69,7 @@ class ProfileSettingsTest extends DuskTestCase
->press('Save'); ->press('Save');
}) })
->pause(2000) ->pause(2000)
->refresh() ->refresh();
->pause(2000);
$updated = [ $updated = [
'name' => $browser->value('#client_name'), 'name' => $browser->value('#client_name'),
@ -110,8 +109,7 @@ class ProfileSettingsTest extends DuskTestCase
->click('button[data-ref="update-contact-details"]'); ->click('button[data-ref="update-contact-details"]');
}) })
->pause(2000) ->pause(2000)
->refresh() ->refresh();
->pause(2000);
$updated = [ $updated = [
'first_name' => $browser->value('#contact_first_name'), 'first_name' => $browser->value('#contact_first_name'),
@ -123,4 +121,47 @@ class ProfileSettingsTest extends DuskTestCase
$this->assertSame($original, $updated); $this->assertSame($original, $updated);
}); });
} }
public function testBillingAddressUpdate()
{
$original = [
'street' => $this->faker->streetName,
'apt' => $this->faker->streetAddress,
'city' => $this->faker->city,
'state' => $this->faker->state,
'postal_code' => $this->faker->postcode,
];
$this->browse(function (Browser $browser) use ($original) {
$browser
->visitRoute('client.invoices.index')
->click('button[data-ref="client-profile-dropdown"]')
->click('a[data-ref="client-profile-dropdown-settings"]')
->waitForText('Client Information');
$browser
->with('#update_billing_address', function (Browser $form) use ($original) {
$form
->type('#address1', $original['street'])
->type('#address2', $original['apt'])
->type('#city', $original['city'])
->type('#state', $original['state'])
->type('#postal_code', $original['postal_code'])
->select('#country')
->press('Save');
})
->pause(1000)
->refresh();
$updated = [
'street' => $browser->value('#address1'),
'apt' => $browser->value('#address2'),
'city' => $browser->value('#city'),
'state' => $browser->value('#state'),
'postal_code' => $browser->value('#postal_code'),
];
$this->assertSame($original, $updated);
});
}
} }