This repository has been archived by the owner on Mar 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
611 lines (431 loc) · 15.9 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
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Responsive Testing mit Galen</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<link rel="stylesheet" href="styles/reveal.css" media="all">
<link rel="stylesheet" href="styles/presentation.css" media="all">
<link rel="shortcut icon" href="images/brand/favicon.png">
<!-- If the query includes 'print-pdf', include the PDF print sheet -->
<script>
if( window.location.search.match( /print-pdf/gi ) ) {
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'bower_components/reveal.js/css/print/pdf.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
var linkMore = document.createElement('link');
linkMore.rel = 'stylesheet';
linkMore.type = 'text/css';
linkMore.href = 'styles/pdf.css';
document.getElementsByTagName( 'head' )[0].appendChild( linkMore );
}
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<div class="slides">
<section data-markdown data-separator="^\n---\n$" data-separator-vertical="^\n--\n$" data-separator-notes="^>NOTES:"><script type="text/template"># Responsive Testing with Galen
Martin Reinhardt
 <!-- .element: class="inline" style="max-height:32px; vertical-align: top; " --> [@mreinhardt](https://twitter.com/mreinhardt)<br />
---
# Agenda
* Why Galen?
* Responsive Testing
* Galen Specs
* Demo
* Best Practices and Lessons Learned
* Outlook
---
# Why Galen
* Different screen size and element appearance for devices<!-- .element: class="fragment"-->
* Responsive Layout drives testing effort<!-- .element: class="fragment"-->
* Agile development need repeatable automated tests<!-- .element: class="fragment"-->
>NOTES:
* Browser-Wanking
* Combinations of screen size and browser increase efforts
* 20 pages in 4 browser
* muliplied with 4 device classes
* Repeats in every sprint
* human are not good in repeating the same things over and over again
--
# About Galen

> "Galen is a OSS tool for testing html layout in a real browser"
* Galen is a OSS tool for testing html layout in a real browser
* Tests describing the expected behaviour in a certian device
* Features<!-- .element: class="fragment"-->
* Human readable DSL<!-- .element: class="fragment"-->
* uses Selenium as Runtime (e.g page interaction with Selenium possible)<!-- .element: class="fragment"-->
* Advanced test suite syntax with data-providers<!-- .element: class="fragment"-->
* Advanced Reporting<!-- .element: class="fragment"-->
>NOTES:
* interaction with WebDriver possible
* positive AND negative feedback
--
# Architecture
* Test specifications and device informations = Test Run
* Tests are running in Selenium

* API for Java and JavaScript<!-- .element: class="fragment"-->
>NOTES:
* Galen is written in Java
* Rhino as API to JavaScript
--

* Layout Testing is challenging
* Simple solution: test object relative to each other via a special syntax and rules
--

* Runs in Selenium Grid
* Test several browser, e.g in a cloud like Sauce Labs or BrowserStack
* Supports testing on different mobile devices
* run multiple tests in parallel to save time
>NOTES:
* can be used with Appium for mobile devices
--
# Installation
* Manual Install
* NPM Install
<br>
```bash
(sudo) npm install -g galenframework-cli
```
---
# Size does matter ...

* responsive Tests in TDD-Style possible
* requirements are written in Layout Spec
* verify requirments via a test run
* screen size import during execution and for the the assumed layout
---
# Galen Spec Language

* elements are defined
* devices are matched via Tags
* rules describe your expectations
--
# Example
```python
@objects
content #content
heading .tile_head_line_icon
= Content should not exceed screen width =
content:
width 90 to 100% of viewport/width
= Content should not exceed component width =
@on mobile
content.heading:
inside parent ~0px left
@on desktop
content.heading:
inside parent ~5px left
```
* Without tag every variant is used
--
## Reuse
* Import
* Components
--
## Import of general specs
```python
@objects
tile-image-* .tile_inline_first
tile-text-* .tile_inline_second
@import shared/commonLayout.gspec
= Content should not exceed screen width =
tile-image-*:
aligned horizontally all tile-image-1
```
--
## Components
* behave like widgets, z.B. menu or list entries
* Pseudo-element 'parent' for reference
```python
@objects
tile-image-* .tile_inline_first
tile-text-* .tile_inline_second
= Content should not exceed screen width =
tile-image-*:
aligned horizontally all tile-image-1
= Info section =
tile-text-*:
component shared/tileTextComponent.gspec
```
--
## Structure of tests
* Galen allows using parameters:
```python
@@ table devices
| device | size |
| mobile | 500x700 |
| tablet | 900x600 |
| desktop | 1300x700 |
@@ parameterized using devices
homepage on ${device}
${websiteUrl} ${size}
check specs/homepage.spec --include "${device}"
```
Run via commandline
```
galen test my.test -DwebsiteUrl='https://getbootstrap.com' --htmlreport reports/
```
--
# Test execution
Can run single tests:
```python
$ galen check home-page.spec
--url "http://example.com/home"
--size 1024x800
--include desktop
--htmlreport report.html
```
--
# Image comparison
* Pagedump taking screenshots of current page
```python
galen dump "specs/homepage.spec"
--url "http://galenframework.com"
--size "1024x768"
--export "dumps/homepage-dump"
--max-width "200"
--max-height "200"
```
--
# Usage in Spec
```python
header-logo
image: file imgs/header-logo.png, error 4%
```

---
# Report

* Report is helping to show errors
--
# Sample-Report
<div class="stretch">
<iframe src="code/reports/bootstrap/12-javascript-page-on-desktop-in-firefox-browser.html" width="100%" height="100%" style=" margin: 0px; padding: 0px;"></iframe>
</div>
---
# Demo
```python
# basic.test
@@ table browsers
| browerName | browser |
| Chrome | chrome |
| Firefox | firefox |
@@ table devices
| deviceName | tags | size |
| Mobile | mobile | 320x600 |
| Desktop | desktop | 1024x800 |
@@ parameterized using browsers
@@ parameterized using devices
@@ groups home, page
homepage on ${deviceName} in ${browerName} browser
selenium ${browser} ${websiteUrl} ${size}
check specs/homePageLayout.spec --include "${device}"
# run
galen test basic.test -DwebsiteUrl="getbootstrap.com" --htmlreport reports -Dwebdriver.chrome.driver=...
```
--
# Live-Demo

>NOTES:
* page dump
* galen dump "code/test/bootstrap/specs/homePageLayout.gspec" --url "http://getbootstrap.com" --size "1024x768" --export "reports/layout/test.dump" --max-width "200" --max-height "200"
* iterm: umst + cmd +7
--
# Saucelabs
* Testing in Cloud possible
```python
@@ set
sauceKey aff16b42-9c23-4cb6-adf7-38da9e02193a
sauceUser hypery2k
gridLogin ${sauceUser}:${sauceKey}
gridUrl http://${gridLogin}@ondemand.saucelabs.com:80/wd/hub
website http://testapp.galenframework.com
@@ table browsers
| browserName | gridArgs |
| Safari on Mac | --browser "safari" --version 6 --dc.platform "OS X 10.8" |
| Opera | --browser "opera" --version 12 --dc.platform "Linux" |
| Firefox | --browser "firefox" --version 34 --dc.platform "Linux" |
| Chrome | --browser "chrome" --version 39 --dc.platform "Linux" |
| IE 11 | --browser "internet explorer" --version 11 --dc.platform "Windows 8.1" |
@@ parameterized using browsers
Home page on ${browserName} browser
selenium grid ${gridUrl} --page ${website} ${gridArgs}
check homepage.spec
```
>NOTES:
* Alternative zum eigenen Grid
* [Dashboard](https://saucelabs.com/beta/dashboard)
---
# Interaction
* [GalenPages API](http://galenframework.com/docs/reference-galenpages-javascript-api/) helps to support simple interactions
* Simple PageObject-Pattern Library
```javascript
var login = arg.login, password = arg.password; // test data
this.LoginPage = $page("Login page", {
email: "input.email", // css locator
password: "xpath: //input[@class='password']", // xpath locator
submitButton: "id: submit", // id locator
load: function () {
this.open("http://example.com/login");
return this.waitForIt();
},
loginAs: function (userName, password) {
this.email.typeText(userName);
this.password.typeText(password);
this.submitButton.click();
}
});// now you can use it like this
new LoginPage(driver).load().loginAs(login, password);
```
--
# Combine GalenPages and Specs
```python
@@ table browsers
| browerName | browser |
| Chrome | chrome |
| Firefox | firefox |
@@ table devices
| deviceName | tags | size |
| Mobile | mobile | 320x600 |
| Desktop | desktop | 1024x800 |
@@ parameterized using browsers
@@ parameterized using devices
@@ groups login, page
login on ${deviceName} in ${browerName} browser
selenium ${browser} ${websiteUrl} ${size}
check specs/loginPageLayout.gspec --include "${device}"
run login.js '{login: "user", password: "password"}'
check specs/eventPageLayout.gspec --include "${device}"
```
---
# Sum up
* TDD in Responsive Design possible
* decribe layout requirements in layout spec
* implement frontend
* verify frontend design
>NOTES:
Once the html is finished you can define the references to all your objects in spec using one of the locators: id, css, xpath
--
## Best Practices and Lessons Learned
* General
* Responsive testing is possible
* but don't check 'each pixel'
* use element relations
* tests can be flaky
* infrastructure (Integration Tests)
* Use Selenium Grid
* Implement step by step (pages, browser, screen sizes)
* not test all
>NOTES:
* Aufgrund von verschiedenen Browsern Pixel-genau nicht sinvoll (Rundungen ...)
* Integrationstests aufgrund ihrer Natur!!
* Fokus beim Testen wichtig
* Nicht den Fehler machen am Anfang alles zu testen
* Eine Platform/Browser zu Beginn
* Schritt für Schritt ausbauen
---
# Links
* Presentation: [github.com/SoKaHH/galen_google-dev-fest-2015](https://github.com/SoKaHH/galen_google-dev-fest-2015)
* Kickstarter for IDE: [github.com/hypery2k/galen_ide](https://github.com/hypery2k/galen_ide)
* [galenframework.com](http://galenframework.com)
* [Visual Test-Driven Development For Responsive Interface Design](http://www.smashingmagazine.com/2015/04/07/visual-test-driven-development-responsive-interface-design/)
* [Using Galen with gulp](http://galenframework.com/docs/tutorial-using-galen-with-a-task-runner/)
* [Responsive Testing with Galen in Java](http://kekz-box.de/en/responsive-testing-galen/)
* [Sublime Highlighting](https://github.com/professant/sublime-galen)
* Doku
* [Test Suite Syntax](http://galenframework.com/docs/reference-galen-test-suite-syntax/#Parameterization)
* [TestSpec Syntax](http://galenframework.com/docs/reference-galen-spec-language-guide/)
* [CLI](http://galenframework.com/docs/reference-working-in-command-line/)
---
# Enjoying Hamburg?
<img src="images/hamburg_speicherstadt.jpg" height="250em" style="padding-top:0"></img>
<div class="fragment">
We are searching local <a href="http://bit.ly/1HCmKft" target="_blank">software enthusiasts (de)</a>!
<br>
<img src="images/qr_job.png" height="400em"></img>
</div>
</script></section>
</div>
<footer>
<img src="images/brand/holisticon-logo-grey.svg" class="holisticon-logo" alt="Holisticon AG">
</footer>
</div>
<script src="scripts/reveal.js"></script>
<script>
// Configure Reveal
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
// The "normal" size of the presentation, aspect ratio will be preserved
// when the presentation is scaled to fit different resolutions. Can be
// specified using percentage units.
width: 1024,
height: 768,
// Factor of the display size that should remain empty around the content
margin: 0.1,
// Display controls in the bottom right corner
controls: true,
// Display a presentation progress bar
progress: true,
// Display the page number of the current slide
slideNumber: false,
// Push each slide change to the browser history
history: true,
// Enable keyboard shortcuts for navigation
keyboard: true,
// Vertical centering of slides
center: true,
// Enable the slide overview mode
overview: true,
// Enables touch navigation on devices with touch input
touch: true,
// Loop the presentation
loop: false,
// Change the presentation direction to be RTL
rtl: false,
// Turns fragments on and off globally
fragments: true,
// Flags if the presentation is running in an embedded mode,
// i.e. contained within a limited portion of the screen
embedded: false,
// Number of milliseconds between automatically proceeding to the
// next slide, disabled when set to 0, this value can be overwritten
// by using a data-autoslide attribute on your slides
autoSlide: 0,
// Stop auto-sliding after user input
autoSlideStoppable: true,
// Factor of the display size that should remain empty around the content
margin: 0.1,
// Bounds for smallest/largest possible scale to apply to content
minScale: 0.5,
maxScale: 100.0,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
// Transition speed
transitionSpeed: 'default', // default/fast/slow
transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/linear/fade/none
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'scripts/reveal.classList.js', condition: function() { return !document.body.classList; } },
{ src: 'scripts/reveal.marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'scripts/reveal.markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'scripts/reveal.highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'scripts/reveal.zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'scripts/reveal.notes.js', async: true, condition: function() { return !!document.body.classList; } },
//{ src: 'scripts/reveal.search.js', async: true, condition: function() { return !!document.body.classList; } },
//{ src: 'scripts/reveal.remotes.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
</script>
</body>
</html>