-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'gh-pages' of https://github.com/devonfw-training/devon4…
…ng-training into gh-pages
- Loading branch information
Showing
7 changed files
with
314 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
.devon.reveal .title-with-image img { | ||
margin-right: 0.5em; | ||
} | ||
|
||
.reveal h1.no_upper, | ||
.reveal h2.no_upper, | ||
.reveal h3.no_upper, | ||
.reveal h4.no_upper, | ||
.reveal h5.no_upper, | ||
.reveal h6.no_upper { | ||
text-transform: none; | ||
} | ||
|
||
.reveal section img { | ||
border: none; | ||
box-shadow: none; | ||
} | ||
|
||
.reveal section img.middle { | ||
vertical-align : middle; | ||
} | ||
|
||
div.margin_top_30 { | ||
margin-top: 30px; | ||
} | ||
|
||
h1.highlight, h2.highlight, h3.highlight, p.highlight, span.highlight { | ||
color: #71e9f4; | ||
} | ||
|
||
div.column { | ||
display: inline-block; | ||
margin-right: 40px; | ||
} | ||
|
||
p.title_image img.white_solid_border { | ||
border: 4px solid #ffffff; | ||
} | ||
|
||
p.justify_text { | ||
text-align: justify; | ||
} | ||
|
||
p.align_right { | ||
text-align: right; | ||
} | ||
|
||
.reveal pre { | ||
border: 3px white solid; | ||
} | ||
|
||
.reveal p { | ||
margin: 0; | ||
} | ||
|
||
.reveal #js-engine { | ||
height: 560px; | ||
} | ||
|
||
.reveal .title_image img { | ||
background: transparent; | ||
margin: 0 40px; | ||
} | ||
|
||
.reveal section pre { | ||
width: 100%; | ||
} | ||
|
||
.reveal section .list-style-none { | ||
list-style: none | ||
} | ||
|
||
.reveal section .margin-top-40 { | ||
margin-top: 40px; | ||
} | ||
|
||
html.img-center-fill div.slide-background.present { | ||
background-position: center; | ||
background-size: contain; | ||
} | ||
|
||
.reveal section .text-align-left { | ||
text-align: left; | ||
} | ||
|
||
.reveal section .font-style-italic { | ||
font-style: italic; | ||
} | ||
|
||
.reveal section div.side-by-side { | ||
width: 960px; | ||
} | ||
|
||
.reveal section div.side-by-side div { | ||
width: 45%; | ||
display: inline-block; | ||
vertical-align: top; | ||
} | ||
|
||
.reveal section pre code.code-without-max-height { | ||
max-height: unset; | ||
} | ||
|
||
.reveal section .inline-block { | ||
display: inline-block; | ||
vertical-align: top; | ||
} | ||
|
||
.reveal section .margin-top-70 { | ||
margin-top: 70px; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
<!doctype html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> | ||
|
||
<title>E2E Testing with Playwright</title> | ||
<link rel="icon" href="../common/img/favicon.ico"> | ||
|
||
<link href="https://fonts.googleapis.com/css?family=Ubuntu+Mono" rel="stylesheet"> | ||
<link href="https://fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet"> | ||
<link rel="stylesheet" href="../node_modules/reveal.js/css/reveal.css"> | ||
<link rel="stylesheet" href="../node_modules/reveal.js/css/theme/white.css"> | ||
<link rel="stylesheet" href="../common/css/common.css"> | ||
<link rel="stylesheet" href="css/own.css"> | ||
|
||
<!-- Theme used for syntax highlighting of code --> | ||
<link rel="stylesheet" href="../common/css/github-gist.css"> | ||
|
||
<!-- Printing and PDF exports --> | ||
<script> | ||
var link = document.createElement('link'); | ||
link.rel = 'stylesheet'; | ||
link.type = 'text/css'; | ||
link.href = window.location.search.match(/print-pdf/gi) ? '../node_modules/reveal.js/css/print/pdf.css' : '../node_modules/reveal.js/css/print/paper.css'; | ||
document.getElementsByTagName('head')[0].appendChild(link); | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<section class="devon-link"> | ||
<a href="http://devonfw.github.io" target="_blank"><img height="30px" src="../common/img/devon_logo_blue.png"></a> | ||
</section> | ||
<section class="angular-link"> | ||
<a href="http://angular.io" target="_blank"><img height="50px" src="../common/img/angular.svg"></a> | ||
</section> | ||
<div class="devon reveal"> | ||
<div class="slides"> | ||
<section> | ||
<h1>E2E-TESTING USING PLAYWRIGHT</h1> | ||
<p><small><a href="https://playwright.dev/docs/writing-tests">Docs</a></small></p> | ||
</section> | ||
<section> | ||
<h3>Why test end-to-end?</h3> | ||
<p class="text-align-left">We test...</p> | ||
<ul> | ||
<li>to ensure our application works within the <span class="highlight">target eco-system</span>.</li> | ||
<li>automated to get <span class="highlight">quick and reliable</span> feedback.</li> | ||
<li>to detect <span class="highlight">breaking features</span> as soon as possible.</li> | ||
<li>to ensure the best <span class="highlight">quality</span>.</li> | ||
</ul> | ||
</section> | ||
<section> | ||
<h3>End-to-end testing our Angular applications</h3> | ||
<p> | ||
<span class="highlight">Protractor</span> is deprecated as of May 2021 due to... | ||
</p> | ||
<ul> | ||
<li>outdated Selenium based testing.</li> | ||
<li>many modern alternatives exist.</li> | ||
</ul> | ||
</section> | ||
<section> | ||
<h3>Playwright as an alternative</h3> | ||
<img src="img/e2e-testing-compare.png" alt="Compare Web Testing"> | ||
<p>"Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API."</p> | ||
<div class="margin_top_30"> | ||
<p class="align_right"><small><a | ||
href="https://github.com/microsoft/playwright">Playwright</a></small> | ||
</p> | ||
</div> | ||
</section> | ||
<section> | ||
<h3>It is just another node module...</h3> | ||
<pre><code class="hljs typescript" data-trim data-noescape> | ||
yarn create playwright | ||
</code></pre> | ||
</section> | ||
<section> | ||
<h3>...which comes with everything you need to start testing!</h3> | ||
<img src="img/playwright-ui-mode.png" alt="Playwright start page"> | ||
</section> | ||
<section> | ||
<h3>You can visit your app...</h3> | ||
<pre><code class="hljs typescript" data-trim data-noescape> | ||
await page.goto('/movies'); | ||
</code></pre> | ||
<div class="margin_top_30"> | ||
<p class="align_right"><small><a | ||
href="https://playwright.dev/docs/api/class-page#page-goto">Playwright docs</a></small> | ||
</p> | ||
</div> | ||
</section> | ||
<section> | ||
<h3>...interact with elements...</h3> | ||
<pre><code class="hljs typescript" data-trim data-noescape> | ||
// click on a fancy button | ||
await page.getByRole('button', { name: 'Fancy Button' }).click(); | ||
// clear and type into a fancy input | ||
await page.getByLabel('Fancy Input').fill('Important stuff'); | ||
</code></pre> | ||
<div class="margin_top_30"> | ||
<p class="align_right"><small><a | ||
href="https://playwright.dev/docs/locators">Playwright docs</a></small> | ||
</p> | ||
</div> | ||
</section> | ||
<section> | ||
<h3>...make assertions...</h3> | ||
<pre><code class="hljs typescript" data-trim data-noescape> | ||
// check whether the input value is something | ||
await expect(page.getByLabel('Fancy Input')).toContainText('Important stuff'); | ||
</code></pre> | ||
<div class="margin_top_30"> | ||
<p class="align_right"><small><a | ||
href="https://playwright.dev/docs/test-assertions">Playwright docs</a></small> | ||
</p> | ||
</div> | ||
</section> | ||
<section> | ||
<h3>...and even mock or intercept backend calls!</h3> | ||
<pre><code class="hljs typescript" data-trim data-noescape> | ||
// mock backend calls | ||
await page.route('/services/rest/movies', async route => { | ||
const json = [{ name: 'Titanic', id: 21 }]; | ||
await route.fulfill({ json }); | ||
}); | ||
|
||
// intercept a call and work with the response | ||
const movies = await request.get(`/services/rest/movies`); | ||
|
||
// wait for a request before moving on | ||
await page.waitForResponse('/services/rest/movies'/); | ||
</code></pre> | ||
<div class="margin_top_30"> | ||
<p class="align_right"><small><a | ||
href="https://playwright.dev/docs/mock">Playwright docs</a></small> | ||
</p> | ||
</div> | ||
</section> | ||
<section> | ||
<h3>The test structure looks familiar!</h3> | ||
<pre><code class="hljs typescript" data-trim data-noescape> | ||
test.describe('Movie Page', () => { | ||
let moviesPage: MoviesPage; | ||
|
||
test.beforeEach(() => { | ||
moviesPage = new MoviesPage(); | ||
}); | ||
|
||
test('should create a new movie', async () => { | ||
// goto the movie overview | ||
await moviesPage.goto(); | ||
|
||
// do stuff | ||
await moviesPage.clickAddButton(); | ||
// do something to add a new movie... | ||
}); | ||
}); | ||
</code></pre> | ||
<div class="margin_top_30"> | ||
<p class="align_right"><small><a | ||
href="https://playwright.dev/docs/test-annotations">Playwright docs</a></small> | ||
</p> | ||
</div> | ||
</section> | ||
<section> | ||
<h3>Some best practices:</h3> | ||
<ul> | ||
<li>Make tests as isolated as possible (i.e. with beforeEach, Page Object Models, Fixture)</li> | ||
<li>Use <span class="highlight">locators</span> with chaining/filtering and prefer user-facing attributes to XPath or CSS selectors</li> | ||
<li>Use <span class="highlight">web first assertions</span> because it will wait until the expected condition is met.</li> | ||
<li>do not store the result of a <span class="highlight">chainable command</span> in a variable.</li> | ||
<li>use as <span class="highlight">many assertions</span> as needed. It's not unit testing.</li> | ||
</ul> | ||
|
||
<div class="margin_top_30"> | ||
<p class="align_right"><small><a | ||
href="https://playwright.dev/docs/best-practices">Playwright docs</a></small> | ||
</p> | ||
</div> | ||
</section> | ||
</div> | ||
</div> | ||
|
||
<script src="../node_modules/reveal.js/js/reveal.js"></script> | ||
<script src="../common/reveal-config.js"></script> | ||
|
||
<script> | ||
// More info https://github.com/hakimel/reveal.js#configuration | ||
Reveal.initialize({ ...revealConfig }); | ||
</script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters