-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
executable file
·420 lines (363 loc) · 13.5 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
<!DOCTYPE html>
<html lang="en">
<head>
<title>Shower Presentation Engine</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="shower/themes/material/styles/styles.css">
<style>
.shower {
--slide-ratio: calc(16 / 9);
--color-key: #16375A
}
.slide::after {
display: none;
}
.center-slide {
display: flex;
flex-direction: column;
align-items: center;
}
.mt-50 {
margin-top: 50px;
}
.code-img {
width: 100% !important;
}
.center {
margin-left: auto !important;
margin-right: auto !important;
}
</style>
</head>
<body class="shower list">
<header class="caption">
<h1>Cypress: painless web testing</h1>
</header>
<section class="slide">
<h2 class="shout" style="font-size: 80px">Modern e2e testing with Cypress.io <br>
<div style="display: flex; margin-top: 50px;">
<img src="pictures/angular-512.png" height="35px" width="35px">
<span style="font-size: 30px">Angular Minsk #2</span>
</div>
</h2>
</section>
<section class="slide">
<h2>Who am I ?</h2>
<div class="center-slide">
<ul>
<li>Front end developer at SaM Solutions</li>
<li>Working with Angular stack</li>
<li>Want you to try Cypress tomorrow</li>
</ul>
</div>
<div class="center-slide">
<img class="center" src="pictures/sam.jpg" alt=""> <img src="pictures/angular-512.png" height="100px">
</div>
</section>
<section class="slide">
<h2>Agenda</h2>
<div class="center-slide">
<ul>
<li>Why should(n't) we test?</li>
<li>E2E testing tools</li>
<li>Experience with Cypress</li>
<li>Downsides</li>
</ul>
</div>
</section>
<section class="slide" id="cover">
<h2>Testing pyramid</h2>
<figure>
<img height="80%" class="cover mt-50" src="pictures/pyramid.png">
</figure>
</section>
<section class="slide" id="cover">
<h2>Testing pyramid</h2>
<figure>
<img height="80%" class="cover mt-50" src="pictures/pyramid2.png">
</figure>
</section>
<section class="slide" id="cover">
<figure>
<img class="cover" src="pictures/errors.jpg">
</figure>
</section>
<section class="slide" id="cover">
<h2>Choose your side</h2>
<figure>
<img class="cover" src="pictures/ptcy.png">
</figure>
</section>
<section class="slide" id="cover">
<figure>
<img class="cover" src="pictures/ptissue.png">
</figure>
</section>
<section class="slide" id="cover">
<figure>
<img class="cover" src="pictures/fm.png">
</figure>
</section>
<section class="slide">
<h2>Recap of Front-end Development in 2018</h2>
<blockquote>
<p>Many realize that end to end testing is the starting point of doing tests correctly in large part due to Cypress (i.e. Cypress first, then Jest).</p>
</blockquote>
<a href="https://frontendmasters.com/books/front-end-handbook/2019/#1.1">Front-end Developer Handbook 2019
</a>
</section>
<section class="slide" id="14">
<h2>End to end testing strategies</h2>
<div class="columns two">
<ul>
<li>Not to use real API calls</li>
<li>Fast, easy and flexible</li>
<li>No state mutations</li>
</ul>
<ul>
<li>Simulate full workflow of application</li>
<li>Requires server/DB</li>
<li>Shares test state</li>
</ul>
</div>
</section>
<section class="slide">
<h2>Installing Cypress</h2>
<div class="center-slide">
<pre>
<code>npm install cypress --save-dev</code>
<code>yarn add cypress --dev</code>
</pre>
</div>
</section>
<section class="slide" id="cover">
<h2>Testing login form</h2>
<figure>
<img class="cover mt-50" src="pictures/tricks.png">
</figure>
</section>
<section class="slide" id="cover">
<h2>Hello world</h2>
<figure>
<img class="code-img" src="pictures/hello world.png">
</figure>
</section>
<section class="slide">
<h2>Running Cypress</h2>
<div class="center-slide">
<pre>
<code>npm run start</code>
<code>npm run cypress:open</code>
<code>yarn run cypress:open</code>
<code>npx cypress open</code>
</pre>
</div>
</section>
<section class="slide" id="cover">
<h2>Cypress test runner</h2>
<figure>
<img class="code-img" src="pictures/open.png">
</figure>
</section>
<section class="slide" id="cover">
<h2>Running the test</h2>
<figure>
<img class="code-img" src="pictures/open1.PNG">
</figure>
</section>
<section class="slide">
<h2>Differences from Selenium</h2>
<div class="center-slide">
<ul>
<li>Behind Cypress is a Node.js server process</li>
<li>Cypress is executed in the same run loop as your application.</li>
<li>Cypress has native access to every single object</li>
<li>Cypress takes snapshots of your application</li>
<li>Stubbing network requests</li>
<li>Spying & Stubbing on DOM API or any JS object</li>
</ul>
</div>
</section>
<section class="slide">
<h2>Folder structure</h2>
<div class="center-slide">
<figure>
<img width="65%" src="pictures/struct.png">
</figure>
</div>
</div>
</section>
<section class="slide">
<h2>Basic configuration</h2>
<figure>
<img class="code-img" src="pictures/config.png">
</figure>
</div>
</section>
<section class="slide" id="cover">
<h2>Querying elements</h2>
<figure>
<img class="code-img" src="pictures/get.png">
</figure>
</section>
<section class="slide">
<h2>Commands</h2>
<div class="center-slide">
<ul>
<li>.blur() - Make a focused DOM element blur.</li>
<li>.focus() - Focus on a DOM element.</li>
<li>.viewport(320,240) - Simulate a viewport</li>
<li>.check() - Check checkbox(es) or radio(s).</li>
<li>.screenshot() - Make a screenshot of current viewport.</li>
<li>.dblclick() - Double-click a DOM element.</li>
</ul>
</div>
</section>
<section class="slide" id="cover">
<h2>Custom commands</h2>
<figure>
<img class="code-img" src="pictures/custom.png">
</figure>
</section>
<section class="slide" id="cover">
<h2>Asserting</h2>
<figure>
<img class="code-img" src="pictures/assert.png">
</figure>
</section>
<section class="slide" id="cover">
<h2>Bundled tools</h2>
<figure>
<img class="cover mt-50" src="pictures/mocha.png">
</figure>
</section>
<section class="slide">
<h2>Aliases</h2>
<figure>
<img class="code-img" src="pictures/aliases.png">
</figure>
</section>
<section class="slide" id="cover">
<h2>Working with network</h2>
<figure>
<img class="code-img mt-50" src="pictures/network.png">
</figure>
</section>
<section class="slide">
<h2>Other features</h2>
<div class="center-slide">
<ul>
<li>Plugins</li>
<li>Dashboard service</li>
<li>Screenshots & video</li>
<li>Continious integration</li>
</ul>
</div>
</section>
<section class="slide">
<h2>How does it works</h2>
<div class="center-slide">
<ul>
<li>Chains of commands</li>
<li>Command queue</li>
<li>Timeouts</li>
</ul>
</div>
</section>
<section class="slide">
<h2>Why do we like Cypress</h2>
<dv class="center-slide">
<ul>
<li>Quick start</li>
<li>No more async hell</li>
<li>Easy to stub network layer</li>
<li>A lot of useful commands out of the box</li>
<li>Easy to integrate with CI system</li>
<li>Great debugging tools</li>
</ul>
</dv>
</section>
<section class="slide">
<h2>Continious integration</h2>
<div class="center-slide">
<pre>
<code>npm run build:prod</code>
<code>http-server dist/app -c-1 -p 4200 --silent</code>
<code>npx cypress verify</code>
<code>npx cypress run</code>
</pre>
</div>
</section>
<section class="slide" id="cover">
<h2>Debugging</h2>
<figure>
<img class="cover mt-50" src="pictures/debug.png">
</figure>
</section>
<section class="slide" id="cover">
<h2>Debugging</h2>
<figure>
<img width="70%" class="cover mt-50" src="pictures/debug2.png">
</figure>
</section>
<section class="slide">
<h2>Issues we found</h2>
<div class="center-slide">
<ul>
<li>Can't store element in a variable</li>
<li>Dynamic stubbing of network requests is not allowed</li>
<li>alert, confirm, file uploading</li>
<li>Overlay elements</li>
</ul>
</div>
</section>
<section class="slide" id="cover">
<h2>There is no silver bullet</h2>
<figure>
<img height="70%" class="cover mt-50" src="pictures/bullet.jpg">
</figure>
</section>
<section class="slide">
<h2>Permanent tradeoffs</h2>
<div class="center-slide">
<ul>
<li>Cypress is not a general purpose automation tool</li>
<li>Cross-browser support</li>
<li>Commands run inside of a browser</li>
<li>There will never be support for multiple browser tabs</li>
<li>You cannot use Cypress to drive two browsers at the same time</li>
<li>Each test is bound to a single origin</li>
</ul>
</div>
</section>
<section class="slide">
<h2>Temporary tradeoffs</h2>
<div class="center-slide">
<ul>
<li>File uploads & downloads (there is a plugin)</li>
<li>lack of commands like .tab() .hover() command</li>
<li>iframe support is limited</li>
<li>cy.route() for fetch (there is a workaround)</li>
<li>Shadow DOM is not supported (there is a plugin)</li>
</ul>
</div>
</section>
<section class="slide">
<h2>Links</h2>
<div class="center-side">
<ul>
<li><a href="https://docs.cypress.io/guides/overview/why-cypress.html#In-a-nutshell">Cypress docs</a></li>
<li><a href="https://www.youtube.com/watch?v=5XQOK0v_YRE&t=1265s">Brian Mann – I see your point, but… (Part 1) - Assert(JS) 2018 </a></li>
<li><a href="https://www.youtube.com/watch?v=GH9Dvo_BYkk&t=1s">Avoiding The Suck Of Testing Using Cypress.io</a></li>
</ul>
</div>
</section>
<section class="slide">
<h2 class="shout shrink">Thank you!</h2>
</section>
<div class="progress"></div>
<script src="shower/shower.min.js"></script>
<!-- Copyright © 3000 Yours Truly, Famous Inc. -->
</body>
</html>