Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓
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
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
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 Jul 8, 2020
Pact Helper for Codeception
View Pact.php
<?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>
</select>
@DavertMik
DavertMik / Swagger.php
Created Mar 12, 2020
Swagger Assertions for Codeception
View Swagger.php
<?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 Jun 18, 2019
Codeception Raml Helper
View Raml.php
<?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) => {
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');
});
View gist:e3a0dbd190c957deaebab41e76ce98c2

Yii2 Module

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

Yii App Basic

  • acceptance tests -
  • functional tests -

Yii App Advanced

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