SlideShare a Scribd company logo
1 of 45
1
A test framework out of the box - Geb for Web
and mobile
Yaroslav Sviatkin
Senior Test Automation Engineer, Consultant
2
3
HtmlElements. Page Object
4
JDI UI Test Automation Framework
@JSite(domain = "https://epam.github.io/JDI/")
public class JDIExampleSite extends WebSite {
public static HomePage homePage;
public static LoginForm loginForm;
@FindBy(css = ".profile-photo")
public static Label profilePhoto;
public static void login() {
profilePhoto.click();
loginForm.loginAs(new User());
}
}
5
Automated Acceptance Testing with Style
http://www.thucydides.info/#/
6
7
Project structure
Page Object classes
Steps implementation
class
Stories classes
Requirements for the
application under test
8
Organizing requirements
First, you create a model of the features and user stories you intend to
implement:
Stories
Features
9
Page Objects
Next you will need to implement your page objects. These are almost just
run-of-the-mill WebDriver page objects, but with a few enhancements:
10
Steps implementation
Now implement the actual test steps using either WebDriver page objects or
other test steps. Here you start thinking about implementation:
A step library
High level steps...
...implemented with
Page Objects
...or with other steps
11
12
Selenide
http://selenide.org
13
14
Geb
http://www.gebish.org
15
Geb is a browser automation solution
What is Geb?
16
• Any web and mobile applications
• App doesn't need to be written in Groovy
What can you test with Geb?
17
go "http://www.google.com"
$("input", name: "q").value("geb")
$("button", name: "btnG").click()
waitFor { $("#search").displayed }
$("h3.r").first().click()
waitFor { title == "Geb - Very Groovy Browser
18
Selector syntax
title { $(By.xpath(".//h4[@class='title ng-
binding']")).text()
$("#by-id")
$(".by-class")
$("div", name: "by-attribute")
$("div", text: "By text")
$(By.id("some-id"))
$(By.className("some-class"))
$(By.xpath('//p[@class="xpath"]'))
…
19
assert $("p", 1..2)*.text() == ["b", "c"]
assert $("p", text: ~/p./).size() == 2
assert $("p", text: startsWith("p")).size() == 2
20
assert $("p.d").previous() == $("p.c")
assert $("p.e").prevAll() == $("p.c").add("p.d")
assert $("p.d").next() == $("p.e")
assert $("p.c").nextAll() == $("p.d").add("p.e")
assert $("p.d").parent() == $("div.b")
assert $("p.c").siblings() ==
$("p.d").add("p.e")
assert $("div.a").children() ==
$("div.b").add("div.f")
21
project { String index -> $(By.xpath("//div[@class=card-item']//h4[@title='${index}']")).click() }
projectPage.project(nameProject)
22
dynamicallyAdded(wait: true) { $("p.dynamic") }
dynamicallyAdded(wait: 5, required: false) {
$("p.dynamic") }
cachedValue(cache: true) { value }
helpLink(to: HelpPage) { $("a", text: "Help") }
23
Page Object Model
24
Page
25
Control modules
• FormElement
• Checkbox
• Select
• MultipleSelect
• TextInput
• Textarea
• FileInput
• RadioButtons
26
class ExamplePage extends Page {
static content = {
theModule { module ExampleModule }
}
}
class ExampleModule extends Module {
static content = {
button { $("input", type: "submit") }
}
}
27
class NotificationModule extends Module {
static content = {
notifocation {
$(By.xpath(".//li[contains(@ng-repeat,'notifications')]")).moduleList(Notification)
}
gotItButton { $(By.xpath(".//button[@ng-click='appCtrl.gotItNotifications()']")) }
}
}
class Notification extends Module {
static content = {
name { $(By.xpath("//h5")).text() }
dete { $(By.xpath("//div[contains(@class,'date')]")).text() }
notification { $(By.xpath("//p")) text() }
}
}
28
searchResult(required: false, wait: 5) { $(By.xpath("//li/a/strong"))*.text() }
notification { $(By.xpath("//ul[contains(@ng-if,'notifications')]")).module(NotificationModule) }
menuLinksModule(wait: 5) {
$(By.xpath("//button[contains(@class,'services')]")).module(MenuLinksModule) }
29
class IdeaCreatePage extends geb.Page {
static at = { $("div#create-idea").displayed }
}
static content = {
createButton(to: IdeaShowPage) { $("input#create") }
}
IdeaCreatePage ideaCreatePage = to(IdeaCreatePage)
isAt(IdeaCreatePage)
30
•
class LoginPage extends Page {
static url = "access/signin"
static at = { browser.currentUrl.startsWith("https://wwwwwwwwww.com") }
static content = {
userName(wait: 5) { $(By.xpath("//input[@type='text']")) }
userPassword { $(By.xpath("//input[@type='password']")) }
loginError(required: false, wait: 3) { $(By.xpath("//div[@class='error']")).text() }
loginSubmit { $("button", text: startsWith("Login")).click() }
heading (to:BasePage){ $(By.xpath("//div[@class='info']/h1")).text() }
}
def login(String login, String password) {
userName.firstElement().clear()
userPassword.firstElement().clear()
userName << login
userPassword << password
loginSubmit
}
}
31
waitFor examples
waitFor {
$("div.alert").displayed
}
waitFor {
$("div.message").text() == "Update
successful"
}
32
Mouse interactions
void moveRatingSlider(Integer rating) {
// Slider is 400 pixels wide and starts at 1,
// so each notch above 1 is 100 pixels
apart
Integer numPixelsX = (rating - 1) * 100
interact {
clickAndHold(ratingSliderHandle)
moveByOffset(numPixelsX, 0)
release()
}
}
WebElement underlyingElement =
$('#myElement').getElement(0)
Action action = new
Actions(browser.driver)
.clickAndHold(underlyingElement)
.moveByOffset(15,15)
.release()
.build()
action.perform()
}
Use keyboard
$(".ui-slider-handle") << Keys.ARROW_RIGHT
33
Already opened windows
withWindow({ title == "Geb - Very Groovy Browser Automation" }) {
assert $("#slogan").text().startsWith("very groovy browser automation…")
}
}
withNewWindow({ $('a').click() }) {
assert title == 'Geb - Very Groovy Browser Automation'
}
34
@Test
void feedBackReferenceTest() {
openMenu
browser.withNewWindow({ basePage.menuLinksModule.feedback }, {
assert browser.currentUrl.startsWith("https://helpdesk.com/")
})
}
@Test
void officeMapReferenceTest() {
openMenu
browser.withWindow({
basePage.menuLinksModule.officeMap }, {
if (browser.currentUrl == signinUrl) {
loginPage.login(userName, userPassword)
}
assert browser.currentUrl == "https://portal.com"
})
browser.to(ProjectPage)
}
35
Show hidden element
void scrollUp() {
js.exec("""window.scrollTo(0,0)""")
}
$("div#a").jquery.mouseov
er()
Browser.drive {
assert js.myGlobalVar ==
1
}
36
Available browsers
37
waiting {
timeout = 2
}
baseUrl = "https://wwwwwwwww.com/"
autoClearCookies = false
atCheckWaiting = true
baseNavigatorWaiting = true
name = ''
password = ''
mail =''
environments {
chrome {
driver = {
def driverInstance = new ChromeDriver()
driverInstance.manage().window().maximize()
driverInstance
}
}
firefox {
driver = {
def driverInstance = new FirefoxDriver()
driverInstance.manage().window().maximize()
driverInstance
}
}
ie {
driver = {
def driverInstance = new InternetExplorerDriver()
driverInstance.manage().window().maximize()
driverInstance
} }}
//Receiving name and password from GebConfig.groovy
final String userName = browser.config.rawConfig.name
final String userPassword =
browser.config.rawConfig.password
38
task chromeTest(type: Test) {
systemProperty "geb.env", "chrome"
systemProperty "webdriver.chrome.driver", "driverschromedriver.exe"
useTestNG {
suites "srctestresourcestestng-suite.xml"
useDefaultListeners = true
}
}
// Drivers
testCompile "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion"
testCompile "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion"
testCompile "org.seleniumhq.selenium:selenium-ie-driver:$seleniumVersion"
39
static String randomString(int count) {
(1..count).inject("") { a, b -> a += ('a'..'z')[new Random().nextFloat() * 26 as int] }.capitalize()
}
def getWanted() {
def result = []
HTTPRequest.request(GET, JSON) { req ->
uri.path = '/wanted'
headers.'Auth' = "${TOKEN}"
response.success = { resp, json ->
println new JsonBuilder( json).toPrettyString()
(json as ArrayList).each {
String name = it.name
def projects = []
(it.projects as ArrayList).each {
projects << [it.projectid.'$oid', it.title]
}
result << [name, projects].flatten()
}
}
}
result
}
40
List getAllIdProject() {
def result = []
GITLAB.get(path: "/gitlab/api/v3/projects/all") { resp, json ->
println new JsonBuilder(json).toPrettyString()
def request = (json as Map)
result = request*.id
}
result
}
assert loginPage.heading == "Welcome"
41
Geb integrates with
42
Geb-mobile
https://github.com/JasonKissinger-MDT/geb-mobile
43
4444
Q & A
45
Yaroslav Sviatkin
Senior Test Automation Engineer,
Consultant
iaroslav.sviatkin@globallogic.com
Thank you

More Related Content

What's hot

JavaScript para Graficos y Visualizacion de Datos - BogotaJS
JavaScript para Graficos y Visualizacion de Datos - BogotaJSJavaScript para Graficos y Visualizacion de Datos - BogotaJS
JavaScript para Graficos y Visualizacion de Datos - BogotaJSphilogb
 
Basic Tutorial of React for Programmers
Basic Tutorial of React for ProgrammersBasic Tutorial of React for Programmers
Basic Tutorial of React for ProgrammersDavid Rodenas
 
Better Bullshit Driven Development [SeleniumCamp 2017]
Better Bullshit Driven Development [SeleniumCamp 2017]Better Bullshit Driven Development [SeleniumCamp 2017]
Better Bullshit Driven Development [SeleniumCamp 2017]automician
 
Awesome State Management for React and Other Virtual-Dom Libraries
Awesome State Management for React and Other Virtual-Dom LibrariesAwesome State Management for React and Other Virtual-Dom Libraries
Awesome State Management for React and Other Virtual-Dom LibrariesFITC
 
Performance Optimization In Angular 2
Performance Optimization In Angular 2Performance Optimization In Angular 2
Performance Optimization In Angular 2Eyal Vardi
 
Présentation et bonnes pratiques du pattern MVVM - MIC Belgique
Présentation et bonnes pratiques du pattern MVVM - MIC BelgiquePrésentation et bonnes pratiques du pattern MVVM - MIC Belgique
Présentation et bonnes pratiques du pattern MVVM - MIC BelgiqueDenis Voituron
 
Desenvolvimento web com Ruby on Rails (extras)
Desenvolvimento web com Ruby on Rails (extras)Desenvolvimento web com Ruby on Rails (extras)
Desenvolvimento web com Ruby on Rails (extras)Joao Lucas Santana
 
Building Reusable Custom Elements With Angular
Building Reusable Custom Elements With AngularBuilding Reusable Custom Elements With Angular
Building Reusable Custom Elements With AngularIlia Idakiev
 
Test and profile your Windows Phone 8 App
Test and profile your Windows Phone 8 AppTest and profile your Windows Phone 8 App
Test and profile your Windows Phone 8 AppMichele Capra
 
Taking Web Apps Offline
Taking Web Apps OfflineTaking Web Apps Offline
Taking Web Apps OfflinePedro Morais
 
Mobile App Development: Primi passi con NativeScript e Angular 2
Mobile App Development: Primi passi con NativeScript e Angular 2Mobile App Development: Primi passi con NativeScript e Angular 2
Mobile App Development: Primi passi con NativeScript e Angular 2Filippo Matteo Riggio
 
Angular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time CompilationAngular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time CompilationEyal Vardi
 
A To-do Web App on Google App Engine
A To-do Web App on Google App EngineA To-do Web App on Google App Engine
A To-do Web App on Google App EngineMichael Parker
 
Reactive Type-safe WebComponents
Reactive Type-safe WebComponentsReactive Type-safe WebComponents
Reactive Type-safe WebComponentsMartin Hochel
 

What's hot (20)

JavaScript para Graficos y Visualizacion de Datos - BogotaJS
JavaScript para Graficos y Visualizacion de Datos - BogotaJSJavaScript para Graficos y Visualizacion de Datos - BogotaJS
JavaScript para Graficos y Visualizacion de Datos - BogotaJS
 
Basic Tutorial of React for Programmers
Basic Tutorial of React for ProgrammersBasic Tutorial of React for Programmers
Basic Tutorial of React for Programmers
 
Better Bullshit Driven Development [SeleniumCamp 2017]
Better Bullshit Driven Development [SeleniumCamp 2017]Better Bullshit Driven Development [SeleniumCamp 2017]
Better Bullshit Driven Development [SeleniumCamp 2017]
 
Awesome State Management for React and Other Virtual-Dom Libraries
Awesome State Management for React and Other Virtual-Dom LibrariesAwesome State Management for React and Other Virtual-Dom Libraries
Awesome State Management for React and Other Virtual-Dom Libraries
 
Performance Optimization In Angular 2
Performance Optimization In Angular 2Performance Optimization In Angular 2
Performance Optimization In Angular 2
 
Présentation et bonnes pratiques du pattern MVVM - MIC Belgique
Présentation et bonnes pratiques du pattern MVVM - MIC BelgiquePrésentation et bonnes pratiques du pattern MVVM - MIC Belgique
Présentation et bonnes pratiques du pattern MVVM - MIC Belgique
 
Javascript 2
Javascript 2Javascript 2
Javascript 2
 
Desenvolvimento web com Ruby on Rails (extras)
Desenvolvimento web com Ruby on Rails (extras)Desenvolvimento web com Ruby on Rails (extras)
Desenvolvimento web com Ruby on Rails (extras)
 
Building Reusable Custom Elements With Angular
Building Reusable Custom Elements With AngularBuilding Reusable Custom Elements With Angular
Building Reusable Custom Elements With Angular
 
Test and profile your Windows Phone 8 App
Test and profile your Windows Phone 8 AppTest and profile your Windows Phone 8 App
Test and profile your Windows Phone 8 App
 
Taking Web Apps Offline
Taking Web Apps OfflineTaking Web Apps Offline
Taking Web Apps Offline
 
Mobile App Development: Primi passi con NativeScript e Angular 2
Mobile App Development: Primi passi con NativeScript e Angular 2Mobile App Development: Primi passi con NativeScript e Angular 2
Mobile App Development: Primi passi con NativeScript e Angular 2
 
Django quickstart
Django quickstartDjango quickstart
Django quickstart
 
Angular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time CompilationAngular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time Compilation
 
A To-do Web App on Google App Engine
A To-do Web App on Google App EngineA To-do Web App on Google App Engine
A To-do Web App on Google App Engine
 
22 j query1
22 j query122 j query1
22 j query1
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
JQuery UI
JQuery UIJQuery UI
JQuery UI
 
Yui app-framework
Yui app-frameworkYui app-framework
Yui app-framework
 
Reactive Type-safe WebComponents
Reactive Type-safe WebComponentsReactive Type-safe WebComponents
Reactive Type-safe WebComponents
 

Similar to A test framework out of the box - Geb for Web and mobile

QA Fest 2017. Ярослав Святкин. Тестовый фреймворк GEB для тестирования WEB пр...
QA Fest 2017. Ярослав Святкин. Тестовый фреймворк GEB для тестирования WEB пр...QA Fest 2017. Ярослав Святкин. Тестовый фреймворк GEB для тестирования WEB пр...
QA Fest 2017. Ярослав Святкин. Тестовый фреймворк GEB для тестирования WEB пр...QAFest
 
Continuous integration using thucydides(bdd) with selenium
Continuous integration using thucydides(bdd) with seleniumContinuous integration using thucydides(bdd) with selenium
Continuous integration using thucydides(bdd) with seleniumXebia IT Architects
 
Google App Engine in 40 minutes (the absolute essentials)
Google App Engine in 40 minutes (the absolute essentials)Google App Engine in 40 minutes (the absolute essentials)
Google App Engine in 40 minutes (the absolute essentials)Python Ireland
 
Continuous integration using thucydides(bdd) with selenium
Continuous integration using thucydides(bdd) with  seleniumContinuous integration using thucydides(bdd) with  selenium
Continuous integration using thucydides(bdd) with seleniumKhyati Sehgal
 
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Iakiv Kramarenko
 
Workshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsWorkshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsSami Ekblad
 
Hybrid App using WordPress
Hybrid App using WordPressHybrid App using WordPress
Hybrid App using WordPressHaim Michael
 
OSGi and Spring Data for simple (Web) Application Development - Christian Bar...
OSGi and Spring Data for simple (Web) Application Development - Christian Bar...OSGi and Spring Data for simple (Web) Application Development - Christian Bar...
OSGi and Spring Data for simple (Web) Application Development - Christian Bar...mfrancis
 
OSGi and Spring Data for simple (Web) Application Development
OSGi and Spring Data  for simple (Web) Application DevelopmentOSGi and Spring Data  for simple (Web) Application Development
OSGi and Spring Data for simple (Web) Application DevelopmentChristian Baranowski
 
Java Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAXJava Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAXIMC Institute
 
Aplicacoes dinamicas Rails com Backbone
Aplicacoes dinamicas Rails com BackboneAplicacoes dinamicas Rails com Backbone
Aplicacoes dinamicas Rails com BackboneRafael Felix da Silva
 
01 Introduction - JavaScript Development
01 Introduction - JavaScript Development01 Introduction - JavaScript Development
01 Introduction - JavaScript DevelopmentTommy Vercety
 
jQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterprisejQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterpriseDave Artz
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoRob Bontekoe
 
Gae Meets Django
Gae Meets DjangoGae Meets Django
Gae Meets Djangofool2nd
 
Breaking the limits_of_page_objects
Breaking the limits_of_page_objectsBreaking the limits_of_page_objects
Breaking the limits_of_page_objectsRobert Bossek
 
Building a Pyramid: Symfony Testing Strategies
Building a Pyramid: Symfony Testing StrategiesBuilding a Pyramid: Symfony Testing Strategies
Building a Pyramid: Symfony Testing StrategiesCiaranMcNulty
 

Similar to A test framework out of the box - Geb for Web and mobile (20)

QA Fest 2017. Ярослав Святкин. Тестовый фреймворк GEB для тестирования WEB пр...
QA Fest 2017. Ярослав Святкин. Тестовый фреймворк GEB для тестирования WEB пр...QA Fest 2017. Ярослав Святкин. Тестовый фреймворк GEB для тестирования WEB пр...
QA Fest 2017. Ярослав Святкин. Тестовый фреймворк GEB для тестирования WEB пр...
 
Continuous integration using thucydides(bdd) with selenium
Continuous integration using thucydides(bdd) with seleniumContinuous integration using thucydides(bdd) with selenium
Continuous integration using thucydides(bdd) with selenium
 
Google App Engine in 40 minutes (the absolute essentials)
Google App Engine in 40 minutes (the absolute essentials)Google App Engine in 40 minutes (the absolute essentials)
Google App Engine in 40 minutes (the absolute essentials)
 
Continuous integration using thucydides(bdd) with selenium
Continuous integration using thucydides(bdd) with  seleniumContinuous integration using thucydides(bdd) with  selenium
Continuous integration using thucydides(bdd) with selenium
 
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
 
Workshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsWorkshop: Building Vaadin add-ons
Workshop: Building Vaadin add-ons
 
Prototype UI Intro
Prototype UI IntroPrototype UI Intro
Prototype UI Intro
 
Hybrid App using WordPress
Hybrid App using WordPressHybrid App using WordPress
Hybrid App using WordPress
 
OSGi and Spring Data for simple (Web) Application Development - Christian Bar...
OSGi and Spring Data for simple (Web) Application Development - Christian Bar...OSGi and Spring Data for simple (Web) Application Development - Christian Bar...
OSGi and Spring Data for simple (Web) Application Development - Christian Bar...
 
OSGi and Spring Data for simple (Web) Application Development
OSGi and Spring Data  for simple (Web) Application DevelopmentOSGi and Spring Data  for simple (Web) Application Development
OSGi and Spring Data for simple (Web) Application Development
 
Java Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAXJava Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAX
 
Aplicacoes dinamicas Rails com Backbone
Aplicacoes dinamicas Rails com BackboneAplicacoes dinamicas Rails com Backbone
Aplicacoes dinamicas Rails com Backbone
 
01 Introduction - JavaScript Development
01 Introduction - JavaScript Development01 Introduction - JavaScript Development
01 Introduction - JavaScript Development
 
jQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterprisejQuery in the [Aol.] Enterprise
jQuery in the [Aol.] Enterprise
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" Domino
 
Gae Meets Django
Gae Meets DjangoGae Meets Django
Gae Meets Django
 
Breaking the limits_of_page_objects
Breaking the limits_of_page_objectsBreaking the limits_of_page_objects
Breaking the limits_of_page_objects
 
Building a Pyramid: Symfony Testing Strategies
Building a Pyramid: Symfony Testing StrategiesBuilding a Pyramid: Symfony Testing Strategies
Building a Pyramid: Symfony Testing Strategies
 
Geb presentation
Geb presentationGeb presentation
Geb presentation
 
Django at the Disco
Django at the DiscoDjango at the Disco
Django at the Disco
 

More from GlobalLogic Ukraine

GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”
GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”
GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”GlobalLogic Ukraine
 
Штучний інтелект як допомога в навчанні, а не замінник.pptx
Штучний інтелект як допомога в навчанні, а не замінник.pptxШтучний інтелект як допомога в навчанні, а не замінник.pptx
Штучний інтелект як допомога в навчанні, а не замінник.pptxGlobalLogic Ukraine
 
Задачі AI-розробника як застосовується штучний інтелект.pptx
Задачі AI-розробника як застосовується штучний інтелект.pptxЗадачі AI-розробника як застосовується штучний інтелект.pptx
Задачі AI-розробника як застосовується штучний інтелект.pptxGlobalLogic Ukraine
 
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptx
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptxЩо треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptx
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptxGlobalLogic Ukraine
 
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...GlobalLogic Ukraine
 
JavaScript Community Webinar #14 "Why Is Git Rebase?"
JavaScript Community Webinar #14 "Why Is Git Rebase?"JavaScript Community Webinar #14 "Why Is Git Rebase?"
JavaScript Community Webinar #14 "Why Is Git Rebase?"GlobalLogic Ukraine
 
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...GlobalLogic Ukraine
 
Страх і сила помилок - IT Inside від GlobalLogic Education
Страх і сила помилок - IT Inside від GlobalLogic EducationСтрах і сила помилок - IT Inside від GlobalLogic Education
Страх і сила помилок - IT Inside від GlobalLogic EducationGlobalLogic Ukraine
 
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”GlobalLogic Ukraine
 
GlobalLogic QA Webinar “What does it take to become a Test Engineer”
GlobalLogic QA Webinar “What does it take to become a Test Engineer”GlobalLogic QA Webinar “What does it take to become a Test Engineer”
GlobalLogic QA Webinar “What does it take to become a Test Engineer”GlobalLogic Ukraine
 
“How to Secure Your Applications With a Keycloak?
“How to Secure Your Applications With a Keycloak?“How to Secure Your Applications With a Keycloak?
“How to Secure Your Applications With a Keycloak?GlobalLogic Ukraine
 
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...GlobalLogic Ukraine
 
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...GlobalLogic Ukraine
 
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”GlobalLogic Ukraine
 
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"GlobalLogic Ukraine
 
GlobalLogic Webinar "Introduction to Embedded QA"
GlobalLogic Webinar "Introduction to Embedded QA"GlobalLogic Webinar "Introduction to Embedded QA"
GlobalLogic Webinar "Introduction to Embedded QA"GlobalLogic Ukraine
 
C++ Webinar "Why Should You Learn C++ in 2021-22?"
C++ Webinar "Why Should You Learn C++ in 2021-22?"C++ Webinar "Why Should You Learn C++ in 2021-22?"
C++ Webinar "Why Should You Learn C++ in 2021-22?"GlobalLogic Ukraine
 
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...GlobalLogic Ukraine
 
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Ukraine
 
GlobalLogic Azure TechTalk ONLINE “Marketing Data Lake in Azure”
GlobalLogic Azure TechTalk ONLINE “Marketing Data Lake in Azure”GlobalLogic Azure TechTalk ONLINE “Marketing Data Lake in Azure”
GlobalLogic Azure TechTalk ONLINE “Marketing Data Lake in Azure”GlobalLogic Ukraine
 

More from GlobalLogic Ukraine (20)

GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”
GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”
GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”
 
Штучний інтелект як допомога в навчанні, а не замінник.pptx
Штучний інтелект як допомога в навчанні, а не замінник.pptxШтучний інтелект як допомога в навчанні, а не замінник.pptx
Штучний інтелект як допомога в навчанні, а не замінник.pptx
 
Задачі AI-розробника як застосовується штучний інтелект.pptx
Задачі AI-розробника як застосовується штучний інтелект.pptxЗадачі AI-розробника як застосовується штучний інтелект.pptx
Задачі AI-розробника як застосовується штучний інтелект.pptx
 
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptx
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptxЩо треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptx
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptx
 
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...
 
JavaScript Community Webinar #14 "Why Is Git Rebase?"
JavaScript Community Webinar #14 "Why Is Git Rebase?"JavaScript Community Webinar #14 "Why Is Git Rebase?"
JavaScript Community Webinar #14 "Why Is Git Rebase?"
 
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...
 
Страх і сила помилок - IT Inside від GlobalLogic Education
Страх і сила помилок - IT Inside від GlobalLogic EducationСтрах і сила помилок - IT Inside від GlobalLogic Education
Страх і сила помилок - IT Inside від GlobalLogic Education
 
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
 
GlobalLogic QA Webinar “What does it take to become a Test Engineer”
GlobalLogic QA Webinar “What does it take to become a Test Engineer”GlobalLogic QA Webinar “What does it take to become a Test Engineer”
GlobalLogic QA Webinar “What does it take to become a Test Engineer”
 
“How to Secure Your Applications With a Keycloak?
“How to Secure Your Applications With a Keycloak?“How to Secure Your Applications With a Keycloak?
“How to Secure Your Applications With a Keycloak?
 
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
 
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...
 
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”
 
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"
 
GlobalLogic Webinar "Introduction to Embedded QA"
GlobalLogic Webinar "Introduction to Embedded QA"GlobalLogic Webinar "Introduction to Embedded QA"
GlobalLogic Webinar "Introduction to Embedded QA"
 
C++ Webinar "Why Should You Learn C++ in 2021-22?"
C++ Webinar "Why Should You Learn C++ in 2021-22?"C++ Webinar "Why Should You Learn C++ in 2021-22?"
C++ Webinar "Why Should You Learn C++ in 2021-22?"
 
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...
 
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
 
GlobalLogic Azure TechTalk ONLINE “Marketing Data Lake in Azure”
GlobalLogic Azure TechTalk ONLINE “Marketing Data Lake in Azure”GlobalLogic Azure TechTalk ONLINE “Marketing Data Lake in Azure”
GlobalLogic Azure TechTalk ONLINE “Marketing Data Lake in Azure”
 

Recently uploaded

A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 

Recently uploaded (20)

A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 

A test framework out of the box - Geb for Web and mobile

  • 1. 1 A test framework out of the box - Geb for Web and mobile Yaroslav Sviatkin Senior Test Automation Engineer, Consultant
  • 2. 2
  • 4. 4 JDI UI Test Automation Framework @JSite(domain = "https://epam.github.io/JDI/") public class JDIExampleSite extends WebSite { public static HomePage homePage; public static LoginForm loginForm; @FindBy(css = ".profile-photo") public static Label profilePhoto; public static void login() { profilePhoto.click(); loginForm.loginAs(new User()); } }
  • 5. 5 Automated Acceptance Testing with Style http://www.thucydides.info/#/
  • 6. 6
  • 7. 7 Project structure Page Object classes Steps implementation class Stories classes Requirements for the application under test
  • 8. 8 Organizing requirements First, you create a model of the features and user stories you intend to implement: Stories Features
  • 9. 9 Page Objects Next you will need to implement your page objects. These are almost just run-of-the-mill WebDriver page objects, but with a few enhancements:
  • 10. 10 Steps implementation Now implement the actual test steps using either WebDriver page objects or other test steps. Here you start thinking about implementation: A step library High level steps... ...implemented with Page Objects ...or with other steps
  • 11. 11
  • 13. 13
  • 15. 15 Geb is a browser automation solution What is Geb?
  • 16. 16 • Any web and mobile applications • App doesn't need to be written in Groovy What can you test with Geb?
  • 17. 17 go "http://www.google.com" $("input", name: "q").value("geb") $("button", name: "btnG").click() waitFor { $("#search").displayed } $("h3.r").first().click() waitFor { title == "Geb - Very Groovy Browser
  • 18. 18 Selector syntax title { $(By.xpath(".//h4[@class='title ng- binding']")).text() $("#by-id") $(".by-class") $("div", name: "by-attribute") $("div", text: "By text") $(By.id("some-id")) $(By.className("some-class")) $(By.xpath('//p[@class="xpath"]')) …
  • 19. 19 assert $("p", 1..2)*.text() == ["b", "c"] assert $("p", text: ~/p./).size() == 2 assert $("p", text: startsWith("p")).size() == 2
  • 20. 20 assert $("p.d").previous() == $("p.c") assert $("p.e").prevAll() == $("p.c").add("p.d") assert $("p.d").next() == $("p.e") assert $("p.c").nextAll() == $("p.d").add("p.e") assert $("p.d").parent() == $("div.b") assert $("p.c").siblings() == $("p.d").add("p.e") assert $("div.a").children() == $("div.b").add("div.f")
  • 21. 21 project { String index -> $(By.xpath("//div[@class=card-item']//h4[@title='${index}']")).click() } projectPage.project(nameProject)
  • 22. 22 dynamicallyAdded(wait: true) { $("p.dynamic") } dynamicallyAdded(wait: 5, required: false) { $("p.dynamic") } cachedValue(cache: true) { value } helpLink(to: HelpPage) { $("a", text: "Help") }
  • 25. 25 Control modules • FormElement • Checkbox • Select • MultipleSelect • TextInput • Textarea • FileInput • RadioButtons
  • 26. 26 class ExamplePage extends Page { static content = { theModule { module ExampleModule } } } class ExampleModule extends Module { static content = { button { $("input", type: "submit") } } }
  • 27. 27 class NotificationModule extends Module { static content = { notifocation { $(By.xpath(".//li[contains(@ng-repeat,'notifications')]")).moduleList(Notification) } gotItButton { $(By.xpath(".//button[@ng-click='appCtrl.gotItNotifications()']")) } } } class Notification extends Module { static content = { name { $(By.xpath("//h5")).text() } dete { $(By.xpath("//div[contains(@class,'date')]")).text() } notification { $(By.xpath("//p")) text() } } }
  • 28. 28 searchResult(required: false, wait: 5) { $(By.xpath("//li/a/strong"))*.text() } notification { $(By.xpath("//ul[contains(@ng-if,'notifications')]")).module(NotificationModule) } menuLinksModule(wait: 5) { $(By.xpath("//button[contains(@class,'services')]")).module(MenuLinksModule) }
  • 29. 29 class IdeaCreatePage extends geb.Page { static at = { $("div#create-idea").displayed } } static content = { createButton(to: IdeaShowPage) { $("input#create") } } IdeaCreatePage ideaCreatePage = to(IdeaCreatePage) isAt(IdeaCreatePage)
  • 30. 30 • class LoginPage extends Page { static url = "access/signin" static at = { browser.currentUrl.startsWith("https://wwwwwwwwww.com") } static content = { userName(wait: 5) { $(By.xpath("//input[@type='text']")) } userPassword { $(By.xpath("//input[@type='password']")) } loginError(required: false, wait: 3) { $(By.xpath("//div[@class='error']")).text() } loginSubmit { $("button", text: startsWith("Login")).click() } heading (to:BasePage){ $(By.xpath("//div[@class='info']/h1")).text() } } def login(String login, String password) { userName.firstElement().clear() userPassword.firstElement().clear() userName << login userPassword << password loginSubmit } }
  • 31. 31 waitFor examples waitFor { $("div.alert").displayed } waitFor { $("div.message").text() == "Update successful" }
  • 32. 32 Mouse interactions void moveRatingSlider(Integer rating) { // Slider is 400 pixels wide and starts at 1, // so each notch above 1 is 100 pixels apart Integer numPixelsX = (rating - 1) * 100 interact { clickAndHold(ratingSliderHandle) moveByOffset(numPixelsX, 0) release() } } WebElement underlyingElement = $('#myElement').getElement(0) Action action = new Actions(browser.driver) .clickAndHold(underlyingElement) .moveByOffset(15,15) .release() .build() action.perform() } Use keyboard $(".ui-slider-handle") << Keys.ARROW_RIGHT
  • 33. 33 Already opened windows withWindow({ title == "Geb - Very Groovy Browser Automation" }) { assert $("#slogan").text().startsWith("very groovy browser automation…") } } withNewWindow({ $('a').click() }) { assert title == 'Geb - Very Groovy Browser Automation' }
  • 34. 34 @Test void feedBackReferenceTest() { openMenu browser.withNewWindow({ basePage.menuLinksModule.feedback }, { assert browser.currentUrl.startsWith("https://helpdesk.com/") }) } @Test void officeMapReferenceTest() { openMenu browser.withWindow({ basePage.menuLinksModule.officeMap }, { if (browser.currentUrl == signinUrl) { loginPage.login(userName, userPassword) } assert browser.currentUrl == "https://portal.com" }) browser.to(ProjectPage) }
  • 35. 35 Show hidden element void scrollUp() { js.exec("""window.scrollTo(0,0)""") } $("div#a").jquery.mouseov er() Browser.drive { assert js.myGlobalVar == 1 }
  • 37. 37 waiting { timeout = 2 } baseUrl = "https://wwwwwwwww.com/" autoClearCookies = false atCheckWaiting = true baseNavigatorWaiting = true name = '' password = '' mail ='' environments { chrome { driver = { def driverInstance = new ChromeDriver() driverInstance.manage().window().maximize() driverInstance } } firefox { driver = { def driverInstance = new FirefoxDriver() driverInstance.manage().window().maximize() driverInstance } } ie { driver = { def driverInstance = new InternetExplorerDriver() driverInstance.manage().window().maximize() driverInstance } }} //Receiving name and password from GebConfig.groovy final String userName = browser.config.rawConfig.name final String userPassword = browser.config.rawConfig.password
  • 38. 38 task chromeTest(type: Test) { systemProperty "geb.env", "chrome" systemProperty "webdriver.chrome.driver", "driverschromedriver.exe" useTestNG { suites "srctestresourcestestng-suite.xml" useDefaultListeners = true } } // Drivers testCompile "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion" testCompile "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion" testCompile "org.seleniumhq.selenium:selenium-ie-driver:$seleniumVersion"
  • 39. 39 static String randomString(int count) { (1..count).inject("") { a, b -> a += ('a'..'z')[new Random().nextFloat() * 26 as int] }.capitalize() } def getWanted() { def result = [] HTTPRequest.request(GET, JSON) { req -> uri.path = '/wanted' headers.'Auth' = "${TOKEN}" response.success = { resp, json -> println new JsonBuilder( json).toPrettyString() (json as ArrayList).each { String name = it.name def projects = [] (it.projects as ArrayList).each { projects << [it.projectid.'$oid', it.title] } result << [name, projects].flatten() } } } result }
  • 40. 40 List getAllIdProject() { def result = [] GITLAB.get(path: "/gitlab/api/v3/projects/all") { resp, json -> println new JsonBuilder(json).toPrettyString() def request = (json as Map) result = request*.id } result } assert loginPage.heading == "Welcome"
  • 43. 43
  • 45. 45 Yaroslav Sviatkin Senior Test Automation Engineer, Consultant iaroslav.sviatkin@globallogic.com Thank you