Last active
August 29, 2015 14:16
-
-
Save ftassi/4d37e52e38713fb20646 to your computer and use it in GitHub Desktop.
PageObjectExampleImplementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BookingPage extends Page | |
{ | |
public function bookAs($firstName, $lastName, $email) | |
{ | |
$bookingForm = $this->find('css', 'form#booking-form'); | |
$bookingForm->fillField('booking[firstName]', $firstName); | |
$bookingForm->fillField('booking[lastName]', $lastName); | |
$bookingForm->fillField('booking[email]', $email); | |
} | |
public function book() | |
{ | |
$this->pressButton('booking-submit-button'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function testTheUserShouldBeAbleToBook() | |
{ | |
//... | |
$page = $mink->getSession()->getPage(); | |
$bookingForm = $page->find('css', 'form#booking-form'); | |
$bookingForm->fillField('booking[firstName]', $firstName); | |
$bookingForm->fillField('booking[lastName]', $lastName); | |
$bookingForm->fillField('booking[email]', $email); | |
$page->pressButton('booking-submit-button'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function testTheUserShouldBeAbleToBook() | |
{ | |
//... | |
$bookingPage = $pageFactory->getPage('booking'); | |
$bookingPage | |
->bookAs($firstName, $lastName, $email) | |
->book(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment