Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/Pages/PaymentMollie.php
Show All 19 Lines | class PaymentMollie extends Page | ||||
* Assert that the browser is on the page. | * Assert that the browser is on the page. | ||||
* | * | ||||
* @param \Laravel\Dusk\Browser $browser The browser object | * @param \Laravel\Dusk\Browser $browser The browser object | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public function assert($browser) | public function assert($browser) | ||||
{ | { | ||||
$browser->waitFor('form#body table, form#body iframe'); | $browser->waitFor('form#body table, form#body iframe', 10); | ||||
} | } | ||||
/** | /** | ||||
* Get the element shortcuts for the page. | * Get the element shortcuts for the page. | ||||
* | * | ||||
* @return array | * @return array | ||||
*/ | */ | ||||
public function elements(): array | public function elements(): array | ||||
Show All 22 Lines | public function submitPayment($browser, $status = 'paid') | ||||
}) | }) | ||||
->withinFrame('#card-holder-name iframe', function ($browser) { | ->withinFrame('#card-holder-name iframe', function ($browser) { | ||||
$browser->type('#cardHolder', 'Test'); | $browser->type('#cardHolder', 'Test'); | ||||
}) | }) | ||||
->withinFrame('#expiry-date iframe', function ($browser) { | ->withinFrame('#expiry-date iframe', function ($browser) { | ||||
$browser->type('#expiryDate', '12/' . (date('y') + 1)); | $browser->type('#expiryDate', '12/' . (date('y') + 1)); | ||||
}) | }) | ||||
->withinFrame('#cvv iframe', function ($browser) { | ->withinFrame('#cvv iframe', function ($browser) { | ||||
$browser->type('#verificationCode', '123'); | $browser->click('#verificationCode')->type('#verificationCode', '123'); | ||||
}) | }) | ||||
->click('#submit-button'); | ->click('#submit-button'); | ||||
} | } | ||||
$browser->waitFor('input[value="' . $status . '"]') | $browser->waitFor('input[value="' . $status . '"]') | ||||
->click('input[value="' . $status . '"]') | ->click('input[value="' . $status . '"]') | ||||
->click('button.form__button'); | ->click('button.form__button'); | ||||
} | } | ||||
} | } |