superbara 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/README.md +4 -0
- data/docs/_FontAwesome/css/font-awesome.css +4 -0
- data/docs/_FontAwesome/fonts/FontAwesome.ttf +0 -0
- data/docs/_FontAwesome/fonts/fontawesome-webfont.eot +0 -0
- data/docs/_FontAwesome/fonts/fontawesome-webfont.svg +640 -0
- data/docs/_FontAwesome/fonts/fontawesome-webfont.ttf +0 -0
- data/docs/_FontAwesome/fonts/fontawesome-webfont.woff +0 -0
- data/docs/_FontAwesome/fonts/fontawesome-webfont.woff2 +0 -0
- data/docs/ayu-highlight.css +71 -0
- data/docs/book.css +1454 -0
- data/docs/book.js +590 -0
- data/docs/clipboard.min.js +7 -0
- data/docs/elasticlunr.min.js +10 -0
- data/docs/favicon.png +0 -0
- data/docs/getting_started/index.html +243 -0
- data/docs/getting_started/shell.png +0 -0
- data/docs/highlight.css +69 -0
- data/docs/highlight.js +2 -0
- data/docs/index.html +221 -0
- data/docs/install.html +227 -0
- data/docs/mark.min.js +7 -0
- data/docs/print.html +336 -0
- data/docs/reference/assert.html +258 -0
- data/docs/reference/dialogs/alert.html +225 -0
- data/docs/reference/dialogs/confirm.html +225 -0
- data/docs/reference/dialogs/index.html +230 -0
- data/docs/reference/dialogs/prompt.html +217 -0
- data/docs/reference/find.html +235 -0
- data/docs/reference/tests/has_text.html +241 -0
- data/docs/reference/tests/index.html +225 -0
- data/docs/reference/wait.html +245 -0
- data/docs/reference.html +225 -0
- data/docs/searcher.js +461 -0
- data/docs/searchindex.js +1 -0
- data/docs/superbara.html +222 -0
- data/docs/tomorrow-night.css +96 -0
- data/docs-src/book.toml +11 -0
- data/docs-src/src/SUMMARY.md +18 -0
- data/docs-src/src/getting_started/index.md +38 -0
- data/docs-src/src/getting_started/shell.png +0 -0
- data/docs-src/src/install.md +5 -0
- data/docs-src/src/reference/assert.md +48 -0
- data/docs-src/src/reference/dialogs/alert.md +1 -0
- data/docs-src/src/reference/dialogs/confirm.md +1 -0
- data/docs-src/src/reference/dialogs/index.md +5 -0
- data/docs-src/src/reference/dialogs/prompt.md +1 -0
- data/docs-src/src/reference/find.md +21 -0
- data/docs-src/src/reference/results.md +53 -0
- data/docs-src/src/reference/tests/has_text.md +24 -0
- data/docs-src/src/reference/tests/index.md +1 -0
- data/docs-src/src/reference/wait.md +33 -0
- data/docs-src/src/reference.md +2 -0
- data/docs-src/src/superbara.md +7 -0
- data/lib/capybara_monkey.rb +10 -5
- data/lib/selenium_monkey.rb +2 -17
- data/lib/superbara/cli.rb +16 -8
- data/lib/superbara/context.rb +5 -6
- data/lib/superbara/dsl.rb +25 -8
- data/lib/superbara/helpers.rb +24 -1
- data/lib/superbara/version.rb +1 -1
- data/lib/superbara.rb +12 -2
- data/superbara.gemspec +1 -0
- data/tests/features/screenshot.rb +30 -0
- metadata +55 -2
data/docs/print.html
ADDED
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
<!DOCTYPE HTML>
|
|
2
|
+
<html lang="en" class="sidebar-visible">
|
|
3
|
+
<head>
|
|
4
|
+
<!-- Book generated using mdBook -->
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<title>Superbara</title>
|
|
7
|
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
|
8
|
+
<meta name="description" content="">
|
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
10
|
+
<meta name="theme-color" content="#ffffff" />
|
|
11
|
+
|
|
12
|
+
<base href="">
|
|
13
|
+
|
|
14
|
+
<link rel="stylesheet" href="book.css">
|
|
15
|
+
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" rel="stylesheet" type="text/css">
|
|
16
|
+
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:500" rel="stylesheet" type="text/css">
|
|
17
|
+
|
|
18
|
+
<link rel="shortcut icon" href="favicon.png">
|
|
19
|
+
|
|
20
|
+
<!-- Font Awesome -->
|
|
21
|
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
|
|
22
|
+
|
|
23
|
+
<link rel="stylesheet" href="highlight.css">
|
|
24
|
+
<link rel="stylesheet" href="tomorrow-night.css">
|
|
25
|
+
<link rel="stylesheet" href="ayu-highlight.css">
|
|
26
|
+
|
|
27
|
+
<!-- Custom theme -->
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
<!-- Fetch Clipboard.js from CDN but have a local fallback -->
|
|
33
|
+
<script src="https://cdn.jsdelivr.net/clipboard.js/1.6.1/clipboard.min.js"></script>
|
|
34
|
+
<script>
|
|
35
|
+
if (typeof Clipboard == 'undefined') {
|
|
36
|
+
document.write(unescape("%3Cscript src='clipboard.min.js'%3E%3C/script%3E"));
|
|
37
|
+
}
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<noscript>
|
|
41
|
+
<style type="text/css">
|
|
42
|
+
.javascript-only {
|
|
43
|
+
display: none;
|
|
44
|
+
}
|
|
45
|
+
</style>
|
|
46
|
+
</noscript>
|
|
47
|
+
|
|
48
|
+
</head>
|
|
49
|
+
<body class="light">
|
|
50
|
+
<!-- Work around some values being stored in localStorage wrapped in quotes -->
|
|
51
|
+
<script type="text/javascript">
|
|
52
|
+
try {
|
|
53
|
+
var theme = localStorage.getItem('mdbook-theme');
|
|
54
|
+
var sidebar = localStorage.getItem('mdbook-sidebar');
|
|
55
|
+
|
|
56
|
+
if (theme.startsWith('"') && theme.endsWith('"')) {
|
|
57
|
+
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
|
|
61
|
+
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
|
62
|
+
}
|
|
63
|
+
} catch (e) { }
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<!-- Set the theme before any content is loaded, prevents flash -->
|
|
67
|
+
<script type="text/javascript">
|
|
68
|
+
var theme;
|
|
69
|
+
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
|
|
70
|
+
if (theme === null || theme === undefined) { theme = 'light'; }
|
|
71
|
+
document.body.className = theme;
|
|
72
|
+
document.querySelector('html').className = theme;
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<!-- Hide / unhide sidebar before it is displayed -->
|
|
76
|
+
<script type="text/javascript">
|
|
77
|
+
var html = document.querySelector('html');
|
|
78
|
+
var sidebar = 'hidden';
|
|
79
|
+
if (document.body.clientWidth >= 1080) {
|
|
80
|
+
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
|
|
81
|
+
sidebar = sidebar || 'visible';
|
|
82
|
+
}
|
|
83
|
+
html.classList.remove('sidebar-visible');
|
|
84
|
+
html.classList.add("sidebar-" + sidebar);
|
|
85
|
+
</script>
|
|
86
|
+
|
|
87
|
+
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
|
|
88
|
+
<ol class="chapter"><li class="affix"><a href="superbara.html">Superbara</a></li><li><a href="install.html">Install</a></li><li><a href="getting_started/index.html">Getting Started</a></li><li><a href="reference.html">Language Reference</a></li><li><ol class="section"><li><a href="reference/assert.html">assert</a></li><li><a href="reference/find.html">find</a></li><li><a href="reference/wait.html">wait</a></li><li><a href="reference/tests/index.html">Tests</a></li><li><ol class="section"><li><a href="reference/tests/has_text.html">has_text?</a></li></ol></li><li><a href="reference/dialogs/index.html">Dialogs</a></li><li><ol class="section"><li><a href="reference/dialogs/alert.html">alert</a></li><li><a href="reference/dialogs/confirm.html">confirm</a></li><li><a href="reference/dialogs/prompt.html">prompt</a></li></ol></li></ol></li></ol>
|
|
89
|
+
</nav>
|
|
90
|
+
|
|
91
|
+
<div id="page-wrapper" class="page-wrapper">
|
|
92
|
+
|
|
93
|
+
<div class="page">
|
|
94
|
+
|
|
95
|
+
<div id="menu-bar" class="menu-bar">
|
|
96
|
+
<div id="menu-bar-sticky-container">
|
|
97
|
+
<div class="left-buttons javascript-only">
|
|
98
|
+
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
|
|
99
|
+
<i class="fa fa-bars"></i>
|
|
100
|
+
</button>
|
|
101
|
+
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
|
|
102
|
+
<i class="fa fa-paint-brush"></i>
|
|
103
|
+
</button>
|
|
104
|
+
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
|
|
105
|
+
<li role="none"><button role="menuitem" class="theme" id="light">Light <span class="default">(default)</span></button></li>
|
|
106
|
+
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
|
|
107
|
+
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
|
|
108
|
+
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
|
|
109
|
+
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
|
|
110
|
+
</ul>
|
|
111
|
+
|
|
112
|
+
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
|
|
113
|
+
<i class="fa fa-search"></i>
|
|
114
|
+
</button>
|
|
115
|
+
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
<h1 class="menu-title">Superbara</h1>
|
|
119
|
+
|
|
120
|
+
<div class="right-buttons">
|
|
121
|
+
<a href="print.html" title="Print this book" aria-label="Print this book">
|
|
122
|
+
<i id="print-button" class="fa fa-print"></i>
|
|
123
|
+
</a>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
<div id="searchbar-outer" class="searchbar-outer">
|
|
130
|
+
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
|
|
131
|
+
</div>
|
|
132
|
+
<div id="searchresults-outer" class="searchresults-outer">
|
|
133
|
+
<div class="searchresults-header" id="searchresults-header"></div>
|
|
134
|
+
<ul id="searchresults">
|
|
135
|
+
</ul>
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
|
|
140
|
+
<script type="text/javascript">
|
|
141
|
+
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
|
|
142
|
+
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
|
|
143
|
+
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
|
|
144
|
+
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
|
|
145
|
+
});
|
|
146
|
+
</script>
|
|
147
|
+
|
|
148
|
+
<div id="content" class="content">
|
|
149
|
+
<main>
|
|
150
|
+
<a class="header" href="print.html#superbara" id="superbara"><h1>Superbara</h1></a>
|
|
151
|
+
<p>Superbara consists of two things:</p>
|
|
152
|
+
<ul>
|
|
153
|
+
<li>Superbara CLI - Command Line Interface for devoloping and running tests with all batteries included and preconfigured</li>
|
|
154
|
+
<li>Superbara DSL - Domain Specific Language for writing tests</li>
|
|
155
|
+
</ul>
|
|
156
|
+
<a class="header" href="print.html#install" id="install"><h1>Install</h1></a>
|
|
157
|
+
<pre><code class="language-shell">gem install superbara
|
|
158
|
+
</code></pre>
|
|
159
|
+
<a class="header" href="print.html#getting-started" id="getting-started"><h1>Getting Started</h1></a>
|
|
160
|
+
<p>Start by opening up the superbara CLI shell:</p>
|
|
161
|
+
<pre><code class="language-shell">superbara shell
|
|
162
|
+
</code></pre>
|
|
163
|
+
<p>This shell is handy for quickly testing something without creating a test file with <code>superbara init</code>.</p>
|
|
164
|
+
<p><img src="getting_started/shell.png" alt="alt text" /></p>
|
|
165
|
+
<a class="header" href="print.html#visiting" id="visiting"><h2>Visiting</h2></a>
|
|
166
|
+
<p>Type following in to the console:</p>
|
|
167
|
+
<pre><code>visit 'example.com'
|
|
168
|
+
</code></pre>
|
|
169
|
+
<p>You can also specify full URL like <code>https://www.exa..</code> or just path <code>/about</code> see <a href="./reference/visit.md">visit</a>.</p>
|
|
170
|
+
<a class="header" href="print.html#finding-elements" id="finding-elements"><h2>Finding elements</h2></a>
|
|
171
|
+
<pre><code>find 'h1'
|
|
172
|
+
</code></pre>
|
|
173
|
+
<pre><code>find 'a', text: 'More information'
|
|
174
|
+
</code></pre>
|
|
175
|
+
<a class="header" href="print.html#click" id="click"><h2>Click</h2></a>
|
|
176
|
+
<pre><code>click 'a'
|
|
177
|
+
</code></pre>
|
|
178
|
+
<a class="header" href="print.html#language-reference" id="language-reference"><h1>Language Reference</h1></a>
|
|
179
|
+
<a class="header" href="print.html#assert" id="assert"><h1>assert</h1></a>
|
|
180
|
+
<p><code>assert</code> <em>asserts</em> that the block is truthy at the given time. The first parameter is an optional failure message.</p>
|
|
181
|
+
<pre><code class="language-ruby">assert 'login missing' do
|
|
182
|
+
has_text? 'Login'
|
|
183
|
+
end
|
|
184
|
+
</code></pre>
|
|
185
|
+
<a class="header" href="print.html#examples" id="examples"><h3>Examples</h3></a>
|
|
186
|
+
<p>Check that example.com still has the same heading.</p>
|
|
187
|
+
<pre><code class="language-ruby">visit 'example.com'
|
|
188
|
+
|
|
189
|
+
assert 'somebody changed the text!'
|
|
190
|
+
h1 = find 'h1'
|
|
191
|
+
h1.text == 'Example Domain'
|
|
192
|
+
end
|
|
193
|
+
</code></pre>
|
|
194
|
+
<p>Asserts can also be written without the message.</p>
|
|
195
|
+
<pre><code class="language-ruby">assert do
|
|
196
|
+
has_text? "Something"
|
|
197
|
+
end
|
|
198
|
+
</code></pre>
|
|
199
|
+
<p>Negative asserts can also be given.</p>
|
|
200
|
+
<pre><code class="language-ruby">assert do
|
|
201
|
+
has_no_text? "Login"
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
# or
|
|
205
|
+
assert do
|
|
206
|
+
!has_text? "Login"
|
|
207
|
+
end
|
|
208
|
+
</code></pre>
|
|
209
|
+
<a class="header" href="print.html#related" id="related"><h2>Related</h2></a>
|
|
210
|
+
<ul>
|
|
211
|
+
<li><a href="./reference/find.html">find</a></li>
|
|
212
|
+
</ul>
|
|
213
|
+
<a class="header" href="print.html#find" id="find"><h1>find</h1></a>
|
|
214
|
+
<p>To get a single element use <code>find</code></p>
|
|
215
|
+
<pre><code class="language-ruby">title = find 'h1'
|
|
216
|
+
</code></pre>
|
|
217
|
+
<p>For multiple results use <code>all</code></p>
|
|
218
|
+
<pre><code class="language-ruby">links = all 'h1'
|
|
219
|
+
</code></pre>
|
|
220
|
+
<p>See (results)[./results.md] for complete list of methods available for the returned element or elements.</p>
|
|
221
|
+
<a class="header" href="print.html#advanced-finding" id="advanced-finding"><h2>Advanced finding</h2></a>
|
|
222
|
+
<pre><code class="language-ruby">title = find 'h1', text: "Example Domain"
|
|
223
|
+
</code></pre>
|
|
224
|
+
<a class="header" href="print.html#wait" id="wait"><h1>wait</h1></a>
|
|
225
|
+
<p><code>wait</code> checks every 0.1s for the block to return <code>true</code> or "anything but false" until <code>max_seconds</code> has elapsed. Quits the script with an error if the wait condition is not satisfied.</p>
|
|
226
|
+
<pre><code class="language-ruby">wait max_seconds do
|
|
227
|
+
# true or anything but false
|
|
228
|
+
end
|
|
229
|
+
</code></pre>
|
|
230
|
+
<a class="header" href="print.html#examples-1" id="examples-1"><h3>Examples</h3></a>
|
|
231
|
+
<p>Wait maximum of 3 seconds for the text 'Example Domain' to appear on the page.</p>
|
|
232
|
+
<pre><code class="language-ruby">visit 'example.com'
|
|
233
|
+
|
|
234
|
+
wait 3 do
|
|
235
|
+
has_text? 'Example Domain'
|
|
236
|
+
end
|
|
237
|
+
</code></pre>
|
|
238
|
+
<p>Wait up to 3.3 seconds for a <code><div id='login'></code> to appear and assign it to a variable for clicking.</p>
|
|
239
|
+
<pre><code class="language-ruby">login = wait 3.3 do
|
|
240
|
+
find 'div#login'
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
login.click
|
|
244
|
+
</code></pre>
|
|
245
|
+
<a class="header" href="print.html#tests" id="tests"><h1>Tests</h1></a>
|
|
246
|
+
<a class="header" href="print.html#has_text" id="has_text"><h1>has_text?</h1></a>
|
|
247
|
+
<p>Checks if the text is found on the screen.</p>
|
|
248
|
+
<pre><code class="language-ruby">assert do
|
|
249
|
+
has_text? "Welcome"
|
|
250
|
+
end
|
|
251
|
+
</code></pre>
|
|
252
|
+
<a class="header" href="print.html#examples-2" id="examples-2"><h1>Examples</h1></a>
|
|
253
|
+
<pre><code class="language-ruby">if has_text? "Logged in"
|
|
254
|
+
click_link "Log out"
|
|
255
|
+
|
|
256
|
+
wait 3 do
|
|
257
|
+
has_text? "You have logged out"
|
|
258
|
+
end
|
|
259
|
+
else
|
|
260
|
+
click_link "Next"
|
|
261
|
+
end
|
|
262
|
+
</code></pre>
|
|
263
|
+
<a class="header" href="print.html#dialogs" id="dialogs"><h1>Dialogs</h1></a>
|
|
264
|
+
<ul>
|
|
265
|
+
<li><a href="/reference/dialogs/alert.html">alert</a></li>
|
|
266
|
+
<li><a href="/reference/dialogs/confirm.html">confirm</a></li>
|
|
267
|
+
<li><a href="/reference/dialogs/prompt.html">prompt</a></li>
|
|
268
|
+
</ul>
|
|
269
|
+
<a class="header" href="print.html#alert" id="alert"><h1>Alert</h1></a>
|
|
270
|
+
<a class="header" href="print.html#confirm" id="confirm"><h1>Confirm</h1></a>
|
|
271
|
+
<a class="header" href="print.html#prompt" id="prompt"><h1>Prompt</h1></a>
|
|
272
|
+
|
|
273
|
+
</main>
|
|
274
|
+
|
|
275
|
+
<nav class="nav-wrapper" aria-label="Page navigation">
|
|
276
|
+
<!-- Mobile navigation buttons -->
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
<div style="clear: both"></div>
|
|
282
|
+
</nav>
|
|
283
|
+
</div>
|
|
284
|
+
</div>
|
|
285
|
+
|
|
286
|
+
<nav class="nav-wide-wrapper" aria-label="Page navigation">
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
</nav>
|
|
291
|
+
|
|
292
|
+
</div>
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
<!-- Local fallback for Font Awesome -->
|
|
296
|
+
<script>
|
|
297
|
+
if (getComputedStyle(document.querySelector(".fa")).fontFamily !== "FontAwesome") {
|
|
298
|
+
var link = document.createElement('link');
|
|
299
|
+
link.rel = 'stylesheet';
|
|
300
|
+
link.type = 'text/css';
|
|
301
|
+
link.href = '_FontAwesome/css/font-awesome.css';
|
|
302
|
+
document.head.insertBefore(link, document.head.firstChild)
|
|
303
|
+
}
|
|
304
|
+
</script>
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
<script src="searchindex.js" type="text/javascript" charset="utf-8"></script>
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
<script src="elasticlunr.min.js" type="text/javascript" charset="utf-8"></script>
|
|
317
|
+
<script src="mark.min.js" type="text/javascript" charset="utf-8"></script>
|
|
318
|
+
<script src="searcher.js" type="text/javascript" charset="utf-8"></script>
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
<script>
|
|
323
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
324
|
+
window.print();
|
|
325
|
+
})
|
|
326
|
+
</script>
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
<script src="highlight.js"></script>
|
|
330
|
+
<script src="book.js"></script>
|
|
331
|
+
|
|
332
|
+
<!-- Custom JS script -->
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
</body>
|
|
336
|
+
</html>
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
<!DOCTYPE HTML>
|
|
2
|
+
<html lang="en" class="sidebar-visible">
|
|
3
|
+
<head>
|
|
4
|
+
<!-- Book generated using mdBook -->
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<title>assert - Superbara</title>
|
|
7
|
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
|
8
|
+
<meta name="description" content="">
|
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
10
|
+
<meta name="theme-color" content="#ffffff" />
|
|
11
|
+
|
|
12
|
+
<base href="../">
|
|
13
|
+
|
|
14
|
+
<link rel="stylesheet" href="book.css">
|
|
15
|
+
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" rel="stylesheet" type="text/css">
|
|
16
|
+
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:500" rel="stylesheet" type="text/css">
|
|
17
|
+
|
|
18
|
+
<link rel="shortcut icon" href="favicon.png">
|
|
19
|
+
|
|
20
|
+
<!-- Font Awesome -->
|
|
21
|
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
|
|
22
|
+
|
|
23
|
+
<link rel="stylesheet" href="highlight.css">
|
|
24
|
+
<link rel="stylesheet" href="tomorrow-night.css">
|
|
25
|
+
<link rel="stylesheet" href="ayu-highlight.css">
|
|
26
|
+
|
|
27
|
+
<!-- Custom theme -->
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
<!-- Fetch Clipboard.js from CDN but have a local fallback -->
|
|
33
|
+
<script src="https://cdn.jsdelivr.net/clipboard.js/1.6.1/clipboard.min.js"></script>
|
|
34
|
+
<script>
|
|
35
|
+
if (typeof Clipboard == 'undefined') {
|
|
36
|
+
document.write(unescape("%3Cscript src='clipboard.min.js'%3E%3C/script%3E"));
|
|
37
|
+
}
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<noscript>
|
|
41
|
+
<style type="text/css">
|
|
42
|
+
.javascript-only {
|
|
43
|
+
display: none;
|
|
44
|
+
}
|
|
45
|
+
</style>
|
|
46
|
+
</noscript>
|
|
47
|
+
|
|
48
|
+
</head>
|
|
49
|
+
<body class="light">
|
|
50
|
+
<!-- Work around some values being stored in localStorage wrapped in quotes -->
|
|
51
|
+
<script type="text/javascript">
|
|
52
|
+
try {
|
|
53
|
+
var theme = localStorage.getItem('mdbook-theme');
|
|
54
|
+
var sidebar = localStorage.getItem('mdbook-sidebar');
|
|
55
|
+
|
|
56
|
+
if (theme.startsWith('"') && theme.endsWith('"')) {
|
|
57
|
+
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
|
|
61
|
+
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
|
62
|
+
}
|
|
63
|
+
} catch (e) { }
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<!-- Set the theme before any content is loaded, prevents flash -->
|
|
67
|
+
<script type="text/javascript">
|
|
68
|
+
var theme;
|
|
69
|
+
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
|
|
70
|
+
if (theme === null || theme === undefined) { theme = 'light'; }
|
|
71
|
+
document.body.className = theme;
|
|
72
|
+
document.querySelector('html').className = theme;
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<!-- Hide / unhide sidebar before it is displayed -->
|
|
76
|
+
<script type="text/javascript">
|
|
77
|
+
var html = document.querySelector('html');
|
|
78
|
+
var sidebar = 'hidden';
|
|
79
|
+
if (document.body.clientWidth >= 1080) {
|
|
80
|
+
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
|
|
81
|
+
sidebar = sidebar || 'visible';
|
|
82
|
+
}
|
|
83
|
+
html.classList.remove('sidebar-visible');
|
|
84
|
+
html.classList.add("sidebar-" + sidebar);
|
|
85
|
+
</script>
|
|
86
|
+
|
|
87
|
+
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
|
|
88
|
+
<ol class="chapter"><li class="affix"><a href="superbara.html">Superbara</a></li><li><a href="install.html">Install</a></li><li><a href="getting_started/index.html">Getting Started</a></li><li><a href="reference.html">Language Reference</a></li><li><ol class="section"><li><a href="reference/assert.html" class="active">assert</a></li><li><a href="reference/find.html">find</a></li><li><a href="reference/wait.html">wait</a></li><li><a href="reference/tests/index.html">Tests</a></li><li><ol class="section"><li><a href="reference/tests/has_text.html">has_text?</a></li></ol></li><li><a href="reference/dialogs/index.html">Dialogs</a></li><li><ol class="section"><li><a href="reference/dialogs/alert.html">alert</a></li><li><a href="reference/dialogs/confirm.html">confirm</a></li><li><a href="reference/dialogs/prompt.html">prompt</a></li></ol></li></ol></li></ol>
|
|
89
|
+
</nav>
|
|
90
|
+
|
|
91
|
+
<div id="page-wrapper" class="page-wrapper">
|
|
92
|
+
|
|
93
|
+
<div class="page">
|
|
94
|
+
|
|
95
|
+
<div id="menu-bar" class="menu-bar">
|
|
96
|
+
<div id="menu-bar-sticky-container">
|
|
97
|
+
<div class="left-buttons javascript-only">
|
|
98
|
+
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
|
|
99
|
+
<i class="fa fa-bars"></i>
|
|
100
|
+
</button>
|
|
101
|
+
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
|
|
102
|
+
<i class="fa fa-paint-brush"></i>
|
|
103
|
+
</button>
|
|
104
|
+
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
|
|
105
|
+
<li role="none"><button role="menuitem" class="theme" id="light">Light <span class="default">(default)</span></button></li>
|
|
106
|
+
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
|
|
107
|
+
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
|
|
108
|
+
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
|
|
109
|
+
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
|
|
110
|
+
</ul>
|
|
111
|
+
|
|
112
|
+
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
|
|
113
|
+
<i class="fa fa-search"></i>
|
|
114
|
+
</button>
|
|
115
|
+
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
<h1 class="menu-title">Superbara</h1>
|
|
119
|
+
|
|
120
|
+
<div class="right-buttons">
|
|
121
|
+
<a href="print.html" title="Print this book" aria-label="Print this book">
|
|
122
|
+
<i id="print-button" class="fa fa-print"></i>
|
|
123
|
+
</a>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
<div id="searchbar-outer" class="searchbar-outer">
|
|
130
|
+
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
|
|
131
|
+
</div>
|
|
132
|
+
<div id="searchresults-outer" class="searchresults-outer">
|
|
133
|
+
<div class="searchresults-header" id="searchresults-header"></div>
|
|
134
|
+
<ul id="searchresults">
|
|
135
|
+
</ul>
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
|
|
140
|
+
<script type="text/javascript">
|
|
141
|
+
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
|
|
142
|
+
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
|
|
143
|
+
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
|
|
144
|
+
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
|
|
145
|
+
});
|
|
146
|
+
</script>
|
|
147
|
+
|
|
148
|
+
<div id="content" class="content">
|
|
149
|
+
<main>
|
|
150
|
+
<a class="header" href="reference/assert.html#assert" id="assert"><h1>assert</h1></a>
|
|
151
|
+
<p><code>assert</code> <em>asserts</em> that the block is truthy at the given time. The first parameter is an optional failure message.</p>
|
|
152
|
+
<pre><code class="language-ruby">assert 'login missing' do
|
|
153
|
+
has_text? 'Login'
|
|
154
|
+
end
|
|
155
|
+
</code></pre>
|
|
156
|
+
<a class="header" href="reference/assert.html#examples" id="examples"><h3>Examples</h3></a>
|
|
157
|
+
<p>Check that example.com still has the same heading.</p>
|
|
158
|
+
<pre><code class="language-ruby">visit 'example.com'
|
|
159
|
+
|
|
160
|
+
assert 'somebody changed the text!'
|
|
161
|
+
h1 = find 'h1'
|
|
162
|
+
h1.text == 'Example Domain'
|
|
163
|
+
end
|
|
164
|
+
</code></pre>
|
|
165
|
+
<p>Asserts can also be written without the message.</p>
|
|
166
|
+
<pre><code class="language-ruby">assert do
|
|
167
|
+
has_text? "Something"
|
|
168
|
+
end
|
|
169
|
+
</code></pre>
|
|
170
|
+
<p>Negative asserts can also be given.</p>
|
|
171
|
+
<pre><code class="language-ruby">assert do
|
|
172
|
+
has_no_text? "Login"
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# or
|
|
176
|
+
assert do
|
|
177
|
+
!has_text? "Login"
|
|
178
|
+
end
|
|
179
|
+
</code></pre>
|
|
180
|
+
<a class="header" href="reference/assert.html#related" id="related"><h2>Related</h2></a>
|
|
181
|
+
<ul>
|
|
182
|
+
<li><a href="./reference/find.html">find</a></li>
|
|
183
|
+
</ul>
|
|
184
|
+
|
|
185
|
+
</main>
|
|
186
|
+
|
|
187
|
+
<nav class="nav-wrapper" aria-label="Page navigation">
|
|
188
|
+
<!-- Mobile navigation buttons -->
|
|
189
|
+
|
|
190
|
+
<a rel="prev" href="reference.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
|
|
191
|
+
<i class="fa fa-angle-left"></i>
|
|
192
|
+
</a>
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
<a rel="next" href="reference/find.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
|
|
197
|
+
<i class="fa fa-angle-right"></i>
|
|
198
|
+
</a>
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
<div style="clear: both"></div>
|
|
202
|
+
</nav>
|
|
203
|
+
</div>
|
|
204
|
+
</div>
|
|
205
|
+
|
|
206
|
+
<nav class="nav-wide-wrapper" aria-label="Page navigation">
|
|
207
|
+
|
|
208
|
+
<a href="reference.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
|
|
209
|
+
<i class="fa fa-angle-left"></i>
|
|
210
|
+
</a>
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
<a href="reference/find.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
|
|
215
|
+
<i class="fa fa-angle-right"></i>
|
|
216
|
+
</a>
|
|
217
|
+
|
|
218
|
+
</nav>
|
|
219
|
+
|
|
220
|
+
</div>
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
<!-- Local fallback for Font Awesome -->
|
|
224
|
+
<script>
|
|
225
|
+
if (getComputedStyle(document.querySelector(".fa")).fontFamily !== "FontAwesome") {
|
|
226
|
+
var link = document.createElement('link');
|
|
227
|
+
link.rel = 'stylesheet';
|
|
228
|
+
link.type = 'text/css';
|
|
229
|
+
link.href = '_FontAwesome/css/font-awesome.css';
|
|
230
|
+
document.head.insertBefore(link, document.head.firstChild)
|
|
231
|
+
}
|
|
232
|
+
</script>
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
<script src="searchindex.js" type="text/javascript" charset="utf-8"></script>
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
<script src="elasticlunr.min.js" type="text/javascript" charset="utf-8"></script>
|
|
245
|
+
<script src="mark.min.js" type="text/javascript" charset="utf-8"></script>
|
|
246
|
+
<script src="searcher.js" type="text/javascript" charset="utf-8"></script>
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
<script src="highlight.js"></script>
|
|
252
|
+
<script src="book.js"></script>
|
|
253
|
+
|
|
254
|
+
<!-- Custom JS script -->
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
</body>
|
|
258
|
+
</html>
|