\documentclass[10pt,a4paper]{article}

% Packages
\usepackage{fancyhdr}           % For header and footer
\usepackage{multicol}           % Allows multicols in tables
\usepackage{tabularx}           % Intelligent column widths
\usepackage{tabulary}           % Used in header and footer
\usepackage{hhline}             % Border under tables
\usepackage{graphicx}           % For images
\usepackage{xcolor}             % For hex colours
%\usepackage[utf8x]{inputenc}    % For unicode character support
\usepackage[T1]{fontenc}        % Without this we get weird character replacements
\usepackage{colortbl}           % For coloured tables
\usepackage{setspace}           % For line height
\usepackage{lastpage}           % Needed for total page number
\usepackage{seqsplit}           % Splits long words.
%\usepackage{opensans}          % Can't make this work so far. Shame. Would be lovely.
\usepackage[normalem]{ulem}     % For underlining links
% Most of the following are not required for the majority
% of cheat sheets but are needed for some symbol support.
\usepackage{amsmath}            % Symbols
\usepackage{MnSymbol}           % Symbols
\usepackage{wasysym}            % Symbols
%\usepackage[english,german,french,spanish,italian]{babel}              % Languages

% Document Info
\author{sofrikdev (sofrikdev)}
\pdfinfo{
  /Title (calabash-android.pdf)
  /Creator (Cheatography)
  /Author (sofrikdev (sofrikdev))
  /Subject (Calabash Android Cheat Sheet)
}

% Lengths and widths
\addtolength{\textwidth}{6cm}
\addtolength{\textheight}{-1cm}
\addtolength{\hoffset}{-3cm}
\addtolength{\voffset}{-2cm}
\setlength{\tabcolsep}{0.2cm} % Space between columns
\setlength{\headsep}{-12pt} % Reduce space between header and content
\setlength{\headheight}{85pt} % If less, LaTeX automatically increases it
\renewcommand{\footrulewidth}{0pt} % Remove footer line
\renewcommand{\headrulewidth}{0pt} % Remove header line
\renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit
% This two commands together give roughly
% the right line height in the tables
\renewcommand{\arraystretch}{1.3}
\onehalfspacing

% Commands
\newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour
\newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols
\newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns
\newcommand{\tn}{\tabularnewline} % Required as custom column type in use

% Font and Colours
\definecolor{HeadBackground}{HTML}{333333}
\definecolor{FootBackground}{HTML}{666666}
\definecolor{TextColor}{HTML}{333333}
\definecolor{DarkBackground}{HTML}{49A337}
\definecolor{LightBackground}{HTML}{F3F9F2}
\renewcommand{\familydefault}{\sfdefault}
\color{TextColor}

% Header and Footer
\pagestyle{fancy}
\fancyhead{} % Set header to blank
\fancyfoot{} % Set footer to blank
\fancyhead[L]{
\noindent
\begin{multicols}{3}
\begin{tabulary}{5.8cm}{C}
    \SetRowColor{DarkBackground}
    \vspace{-7pt}
    {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent
        \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}}
    }
\end{tabulary}
\columnbreak
\begin{tabulary}{11cm}{L}
    \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Calabash Android Cheat Sheet}}}} \\
    \normalsize{by \textcolor{DarkBackground}{sofrikdev (sofrikdev)} via \textcolor{DarkBackground}{\uline{cheatography.com/31610/cs/9634/}}}
\end{tabulary}
\end{multicols}}

\fancyfoot[L]{ \footnotesize
\noindent
\begin{multicols}{3}
\begin{tabulary}{5.8cm}{LL}
  \SetRowColor{FootBackground}
  \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}}  \\
  \vspace{-2pt}sofrikdev (sofrikdev) \\
  \uline{cheatography.com/sofrikdev} \\
  \end{tabulary}
\vfill
\columnbreak
\begin{tabulary}{5.8cm}{L}
  \SetRowColor{FootBackground}
  \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}}  \\
   \vspace{-2pt}Published 26th October, 2016.\\
   Updated 26th October, 2016.\\
   Page {\thepage} of \pageref{LastPage}.
\end{tabulary}
\vfill
\columnbreak
\begin{tabulary}{5.8cm}{L}
  \SetRowColor{FootBackground}
  \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}}  \\
  \SetRowColor{white}
  \vspace{-5pt}
  %\includegraphics[width=48px,height=48px]{dave.jpeg}
  Measure your website readability!\\
  www.readability-score.com
\end{tabulary}
\end{multicols}}




\begin{document}
\raggedright
\raggedcolumns

% Set font size to small. Switch to any value
% from this page to resize cheat sheet text:
% www.emerson.emory.edu/services/latex/latex_169.html
\footnotesize % Small font.


\begin{tabularx}{17.67cm}{x{8.4623 cm} x{8.8077 cm} }
\SetRowColor{DarkBackground}
\mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{General}}  \tn
% Row 0
\SetRowColor{LightBackground}
{\bf{calabash-android resign \textless{}apk.name\textgreater{}}} & Подписать apk \tn 
% Row Count 2 (+ 2)
% Row 1
\SetRowColor{white}
{\bf{calabash-android console \textless{}apk.name\textgreater{}}} & Запуск консоли \seqsplit{разработки} тестов \tn 
% Row Count 6 (+ 4)
% Row 2
\SetRowColor{LightBackground}
{\bf{calabash-android run \textless{}apk.name\textgreater{}}} & Запуск текстов \tn 
% Row Count 8 (+ 2)
% Row 3
\SetRowColor{white}
{\bf{start\_test\_server\_in\_background}} & Запуск тестового сервера и \seqsplit{приложения} \tn 
% Row Count 12 (+ 4)
% Row 4
\SetRowColor{LightBackground}
{\bf{reinstall\_apps}} & \seqsplit{Переустановить} \seqsplit{приложение} \tn 
% Row Count 15 (+ 3)
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\SetRowColor{LightBackground}
\mymulticolumn{2}{x{17.67cm}}{Можно использовать модификаторы к команде {\bf{run}} : \newline -p profile\_name \newline -{}-tag @tagname \newline -{}-format html  \newline -{}-out=report.html}  \tn 
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\end{tabularx}
\par\addvspace{1.3em}

\begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} }
\SetRowColor{DarkBackground}
\mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Query}}  \tn
% Row 0
\SetRowColor{LightBackground}
{\bf{query(uiquery, *args)}} & Поиск элементов на экране \tn 
% Row Count 3 (+ 3)
% Row 1
\SetRowColor{white}
{\bf{element\_does\_not\_exist(uiquery)}} & Если элемент не найден \seqsplit{возвращает} TRUE \tn 
% Row Count 7 (+ 4)
% Row 2
\SetRowColor{LightBackground}
{\bf{element\_exists(uiquery)}} & Если элемент найден \seqsplit{возвращает} TRUE \tn 
% Row Count 11 (+ 4)
% Row 3
\SetRowColor{white}
{\bf{view\_with\_mark\_exists(expected\_mark)}} & Если элемент с \seqsplit{определенной} \seqsplit{маркировкой} найден \seqsplit{возвращает} TRUE \tn 
% Row Count 17 (+ 6)
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\SetRowColor{LightBackground}
\mymulticolumn{2}{x{17.67cm}}{Примеры: \newline {\bf{query("{\emph{")}} - показать все элементы на экране \newline {\bf{query("}} id:'test\_id'")}} - показать определенный элемент \newline {\bf{query("* id:'test'", :text)}} - показать поле text элемента}  \tn 
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\end{tabularx}
\par\addvspace{1.3em}

\begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} }
\SetRowColor{DarkBackground}
\mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Assertions}}  \tn
% Row 0
\SetRowColor{LightBackground}
{\bf{fail(msg="Error. Check log for details.")}} & \seqsplit{Прерывание} теста , вывод тестовой ошибки \tn 
% Row Count 4 (+ 4)
% Row 1
\SetRowColor{white}
{\bf{check\_element\_exists(query)}} & Проверка что элемент \seqsplit{существует} на экране, возврат FAIL если нет \tn 
% Row Count 10 (+ 6)
% Row 2
\SetRowColor{LightBackground}
{\bf{check\_element\_does\_not\_exist(query)}} & Проверка что элемент не \seqsplit{существует} на экране, возврат FAIL если да \tn 
% Row Count 16 (+ 6)
% Row 3
\SetRowColor{white}
{\bf{check\_view\_with\_mark\_exists(expected\_mark)}} & Проверка что \seqsplit{промаркированный} элемент \seqsplit{существует} на экране \tn 
% Row Count 22 (+ 6)
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\SetRowColor{LightBackground}
\mymulticolumn{2}{x{17.67cm}}{Пример: \newline {\bf{check\_element\_exists("view marked:'\#\{expected\_mark\}'")}}}  \tn 
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\end{tabularx}
\par\addvspace{1.3em}

\begin{tabularx}{17.67cm}{x{7.4261 cm} x{9.8439 cm} }
\SetRowColor{DarkBackground}
\mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Touch}}  \tn
% Row 0
\SetRowColor{LightBackground}
{\bf{touch(uiquery, options=\{\})}} & Выполнить нажатие на элемент \tn 
% Row Count 3 (+ 3)
% Row 1
\SetRowColor{white}
{\bf{tap\_mark(uiquery)}} & Выполнить нажатие на элемент \tn 
% Row Count 6 (+ 3)
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\SetRowColor{LightBackground}
\mymulticolumn{2}{x{17.67cm}}{Примеры: \newline {\bf{touch("* marked:'Save'")}} \newline {\bf{touch(query("button"))}} \newline {\bf{tap\_mark("Выход")}}}  \tn 
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\end{tabularx}
\par\addvspace{1.3em}

\begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} }
\SetRowColor{DarkBackground}
\mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Entering text}}  \tn
% Row 0
\SetRowColor{LightBackground}
{\bf{keyboard\_enter\_text(text, options=\{\})}} & Ввод текста в view в фокусе \tn 
% Row Count 3 (+ 3)
% Row 1
\SetRowColor{white}
{\bf{enter\_text(uiquery, text, options=\{\})}} & Нажать на элемент и начать ввод текста \tn 
% Row Count 7 (+ 4)
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\end{tabularx}
\par\addvspace{1.3em}

\begin{tabularx}{17.67cm}{x{6.3899 cm} x{10.8801 cm} }
\SetRowColor{DarkBackground}
\mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Pull and push files}}  \tn
% Row 0
\SetRowColor{LightBackground}
{\bf{pull(remote, local)}} & Перенести файл с устройства на ПК \tn 
% Row Count 3 (+ 3)
% Row 1
\SetRowColor{white}
{\bf{push(local, remote)}} & Перенести файл с ПК на устройство \tn 
% Row Count 6 (+ 3)
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\SetRowColor{LightBackground}
\mymulticolumn{2}{x{17.67cm}}{Примеры: \newline {\bf{pull("/sdcard/file.jpg", "file.jpg")}} \newline {\bf{push("file.jpg", "/sdcard/file.jpg")}}}  \tn 
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\end{tabularx}
\par\addvspace{1.3em}

\begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} }
\SetRowColor{DarkBackground}
\mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Screenshot}}  \tn
% Row 0
\SetRowColor{LightBackground}
{\bf{screenshot(options=\{:prefix=\textgreater{}nil, :name=\textgreater{}nil\})}} & Снять скриншот \tn 
% Row Count 3 (+ 3)
% Row 1
\SetRowColor{white}
{\bf{screenshot\_embed(options=\{:prefix=\textgreater{}nil, :name=\textgreater{}nil, :label =\textgreater{} nil\})}} & Снять скриншот и приложить его к \seqsplit{результатам} теста \tn 
% Row Count 8 (+ 5)
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\SetRowColor{LightBackground}
\mymulticolumn{2}{x{17.67cm}}{Примеры: \newline {\bf{screenshot(\{:prefix =\textgreater{} "/tmp", :name=\textgreater{}"my.png"\})}}}  \tn 
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\end{tabularx}
\par\addvspace{1.3em}

\begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} }
\SetRowColor{DarkBackground}
\mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Waiting}}  \tn
% Row 0
\SetRowColor{LightBackground}
{\bf{wait\_for(options, \&block)}} & Ожидание элемента с \seqsplit{модификаторами} \{  :timeout =\textgreater{} 10, \#maximum number of seconds to wait  :retry\_frequency =\textgreater{} 0.2, \#wait this long before retrying the block  :post\_timeout =\textgreater{} 0.1, \#wait this long after the block returns true  :timeout\_message =\textgreater{} "Timed out waiting...", \#error message in case options{[}:timeout{]} is exceeded  \seqsplit{:screenshot\_on\_error} =\textgreater{} true \# take a screenshot in case of error \} \tn 
% Row Count 22 (+ 22)
% Row 1
\SetRowColor{white}
{\bf{wait\_for\_element\_exists(uiquery, options=\{\})}} & Ожидание появления элемента \tn 
% Row Count 25 (+ 3)
% Row 2
\SetRowColor{LightBackground}
{\bf{wait\_for\_elements\_exist(elements\_arr, options=\{\})}} & Ожидание \seqsplit{нескольких} элементов, принимает массив запросов \tn 
% Row Count 31 (+ 6)
\end{tabularx}
\par\addvspace{1.3em}

\begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} }
\SetRowColor{DarkBackground}
\mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Waiting (cont)}}  \tn
% Row 3
\SetRowColor{LightBackground}
{\bf{wait\_for\_element\_does\_not\_exist(uiquery, options=\{\})}} & Ожидает пока элемент пропадет \tn 
% Row Count 3 (+ 3)
% Row 4
\SetRowColor{white}
{\bf{wait\_for\_elements\_do\_not\_exist(elements\_arr, options=\{\})}} & Ожидает пока несколько элементов пропадет, принимает массив запросов \tn 
% Row Count 10 (+ 7)
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\SetRowColor{LightBackground}
\mymulticolumn{2}{x{17.67cm}}{Примеры: \newline {\bf{wait\_for(:timeout =\textgreater{} 5) \{ query("button marked:'Save'").size \textgreater{} 0 \}}} \newline {\bf{wait\_for(:timeout =\textgreater{} 5) \{ element\_exists("button marked:'Save'") \}}} \newline {\bf{wait\_for(:timeout =\textgreater{} 30) do}} \newline     res = query("checkbox marked:'Geotag Posts'", 'checked') \newline     res.first == true \newline {\bf{end}} \newline {\bf{wait\_for\_elements\_exist( "{\emph{ marked:'Please sign in'", :timeout =\textgreater{} 10)}} \newline {\bf{wait\_for\_elements\_exist( {[}"button marked:'Save'", "}} marked:'Please sign}} {\bf{in'"{]}, :timeout =\textgreater{} 2)}}}  \tn 
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\end{tabularx}
\par\addvspace{1.3em}



\end{document}