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
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
DavertMik / test_helper.rb
Created December 18, 2020 04:28
Better debugging for rails tests: logs and custom output to stdout
# run it as DEBUG=true rails test
if ENV['DEBUG']
Rails.logger = Logger.new(STDOUT)
Rails.logger.level = Logger::INFO
Rails.logger.datetime_format = ""
Rails.logger.formatter = proc do |severity, _time, _progname, msg|
"#{severity.green}: #{msg}\n"
end
@DavertMik
DavertMik / Pact.php
Created July 8, 2020 22:14
Pact Helper for Codeception
<?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;
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,
<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>
</select>
@DavertMik
DavertMik / Swagger.php
Created March 12, 2020 14:46
Swagger Assertions for Codeception
<?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
DavertMik / Raml.php
Created June 18, 2019 07:11
Codeception Raml Helper
<?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)
{
it('should create todo item', (I) => {
browser.get("http://todomvc.com/examples/angularjs/#/");
expect(element(by.css("#todo-count")).isPresent()).toBeFalsy();
var inputField = element(by.model("newTodo"));
inputField.sendKeys("Write a guide");
inputField.sendKeys(protractor.Key.ENTER);
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');
});

Yii2 Module

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

Yii App Basic

  • acceptance tests -
  • functional tests -

Yii App Advanced

..00Ooo...
.Oo...
.o0o00oo...
o.. .0OoO0Ooo00Ooo... o
0Ooo.. + (x)
0ooooooo.. /_\ ( |x)