diff --git a/resources/views/portal/ninja2020/profile/settings/personal-address.blade.php b/resources/views/portal/ninja2020/profile/settings/personal-address.blade.php index 53c51709a6..e4b9ffc6e4 100644 --- a/resources/views/portal/ninja2020/profile/settings/personal-address.blade.php +++ b/resources/views/portal/ninja2020/profile/settings/personal-address.blade.php @@ -6,7 +6,7 @@
-
+ @csrf
diff --git a/tests/Browser/ClientPortal/ProfileSettingsTest.php b/tests/Browser/ClientPortal/ProfileSettingsTest.php index 2e5b5bcd71..64f1b9c822 100644 --- a/tests/Browser/ClientPortal/ProfileSettingsTest.php +++ b/tests/Browser/ClientPortal/ProfileSettingsTest.php @@ -69,8 +69,7 @@ class ProfileSettingsTest extends DuskTestCase ->press('Save'); }) ->pause(2000) - ->refresh() - ->pause(2000); + ->refresh(); $updated = [ 'name' => $browser->value('#client_name'), @@ -110,8 +109,7 @@ class ProfileSettingsTest extends DuskTestCase ->click('button[data-ref="update-contact-details"]'); }) ->pause(2000) - ->refresh() - ->pause(2000); + ->refresh(); $updated = [ 'first_name' => $browser->value('#contact_first_name'), @@ -123,4 +121,47 @@ class ProfileSettingsTest extends DuskTestCase $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); + }); + } }