Skip to content

Instantly share code, notes, and snippets.

View DavertMik's full-sized avatar
🤓
developing codeception & codeceptjs

Michael Bodnarchuk DavertMik

🤓
developing codeception & codeceptjs
View GitHub Profile
@DavertMik
DavertMik / gist:3684798
Created September 9, 2012 14:45
XPath dsl in Codeception RFC
<?php
XPath::descendant('p')[1]; //
XPath::descendant('p', array('@id' => 'xxx')); // .//p[@id = 'foo']
XPath::descendant('a', array('href'))->OR(XPath::attrEquals('id', $locator), XPath::contains($locator), XPath::descendant('img')->attrContains('alt', $locator));
XPath::descendant('input', array('type' => 'radio'));
XPath::descendant('table')->or(array('id' => $locator, XPath::descendant('caption')->contains($locator));
// .//input[@id=//label[contains(.,'My Label')]/@for]
XPath::descendant('input')->attrEquals('id', XPath::anywhere('label')->contains($label)->attr('for'));
@DavertMik
DavertMik / gist:3796226
Created September 27, 2012 20:19
Codeception RFC - Herkin language =)

Herkin new awesome language for writing tests RFC

Action

PHP

$I->click('Hello');
@DavertMik
DavertMik / Bugira.user.js
Created October 3, 2012 22:28 — forked from bebraw/Bugira.user.js
Bugira user script (expects jQuery to be found)
// ==UserScript==
// @name Bugira Script
// @namespace http://use.i.E.your.homepage/
// @version 0.55
// @description injects bugira script
// @match http://jswiki.codegyre.com/*
// @copyright 2012+, You
// ==/UserScript==
// http://stackoverflow.com/questions/2246901/how-can-i-use-jquery-in-greasemonkey-scripts-in-google-chrome
@DavertMik
DavertMik / gist:3905959
Created October 17, 2012 14:54
Codeception Log
[2012-09-26 12:32:01] LoginCept.php.INFO: click "Login" [] []
[2012-09-26 12:32:01] LoginCept.php.INFO: fill field "Username","jon" [] []
[2012-09-26 12:32:01] LoginCept.php.INFO: fill field "Password","gfhjkm" [] []
[2012-09-26 12:32:01] LoginCept.php.INFO: click "sign in" [] []
[2012-09-26 12:32:02] LoginCept.php.INFO: see "jon",".navbar" [] []
[2012-09-26 12:32:02] LoginCept.php.INFO: PASSED [] []
[2012-09-26 12:32:09] LoginCept.php.INFO: click "Login" [] []
[2012-09-26 12:32:09] LoginCept.php.INFO: fill field "Username","jon" [] []
[2012-09-26 12:32:09] LoginCept.php.INFO: fill field "Password","gfhjkm" [] []
[2012-09-26 12:32:09] LoginCept.php.INFO: click "sign in" [] []
@DavertMik
DavertMik / gist:3905968
Created October 17, 2012 14:55
Codeception Log
[2012-08-02 12:33:40] GenerateCeptCept.php.INFO: am in path "tests/data/sandbox" [] []
[2012-08-02 12:33:40] GenerateCeptCept.php.INFO: execute command "generate:cept dummy DummyCept" [] []
[2012-08-02 12:33:41] GenerateCeptCept.php.INFO: see file found "DummyCept.php","tests/dummy" [] []
[2012-08-02 12:33:41] GenerateCeptCept.php.INFO: see in this file "$I = new DumbGuy($scenario);" [] []
[2012-08-02 12:33:41] GenerateCeptCept.php.INFO: delete this file [] []
[2012-08-02 12:33:41] GenerateCeptCept.php.INFO: execute command "generate:cept dummy path/DummyCept" [] []
[2012-08-02 12:33:41] GenerateCeptCept.php.INFO: see file found "DummyCept.php","tests/dummy/path" [] []
[2012-08-02 12:33:41] GenerateCeptCept.php.INFO: delete this file [] []
[2012-08-02 12:33:41] GenerateCeptCept.php.INFO: execute command "generate:cept dummy DummyCept.php" [] []
[2012-08-02 12:33:42] GenerateCeptCept.php.INFO: see file found "DummyCept.php" [] []
@DavertMik
DavertMik / gist:3939277
Created October 23, 2012 15:04
Using Helpers in Codeception
<?php
namespace Codeception\Module;
class WebHelper extends \Codeception\Module
{
public function seeUserAuthenticated($account, $username, $password)
{
$b = $this->getModule('PhpBrowser');
$b->fillField('fsaccount', $account);
<?php
class User extends Model {
// methods
protected static $name = Model::String;
protected static $email = Model::Email;
protected static $salt = Model::String;
protected static $sha = Model::String;
protected static $homepage = Model::URL;
@DavertMik
DavertMik / Users.php
Created November 11, 2012 11:49
PHP MVC framework.
<?php
// Framework concept
// Very THIN controller + THICK model
// Great for MVC frontend apps
// Using models from frontend is just like using from backend
class UsersController extends Users {
@DavertMik
DavertMik / gist:4100360
Created November 17, 2012 21:09
PHP Slices MVC Framework Concept
<?php
class UserController extends UserCollection implements Slice\RestController {
use \Slice\HttpController;
use \Slice\RESTController;
use \Slice\Response\ToJson;
protected function action($request, $user)
{
if ($request->GET('/'))
return $this->list($request['offset']);
@DavertMik
DavertMik / 3-colorpickers.yml
Created December 5, 2012 20:44 — forked from bebraw/3-colorpickers.yml
Color picker blog post
type: rating
title: JavaScript Color Pickers
user: bebraw
slug: javascript-color-pickers
includes: [nativeColorPicker, colorjoe, Flexi Colorpicker, SimpleColor, ExColor, JavaScript Colorpicker, Farbtastic, mooRainbow, jPicker]
body: |
If you are building an application that deals with graphics somehow, you are likely going to need a color picker. Fortunately
there are quite a few of those available for JavaScript. *HTML5 includes `color` input type even*. One color picker, aptly
named **nativeColorPicker**, provides a shim for Internet Explorer so that you have got all bases covered. Other pickers
available are more specialized.