Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Tests\Browser;
- use Tests\DuskTestCase;
- use Laravel\Dusk\Browser;
- use Illuminate\Foundation\Testing\WithFaker;
- class SubscriptionsTest extends DuskTestCase
- {
- use WithFaker;
- /**
- * A basic browser test example.
- *
- * @return void
- */
- public function testSubscribe()
- {
- $this->browse(function (Browser $browser) {
- $browser->loginAs($this->customer_user)
- ->visit('/settings')
- ->click('a[href="#subscription"]')
- ->click('#subscription .radio-select:nth-child(1)')
- ->assertSee('Billing Information')
- ->type('@subscribeNameInput', $this->faker->name)
- ->type('@addressInput', $this->faker->streetAddress)
- ->type('@address2Input', $this->faker->secondaryAddress)
- ->type('@cityInput', $this->faker->city)
- ->type('@stateInput', $this->faker->stateAbbr)
- ->type('@zipInput', $this->faker->postcode)
- ->select('@countryInput', 'US')
- ->waitFor('#subscription iframe[allowpaymentrequest="true"]', 15);
- $browser->driver->switchTo()->frame($browser->script('return $(\'#subscription iframe[allowpaymentrequest="true"]\').attr("name");')[0]);
- foreach (str_split('4242424242424242') as $char) {
- $browser->append('cardnumber', $char)->pause(100);
- }
- $browser->type('exp-date', '1222')
- ->type('cvc', '123');
- $browser->driver->switchTo()->defaultContent();
- $browser->press('Subscribe')
- ->waitForText('You are currently subscribed', 60)
- ->assertSee('You are currently subscribed');
- });
- }
- }
Add Comment
Please, Sign In to add comment