Skip to content

Instantly share code, notes, and snippets.

View ferfabricio's full-sized avatar

Fernando Fabricio dos Santos ferfabricio

View GitHub Profile
@ferfabricio
ferfabricio / TestController.php
Created August 17, 2015 22:14
Example of controller to phalcon forum
<?php
use Phalcon\Mvc\Controller;
class TestController extends Controller
{
public function indexAction() {
//If this controller responds to abc.com/aa/bb/cc
//the $uri value will be: /aa/bb/cc
$uri = $this->request->getURI();
@ferfabricio
ferfabricio / index_step01.js
Last active August 29, 2015 14:27
CasperJS Tutorial - First test case
casper.test.begin('Testing index of blog.fernando.inf.br', 1, function (test){
});
@ferfabricio
ferfabricio / index_step02.js
Last active September 17, 2015 14:14
CasperJS Tutorial
casper.test.begin('Testing index of blog.fernando.inf.br', 1, function (test){
casper.run(function(){
test.done();
});
});
@ferfabricio
ferfabricio / index_step03.js
Last active August 29, 2015 14:27
CasperJS Tutorial
casper.test.begin('Testing index of blog.fernando.inf.br', 1, function (test){
casper.start('http://blog.fabricio.inf.br', function(){
});
casper.run(function(){
test.done();
});
});
@ferfabricio
ferfabricio / index_step04.js
Created August 18, 2015 00:41
CasperJS Tutorial
casper.test.begin('Testing index of blog.fernando.inf.br', 3, function (test){
casper.start('http://blog.fabricio.inf.br', function(){
test.assertHttpStatus(200);
test.assertTitle('Fernando Fabricio');
test.assertEquals(this.getHTML('#header-inner > div.titlewrapper > h1'), "\nFernando Fabricio\n");
});
casper.run(function(){
test.done();
});
<?php
use Phalcon\Mvc\Controller;
use Phalcon\Mvc\View\Simple as SimpleView;
class TestController extends Controller
{
public functino testAction() {
$this->view = new SimpleView();
$this->view->setViewsDir('/your/view/directory');
casper.test.begin('Testing index of blog.fernando.inf.br', 5, function(test) {
casper.start('http://blog.fabricio.inf.br', function() {
test.assertHttpStatus(200);
});
casper.then(function() {
test.assertExists('head > title');
test.assertExists('#header-inner > div.titlewrapper > h1');
});
casper.test.begin('Testing index of blog.fernando.inf.br', 3, function(test) {
casper.start('http://blog.fabricio.inf.br', function() {
test.assertHttpStatus(200);
});
casper.then(function() {
casper.waitForSelector(
'#header-inner > div.titlewrapper > h1',
function then() {
test.assertTitle('Fernando Fabricio');
casper.capture('yourbealtyfullscree.jpg', {
top: 0,
left: 0,
width: 1600,
height: 900
});
@ferfabricio
ferfabricio / index_with_screenshot.js
Created August 20, 2015 16:25
CasperJS Tutorial
casper.test.begin('Testing index of blog.fernando.inf.br', 5, function(test) {
casper.start('http://blog.fabricio.inf.br', function() {
test.assertHttpStatus(200);
});
casper.then(function() {
test.assertExists('head > title');
test.assertExists('#header-inner > div.titlewrapper > h1');
});