Skip to content

Instantly share code, notes, and snippets.

developing codeception & codeceptjs

Michael Bodnarchuk DavertMik

developing codeception & codeceptjs
View GitHub Profile
View test.js
const inventory = [
{ name: 'sword', weight: 3},
{ name: 'pickaxe', weight: 2},
{ name: 'bow', weight: 1},
var inventoryWeight = 0;
function addToInventory(item) {
// if weight of items in inventory
// less than 10
DavertMik / test_helper.rb
Created Dec 18, 2020
Better debugging for rails tests: logs and custom output to stdout
View test_helper.rb
# run it as DEBUG=true rails test
Rails.logger =
Rails.logger.level = Logger::INFO
Rails.logger.datetime_format = ""
Rails.logger.formatter = proc do |severity, _time, _progname, msg|
"#{}: #{msg}\n"
DavertMik / Pact.php
Created Jul 8, 2020
Pact Helper for Codeception
View Pact.php
namespace Codeception\Module;
use Codeception\Exception\ConfigurationException;
use Codeception\Exception\ModuleException;
use Codeception\Test\Test;
use Codeception\TestInterface;
use PhpPact\Consumer\Model\Interaction;
use PhpPact\Exception\ConnectionException;
use PhpPact\Http\GuzzleClient;
View controllers.application\.js
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
get model() {
return [{
id: 1,
name: 'Write tests from scratch',
isVisible: true,
View form.html
<form method="post" action="/update" id="update_form">
<label for="user_name">Name</label>
<input type="text" name="user[name]" id="user_name" />
<label for="user_email">Email</label>
<input type="text" name="user[email]" id="user_email" />
<label for="user_role">Role</label>
<select id="user_role" name="user[role]">
<option value="0">Admin</option>
<option value="1">User</option>
DavertMik / Swagger.php
Created Mar 12, 2020
Swagger Assertions for Codeception
View Swagger.php
use Codeception\TestInterface;
use FR3D\SwaggerAssertions\PhpUnit\AssertsTrait;
use FR3D\SwaggerAssertions\SchemaManager;
class Api extends \Codeception\Module
use AssertsTrait;
public function _before(TestInterface $test)
DavertMik / Raml.php
Created Jun 18, 2019
Codeception Raml Helper
View Raml.php
namespace Helper;
// here you can define custom actions
// all public methods declared in helper class will be available in $I
class Raml extends \Codeception\Module
public function parseSchemaFor($type)
View protractor.js
it('should create todo item', (I) => {
var inputField = element(by.model("newTodo"));
inputField.sendKeys("Write a guide");
var todos = element.all(by.repeater("todo in todos"));
expect(todos.last().getText()).toEqual("Write a guide"));
element(by.css("#todo-count")).getText()).toContain('1 items left');
View gist:e3a0dbd190c957deaebab41e76ce98c2

Yii2 Module

  • работа с роутингом: amOnRoute, getUrlByRoute - @notgosu (Паша Науменко)

Yii App Basic

  • acceptance tests -
  • functional tests -

Yii App Advanced

View gist:1712bfc13225b1315c2d10fcbe839804
o.. .0OoO0Ooo00Ooo... o
0Ooo.. + (x)
0ooooooo.. /_\ ( |x)