23.02.2015 Views

www.it-ebooks.info

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Testing and Qual<strong>it</strong>y Assurance<br />

}<br />

// Go to the Login page<br />

$loginUrl = $this->find('css', 'ul.links li.last a');<br />

if ($loginUrl) {<br />

$this->vis<strong>it</strong>($loginUrl->getAttribute('href'));<br />

}<br />

$login = $this->find('css', '#email');<br />

$pwd = $this->find('css', '#pass');<br />

$subm<strong>it</strong> = $this->find('css', '#send2');<br />

if ($login && $pwd && $subm<strong>it</strong>) {<br />

$email = 'user@example.com';<br />

$password = 'password';<br />

$this->output(sprintf("Try to authenticate '%s' w<strong>it</strong>h<br />

password '%s'", $email, $password));<br />

$login->setValue($email);<br />

$pwd->setValue($password);<br />

$subm<strong>it</strong>->click();<br />

$this->attempt(<br />

$this->find('css', 'div.welcome-msg'),<br />

'Customer successfully logged in',<br />

'Error authenticating customer'<br />

);<br />

}<br />

a');<br />

// Go to the category page<br />

$this->output($this->bold('Go to the category list'));<br />

$this->vis<strong>it</strong>($category->getAttribute('href'));<br />

$product = $this->find('css', '.category-products li.first<br />

if (!$product) {<br />

return false;<br />

}<br />

// Go to product view<br />

$this->output($this->bold('Go to product view'));<br />

$this->vis<strong>it</strong>($product->getAttribute('href'));<br />

$form = $this->find('css', '#product_registry_form');<br />

if ($form) {<br />

$addToCartUrl = $form->getAttribute('action');<br />

$this->vis<strong>it</strong>($addToCartUrl);<br />

$this->attempt(<br />

[ 210 ]<br />

<strong>www</strong>.<strong>it</strong>-<strong>ebooks</strong>.<strong>info</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!