This presentation provides an overview of WebDriver.io, an open-source automation framework for browser and mobile testing. It discusses the key features of WebDriver.io, including its simple installation, integration with other tools, online tutorials and support community. The presentation also demonstrates different modes for using WebDriver.io (standalone, bare metal, test runner), custom commands, multi-remote testing, and visual and performance testing capabilities. Examples are provided to illustrate interacting with elements, selecting elements, and React support.
4. “WebDriver is a remote control
interface that enables
introspection and control of user
agents.
5.
6. Was ist das WebDriver Protokoll?
▸ Offizieller W3C Standard für Browser Automatisierung
▸ Vorgänger des JSONWireProtocol
▸ WebDriver !== Selenium!!!
▸ Definiert ein REST Interface
▸ Ermöglicht Automatisierung aller Browser
▸ Kann mit allen Programmiersprachen genutzt werden
(minimale Anforderungen: das Senden von HTTP Anfragen)
16. Standalone Mode
Nutzung der
Autom.-befehle über das
Node.js Modul:
WebdriverIO kann auf drei verschiedenen Arten genutzt werden!
WDIO Testrunner
Nutzung des Testrunners,
um Tests parallel laufen zu
lassen:
import {remote} from ‘webdriverio’
const client = remote({
capabilities: { ... }
})
$ wdio wdio.conf.js
Bare Metal Mode
Schnittstelle um direkt
auf das WebDriver
Protokoll zuzugreifen:
import WebDriver from 'webdriver'
const client = await WebDriver
.newSession({
capabilities: {
browserName: 'firefox'
}
})
19. var expect = require('chai').expect;
describe('webdriver.io api page', function() {
it('should be able to filter for commands', function () {
browser.url('http://webdriver.io/api.html');
$('.searchbar input').setValue('getT');
var results = $$('.commands.property a').filter(function (link) {
return link.isVisible();
});
expect(results.length).to.be.equal(3);
// check out second result
results[1].click();
expect($('.doc h1').getText()).to.be.equal('GETTEXT');
});
});
WDIO TESTRUNNER MODE
25. SERVICES IN WEBDRIVER.IO
▸ Möglichkeit Code zu bestimmten Zeiten während des Tests auszuführen
▸ Dazu gibt es sog. Hooks:
▹ onPrepare / onComplete
▹ beforeSession / afterSession
▹ before / after
▹ beforeSuite / afterSuite
▹ beforeTest / afterTest
▹ beforeCommand / afterCommand
▸ Ermöglicht die Modifizierung von Optionen und kann die browser
Instanz mit nützlichen Funktionen bereichern
▸ Nutzung von selbst erstellten Services möglich
29. Element with certain text
const header = $('h1=Welcome to my Page');
const header2 = $('h1*=Welcome');
AUSWÄHLEN VON ELEMENTEN
DURCH DAS WEBDRIVER PROTOKOLL
CSS Query Selector
const elem = $('h2.subheading a');
elem.click();
Link Text
<!-- index.html -->
<a href="http://webdriver.io">WebdriverIO</a>
<h1>Welcome to my Page</h1>
// test.js
const link = $('=WebdriverIO');
console.log(link.getText()); // outputs: "WebdriverIO"
Partial Link Text
const link = $('*=driver');
console.log(link.getText()); // outputs: "WebdriverIO"
XPath
const elem = $('//BODY/P[1]');
elem.click();
30. React.JS Support
<!-- my-component.jsx -->
import React from 'react'
import ReactDOM from 'react-dom'
const MyComponent = (props) => {
const { name } = props;
const [state] = React.useState(name === 'there'
? ', how are you?' : '')
return (<div>Hello {name || 'World'}{state}</div>)
}
ReactDOM.render(
<div>
<MyComponent />
<MyComponent name="Barry"/>
<MyComponent name="WebdriverIO"/>
<MyComponent name="there"/>
</div>,
document.getElementById('#root'),
)
// test.js
const myComponent = browser.react$('MyComponent')
expect(myComponent.isDisplayed()).toBe(true) // pass
const myComponent = browser.react$('MyComponent', {name: 'WebdriverIO'})
expect(myComponent.getText()).toBe('Hello WebdriverIO') // pass
const myComponent = browser.react$('MyComponent', {}, ', how are you?')
expect(myComponent.getText()).toBe('Hello there, how are you?') // pass
AUSWÄHLEN VON ELEMENTEN
DURCH DAS WEBDRIVER PROTOKOLL
31. Accessibility ID
const elem = $('~my_identifier');
elem.click();
UI Automator (iOS)
const selector = 'UIATarget.localTarget().frontMostApp().mainWindow().buttons()[0]';
const Button = $(`ios=${selector}`);
Button.click();
Class Name
// iOS example
$('UIATextField').click();
// Android example
$('android.widget.DatePicker').click();
UI Automator (Android)
const selector = 'new UiSelector().text("Cancel").className("android.widget.Button")';
const Button = $(`android=${selector}`);
Button.click();
AUSWÄHLEN VON ELEMENTEN
MIT Appium
32. Hervorragend geeignet, um spezifische (asynchrone) Logiken in
einen synchronen Befehl zu verwandeln:
browser.addCommand('deleteUser', (username) => {
return axios.post(
'/rest/v1/_test_helpers/delete_user',
{ user: username }
);
});
browser.deleteUser('anonymous123')
browser.url('/dashboard')
// ...
BENUTZERDEFINIERTE BEFEHLE
35. THE PAGE OBJECT MODEL
▸ Sehr populäres Design pattern in der Testautomatisierung
▸ Hält Code sauber und einfach zu managen
▸ In einer idealen Welt würde ein Page Redesign nur Änderungen im
POM erfordern und nicht in den Tests
▸ Alles kann in einem POM abstrahiert werden
▸ Ein POM enthält:
▹ Locators und Elemente
▹ Methoden die spezifische Workflows und Interaktionen mit der
Seite abbilden
43. Zusammenfassung
● WebdriverIO ist ein Framework zur
Automatisierung von E2E (end-to
-end) Tests
● Unterstützt Automatisierung basierend
auf dem WebDriver Protokoll und kann
dadurch Browser als auch mobile Geräte
(web oder native Apps) steuern
● Bietet einen Testrunner, der neben dem
Reporting eine große Anzahl von weiteren
Aufgaben übernimmt, die beim täglichen
Testen anfallen (Integrationen)
Wo kann ich anfangen?
Projektdokumentation: https://webdriver.io
Online Kurs: https://learn.webdriver.io/
Support Chat: https://gitter.im/webdriverio/webdriverio
45. DANKE!
Noch Fragen?
Schreibe mir auf Twitter an: @bromann
oder via E-Mail: christian@saucelabs.com
Slides: http://bit.ly/test-automation-with-webdriverio
46. BIG CONCEPT
Bring the attention of your audience over a key
concept using icons or illustrations
47. White
Is the color of milk and
fresh snow, the color
produced by the
combination of all the
colors of the visible
spectrum.
YOU CAN ALSO SPLIT YOUR CONTENT
Black
Is the color of coal, ebony,
and of outer space. It is
the darkest color, the
result of the absence of or
complete absorption of
light.
48. IN TWO OR THREE COLUMNS
Yellow
Is the color of gold,
butter and ripe
lemons. In the
spectrum of visible
light, yellow is found
between green and
orange.
Blue
Is the colour of the
clear sky and the
deep sea. It is located
between violet and
green on the optical
spectrum.
Red
Is the color of blood,
and because of this it
has historically been
associated with
sacrifice, danger and
courage.
56. LET’S REVIEW SOME CONCEPTS
Yellow
Is the color of gold, butter and
ripe lemons. In the spectrum of
visible light, yellow is found
between green and orange.
Blue
Is the colour of the clear sky
and the deep sea. It is located
between violet and green on the
optical spectrum.
Red
Is the color of blood, and
because of this it has
historically been associated
with sacrifice, danger and
courage.
Yellow
Is the color of gold, butter and
ripe lemons. In the spectrum of
visible light, yellow is found
between green and orange.
Blue
Is the colour of the clear sky
and the deep sea. It is located
between violet and green on the
optical spectrum.
Red
Is the color of blood, and
because of this it has
historically been associated
with sacrifice, danger and
courage.
63. CREDITS
Special thanks to all the people who made and released these
awesome resources for free:
▸ Simple line icons by Mirko Monti
▸ E-commerce icons by Virgil Pana
▸ Streamline iconset by Webalys
▸ Presentation template by SlidesCarnival
▸ Photographs by Death to the Stock Photo (license)
64. PRESENTATION DESIGN
This presentations uses the following typographies and colors:
▸ Titles: Montserrat
▸ Body copy: Karla
You can download the fonts on this page:
http://www.google.com/fonts/#UsePlace:use/Collection:Montserrat:400,700|Karla:400,400italic,700,700italic
Click on the “arrow button” that appears on the top right
Red #F44336 Deep orange #FF5722 Orange #FF9800 Amber #FFC107
Yellow #FFEB3B Lime #CDDC39 Green #8BC34A Dark green #4CAF50
Teal #009688 Cyan #00BCD4 Blue #03A9F4 Dark blue #2196F3
Indigo #3F51B5 Deep Purple #673AB7 Purple #9C27B0 Magenta #E91E63
Blue gray #607D8B
You don’t need to keep this
slide in your presentation.
It’s only here to serve you
as a design guide if you
need to create new slides
or download the fonts to
edit the presentation in
PowerPoint®
65. What’s this?
This is a free presentation template for
Google Slides designed by
SlidesCarnival.
We believe that good design serves to
better communicate ideas, so we create
free quality presentation templates for
you to focus on the content.
Enjoy them at will and share with us
your results at:
twitter.com/SlidesCarnival
facebook.com/slidescarnival
ABOUT THIS TEMPLATE
How can I use it?
Open this document in Google Slides (if you are at
slidescarnival.com use the button below this presentation).
You have to be signed in to your Google account
EDIT IN GOOGLE SLIDES
Go to the File menu and select Make a copy. You will get a
copy of this document on your Google Drive and will be able
to edit, add or delete slides.
EDIT IN MICROSOFT POWERPOINT®
Go to the File menu and select Download as Microsoft
PowerPoint. You will get a .pptx file that you can edit in
PowerPoint. Remember to download and install the fonts
used in this presentation (you’ll find the links to the font files
needed in the Presentation design slide)
This template is free to use
under Creative Commons
Attribution license. If you
use the graphic assets
(photos, icons and
typographies) provided with
this presentation you must
keep the Credits slide.
66. Line Icons by Webalys, Virgil Pana and Mirko Monti are published under a Creative Commons Attribution license and Free for both personal and commercial
use. You can copy, adapt, remix, distribute or transmit them. If you use these sets on your presentation remember to keep the “Credits” slide or provide a
mention and link to these resources:
● Mirko Monti - Simple line icons
● Virgil Pana - E-commerce icons
● Webalys - Streamline iconset