156 - Getting Cozy with Stripe Connect

This commit is contained in:
Adam Wathan
2018-01-19 10:44:00 -05:00
parent 10ce7477d9
commit ec1986eb8a
4 changed files with 170 additions and 128 deletions

View File

@@ -0,0 +1,30 @@
<?php
namespace Tests\Browser;
use App\User;
use Tests\DuskTestCase;
use Laravel\Dusk\Browser;
use Illuminate\Foundation\Testing\DatabaseMigrations;
class ConnectWithStripeTest extends DuskTestCase
{
/** @test */
public function connecting_a_stripe_account_successfully()
{
$user = factory(User::class)->create([
'stripe_account_id' => null,
'stripe_access_token' => null,
]);
$this->browse(function (Browser $browser) use ($user) {
$browser->loginAs($user)
->visit('/backstage/stripe-connect/authorize')
->assertUrlIs('https://connect.stripe.com/oauth/authorize')
->assertQueryStringHas('response_type', 'code')
->assertQueryStringHas('scope', 'read_write')
->assertQueryStringHas('client_id', config('services.stripe.client_id'))
;
});
}
}

View File

@@ -3,6 +3,7 @@
namespace Tests;
use Laravel\Dusk\TestCase as BaseTestCase;
use Facebook\WebDriver\Chrome\ChromeOptions;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\Remote\DesiredCapabilities;
@@ -28,8 +29,15 @@ abstract class DuskTestCase extends BaseTestCase
*/
protected function driver()
{
$options = (new ChromeOptions)->addArguments([
'--disable-gpu',
'--headless'
]);
return RemoteWebDriver::create(
'http://localhost:9515', DesiredCapabilities::chrome()
'http://localhost:9515', DesiredCapabilities::chrome()->setCapability(
ChromeOptions::CAPABILITY, $options
)
);
}
}