** Update **
There is now an updated version of this implementation with Javascript Async/Await
Recording - https://www.youtube.com/watch?v=BTpMB2-8qMM
Slides - https://www.slideshare.net/MekSrunyuStittri/endtoend-test-automation-with-nodejs-one-year-later
Abstract
With the growing popularity of NodeJS, many companies have embraced its adoption and gone full stack. The next logical move is to have the test framework be on the same stack. Unfortunately, proven ways of implementing a Selenium framework in JavaScript are very limited and very much fragmented.
Airware builds software and hardware for commercial drones; their cloud team ships code to production every week. In this talk, their cloud automation team will talk about: how they have built their Selenium framework with Node.js; the challenges of coming from a synchronous programming language like Java; lessons learned along this journey; and other technologies/tools used to complement testing their cloud and rolling out quality.
Recording by New Relic and SauceLabs - https://www.youtube.com/watch?v=CqeCUyoIEo8
Packer and TerraForm are fundamental components of Infrastructure as Code. I recently gave a talk at a DevOps meetup, which allowed me the opportunity to discuss the basics of these two tools, and how DevOps teams should be using them
Docker Kubernetes Istio
Understanding Docker and creating containers.
Container Orchestration based on Kubernetes
Blue Green Deployment, AB Testing, Canary Deployment, Traffic Rules based on Istio
Kubernetes Architecture - beyond a black box - Part 1Hao H. Zhang
This is part 1 of my Kubernetes architecture deep-dive slide series.
I have been working with Kubernetes for more than a year, from v1.3.6 to v1.6.7, and I am a CNCF certified Kubernetes administrator. Before I move on to something else, I would like to summarize and share my knowledges and take-aways about Kubernetes, from a software engineer perspective.
This set of slides is a humble dig into one level below your running application in production, revealing how different components of Kubernetes work together to orchestrate containers and present your applications to the rest of the world.
The slides contains 80+ external links to Kubernetes documentations, blog posts, Github issues, discussions, design proposals, pull requests, papers, source code files I went through when I was working with Kubernetes - which I think are valuable for people to understand how Kubernetes works, Kubernetes design philosophies and why these design came into places.
Packer and TerraForm are fundamental components of Infrastructure as Code. I recently gave a talk at a DevOps meetup, which allowed me the opportunity to discuss the basics of these two tools, and how DevOps teams should be using them
Docker Kubernetes Istio
Understanding Docker and creating containers.
Container Orchestration based on Kubernetes
Blue Green Deployment, AB Testing, Canary Deployment, Traffic Rules based on Istio
Kubernetes Architecture - beyond a black box - Part 1Hao H. Zhang
This is part 1 of my Kubernetes architecture deep-dive slide series.
I have been working with Kubernetes for more than a year, from v1.3.6 to v1.6.7, and I am a CNCF certified Kubernetes administrator. Before I move on to something else, I would like to summarize and share my knowledges and take-aways about Kubernetes, from a software engineer perspective.
This set of slides is a humble dig into one level below your running application in production, revealing how different components of Kubernetes work together to orchestrate containers and present your applications to the rest of the world.
The slides contains 80+ external links to Kubernetes documentations, blog posts, Github issues, discussions, design proposals, pull requests, papers, source code files I went through when I was working with Kubernetes - which I think are valuable for people to understand how Kubernetes works, Kubernetes design philosophies and why these design came into places.
Kubernetes ecosystem is seeing adoption across the industry and is on the path to becoming the de-facto orchestration platform on modern cloud service delivery. Kubernetes not only provides primitives for deploying run microservices in the cloud but goes one step further and helps you define interactions and lifecycle for your APIs. The Ingress API in Kubernetes allows you to expose your microservice to the outside world and define routing policies for your north-south traffic (or traffic coming into your virtual data center).
We invite Harry Bagdi, Sr. Cloud to discuss in-depth about the design and why of Ingress resource, the benefits of using Ingress to manage your API lifecycle using CI/CD pipelines, and how you can accomplish Ingress using a popular open-source solution, Kong. Kong’s Ingress Controller implements authentication, load-balancing, traffic throttling, transformations, caching, metrics, and logging across Kubernetes clusters.
도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!pyrasis
도커 무작정 따라하기
- 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!
도커의 기본 개념부터 설치와 사용 방법까지 설명합니다.
더 자세한 내용은 가장 빨리 만나는 도커(Docker)를 참조해주세요~
http://www.pyrasis.com/private/2014/11/30/publish-docker-for-the-really-impatient-book
Cilium - Bringing the BPF Revolution to Kubernetes Networking and SecurityThomas Graf
BPF is one of the fastest emerging technologies of the Linux kernel. The talk provides an introduction to Cilium which brings the powers of BPF to Kubernetes and other orchestration systems to provide highly scalable and efficient networking, security and load balancing for containers and microservices. The talk will provide an introduction to the capabilities of Cilium today but also deep dives into the emerging roadmap involving networking at the socket layer and service mesh datapath capabilities to provide highly efficient connectivity between cloud native apps and sidecar proxies.
On Friday 5 June 2015 I gave a talk called Cluster Management with Kubernetes to a general audience at the University of Edinburgh. The talk includes an example of a music store system with a Kibana front end UI and an Elasticsearch based back end which helps to make concrete concepts like pods, replication controllers and services.
I have Over 8+ years of experience as a DevOps Engineer. I came across an interesting position of DevOps Engineering position on your Linked post. Constantly updating my skill set, I am proficient in DevOps Tools like Git, Jenkins Pipeline Automation, AWS, Chef, Ansible, Kubernetes, Terraform, Docker, Shell Scripting,ELK, Jfrog and Prometheus.
Presented Docker in 15 minutes with two of my classmates at school.
Presentation covering topics:
Virtualization
Virtual Machines
Container Technology (Docker)
Docker Compose
Docker Swarm
The demo can be found at:
https://github.com/DanishKhakwani/SimpleDockerDemo
Bonjour à ma communauté Linkedin! Nous avons actuellement un développeur fullstack java/angular
Elle maîtrise les frameworks Angular, Node JS, Bootstrap, Express JS
Si vous êtes intéressé contactez moi en MP !
Fullstack End-to-end test automation with Node.js, one year laterMek Srunyu Stittri
Airware's cloud automation team returns with a year’s worth of lessons learned, and will share the challenges involved with building a full-stack test automation framework with Node.js while using the latest and greatest in JavaScript tools.
Topics
Async / Await - an alternative to Webdriver’s built-in control flow. Limitations with control flow. Use Babel to write the latest ES6 JavaScript syntax. Custom reporter with screenshots from Sauce Labs. Parallel tests and accurate reporting.
Type-safe JavaScript with Facebook’s Flow-type library.
Robust visual diffs
Kubernetes ecosystem is seeing adoption across the industry and is on the path to becoming the de-facto orchestration platform on modern cloud service delivery. Kubernetes not only provides primitives for deploying run microservices in the cloud but goes one step further and helps you define interactions and lifecycle for your APIs. The Ingress API in Kubernetes allows you to expose your microservice to the outside world and define routing policies for your north-south traffic (or traffic coming into your virtual data center).
We invite Harry Bagdi, Sr. Cloud to discuss in-depth about the design and why of Ingress resource, the benefits of using Ingress to manage your API lifecycle using CI/CD pipelines, and how you can accomplish Ingress using a popular open-source solution, Kong. Kong’s Ingress Controller implements authentication, load-balancing, traffic throttling, transformations, caching, metrics, and logging across Kubernetes clusters.
도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!pyrasis
도커 무작정 따라하기
- 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!
도커의 기본 개념부터 설치와 사용 방법까지 설명합니다.
더 자세한 내용은 가장 빨리 만나는 도커(Docker)를 참조해주세요~
http://www.pyrasis.com/private/2014/11/30/publish-docker-for-the-really-impatient-book
Cilium - Bringing the BPF Revolution to Kubernetes Networking and SecurityThomas Graf
BPF is one of the fastest emerging technologies of the Linux kernel. The talk provides an introduction to Cilium which brings the powers of BPF to Kubernetes and other orchestration systems to provide highly scalable and efficient networking, security and load balancing for containers and microservices. The talk will provide an introduction to the capabilities of Cilium today but also deep dives into the emerging roadmap involving networking at the socket layer and service mesh datapath capabilities to provide highly efficient connectivity between cloud native apps and sidecar proxies.
On Friday 5 June 2015 I gave a talk called Cluster Management with Kubernetes to a general audience at the University of Edinburgh. The talk includes an example of a music store system with a Kibana front end UI and an Elasticsearch based back end which helps to make concrete concepts like pods, replication controllers and services.
I have Over 8+ years of experience as a DevOps Engineer. I came across an interesting position of DevOps Engineering position on your Linked post. Constantly updating my skill set, I am proficient in DevOps Tools like Git, Jenkins Pipeline Automation, AWS, Chef, Ansible, Kubernetes, Terraform, Docker, Shell Scripting,ELK, Jfrog and Prometheus.
Presented Docker in 15 minutes with two of my classmates at school.
Presentation covering topics:
Virtualization
Virtual Machines
Container Technology (Docker)
Docker Compose
Docker Swarm
The demo can be found at:
https://github.com/DanishKhakwani/SimpleDockerDemo
Bonjour à ma communauté Linkedin! Nous avons actuellement un développeur fullstack java/angular
Elle maîtrise les frameworks Angular, Node JS, Bootstrap, Express JS
Si vous êtes intéressé contactez moi en MP !
Fullstack End-to-end test automation with Node.js, one year laterMek Srunyu Stittri
Airware's cloud automation team returns with a year’s worth of lessons learned, and will share the challenges involved with building a full-stack test automation framework with Node.js while using the latest and greatest in JavaScript tools.
Topics
Async / Await - an alternative to Webdriver’s built-in control flow. Limitations with control flow. Use Babel to write the latest ES6 JavaScript syntax. Custom reporter with screenshots from Sauce Labs. Parallel tests and accurate reporting.
Type-safe JavaScript with Facebook’s Flow-type library.
Robust visual diffs
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.jsMek Srunyu Stittri
Slide deck for ForwardJS 2017 in San Francisco - March 1st 2017
https://forwardjs.com/schedule#lecture-224
Airware builds hardware, software and cloud for commercial drones. We have transitioned to Node.js for cloud functional test automation in 2015. The purpose of this is to unite Fullstack developers and Automation engineers to speak in the same language which is JavaScript. With a year worth of lessons learnt, we will share the challenges involved with building a full-stack test automation framework with Node.js while using the latest and greatest in JavaScript tools.
Main instruments used for Web UI test automation.
Drivers: Selenium WebDriver, Sikuli X.
Frameworks: PageFactory, TestNG.
Other tools: Apache Ant, Jenkins CI.
Front End Development for Back End Java Developers - Jfokus 2020Matt Raible
Are you a backend Java developer that's being pushed into front-end development? Are you frustrated with all the JavaScript frameworks and build tools you have to learn to be a good UI developer? If so, this session is for you! We'll explore the landscape of UI development, including web standards, frameworks, and what’s on the horizon (e.g., micro frontends).
I Know It Was MEAN, But I Cut the Cord to LAMP AnywayAll Things Open
All Things Open 2014 - Day 2
Thursday, October 23rd, 2014
Brian Hyder
Co-Founder & CTO of PencilBlue, LLC
Back Dev
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
This OpenWorld 2015 presentation shows how to automate testing of Oracle Application Development Framework (ADF) applications with Selenium, including visual/perceptual diff checking, JaCoCo Code Coverage, and Isolated taskflow testing with ADF TaskFlow Tester
Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...Fwdays
Are you ready for production? Are you sure? Is your application prefetchable? Is it readable for search engine robots? Will it fit into Content Delivery Network? Do you want to make it even faster? Meet the Server-Side Rendering concept. Learn how to implement it in your application and gain knowledge about best practices, such as transfer state and route resolving strategies.
Creating Modular Test-Driven SPAs with Spring and AngularJSGunnar Hillert
Single-page Applications (SPA) are all the rage these days and with them there is an avalanche of new tools, libraries and frameworks we need to know. But what does this mean for us as Spring developers? In this session we will give you an overview of the current landscape and illustrate the choices the Spring XD team has made for its user interface. What do I use to write SPA applications? How do I integrate them into existing Spring-based backends? How do I build them? Can I integrate them into my existing Gradle or Maven build processes in order to achieve complete build automation? How do I integrate realtime messaging using Spring's SockJS/WebSocket support? In this talk we will answer these and many more questions. We will cover frameworks such as AngularJS, Bootstrap, RequireJS; tools like Bower, Grunt, Gulp; and also talk about testing using Karma and Protractor.
Integrating React.js Into a PHP ApplicationAndrew Rota
React.js has taken the web development world by storm, and for good reason: React offers a declarative, component-oriented approach to building highly-scalable web UIs. But how can we take advantage of a JavaScript library like React in our server-side PHP applications. In this talk l cover the different ways React.js can be integrated into an existing PHP web application: from a client-side only approach to multiple techniques that support full server-side rendering with a Node.js server or PHP’s v8js. I also discuss the trade-offs in each of these designs and the challenges involved with adding React to a PHP site. Most importantly, I consider the higher-level issue of how to improve view cohesion across the client-server divide in a PHP application.
Android UI Testing with Appium
This presentation covers:
- how appium works
- setting up test development environment with AndroidStudio
- running tests
- UI automation best practices
- common problems with automation
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
In his public lecture, Christian Timmerer provides insights into the fascinating history of video streaming, starting from its humble beginnings before YouTube to the groundbreaking technologies that now dominate platforms like Netflix and ORF ON. Timmerer also presents provocative contributions of his own that have significantly influenced the industry. He concludes by looking at future challenges and invites the audience to join in a discussion.
Climate Impact of Software Testing at Nordic Testing DaysKari Kakkonen
My slides at Nordic Testing Days 6.6.2024
Climate impact / sustainability of software testing discussed on the talk. ICT and testing must carry their part of global responsibility to help with the climat warming. We can minimize the carbon footprint but we can also have a carbon handprint, a positive impact on the climate. Quality characteristics can be added with sustainability, and then measured continuously. Test environments can be used less, and in smaller scale and on demand. Test techniques can be used in optimizing or minimizing number of tests. Test automation can be used to speed up testing.
Pushing the limits of ePRTC: 100ns holdover for 100 daysAdtran
At WSTS 2024, Alon Stern explored the topic of parametric holdover and explained how recent research findings can be implemented in real-world PNT networks to achieve 100 nanoseconds of accuracy for up to 100 days.
Enhancing Performance with Globus and the Science DMZGlobus
ESnet has led the way in helping national facilities—and many other institutions in the research community—configure Science DMZs and troubleshoot network issues to maximize data transfer performance. In this talk we will present a summary of approaches and tips for getting the most out of your network infrastructure using Globus Connect Server.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
4. 4
Background
Back in June start looking at node.js for selenium
E2E functional test framework.
● Kept Node.js adoption in mind
● More and more company moving to node and
going full stack.
● Share code with developers and get help
5. 5
Problem statement
Disconnected engineering stack
QA, Automation engineers
Frontend engineers
Backend engineers
Java
Javascript
Java
Python
Javascript
Java
Ruby
Javascript
Node.js
Company A Company B Company C
Node.js
Javascript
Node.js
10. 10
Javascript 101
Javascript is Asynchronous
Example
var source = ['foo', 'bar', 'baz'];
var result = [];
setTimeout(function () {
for (var i = 0 ; i < source.length ; i++) {
console.log('Stepping through : ' + source[i]);
result.push(source[i]);
console.log('Current result: ' + result);
}
}, 1000); // Wait 1000 ms to finish operation
console.log('Result: ' + result);
console.log('Finished!!');
Output:
Result: ←------- Empty array ?!?!
Finished!!
Stepping through : foo
Current result: foo
Stepping through : bar
Current result: foo,bar
Stepping through : baz
Current result: foo,bar,baz
16. 16
Back to the list
● NightwatchJS
● WebdriverIO formerly WebdriverJS
● WD.js
● The Intern
● webdriver-sync
● Cabbie
● Selenium-Webdriver now WebDriverJs
● Protractor
● And many more…
WebDriverNode jwebdriver ot-webdriverjs
burnout testium yiewd nwd co-nwd
selenium-node-webdriver nemo.js taxi
etc...
???
17. 17
Experimenting with Nightwatch
What Nightwatch offers
● Convenient chain APIs
○ A workaround for dealing with callbacks
● Wraps Selenium JsonWireProtocol
● Some form of page object support
● Some extendability custom
commands
● Saucelabs / Browserstack integration
out of the box
● Pretty good documentation
Nightwatch test
module.exports = {
'Demo test Google' : function (browser) {
browser
.url('http://www.google.com')
.waitForElementVisible('body', 1000)
.setValue('input[type=text]', 'nightwatch')
.waitForElementVisible('button[name=btnG]', 1000)
.click('button[name=btnG]')
.pause(1000)
.assert.containsText('#main', 'Night Watch')
.end();
}
};
18. 18
Experimenting with WebdriverIO
WebdriverIO test
client
.init()
.url('https://duckduckgo.com/')
.setValue('#search_form_input_homepage', 'WebdriverIO')
.click('#search_button_homepage')
.getTitle().then(function(title) {
console.log('Title is: ' + title);
// outputs: "Title is: WebdriverIO
})
.end();
What WebdriverIO offers
● Convenient chain APIs
● A+ Promise support
● Wraps Selenium JsonWireProtocol
● Saucelabs / Browserstack
integration out of the box
● Some form of visual testing capability
○ Based on WebdriverCSS
○ Limited support for Applitools
● But.. pageobject ??
20. 20
Chain based api - Nightwatch
Pageobject
this.clickLogout = function() {
browser
.waitForElement(USERNAME_DROPDOWN_TRIGGER)
.click(USERNAME_DROPDOWN_TRIGGER)
.waitForElement(LOGOUT_BUTTON)
.click(LOGOUT_BUTTON);
return browser;
};
Test code
testLoginProjectOwner: function (browser) {
browser
.page.Login().enterUserInfo(OWNER_USER,
DEFAULT_PASSWORD)
.page.Login().clickSignIn()
.page.Jobs().isJobListPresent()
.page.TopNavBar().verifyUserName("Project Owner")
.page.TopNavBar().clickLogout()
.page.Login().waitForLoginLoad();
}
The nice part
But.. starting to see a pattern
forming : a chain within a chain
21. 21
Chain based api - Nightwatch
The not so nice..
browser
.page.Login().enterUserInfo(OWNER_USER,DEFAULT_PASSWORD)
.page.Jobs().getNumberOfJobs(function (result) {
var numberOfJobsBefore = result.value.length;
browser
.page.JobConfig().createJob(jobName)
.page.Jobs().getNumberOfJobs(function (result) {
var numberOfJobsAfter = result.value.length;
Assert.equal(numberOfJobsAfter, numberOfJobsBefore + 1);
browser.page.Jobs().getJobs(function (result) {
for (var i = 0; i <= result.length; i++) {
if (result[i].name === jobName) {
jobInfo = result;
break;
}
}
});
}).perform(function(client, done){
Assert.equal(jobInfo.name, expectedJobName, 'Job name is correct');
Assert.equal(jobInfo.creator, expectedJobCreator, 'Job creator is correct');
browser.page.TopNav().clickLogout()
.end();
});
});
}
Chain breaks once you start to
do something complex that is not
supported in the api
● Datastructure
● Iterating
22. 22
Chain based api - Nightwatch
The not so nice..
function getJobRow (index) {
var deferred = new Q.defer();
var jobInfo = {name: '', creator: '', date: ''};
browser.getText(JOB_LIST_ROW + ':nth-child(' + index + ') > td:nth-child(1)', function (result) {
jobInfo.name = result.value;
console.log('Retrieved job name ' + jobInfo.name);
browser.getText(JOB_LIST_ROW + ':nth-child(' + index + ') > td:nth-child(2)', function (result) {
jobInfo.creator = result.value;
console.log('Retrieved job name ' + jobInfo.creator );
browser.getText(JOB_LIST_ROW + ':nth-child(' + index + ') > td:nth-child(3)', function (result) {
jobInfo.date = result.value;
console.log('Retrieved job date ' + jobInfo.date);
deferred.resolve(jobInfo);
});
});
});
return deferred.promise;
}
23. 23
Lessons learned
● Chain based api - a particular bad pattern when async call are
involved. As soon as you try to do something complex (dealing with an
array of WebElements) you end up having to break the chain.
● Page Object pattern and chained APIs don’t get along well.
○ Methods end up containing another chain which does not help
with code composition. Also still prone to pyramid of doom
● Most selenium chain based libraries gives you just one main object and
all interaction commands are tied to that object’s chain
○ NightwatchJS : browser
○ WebdriverIO : client
● Ignore Github Stars when choosing which projects to use...
24. 24
Kinda miss Java synchronous programming
languages at this point
1 month later...
25. 25
selenium-webdriver WebDriverJs
Then we took a deep look at selenium-webdriver the current WebDriverJs
https://code.google.com/p/selenium/wiki/WebDriverJs#Writing_Tests
WebDriverJs uses a promise manager
● Coordinate the scheduling and execution of all commands.
● Maintains a queue of scheduled tasks, executing each once the one before it in the queue is
finished. The WebDriver API is layered on top of the promise manager.
Provided Mocha Framework Wrapper with a built in promise manager
There is a built in wrapper for mocha methods that automatically handles all the calls into the
promise manager which makes the code very sync like.
http://selenium.googlecode.com/git/docs/api/javascript/module_selenium-webdriver_testing.html
26. 26
Achieving sync-like code
Code written using Webdriver Promise Manager
Javascript selenium tests using promise manager
driver.get("http://www.google.com");
driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');
driver.findElement(webdriver.By.name('btnG')).click();
driver.getTitle().then(function(title) {
console.log(title);
});
Equivalent Java code
driver.get("http://www.google.com");
driver.findElement(By.name("q")).sendKeys("webdriver");
driver.findElement(By.name("btnG")).click();
assertEquals("webdriver - Google Search", driver.getTitle());
Hey we look similar now!
27. 27
Mocha with selenium wrapper
All callbacks can be omitted and it just works which makes the code very “synchronous” like.
Specifically, you don’t have to chain everything and each individual line of code can do only one
ui action and then some assertion if necessary.
var test = require('selenium-webdriver/testing');
var webdriver = require('selenium-webdriver');
var By = require('selenium-webdriver').By;
var Until = require('selenium-webdriver').until;
test.it('Login and make sure the job menu is there', function() {
driver.get(url, 5000);
driver.findElement(By.css('input#email')).sendKeys('useremail@email.com');
driver.findElement(By.css('input#password')).sendKeys(password);
driver.findElement(By.css('button[type="submit"]')).click();
driver.wait(Until.elementLocated(By.css('li.active > a.jobs')));
var job = driver.findElement(By.css('li.active a.jobs'));
job.getText().then(function (text) {
assert.equal(text, 'Jobs', 'Job link title is correct');
});
});
28. 28
Comparison
Library API structure Underlying implementation
NightwatchJs chain Its own JsonWireProtocol 3457 stars on github
WebDriverIO chain/promise Its own JsonWireProtocol 1322 stars on github
The Intern chain leadfoot 3095 stars on github
WebDriver-sync sync JsonWireProtocol ?? 72 stars on github
WD.js chain/promise Its own JsonWireProtocol 890 stars on github
Official
selenium-webdriver
promise & built-in
promise manager
Webdriver API with native
WebElement & Driver objects
2016 stars on github
30. 30
Designing frameworks
The magic number 7
https://en.wikipedia.org/wiki/The_Magical_Number_Seven,_Plus_or_Minus_Two
The human brain can only focus on 7 ± 2 things at once.
● Handle all UI interactions and nuances in a common location
○ Stale elements, retries and etc.
○ Mimicking an actual human in the UI
● Keep tests dry, more business facing methods and logic in page-objects
● Easy to add tests
31. 31
Object Oriented Javascript
● The world's most misunderstood prog language
● There are no real classes
● Inheritance - different from Java
○ prototype-oriented (has a) vs class-oriented inheritance (is a)
○ http://www.crockford.com/javascript/javascript.html
● Recommended reading
○ The Principles of Object-Oriented Javascript
Nicholas C. Zakas
32. 32
BasePage.js
var driver;
/**
* Base constructor for a pageobject
* Takes in a WebDriver object
* Sets the Webdriver in the base page surfacing this
to child page objects
* @param webdriver
* @constructor
*/
function BasePage(webdriver) {
this.driver = webdriver;
}
...
LoginPage.js
var BasePage = require('./BasePage');
/**
* Constructor for the Login Page
* Hooks up the Webdriver holder in the base page allowing to
call this.driver in page objects
* @param webdriver
* @constructor
*/
function LoginPage (webdriver) {
BasePage.call(this, webdriver);
this.isLoaded();
}
// Hooking up prototypal inheritance to BasePage
LoginPage.prototype = Object.create(BasePage.prototype);
// Declaring constructor
LoginPage.prototype.constructor = LoginPage;
...
Javascript pageobjects
Kinda like calling
super(); in Java
33. 33
BasePage.js con’t
BasePage.prototype.waitForLocated = function(locator, timeout) {
var MAX_RETRIES = 5;
var retry = 0;
timeout = timeout || WAIT_TIME_PRESENT;
var _this = this;
// The actual wait, but we handle the error
return _this.driver.wait(Until.elementLocated(locator),timeout).thenCatch(function (err) {
if (err.name !== 'StaleElementReferenceError') {
throw new Error(err.stack);
}
// fail after max retry
if (retry >= MAX_RETRIES) {
Logger.error('Failed maximum retries (' + MAX_RETRIES + '), error : ' + err.stack);
throw new Error('Failed after maximum retries (' + MAX_RETRIES + '), error : ' + err.stack);
}
//retry
retry++;
Logger.debug('Element not located with error : ' + err.stack + ' retrying... attempt ' + retry);
return _this.waitForLocated(locator, timeout, retry);
});
};
Javascript pageobjects
Handle most of the UI interaction in a common place
● Takes care of stale elements exceptions
● Retries
● WaitForLocated();
● WaitForVisible();
● WaitForEnabled();
● ...
34. 34
LoginPage.js con’t
/**
* Page load definition
* @returns {LoginPage}
*/
LoginPage.prototype.isLoaded = function() {
this.waitForDisplayed(By.css(EMAIL));
this.waitForDisplayed(By.css(PASSWORD));
this.waitForDisplayed(By.css(LOGIN_BUTTON));
return this;
};
/**
* Enter the user information and login
* @param username
* @param password
* @returns {LoginPage}
*/
LoginPage.prototype.enterUserInfo = function(username, password) {
this.waitForEnabled(By.css(EMAIL));
this.driver.findElement(By.css(EMAIL)).sendKeys(username);
this.driver.findElement(By.css(PASSWORD)).sendKeys(password);
this.waitForEnabled(By.css(LOGIN_BUTTON));
return this;
};
Javascript pageobjects
Pageobject methods work seamlessly with mocha promise
manager wrapper
● Each line is a promise that gets added to the queue
● Everything runs top down just like java
a synchronous language
35. 35
var test = require('selenium-webdriver/testing');
var assert = require('chai').assert;
var LoginPage = require('./../../src/pageobjects/LoginPage');
var SideNav = require('./../../src/pageobjects/SideNav');
var TopNav = require('./../../src/pageobjects/TopNav');
var url = Constants.launch_url;
//Login Tests
test.describe('Login tests', function() {
var driver;
test.beforeEach(function() {
driver = DriverBuilder.build();
});
test.it('Login with an invalid password @smoke', function() {
var login = new LoginPage(driver);
login.enterUserInfo(Constants.MANAGER_USER, 'foobar');
login.clickLogin();
login.getLoginErrorText().then(function(result){
assert.include(result, 'Your email or password was incorrect. Please try again.');
});
});
});
Putting it together
Sample project : https://github.com/mekdev/mocha-selenium-pageobject
Import statements
● pageobjects / other libs
TestNG @beforeTest looks familiar ? :)
Look ma no WebElements or Locators
37. 37
Visual Validation - Applitools
Went with Applitools
● Proven track record of prior implementation in Java
http://www.slideshare.net/MekSrunyuStittri/visual-automation-framework-via-screenshot-comparison
● Made Applitools integration a criteria when building
the framework
● 3 implementation choices
○ WebdriverIO’s WebdriverCSS
○ Official selenium-webdriver WebdriverJs (Driver instance)
○ Protractor
○ Native eyes.images (manage your own uploads and imgs)
38. 38
Trial runs with WebDriverCSS
WebdriverCSS
webdrivercss.init(client, {key: 'your key here'});
client.init()
.url(url)
.webdrivercss('Check #1', {
name : 'Login'
}, function(err, res) {
assert.ifError(err)
})
.setValue('input#email', MANAGER_USER)
.setValue('input#password', PASSWORD)
.click('button[type="submit"]')
.webdrivercss('Check #2', {
name : 'Job page'
}, function(err, res) {
assert.ifError(err)
})
Challenges
● Still stuck in chain API world
● Cannot choose match level
○ Defaults to strict
● One screenshot eqs 1 test not 1 step
● Even harder to do pageobjects
○ .webdrivercss() needs to be chained in
order to capture the screenshot
39. 39
Applitools test
test.it("test with login page and applitools", function() {
var eyes = new Eyes();
var driver= DriverBuilder.build();
eyes.setApiKey("<your key here>");
eyes.setMatchLevel('Content');
eyes.open(driver, "Airware", "Simple Airware main page")
.then(function(eyesDriver) {
driver = eyesDriver;
});
var login = new LoginPage(driver);
login.open(url);
eyes.checkWindow("Main Page");
login.enterUserInfo(USERNAME, PASSWORD);
login.clickLogin();
eyes.checkWindow("Jobs Page");
eyes.close();
});
Tests written using the promise manager fits with Applitools and
Pageobjects perfectly.
● Maintains app context while allowing the insertion of checkpoints
Applitools JS SDK : https://eyes.applitools.com/app/tutorial.html
Visual Checkpoints
42. Looked at REST frameworks
Supertest
https://github.com/visionmedia/supertest
● Built on mocha
● Chain API based
● Asserts are built in
Chakram
http://dareid.github.io/chakram/
● Runs on mocha
● Promise based
● Asserts are built in
● Needs to return chakram.wait()
describe('GET /users', function(){
it('respond with json', function(done){
request(app)
.get('/user')
.set('Accept', 'application/json')
.expect(200)
.end(function(err, res){
if (err) return done(err);
done();
});
});
});
describe("HTTP assertions", function () {
it("Should return 200", function () {
var response = chakram.get("your.api/get");
expect(response).status(200);
expect(response).header("application/json");
expect(response).comprise.of.json({...});
return chakram.wait();
});
});
43. Request library
Request
https://github.com/request/request
● Standard http request library
● Callback syntax - request(options, callback)
it("A series of requests", function (done) {
var request = require('request');
request({
method: 'POST',
uri: '/login',
form: {
username: 'username', password: 'password'
},
}, function (error, response, body) {
request({
method: 'GET',
...
}, function (error, response, body) {
request({
method: 'PUT',
...
}, function (error, response, body) {
done();
});
}
});
});
});
Then around the same time..
● Share code with UI devs
○ Generators and Coroutines
● Node v4.0.0 (Stable)
2015-09-08
○ Official support for ES6!
○ Yield statements!
44. Generator based calls
Co-Request
https://github.com/denys/co-request
● wraps http request library but yieldable
it("Login", function *() {
var request = require('co-request');
var cookieJar = request.jar();
response = yield request({
method: 'GET',
url: BASE_URL,
jar: cookieJar,
followRedirect: false
});
response = yield request({
method: 'POST',
url: BASE_URL + '/login',
jar: cookieJar,
form: {
username: 'useremail@email.com',
password: 'foobar',
},
followAllRedirects: true
});
});
Generator based requests
● Became the base for our WebClient
● Same principles as a page object
but for REST APIs
● Yield blocks until execution is done
● The Magic number 7
45. 45
JSON and Javascript
The hidden power of working in javascript
○ JSON stands for JavaScript Object Notation
JSON is a subset of the object literal notation of JavaScript. Since JSON is a subset
of JavaScript, it can be used in the language with no muss or fuss. dto jackson
Actual response
{
"type": "forbidden",
"message": "You do not have permissions in this project"
}
Code
var webClient = new WebClient();
yield webClient.login(VIEWER_USER, VIEWER_PASSWORD);
// Try to view users
var projectUsers = yield webClient.getProjectUsers(qeProject.id);
assert.strictEqual(projectUsers.type, TYPE_FORBIDDEN, 'Return type should be forbidden');
assert.strictEqual(projectUsers.message, 'You do not have permissions in this project');
46. 46
Fitting it with selenium framework
● Adapting yield calls to work with the promise manager
○ Selenium Control Flows https://code.google.com/p/selenium/wiki/WebDriverJs#Framing
○ Allows execution order framing and supports generators from the manager queue
● Functional programing - high order functions are your friends
test.it('Verify data from both frontend and backend', function() {
var webClient = new WebClient();
var projectFromBackend;
// API Portion of the test
var flow = webdriver.promise.controlFlow();
flow.execute(function *(){
yield webClient.login(Constants.FORSETI001_EMAIL, Constants.FORSETI_PASSWORD);
var projects = yield webClient.getProjects();
projectFromBackend = projectutil.getProjectByName(projects, Constants.QE_PROJECT);
});
// UI Portion of the test
var login = new LoginPage(driver);
login.enterUserInfo(Constants.FORSETI001_EMAIL, Constants.FORSETI_PASSWORD);
var topNav = new TopNav(driver);
topNav.getProjects().then(function (projects){
Logger.debug('Projects from backend:', projectsFromBackend);
Logger.debug('Projects from frontend:', projects);
assert.equal(projectsFromBackend.size, projects.size);
});
Utility module that
heavily uses
underscore
47. 47
What the final stack looks like
Data
Backend : node.js
Browser
Input /
update data
Get data
Frontend : javascript
Microservice
1
Microservice
2 .. n
Rest APIs
Input /
update data
Get data
UI Framework : node.js
● selenium-webdriver
● mocha + wrapper
● Applitools
● co-wrap for webclient
● chai (asserts)
Rest API Framework : node.js
● co-requests
● mocha
● co-mocha
● chai (asserts)
● json, jayschema
WebClient
Pageobjects
Webclient
adaptor
48. 48
Introduction to deployments
Cloud Deployment Culture
● Weekly deploys to production
● Gated deploys to preprod
● Automatic deploys to staging and tests
staging preprod
prod
Clouds envs
50. 50
Deployment Dashboard (Vili)
Problem:
● Manage and deploy:
○ Many microservices
○ In many environments
○ With many versions
● Access control for deployments
● QA gating for production deployments
Solution: Vili
51. 51
Vili Overview
Kubernetes
- Controllers for apps
- Pods for jobs
- Rolling deploys
Docker Repo
- Many apps
- Many versions
Environments
- Different variables
- Need source control
Notifications
- Slack
Authentication
- Okta
- Extensible
Approvals
- Only QA can approve
- Required for prod deploy
VILI
53. 53
Follow the Airware github
repo to be notified:
https://github.com/airware
(About to be) Open Sourced
54. The Team
● Bj Gopinath - Guidance and support
● Lucas Doyle, Nick Italiano - co and Node.js generators, locator sharing strategy with frontend
● Phil Kates - Countless nights/weekends on infrastructure work
● Eric Johnson - Guidance and support. On coming from Java to Javascript :
“Yeah, probably some unlearning going on. JS is crazy, but I’ve rarely had more fun”
Meetup Folks
● Marcel Erz, Yahoo - Feedback on implementations of Webdriver-sync
● Mary Ann May-Pumphrey - Nightwatch feedback
Special Thanks
Saucelabs
Initial feedback on selenium node.js
● Neil Manvar
● Kristian Meier
● Adam Pilger
● Christian Bromann - WebdriverIO
Applitools
Trial POC with Applitools Javascript bindings and performance
● Moshe Milman
● Matan Carmi
● Adam Carmi
● Ryan Peterson