Skip to content

Instantly share code, notes, and snippets.

@eremv
eremv / auth_helper.rb
Created December 9, 2016 13:14
OmniAuth mock
module OmniAuthMock
def auth_mock
omniauth_hash = {
"provider" => "linkedin",
"uid" => "oOkD8MWCjm",
"info" => {
"name" => "Sean O'Connor",
"email" => "test@mail.com",
"nickname" => "Sean O'Connor",
"first_name" => "Sean",
@eremv
eremv / form_cheat_sheet
Last active June 26, 2022 21:30
Cheat list for form testing
# C корректно заполненными полями
------Фамилия, Имя
# С пустым полем
# С латиницей/арабицей/китайский/тайский... в фамилии
# Со сложной фамилией (Смоктуновский-Верховодец)
# С фамилией содержащей апостроф (O'Connor)
# С фамилией содержащей 2 больших буквы (McDonald)
# С полем, содержашим пробелы Вначале/ В середине / В конце
# С полем, содержащим единственный пробел
class DriverJSError < StandardError; end
AfterStep do |scenario, step|
errors = page.driver.browser.manage.logs.get(:browser)
if errors.present?
message = errors.map(&:message).join("\n\n")
raise DriverJSError, message
end
@eremv
eremv / gist:f3f6149eb09c943d92e4
Created September 30, 2015 10:43 — forked from gkop/gist:1371962
Capture javascript errors in Cucumber+Capybara+Webdriver tests
# in features/support/env.rb
require 'selenium/webdriver'
# we need a firefox extension to start intercepting javascript errors before the page
# scripts load
Capybara.register_driver :selenium do |app|
profile = Selenium::WebDriver::Firefox::Profile.new
# see https://github.com/mguillem/JSErrorCollector
profile.add_extension File.join(Rails.root, "features/support/extensions/JSErrorCollector.xpi")
Capybara::Selenium::Driver.new app, :profile => profile
@eremv
eremv / steps
Created January 19, 2015 14:27
Given /^I am on the Welcome Screen$/ do
element_exists("view")
sleep(STEP_PAUSE)
end
And(/^I should see "([^"]*)" on the screen$/) do |expected_mark|
wait_for(WAIT_TIMEOUT) { view_with_mark_exists( expected_mark ) }
sleep(STEP_PAUSE)
end
Then(/^I enter "([^"]*)" in the "([^"]*)" field$/) do |text_to_type, field_name|
touch("UITextFieldLabel marked:'#{field_name}'")
(function( $ ) {
$.fn.simulateDragDrop = function(options) {
return this.each(function() {
new $.simulateDragDrop(this, options);
});
};
$.simulateDragDrop = function(elem, options) {
this.options = options;
this.simulateEvent(elem, options);
};
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
sudo port install git-core +bash_completion
if [ -f /opt/local/etc/bash_completion ]; then
. /opt/local/etc/bash_completion
fi
GIT_PS1_SHOWDIRTYSTATE=true
PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;33m\]\w\[\033[00m\]\[\033[01;31m\]$(__git_ps1 " {%s}")\[\033[00m\]\$ '
@eremv
eremv / ve-well.cs
Created March 21, 2013 08:06 — forked from aratak/ve-well.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace drawwell
{
class Program
{
@eremv
eremv / well.cs
Created March 21, 2013 08:04
old dry well
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace drawwell
{
class Program
{