SlideShare a Scribd company logo
Elio Struyf
Architect @ Valo – MVP
November 15th, 2018
Implementing automated UI
testing for SharePoint solutions
O365Con18 - Implementing Automated UI Testing for SharePoint Solutions - Elio Struyf
Testing your code
Code analysis
• Manual
• JSLint / TSLint → Define code/analysis rules
• Static analysis like SonarQube
Unit Tests
Visual UI Tests
Automated UI Tests
• Unit tests validate your code, UI tests validate that it actually works
• Test your solution functionality
• Test out time consuming actions
• Check if your solution gets rendered correctly
• Use tools like:
• Coded UI Tests in Visual Studio
• Selenium
• Robot Framework
• …
O365Con18 - Implementing Automated UI Testing for SharePoint Solutions - Elio Struyf
Puppeteer
• High-level API to control Chrome / Chromium
• Runs Chrome in headless mode (can be non-headless)
• Full access over the DevTools Protocol
• Can automate all manual browsers steps
• Navigating
• Taking screenshots / generating a PDF
• Clicking on links / buttons / menu / …
• Documentation: https://github.com/GoogleChrome/puppeteer
• Install: npm i puppeteer
Puppeteer sample
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://www.eliostruyf.com’);
await page.screenshot({path: 'example.png', fullPage: true});
await browser.close();
})();
Make tests easier with a recorder:
https://github.com/checkly/puppeteer-recorder
Authenticate against
SharePoint
Authenticate against SharePoint
• Go through the whole authentication process
• Use a library like: node-sp-auth
• https://www.npmjs.com/package/node-sp-auth
import * as spauth from 'node-sp-auth';
const data = await spauth.getAuth(pageUrl, {
username: username,
password: password
});
Finding differences in
your pictures
What changed
between today
and yesterday
Pixel matching
https://github.com/mapbox/pixelmatch
pixelmatch(img1.data, img2.data, diff.data, img1.width, img1.height, { threshold: 0.1 });
O365Con18 - Implementing Automated UI Testing for SharePoint Solutions - Elio Struyf
Jest testing framework
• Zero configuration testing platform
• Testing JavaScript based applications
• Created by Facebook
• Install: npm install jest @types/jest -D
Combining Puppeteer and Jest
test('Should load the page', async (done) => {
if (page) {
await page.goto(configObj.pageUrl, {
waitUntil: 'networkidle0’
});
expect(page).not.toBeNull();
expect(await page.title()).not.toBeNull();
expect(await page.title()).toBe("Automated UI Tests - Home");
done();
}
}, 30000);
Combining Puppeteer and Jest
/**
* Start of the other page tests
*/
test('Check if caption element is present in the web part', async (done) => {
const elm = await page.$('.caption’);
expect(elm).not.toBeNull();
done();
}, 5000);
Wait!
It’s not so easy!
.caption !== .caption_8f70350b
Solution: work with data-* attributes
<div className={styles.caption} data-ui-test-id="caption">
<p data-ui-test-id="caption-title">
<b>{item.title}</b>
</p>
<p data-ui-test-id="caption-description">
<i>{item.description}</i>
</p>
</div>
O365Con18 - Implementing Automated UI Testing for SharePoint Solutions - Elio Struyf
Simple element retrieval
/**
* Start of the other page tests
*/
test('Check if caption element is present in the web part', async (done) => {
const caption = await page.$('div[data-ui-test-id="caption"]’);
expect(caption).not.toBeNull();
done();
}, 5000);
O365Con18 - Implementing Automated UI Testing for SharePoint Solutions - Elio Struyf
Questions?
Office Servers & Services MVP
Azure / Office 365 / SharePoint
@eliostruyf
www.eliostruyf.com
info@estruyf.be
Elio Struyf
Architect
O365Con18 - Implementing Automated UI Testing for SharePoint Solutions - Elio Struyf

More Related Content

What's hot (20)

PDF
Beyond Domino Designer
Paul Withers
 
PPTX
Serverless in Azure with Functions
Christos Matskas
 
PPTX
Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)
Chris O'Brien
 
PPTX
Azure Web Jobs
BizTalk360
 
PPTX
ASP.NET Core Unit Testing
Shahed Chowdhuri
 
PPTX
Going Serverless with Azure Functions
Christos Matskas
 
PPTX
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
Ricardo Wilkins
 
PDF
ECS19 - Daniel Neumann - AZURE FUNCTIONS 2.0 - RUNNING SERVERLESS EVERYWHERE
European Collaboration Summit
 
PPTX
ASP.NET Core 1.0 Overview
Shahed Chowdhuri
 
PPTX
Application Lifecycle Management for Office 365 development
Chris O'Brien
 
PPTX
Logic Apps – Deployments
BizTalk360
 
PDF
SPUnite17 TypeScript for SharePoint Developers
NCCOMMS
 
PPTX
Building reliable web applications using Cypress
Maurice De Beijer [MVP]
 
PDF
Create SASSy web parts in SPFx
Stefan Bauer
 
PPTX
D2 - Automate Custom Solutions Deployment on Office 365 and Azure - Paolo Pia...
SPS Paris
 
PPTX
TypeScript and SharePoint Framework
Bob German
 
PPTX
Building your first android app using xamarin (Gill Cleeren)
Visug
 
PPTX
Vincent biret azure functions and flow (ottawa)
Vincent Biret
 
PPTX
Vincent biret azure functions and flow (toronto)
Vincent Biret
 
PPTX
Building solutions with the SharePoint Framework - introduction
Waldek Mastykarz
 
Beyond Domino Designer
Paul Withers
 
Serverless in Azure with Functions
Christos Matskas
 
Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)
Chris O'Brien
 
Azure Web Jobs
BizTalk360
 
ASP.NET Core Unit Testing
Shahed Chowdhuri
 
Going Serverless with Azure Functions
Christos Matskas
 
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
Ricardo Wilkins
 
ECS19 - Daniel Neumann - AZURE FUNCTIONS 2.0 - RUNNING SERVERLESS EVERYWHERE
European Collaboration Summit
 
ASP.NET Core 1.0 Overview
Shahed Chowdhuri
 
Application Lifecycle Management for Office 365 development
Chris O'Brien
 
Logic Apps – Deployments
BizTalk360
 
SPUnite17 TypeScript for SharePoint Developers
NCCOMMS
 
Building reliable web applications using Cypress
Maurice De Beijer [MVP]
 
Create SASSy web parts in SPFx
Stefan Bauer
 
D2 - Automate Custom Solutions Deployment on Office 365 and Azure - Paolo Pia...
SPS Paris
 
TypeScript and SharePoint Framework
Bob German
 
Building your first android app using xamarin (Gill Cleeren)
Visug
 
Vincent biret azure functions and flow (ottawa)
Vincent Biret
 
Vincent biret azure functions and flow (toronto)
Vincent Biret
 
Building solutions with the SharePoint Framework - introduction
Waldek Mastykarz
 

Similar to O365Con18 - Implementing Automated UI Testing for SharePoint Solutions - Elio Struyf (20)

PDF
[Struyf] Automate Your Tasks With Azure Functions
European Collaboration Summit
 
PDF
Testing mit Codeception: Full-stack testing PHP framework
SusannSgorzaly
 
PPTX
Testing Ext JS and Sencha Touch
Mats Bryntse
 
PPTX
Cypress.pptx
Arshad QA
 
PPTX
Asp.net core 1.0 (Peter Himschoot)
Visug
 
PDF
Playwright Testing Guide for QA Engineers.pdf
jamescantor38
 
PDF
From MEAN to the MERN Stack
Troy Miles
 
PPTX
Protractor Tutorial Quality in Agile 2015
Andrew Eisenberg
 
PPTX
Automation of online games
Robert Grzeskowiak
 
PPTX
Django
Abhijeet Shekhar
 
PDF
The MEAN stack
Nattaya Mairittha
 
PDF
Jenkins CI for MacDevOps
Timothy Sutton
 
PDF
Play Framework workshop: full stack java web app
Andrew Skiba
 
PDF
Android UI Testing with Appium
Luke Maung
 
PDF
vodQA Pune (2019) - Browser automation using dev tools
vodQA
 
PPTX
Using protractor to build automated ui tests
🌱 Dale Spoonemore
 
PPTX
VorlonJS
Fabrício Catae
 
PPTX
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
PPT
Play framework
sambaochung
 
PPTX
JavaScript on the Desktop
Domenic Denicola
 
[Struyf] Automate Your Tasks With Azure Functions
European Collaboration Summit
 
Testing mit Codeception: Full-stack testing PHP framework
SusannSgorzaly
 
Testing Ext JS and Sencha Touch
Mats Bryntse
 
Cypress.pptx
Arshad QA
 
Asp.net core 1.0 (Peter Himschoot)
Visug
 
Playwright Testing Guide for QA Engineers.pdf
jamescantor38
 
From MEAN to the MERN Stack
Troy Miles
 
Protractor Tutorial Quality in Agile 2015
Andrew Eisenberg
 
Automation of online games
Robert Grzeskowiak
 
The MEAN stack
Nattaya Mairittha
 
Jenkins CI for MacDevOps
Timothy Sutton
 
Play Framework workshop: full stack java web app
Andrew Skiba
 
Android UI Testing with Appium
Luke Maung
 
vodQA Pune (2019) - Browser automation using dev tools
vodQA
 
Using protractor to build automated ui tests
🌱 Dale Spoonemore
 
VorlonJS
Fabrício Catae
 
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Play framework
sambaochung
 
JavaScript on the Desktop
Domenic Denicola
 
Ad

More from NCCOMMS (20)

PDF
O365Con19 - UI:UX 101 Learn How to Design Custom Experiences for SharePoint -...
NCCOMMS
 
PDF
O365Con19 - Model-driven Apps or Canvas Apps? - Rick Bakker
NCCOMMS
 
PDF
O365Con19 - Office 365 Groups Surviving the Real World - Jasper Oosterveld
NCCOMMS
 
PDF
O365Con19 - Developing Timerjob and Eventhandler Equivalents - Adis Jugo
NCCOMMS
 
PDF
O365Con19 - Sharepoint with (Artificial) Intelligence - Adis Jugo
NCCOMMS
 
PDF
O365Con19 - What Do You Mean 90 days Isn't Enough - Paul Hunt
NCCOMMS
 
PDF
O365Con19 - Tips and Tricks for Complex Migrations to SharePoint Online - And...
NCCOMMS
 
PDF
O365Con19 - Start Developing Teams Tabs and SharePoint Webparts with SPFX - O...
NCCOMMS
 
PDF
O365Con19 - Start Your Journey from Skype for Business to Teams - Sasja Beere...
NCCOMMS
 
PDF
O365Con19 - Lets Get Started with Azure Container Instances - Jussi Roine
NCCOMMS
 
PDF
O365Con19 - Azure Blackbelt - Jussi Roine
NCCOMMS
 
PDF
O365Con19 - Customise the UI in Modern SharePoint Workspaces - Corinna Lins
NCCOMMS
 
PDF
O365Con19 - Be The Protagonist of Your Modern Workplace - Corinna Lins
NCCOMMS
 
PDF
O365Con19 - How to Really Manage all your Tasks Across Microsoft 365 - Luise ...
NCCOMMS
 
PDF
O365Con19 - Sharing Code Efficiently in your Organisation - Elio Struyf
NCCOMMS
 
PDF
O365Con19 - Things I've Learned While Building a Product on SharePoint Modern...
NCCOMMS
 
PDF
O365Con19 - Keep Control of Your Data with AIP and CA - Bram de Jager
NCCOMMS
 
PDF
O365Con19 - Kaizala a Dive Into the Unknown - Rick van Rousselt
NCCOMMS
 
PDF
O365Con19 - How to Inspire Users to Unstick from Email - Luise Freese
NCCOMMS
 
PDF
O365Con19 - O365 Identity Management and The Golden Config - Chris Goosen
NCCOMMS
 
O365Con19 - UI:UX 101 Learn How to Design Custom Experiences for SharePoint -...
NCCOMMS
 
O365Con19 - Model-driven Apps or Canvas Apps? - Rick Bakker
NCCOMMS
 
O365Con19 - Office 365 Groups Surviving the Real World - Jasper Oosterveld
NCCOMMS
 
O365Con19 - Developing Timerjob and Eventhandler Equivalents - Adis Jugo
NCCOMMS
 
O365Con19 - Sharepoint with (Artificial) Intelligence - Adis Jugo
NCCOMMS
 
O365Con19 - What Do You Mean 90 days Isn't Enough - Paul Hunt
NCCOMMS
 
O365Con19 - Tips and Tricks for Complex Migrations to SharePoint Online - And...
NCCOMMS
 
O365Con19 - Start Developing Teams Tabs and SharePoint Webparts with SPFX - O...
NCCOMMS
 
O365Con19 - Start Your Journey from Skype for Business to Teams - Sasja Beere...
NCCOMMS
 
O365Con19 - Lets Get Started with Azure Container Instances - Jussi Roine
NCCOMMS
 
O365Con19 - Azure Blackbelt - Jussi Roine
NCCOMMS
 
O365Con19 - Customise the UI in Modern SharePoint Workspaces - Corinna Lins
NCCOMMS
 
O365Con19 - Be The Protagonist of Your Modern Workplace - Corinna Lins
NCCOMMS
 
O365Con19 - How to Really Manage all your Tasks Across Microsoft 365 - Luise ...
NCCOMMS
 
O365Con19 - Sharing Code Efficiently in your Organisation - Elio Struyf
NCCOMMS
 
O365Con19 - Things I've Learned While Building a Product on SharePoint Modern...
NCCOMMS
 
O365Con19 - Keep Control of Your Data with AIP and CA - Bram de Jager
NCCOMMS
 
O365Con19 - Kaizala a Dive Into the Unknown - Rick van Rousselt
NCCOMMS
 
O365Con19 - How to Inspire Users to Unstick from Email - Luise Freese
NCCOMMS
 
O365Con19 - O365 Identity Management and The Golden Config - Chris Goosen
NCCOMMS
 
Ad

Recently uploaded (20)

PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
Digital Circuits, important subject in CS
contactparinay1
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 

O365Con18 - Implementing Automated UI Testing for SharePoint Solutions - Elio Struyf